The Design and Implementation of the FreeBSD Operating System, Second Edition
Now available: The Design and Implementation of the FreeBSD Operating System (Second Edition)


[ source navigation ] [ diff markup ] [ identifier search ] [ freetext search ] [ file search ] [ list types ] [ track identifier ]

FreeBSD/Linux Kernel Cross Reference
sys/netinet/in_pcb.h

Version: -  FREEBSD  -  FREEBSD-13-STABLE  -  FREEBSD-13-0  -  FREEBSD-12-STABLE  -  FREEBSD-12-0  -  FREEBSD-11-STABLE  -  FREEBSD-11-0  -  FREEBSD-10-STABLE  -  FREEBSD-10-0  -  FREEBSD-9-STABLE  -  FREEBSD-9-0  -  FREEBSD-8-STABLE  -  FREEBSD-8-0  -  FREEBSD-7-STABLE  -  FREEBSD-7-0  -  FREEBSD-6-STABLE  -  FREEBSD-6-0  -  FREEBSD-5-STABLE  -  FREEBSD-5-0  -  FREEBSD-4-STABLE  -  FREEBSD-3-STABLE  -  FREEBSD22  -  l41  -  OPENBSD  -  linux-2.6  -  MK84  -  PLAN9  -  xnu-8792 
SearchContext: -  none  -  3  -  10 

    1 /*-
    2  * Copyright (c) 1982, 1986, 1990, 1993
    3  *      The Regents of the University of California.
    4  * All rights reserved.
    5  *
    6  * Redistribution and use in source and binary forms, with or without
    7  * modification, are permitted provided that the following conditions
    8  * are met:
    9  * 1. Redistributions of source code must retain the above copyright
   10  *    notice, this list of conditions and the following disclaimer.
   11  * 2. Redistributions in binary form must reproduce the above copyright
   12  *    notice, this list of conditions and the following disclaimer in the
   13  *    documentation and/or other materials provided with the distribution.
   14  * 4. Neither the name of the University nor the names of its contributors
   15  *    may be used to endorse or promote products derived from this software
   16  *    without specific prior written permission.
   17  *
   18  * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
   19  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
   20  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
   21  * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
   22  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
   23  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
   24  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
   25  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
   26  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
   27  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
   28  * SUCH DAMAGE.
   29  *
   30  *      @(#)in_pcb.h    8.1 (Berkeley) 6/10/93
   31  * $FreeBSD$
   32  */
   33 
   34 #ifndef _NETINET_IN_PCB_H_
   35 #define _NETINET_IN_PCB_H_
   36 
   37 #include <sys/queue.h>
   38 #include <sys/_lock.h>
   39 #include <sys/_mutex.h>
   40 #include <sys/_rwlock.h>
   41 
   42 #include <net/route.h>
   43 
   44 #ifdef _KERNEL
   45 #include <sys/rwlock.h>
   46 #endif
   47 
   48 #define in6pcb          inpcb   /* for KAME src sync over BSD*'s */
   49 #define in6p_sp         inp_sp  /* for KAME src sync over BSD*'s */
   50 struct inpcbpolicy;
   51 
   52 /*
   53  * struct inpcb is the common protocol control block structure used in most
   54  * IP transport protocols.
   55  *
   56  * Pointers to local and foreign host table entries, local and foreign socket
   57  * numbers, and pointers up (to a socket structure) and down (to a
   58  * protocol-specific control block) are stored here.
   59  */
   60 LIST_HEAD(inpcbhead, inpcb);
   61 LIST_HEAD(inpcbporthead, inpcbport);
   62 typedef u_quad_t        inp_gen_t;
   63 
   64 /*
   65  * PCB with AF_INET6 null bind'ed laddr can receive AF_INET input packet.
   66  * So, AF_INET6 null laddr is also used as AF_INET null laddr, by utilizing
   67  * the following structure.
   68  */
   69 struct in_addr_4in6 {
   70         u_int32_t       ia46_pad32[3];
   71         struct  in_addr ia46_addr4;
   72 };
   73 
   74 /*
   75  * NOTE: ipv6 addrs should be 64-bit aligned, per RFC 2553.  in_conninfo has
   76  * some extra padding to accomplish this.
   77  */
   78 struct in_endpoints {
   79         u_int16_t       ie_fport;               /* foreign port */
   80         u_int16_t       ie_lport;               /* local port */
   81         /* protocol dependent part, local and foreign addr */
   82         union {
   83                 /* foreign host table entry */
   84                 struct  in_addr_4in6 ie46_foreign;
   85                 struct  in6_addr ie6_foreign;
   86         } ie_dependfaddr;
   87         union {
   88                 /* local host table entry */
   89                 struct  in_addr_4in6 ie46_local;
   90                 struct  in6_addr ie6_local;
   91         } ie_dependladdr;
   92 };
   93 #define ie_faddr        ie_dependfaddr.ie46_foreign.ia46_addr4
   94 #define ie_laddr        ie_dependladdr.ie46_local.ia46_addr4
   95 #define ie6_faddr       ie_dependfaddr.ie6_foreign
   96 #define ie6_laddr       ie_dependladdr.ie6_local
   97 
   98 /*
   99  * XXX The defines for inc_* are hacks and should be changed to direct
  100  * references.
  101  */
  102 struct in_conninfo {
  103         u_int8_t        inc_flags;
  104         u_int8_t        inc_len;
  105         u_int16_t       inc_fibnum;     /* XXX was pad, 16 bits is plenty */
  106         /* protocol dependent part */
  107         struct  in_endpoints inc_ie;
  108 };
  109 #define inc_isipv6      inc_flags       /* temp compatability */
  110 #define inc_fport       inc_ie.ie_fport
  111 #define inc_lport       inc_ie.ie_lport
  112 #define inc_faddr       inc_ie.ie_faddr
  113 #define inc_laddr       inc_ie.ie_laddr
  114 #define inc6_faddr      inc_ie.ie6_faddr
  115 #define inc6_laddr      inc_ie.ie6_laddr
  116 
  117 struct  icmp6_filter;
  118 
  119 /*-
  120  * struct inpcb captures the network layer state for TCP, UDP, and raw IPv4
  121  * and IPv6 sockets.  In the case of TCP, further per-connection state is
  122  * hung off of inp_ppcb most of the time.  Almost all fields of struct inpcb
  123  * are static after creation or protected by a per-inpcb rwlock, inp_lock.  A
  124  * few fields also require the global pcbinfo lock for the inpcb to be held,
  125  * when modified, such as the global connection lists and hashes, as well as
  126  * binding information (which affects which hash a connection is on).  This
  127  * model means that connections can be looked up without holding the
  128  * per-connection lock, which is important for performance when attempting to
  129  * find the connection for a packet given its IP and port tuple.  Writing to
  130  * these fields that write locks be held on both the inpcb and global locks.
  131  *
  132  * Key:
  133  * (c) - Constant after initialization
  134  * (i) - Protected by the inpcb lock
  135  * (p) - Protected by the pcbinfo lock for the inpcb
  136  * (s) - Protected by another subsystem's locks
  137  * (x) - Undefined locking
  138  *
  139  * A few other notes:
  140  *
  141  * When a read lock is held, stability of the field is guaranteed; to write
  142  * to a field, a write lock must generally be held.
  143  *
  144  * netinet/netinet6-layer code should not assume that the inp_socket pointer
  145  * is safe to dereference without inp_lock being held, even for protocols
  146  * other than TCP (where the inpcb persists during TIMEWAIT even after the
  147  * socket has been freed), or there may be close(2)-related races.
  148  *
  149  * The inp_vflag field is overloaded, and would otherwise ideally be (c).
  150  */
  151 struct inpcb {
  152         LIST_ENTRY(inpcb) inp_hash;     /* (i/p) hash list */
  153         LIST_ENTRY(inpcb) inp_list;     /* (i/p) list for all PCBs for proto */
  154         void    *inp_ppcb;              /* (i) pointer to per-protocol pcb */
  155         struct  inpcbinfo *inp_pcbinfo; /* (c) PCB list info */
  156         struct  socket *inp_socket;     /* (i) back pointer to socket */
  157         u_int32_t inp_flow;             /* (i) IPv6 flow information */
  158         int     inp_flags;              /* (i) generic IP/datagram flags */
  159         u_char  inp_vflag;              /* (i) IP version flag (v4/v6) */
  160         u_char  inp_ip_ttl;             /* (i) time to live proto */
  161         u_char  inp_ip_p;               /* (c) protocol proto */
  162         u_char  inp_ip_minttl;          /* (i) minimum TTL or drop */
  163         uint32_t inp_ispare1;           /* (x) connection id / queue id */
  164         void    *inp_pspare;            /* (x) rtentry / general use */
  165         struct  ucred   *inp_cred;      /* (c) cache of socket cred */
  166 
  167         /* Local and foreign ports, local and foreign addr. */
  168         struct  in_conninfo inp_inc;    /* (i/p) list for PCB's local port */
  169 
  170         /* MAC and IPSEC policy information. */
  171         struct  label *inp_label;       /* (i) MAC label */
  172         struct  inpcbpolicy *inp_sp;    /* (s) for IPSEC */
  173 
  174         /* Protocol-dependent part; options. */
  175         struct {
  176                 u_char  inp4_ip_tos;            /* (i) type of service proto */
  177                 struct  mbuf *inp4_options;     /* (i) IP options */
  178                 struct  ip_moptions *inp4_moptions; /* (i) IP mcast options */
  179         } inp_depend4;
  180         struct {
  181                 /* (i) IP options */
  182                 struct  mbuf *inp6_options;
  183                 /* (i) IP6 options for outgoing packets */
  184                 struct  ip6_pktopts *inp6_outputopts;
  185                 /* (i) IP multicast options */
  186                 struct  ip6_moptions *inp6_moptions;
  187                 /* (i) ICMPv6 code type filter */
  188                 struct  icmp6_filter *inp6_icmp6filt;
  189                 /* (i) IPV6_CHECKSUM setsockopt */
  190                 int     inp6_cksum;
  191                 short   inp6_hops;
  192         } inp_depend6;
  193         LIST_ENTRY(inpcb) inp_portlist; /* (i/p) */
  194         struct  inpcbport *inp_phd;     /* (i/p) head of this list */
  195 #define inp_zero_size offsetof(struct inpcb, inp_gencnt)
  196         inp_gen_t       inp_gencnt;     /* (c) generation count */
  197         struct rwlock   inp_lock;
  198 };
  199 #define inp_fport       inp_inc.inc_fport
  200 #define inp_lport       inp_inc.inc_lport
  201 #define inp_faddr       inp_inc.inc_faddr
  202 #define inp_laddr       inp_inc.inc_laddr
  203 #define inp_ip_tos      inp_depend4.inp4_ip_tos
  204 #define inp_options     inp_depend4.inp4_options
  205 #define inp_moptions    inp_depend4.inp4_moptions
  206 
  207 #define in6p_faddr      inp_inc.inc6_faddr
  208 #define in6p_laddr      inp_inc.inc6_laddr
  209 #define in6p_hops       inp_depend6.inp6_hops   /* default hop limit */
  210 #define in6p_ip6_nxt    inp_ip_p
  211 #define in6p_flowinfo   inp_flow
  212 #define in6p_vflag      inp_vflag
  213 #define in6p_options    inp_depend6.inp6_options
  214 #define in6p_outputopts inp_depend6.inp6_outputopts
  215 #define in6p_moptions   inp_depend6.inp6_moptions
  216 #define in6p_icmp6filt  inp_depend6.inp6_icmp6filt
  217 #define in6p_cksum      inp_depend6.inp6_cksum
  218 #define in6p_flags      inp_flags  /* for KAME src sync over BSD*'s */
  219 #define in6p_socket     inp_socket  /* for KAME src sync over BSD*'s */
  220 #define in6p_lport      inp_lport  /* for KAME src sync over BSD*'s */
  221 #define in6p_fport      inp_fport  /* for KAME src sync over BSD*'s */
  222 #define in6p_ppcb       inp_ppcb  /* for KAME src sync over BSD*'s */
  223 
  224 /*
  225  * The range of the generation count, as used in this implementation, is 9e19.
  226  * We would have to create 300 billion connections per second for this number
  227  * to roll over in a year.  This seems sufficiently unlikely that we simply
  228  * don't concern ourselves with that possibility.
  229  */
  230 
  231 /*
  232  * Interface exported to userland by various protocols which use inpcbs.  Hack
  233  * alert -- only define if struct xsocket is in scope.
  234  */
  235 #ifdef _SYS_SOCKETVAR_H_
  236 struct  xinpcb {
  237         size_t  xi_len;         /* length of this structure */
  238         struct  inpcb xi_inp;
  239         struct  xsocket xi_socket;
  240         u_quad_t        xi_alignment_hack;
  241 };
  242 
  243 struct  xinpgen {
  244         size_t  xig_len;        /* length of this structure */
  245         u_int   xig_count;      /* number of PCBs at this time */
  246         inp_gen_t xig_gen;      /* generation count at this time */
  247         so_gen_t xig_sogen;     /* socket generation count at this time */
  248 };
  249 #endif /* _SYS_SOCKETVAR_H_ */
  250 
  251 struct inpcbport {
  252         LIST_ENTRY(inpcbport) phd_hash;
  253         struct inpcbhead phd_pcblist;
  254         u_short phd_port;
  255 };
  256 
  257 /*
  258  * Global data structure for each high-level protocol (UDP, TCP, ...) in both
  259  * IPv4 and IPv6.  Holds inpcb lists and information for managing them.
  260  */
  261 struct inpcbinfo {
  262         /*
  263          * Global list of inpcbs on the protocol.
  264          */
  265         struct inpcbhead        *ipi_listhead;
  266         u_int                    ipi_count;
  267 
  268         /*
  269          * Global hash of inpcbs, hashed by local and foreign addresses and
  270          * port numbers.
  271          */
  272         struct inpcbhead        *ipi_hashbase;
  273         u_long                   ipi_hashmask;
  274 
  275         /*
  276          * Global hash of inpcbs, hashed by only local port number.
  277          */
  278         struct inpcbporthead    *ipi_porthashbase;
  279         u_long                   ipi_porthashmask;
  280 
  281         /*
  282          * Fields associated with port lookup and allocation.
  283          */
  284         u_short                  ipi_lastport;
  285         u_short                  ipi_lastlow;
  286         u_short                  ipi_lasthi;
  287 
  288         /*
  289          * UMA zone from which inpcbs are allocated for this protocol.
  290          */
  291         struct  uma_zone        *ipi_zone;
  292 
  293         /*
  294          * Generation count--incremented each time a connection is allocated
  295          * or freed.
  296          */
  297         u_quad_t                 ipi_gencnt;
  298         struct rwlock            ipi_lock;
  299 
  300         /*
  301          * vimage 1
  302          * general use 1
  303          */
  304         void                    *ipi_pspare[2];
  305 };
  306 
  307 #define INP_LOCK_INIT(inp, d, t) \
  308         rw_init_flags(&(inp)->inp_lock, (t), RW_RECURSE |  RW_DUPOK)
  309 #define INP_LOCK_DESTROY(inp)   rw_destroy(&(inp)->inp_lock)
  310 #define INP_RLOCK(inp)          rw_rlock(&(inp)->inp_lock)
  311 #define INP_WLOCK(inp)          rw_wlock(&(inp)->inp_lock)
  312 #define INP_TRY_RLOCK(inp)      rw_try_rlock(&(inp)->inp_lock)
  313 #define INP_TRY_WLOCK(inp)      rw_try_wlock(&(inp)->inp_lock)
  314 #define INP_RUNLOCK(inp)        rw_runlock(&(inp)->inp_lock)
  315 #define INP_WUNLOCK(inp)        rw_wunlock(&(inp)->inp_lock)
  316 #define INP_LOCK_ASSERT(inp)    rw_assert(&(inp)->inp_lock, RA_LOCKED)
  317 #define INP_RLOCK_ASSERT(inp)   rw_assert(&(inp)->inp_lock, RA_RLOCKED)
  318 #define INP_WLOCK_ASSERT(inp)   rw_assert(&(inp)->inp_lock, RA_WLOCKED)
  319 #define INP_UNLOCK_ASSERT(inp)  rw_assert(&(inp)->inp_lock, RA_UNLOCKED)
  320 
  321 #ifdef _KERNEL
  322 /*
  323  * These locking functions are for inpcb consumers outside of sys/netinet,
  324  * more specifically, they were added for the benefit of TOE drivers. The
  325  * macros are reserved for use by the stack.
  326  */
  327 void inp_wlock(struct inpcb *);
  328 void inp_wunlock(struct inpcb *);
  329 void inp_rlock(struct inpcb *);
  330 void inp_runlock(struct inpcb *);
  331 
  332 #ifdef INVARIANTS
  333 void inp_lock_assert(struct inpcb *);
  334 void inp_unlock_assert(struct inpcb *);
  335 void inp_wlock_assert(struct inpcb *);
  336 void inp_wunlock_assert(struct inpcb *);
  337 void inp_rlock_assert(struct inpcb *);
  338 void inp_runlock_assert(struct inpcb *);
  339 
  340 #else
  341 static __inline void
  342 inp_lock_assert(struct inpcb *inp __unused)
  343 {
  344 }
  345 
  346 static __inline void
  347 inp_unlock_assert(struct inpcb *inp __unused)
  348 {
  349 }
  350 
  351 static __inline void
  352 inp_wlock_assert(struct inpcb *inp __unused)
  353 {
  354 }
  355 
  356 static __inline void
  357 inp_wunlock_assert(struct inpcb *inp __unused)
  358 {
  359 }
  360 
  361 static __inline void
  362 inp_rlock_assert(struct inpcb *inp __unused)
  363 {
  364 }
  365 
  366 static __inline void
  367 inp_runlock_assert(struct inpcb *inp __unused)
  368 {
  369 }
  370 
  371 
  372 #endif
  373 
  374 void    inp_apply_all(void (*func)(struct inpcb *, void *), void *arg);
  375 int     inp_ip_tos_get(const struct inpcb *inp);
  376 void    inp_ip_tos_set(struct inpcb *inp, int val);
  377 struct socket *
  378         inp_inpcbtosocket(struct inpcb *inp);
  379 struct tcpcb *
  380         inp_inpcbtotcpcb(struct inpcb *inp);
  381 void    inp_4tuple_get(struct inpcb *inp, uint32_t *laddr, uint16_t *lp,
  382                 uint32_t *faddr, uint16_t *fp);
  383 
  384 #endif /* _KERNEL */
  385 
  386 #define INP_INFO_LOCK_INIT(ipi, d) \
  387         rw_init_flags(&(ipi)->ipi_lock, (d), RW_RECURSE)
  388 #define INP_INFO_LOCK_DESTROY(ipi)  rw_destroy(&(ipi)->ipi_lock)
  389 #define INP_INFO_RLOCK(ipi)     rw_rlock(&(ipi)->ipi_lock)
  390 #define INP_INFO_WLOCK(ipi)     rw_wlock(&(ipi)->ipi_lock)
  391 #define INP_INFO_TRY_RLOCK(ipi) rw_try_rlock(&(ipi)->ipi_lock)
  392 #define INP_INFO_TRY_WLOCK(ipi) rw_try_wlock(&(ipi)->ipi_lock)
  393 #define INP_INFO_RUNLOCK(ipi)   rw_runlock(&(ipi)->ipi_lock)
  394 #define INP_INFO_WUNLOCK(ipi)   rw_wunlock(&(ipi)->ipi_lock)
  395 #define INP_INFO_LOCK_ASSERT(ipi)       rw_assert(&(ipi)->ipi_lock, RA_LOCKED)
  396 #define INP_INFO_RLOCK_ASSERT(ipi)      rw_assert(&(ipi)->ipi_lock, RA_RLOCKED)
  397 #define INP_INFO_WLOCK_ASSERT(ipi)      rw_assert(&(ipi)->ipi_lock, RA_WLOCKED)
  398 #define INP_INFO_UNLOCK_ASSERT(ipi)     rw_assert(&(ipi)->ipi_lock, RA_UNLOCKED)
  399 
  400 #define INP_PCBHASH(faddr, lport, fport, mask) \
  401         (((faddr) ^ ((faddr) >> 16) ^ ntohs((lport) ^ (fport))) & (mask))
  402 #define INP_PCBPORTHASH(lport, mask) \
  403         (ntohs((lport)) & (mask))
  404 
  405 /*
  406  * Flags for inp_vflags -- historically version flags only, but now quite a
  407  * bit more due to an overflow of inp_flag, leading to some locking ambiguity
  408  * as some bits are stable from initial allocation, and others may change.
  409  */
  410 #define INP_IPV4        0x1
  411 #define INP_IPV6        0x2
  412 #define INP_IPV6PROTO   0x4             /* opened under IPv6 protocol */
  413 #define INP_TIMEWAIT    0x8             /* inpcb in TIMEWAIT, ppcb is tcptw */
  414 #define INP_ONESBCAST   0x10            /* send all-ones broadcast */
  415 #define INP_DROPPED     0x20            /* protocol drop flag */
  416 #define INP_SOCKREF     0x40            /* strong socket reference */
  417 
  418 /*
  419  * Flags for inp_flag.
  420  */
  421 #define INP_RECVOPTS            0x01    /* receive incoming IP options */
  422 #define INP_RECVRETOPTS         0x02    /* receive IP options for reply */
  423 #define INP_RECVDSTADDR         0x04    /* receive IP dst address */
  424 #define INP_HDRINCL             0x08    /* user supplies entire IP header */
  425 #define INP_HIGHPORT            0x10    /* user wants "high" port binding */
  426 #define INP_LOWPORT             0x20    /* user wants "low" port binding */
  427 #define INP_ANONPORT            0x40    /* port chosen for user */
  428 #define INP_RECVIF              0x80    /* receive incoming interface */
  429 #define INP_MTUDISC             0x100   /* user can do MTU discovery */
  430 #define INP_FAITH               0x200   /* accept FAITH'ed connections */
  431 #define INP_RECVTTL             0x400   /* receive incoming IP TTL */
  432 #define INP_DONTFRAG            0x800   /* don't fragment packet */
  433 
  434 #define IN6P_IPV6_V6ONLY        0x008000 /* restrict AF_INET6 socket for v6 */
  435 
  436 #define IN6P_PKTINFO            0x010000 /* receive IP6 dst and I/F */
  437 #define IN6P_HOPLIMIT           0x020000 /* receive hoplimit */
  438 #define IN6P_HOPOPTS            0x040000 /* receive hop-by-hop options */
  439 #define IN6P_DSTOPTS            0x080000 /* receive dst options after rthdr */
  440 #define IN6P_RTHDR              0x100000 /* receive routing header */
  441 #define IN6P_RTHDRDSTOPTS       0x200000 /* receive dstoptions before rthdr */
  442 #define IN6P_TCLASS             0x400000 /* receive traffic class value */
  443 #define IN6P_AUTOFLOWLABEL      0x800000 /* attach flowlabel automatically */
  444 #define IN6P_RFC2292            0x40000000 /* used RFC2292 API on the socket */
  445 #define IN6P_MTU                0x80000000 /* receive path MTU */
  446 
  447 #define INP_CONTROLOPTS         (INP_RECVOPTS|INP_RECVRETOPTS|INP_RECVDSTADDR|\
  448                                  INP_RECVIF|INP_RECVTTL|\
  449                                  IN6P_PKTINFO|IN6P_HOPLIMIT|IN6P_HOPOPTS|\
  450                                  IN6P_DSTOPTS|IN6P_RTHDR|IN6P_RTHDRDSTOPTS|\
  451                                  IN6P_TCLASS|IN6P_AUTOFLOWLABEL|IN6P_RFC2292|\
  452                                  IN6P_MTU)
  453 #define INP_UNMAPPABLEOPTS      (IN6P_HOPOPTS|IN6P_DSTOPTS|IN6P_RTHDR|\
  454                                  IN6P_TCLASS|IN6P_AUTOFLOWLABEL)
  455 
  456  /* for KAME src sync over BSD*'s */
  457 #define IN6P_HIGHPORT           INP_HIGHPORT
  458 #define IN6P_LOWPORT            INP_LOWPORT
  459 #define IN6P_ANONPORT           INP_ANONPORT
  460 #define IN6P_RECVIF             INP_RECVIF
  461 #define IN6P_MTUDISC            INP_MTUDISC
  462 #define IN6P_FAITH              INP_FAITH
  463 #define IN6P_CONTROLOPTS INP_CONTROLOPTS
  464         /*
  465          * socket AF version is {newer than,or include}
  466          * actual datagram AF version
  467          */
  468 
  469 #define INPLOOKUP_WILDCARD      1
  470 #define sotoinpcb(so)   ((struct inpcb *)(so)->so_pcb)
  471 #define sotoin6pcb(so)  sotoinpcb(so) /* for KAME src sync over BSD*'s */
  472 
  473 #define INP_SOCKAF(so) so->so_proto->pr_domain->dom_family
  474 
  475 #define INP_CHECK_SOCKAF(so, af)        (INP_SOCKAF(so) == af)
  476 
  477 #ifdef _KERNEL
  478 extern int      ipport_reservedhigh;
  479 extern int      ipport_reservedlow;
  480 extern int      ipport_lowfirstauto;
  481 extern int      ipport_lowlastauto;
  482 extern int      ipport_firstauto;
  483 extern int      ipport_lastauto;
  484 extern int      ipport_hifirstauto;
  485 extern int      ipport_hilastauto;
  486 extern struct callout ipport_tick_callout;
  487 
  488 void    in_pcbpurgeif0(struct inpcbinfo *, struct ifnet *);
  489 int     in_pcballoc(struct socket *, struct inpcbinfo *);
  490 int     in_pcbbind(struct inpcb *, struct sockaddr *, struct ucred *);
  491 int     in_pcbbind_setup(struct inpcb *, struct sockaddr *, in_addr_t *,
  492             u_short *, struct ucred *);
  493 int     in_pcbconnect(struct inpcb *, struct sockaddr *, struct ucred *);
  494 int     in_pcbconnect_setup(struct inpcb *, struct sockaddr *, in_addr_t *,
  495             u_short *, in_addr_t *, u_short *, struct inpcb **,
  496             struct ucred *);
  497 void    in_pcbdetach(struct inpcb *);
  498 void    in_pcbdisconnect(struct inpcb *);
  499 void    in_pcbdrop(struct inpcb *);
  500 void    in_pcbfree(struct inpcb *);
  501 int     in_pcbinshash(struct inpcb *);
  502 struct inpcb *
  503         in_pcblookup_local(struct inpcbinfo *,
  504             struct in_addr, u_short, int, struct ucred *);
  505 struct inpcb *
  506         in_pcblookup_hash(struct inpcbinfo *, struct in_addr, u_int,
  507             struct in_addr, u_int, int, struct ifnet *);
  508 void    in_pcbnotifyall(struct inpcbinfo *pcbinfo, struct in_addr,
  509             int, struct inpcb *(*)(struct inpcb *, int));
  510 void    in_pcbrehash(struct inpcb *);
  511 void    in_pcbsetsolabel(struct socket *so);
  512 int     in_getpeeraddr(struct socket *so, struct sockaddr **nam);
  513 int     in_getsockaddr(struct socket *so, struct sockaddr **nam);
  514 struct sockaddr *
  515         in_sockaddr(in_port_t port, struct in_addr *addr);
  516 void    in_pcbsosetlabel(struct socket *so);
  517 void    in_pcbremlists(struct inpcb *inp);
  518 void    ipport_tick(void *xtp);
  519 
  520 /*
  521  * Debugging routines compiled in when DDB is present.
  522  */
  523 void    db_print_inpcb(struct inpcb *inp, const char *name, int indent);
  524 
  525 #endif /* _KERNEL */
  526 
  527 #endif /* !_NETINET_IN_PCB_H_ */

Cache object: c35a631a960993ff6e8a852adb58be5b


[ source navigation ] [ diff markup ] [ identifier search ] [ freetext search ] [ file search ] [ list types ] [ track identifier ]


This page is part of the FreeBSD/Linux Linux Kernel Cross-Reference, and was automatically generated using a modified version of the LXR engine.