1df8bae1dSRodney W. Grimes /* 2df8bae1dSRodney W. Grimes * Copyright (c) 1982, 1986, 1990, 1993 3df8bae1dSRodney W. Grimes * The Regents of the University of California. All rights reserved. 4df8bae1dSRodney W. Grimes * 5df8bae1dSRodney W. Grimes * Redistribution and use in source and binary forms, with or without 6df8bae1dSRodney W. Grimes * modification, are permitted provided that the following conditions 7df8bae1dSRodney W. Grimes * are met: 8df8bae1dSRodney W. Grimes * 1. Redistributions of source code must retain the above copyright 9df8bae1dSRodney W. Grimes * notice, this list of conditions and the following disclaimer. 10df8bae1dSRodney W. Grimes * 2. Redistributions in binary form must reproduce the above copyright 11df8bae1dSRodney W. Grimes * notice, this list of conditions and the following disclaimer in the 12df8bae1dSRodney W. Grimes * documentation and/or other materials provided with the distribution. 13df8bae1dSRodney W. Grimes * 3. All advertising materials mentioning features or use of this software 14df8bae1dSRodney W. Grimes * must display the following acknowledgement: 15df8bae1dSRodney W. Grimes * This product includes software developed by the University of 16df8bae1dSRodney W. Grimes * California, Berkeley and its contributors. 17df8bae1dSRodney W. Grimes * 4. Neither the name of the University nor the names of its contributors 18df8bae1dSRodney W. Grimes * may be used to endorse or promote products derived from this software 19df8bae1dSRodney W. Grimes * without specific prior written permission. 20df8bae1dSRodney W. Grimes * 21df8bae1dSRodney W. Grimes * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND 22df8bae1dSRodney W. Grimes * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 23df8bae1dSRodney W. Grimes * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 24df8bae1dSRodney W. Grimes * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE 25df8bae1dSRodney W. Grimes * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 26df8bae1dSRodney W. Grimes * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 27df8bae1dSRodney W. Grimes * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 28df8bae1dSRodney W. Grimes * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 29df8bae1dSRodney W. Grimes * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 30df8bae1dSRodney W. Grimes * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 31df8bae1dSRodney W. Grimes * SUCH DAMAGE. 32df8bae1dSRodney W. Grimes * 33df8bae1dSRodney W. Grimes * @(#)in_pcb.h 8.1 (Berkeley) 6/10/93 34c3aac50fSPeter Wemm * $FreeBSD$ 35df8bae1dSRodney W. Grimes */ 36df8bae1dSRodney W. Grimes 37707f139eSPaul Richards #ifndef _NETINET_IN_PCB_H_ 38707f139eSPaul Richards #define _NETINET_IN_PCB_H_ 39707f139eSPaul Richards 40f1844d4cSBruce Evans #include <sys/queue.h> 41f1844d4cSBruce Evans 4238e04732SRobert Watson #include <net/route.h> 4382cd038dSYoshinobu Inoue #include <netinet6/ipsec.h> /* for IPSEC */ 4469c2d429SJeff Roberson #include <vm/uma.h> 4582cd038dSYoshinobu Inoue 4682cd038dSYoshinobu Inoue #define in6pcb inpcb /* for KAME src sync over BSD*'s */ 4782cd038dSYoshinobu Inoue #define in6p_sp inp_sp /* for KAME src sync over BSD*'s */ 4882cd038dSYoshinobu Inoue 49df8bae1dSRodney W. Grimes /* 50df8bae1dSRodney W. Grimes * Common structure pcb for internet protocol implementation. 51df8bae1dSRodney W. Grimes * Here are stored pointers to local and foreign host table 52df8bae1dSRodney W. Grimes * entries, local and foreign socket numbers, and pointers 53df8bae1dSRodney W. Grimes * up (to a socket structure) and down (to a protocol-specific) 54df8bae1dSRodney W. Grimes * control block. 55df8bae1dSRodney W. Grimes */ 56e3975643SJake Burkholder LIST_HEAD(inpcbhead, inpcb); 57e3975643SJake Burkholder LIST_HEAD(inpcbporthead, inpcbport); 5898271db4SGarrett Wollman typedef u_quad_t inp_gen_t; 5915bd2b43SDavid Greenman 603d4d47f3SGarrett Wollman /* 6182cd038dSYoshinobu Inoue * PCB with AF_INET6 null bind'ed laddr can receive AF_INET input packet. 6282cd038dSYoshinobu Inoue * So, AF_INET6 null laddr is also used as AF_INET null laddr, 6382cd038dSYoshinobu Inoue * by utilize following structure. (At last, same as INRIA) 6482cd038dSYoshinobu Inoue */ 6582cd038dSYoshinobu Inoue struct in_addr_4in6 { 6682cd038dSYoshinobu Inoue u_int32_t ia46_pad32[3]; 6782cd038dSYoshinobu Inoue struct in_addr ia46_addr4; 6882cd038dSYoshinobu Inoue }; 6982cd038dSYoshinobu Inoue 7082cd038dSYoshinobu Inoue /* 71be2ac88cSJonathan Lemon * NOTE: ipv6 addrs should be 64-bit aligned, per RFC 2553. 72be2ac88cSJonathan Lemon * in_conninfo has some extra padding to accomplish this. 73be2ac88cSJonathan Lemon */ 74be2ac88cSJonathan Lemon struct in_endpoints { 75be2ac88cSJonathan Lemon u_int16_t ie_fport; /* foreign port */ 76be2ac88cSJonathan Lemon u_int16_t ie_lport; /* local port */ 77be2ac88cSJonathan Lemon /* protocol dependent part, local and foreign addr */ 78be2ac88cSJonathan Lemon union { 79be2ac88cSJonathan Lemon /* foreign host table entry */ 80be2ac88cSJonathan Lemon struct in_addr_4in6 ie46_foreign; 81be2ac88cSJonathan Lemon struct in6_addr ie6_foreign; 82be2ac88cSJonathan Lemon } ie_dependfaddr; 83be2ac88cSJonathan Lemon union { 84be2ac88cSJonathan Lemon /* local host table entry */ 85be2ac88cSJonathan Lemon struct in_addr_4in6 ie46_local; 86be2ac88cSJonathan Lemon struct in6_addr ie6_local; 87be2ac88cSJonathan Lemon } ie_dependladdr; 88be2ac88cSJonathan Lemon #define ie_faddr ie_dependfaddr.ie46_foreign.ia46_addr4 89be2ac88cSJonathan Lemon #define ie_laddr ie_dependladdr.ie46_local.ia46_addr4 90be2ac88cSJonathan Lemon #define ie6_faddr ie_dependfaddr.ie6_foreign 91be2ac88cSJonathan Lemon #define ie6_laddr ie_dependladdr.ie6_local 92be2ac88cSJonathan Lemon }; 93be2ac88cSJonathan Lemon 94be2ac88cSJonathan Lemon /* 95be2ac88cSJonathan Lemon * XXX 96be2ac88cSJonathan Lemon * At some point struct route should possibly change to: 97be2ac88cSJonathan Lemon * struct rtentry *rt 98be2ac88cSJonathan Lemon * struct in_endpoints *ie; 99be2ac88cSJonathan Lemon */ 100be2ac88cSJonathan Lemon struct in_conninfo { 101be2ac88cSJonathan Lemon u_int8_t inc_flags; 102be2ac88cSJonathan Lemon u_int8_t inc_len; 103be2ac88cSJonathan Lemon u_int16_t inc_pad; /* XXX alignment for in_endpoints */ 104be2ac88cSJonathan Lemon /* protocol dependent part; cached route */ 105be2ac88cSJonathan Lemon struct in_endpoints inc_ie; 106be2ac88cSJonathan Lemon union { 107be2ac88cSJonathan Lemon /* placeholder for routing entry */ 108be2ac88cSJonathan Lemon struct route inc4_route; 109be2ac88cSJonathan Lemon struct route_in6 inc6_route; 110be2ac88cSJonathan Lemon } inc_dependroute; 111be2ac88cSJonathan Lemon }; 112be2ac88cSJonathan Lemon #define inc_isipv6 inc_flags /* temp compatability */ 113be2ac88cSJonathan Lemon #define inc_fport inc_ie.ie_fport 114be2ac88cSJonathan Lemon #define inc_lport inc_ie.ie_lport 115be2ac88cSJonathan Lemon #define inc_faddr inc_ie.ie_faddr 116be2ac88cSJonathan Lemon #define inc_laddr inc_ie.ie_laddr 117be2ac88cSJonathan Lemon #define inc_route inc_dependroute.inc4_route 118be2ac88cSJonathan Lemon #define inc6_faddr inc_ie.ie6_faddr 119be2ac88cSJonathan Lemon #define inc6_laddr inc_ie.ie6_laddr 120be2ac88cSJonathan Lemon #define inc6_route inc_dependroute.inc6_route 121be2ac88cSJonathan Lemon 12282cd038dSYoshinobu Inoue struct icmp6_filter; 12382cd038dSYoshinobu Inoue 124df8bae1dSRodney W. Grimes struct inpcb { 125e3975643SJake Burkholder LIST_ENTRY(inpcb) inp_hash; /* hash list */ 126e3975643SJake Burkholder LIST_ENTRY(inpcb) inp_list; /* list for all PCBs of this proto */ 12782cd038dSYoshinobu Inoue u_int32_t inp_flow; 12882cd038dSYoshinobu Inoue 129be2ac88cSJonathan Lemon /* local and foreign ports, local and foreign addr */ 130be2ac88cSJonathan Lemon struct in_conninfo inp_inc; 13182cd038dSYoshinobu Inoue 132df8bae1dSRodney W. Grimes caddr_t inp_ppcb; /* pointer to per-protocol pcb */ 133c3229e05SDavid Greenman struct inpcbinfo *inp_pcbinfo; /* PCB list info */ 134ca98b82cSDavid Greenman struct socket *inp_socket; /* back pointer to socket */ 13582cd038dSYoshinobu Inoue /* list for this PCB's local port */ 136df8bae1dSRodney W. Grimes int inp_flags; /* generic IP/datagram flags */ 13782cd038dSYoshinobu Inoue 13882cd038dSYoshinobu Inoue struct inpcbpolicy *inp_sp; /* for IPSEC */ 1396d53e163SAlfred Perlstein u_char inp_vflag; /* IP version flag (v4/v6) */ 14082cd038dSYoshinobu Inoue #define INP_IPV4 0x1 14182cd038dSYoshinobu Inoue #define INP_IPV6 0x2 142ca98b82cSDavid Greenman u_char inp_ip_ttl; /* time to live proto */ 143ca98b82cSDavid Greenman u_char inp_ip_p; /* protocol proto */ 14482cd038dSYoshinobu Inoue 14582cd038dSYoshinobu Inoue /* protocol dependent part; options */ 14682cd038dSYoshinobu Inoue struct { 14782cd038dSYoshinobu Inoue u_char inp4_ip_tos; /* type of service proto */ 14882cd038dSYoshinobu Inoue struct mbuf *inp4_options; /* IP options */ 14982cd038dSYoshinobu Inoue struct ip_moptions *inp4_moptions; /* IP multicast options */ 15082cd038dSYoshinobu Inoue } inp_depend4; 151be2ac88cSJonathan Lemon #define inp_fport inp_inc.inc_fport 152be2ac88cSJonathan Lemon #define inp_lport inp_inc.inc_lport 153be2ac88cSJonathan Lemon #define inp_faddr inp_inc.inc_faddr 154be2ac88cSJonathan Lemon #define inp_laddr inp_inc.inc_laddr 155be2ac88cSJonathan Lemon #define inp_route inp_inc.inc_route 15682cd038dSYoshinobu Inoue #define inp_ip_tos inp_depend4.inp4_ip_tos 15782cd038dSYoshinobu Inoue #define inp_options inp_depend4.inp4_options 15882cd038dSYoshinobu Inoue #define inp_moptions inp_depend4.inp4_moptions 15982cd038dSYoshinobu Inoue struct { 16082cd038dSYoshinobu Inoue /* IP options */ 16182cd038dSYoshinobu Inoue struct mbuf *inp6_options; 16282cd038dSYoshinobu Inoue /* IP6 options for outgoing packets */ 16382cd038dSYoshinobu Inoue struct ip6_pktopts *inp6_outputopts; 16482cd038dSYoshinobu Inoue /* IP multicast options */ 16582cd038dSYoshinobu Inoue struct ip6_moptions *inp6_moptions; 16682cd038dSYoshinobu Inoue /* ICMPv6 code type filter */ 16782cd038dSYoshinobu Inoue struct icmp6_filter *inp6_icmp6filt; 16882cd038dSYoshinobu Inoue /* IPV6_CHECKSUM setsockopt */ 16982cd038dSYoshinobu Inoue int inp6_cksum; 17082cd038dSYoshinobu Inoue u_short inp6_ifindex; 17182cd038dSYoshinobu Inoue short inp6_hops; 17282cd038dSYoshinobu Inoue u_int8_t inp6_hlim; 17382cd038dSYoshinobu Inoue } inp_depend6; 174e3975643SJake Burkholder LIST_ENTRY(inpcb) inp_portlist; 1758781d8e9SBruce Evans struct inpcbport *inp_phd; /* head of this list */ 17698271db4SGarrett Wollman inp_gen_t inp_gencnt; /* generation count of this instance */ 177be2ac88cSJonathan Lemon #define in6p_faddr inp_inc.inc6_faddr 178be2ac88cSJonathan Lemon #define in6p_laddr inp_inc.inc6_laddr 179be2ac88cSJonathan Lemon #define in6p_route inp_inc.inc6_route 18082cd038dSYoshinobu Inoue #define in6p_ip6_hlim inp_depend6.inp6_hlim 18182cd038dSYoshinobu Inoue #define in6p_hops inp_depend6.inp6_hops /* default hop limit */ 18282cd038dSYoshinobu Inoue #define in6p_ip6_nxt inp_ip_p 18382cd038dSYoshinobu Inoue #define in6p_flowinfo inp_flow 18482cd038dSYoshinobu Inoue #define in6p_vflag inp_vflag 18582cd038dSYoshinobu Inoue #define in6p_options inp_depend6.inp6_options 18682cd038dSYoshinobu Inoue #define in6p_outputopts inp_depend6.inp6_outputopts 18782cd038dSYoshinobu Inoue #define in6p_moptions inp_depend6.inp6_moptions 18882cd038dSYoshinobu Inoue #define in6p_icmp6filt inp_depend6.inp6_icmp6filt 18982cd038dSYoshinobu Inoue #define in6p_cksum inp_depend6.inp6_cksum 19082cd038dSYoshinobu Inoue #define inp6_ifindex inp_depend6.inp6_ifindex 19182cd038dSYoshinobu Inoue #define in6p_flags inp_flags /* for KAME src sync over BSD*'s */ 19282cd038dSYoshinobu Inoue #define in6p_socket inp_socket /* for KAME src sync over BSD*'s */ 19382cd038dSYoshinobu Inoue #define in6p_lport inp_lport /* for KAME src sync over BSD*'s */ 19482cd038dSYoshinobu Inoue #define in6p_fport inp_fport /* for KAME src sync over BSD*'s */ 19582cd038dSYoshinobu Inoue #define in6p_ppcb inp_ppcb /* for KAME src sync over BSD*'s */ 196c3229e05SDavid Greenman }; 1973d4d47f3SGarrett Wollman /* 1983d4d47f3SGarrett Wollman * The range of the generation count, as used in this implementation, 1993d4d47f3SGarrett Wollman * is 9e19. We would have to create 300 billion connections per 2003d4d47f3SGarrett Wollman * second for this number to roll over in a year. This seems sufficiently 2013d4d47f3SGarrett Wollman * unlikely that we simply don't concern ourselves with that possibility. 2023d4d47f3SGarrett Wollman */ 203c3229e05SDavid Greenman 20498271db4SGarrett Wollman /* 20598271db4SGarrett Wollman * Interface exported to userland by various protocols which use 20698271db4SGarrett Wollman * inpcbs. Hack alert -- only define if struct xsocket is in scope. 20798271db4SGarrett Wollman */ 20898271db4SGarrett Wollman #ifdef _SYS_SOCKETVAR_H_ 20998271db4SGarrett Wollman struct xinpcb { 21098271db4SGarrett Wollman size_t xi_len; /* length of this structure */ 21198271db4SGarrett Wollman struct inpcb xi_inp; 21298271db4SGarrett Wollman struct xsocket xi_socket; 21398271db4SGarrett Wollman u_quad_t xi_alignment_hack; 21498271db4SGarrett Wollman }; 21598271db4SGarrett Wollman 21698271db4SGarrett Wollman struct xinpgen { 21798271db4SGarrett Wollman size_t xig_len; /* length of this structure */ 21898271db4SGarrett Wollman u_int xig_count; /* number of PCBs at this time */ 21998271db4SGarrett Wollman inp_gen_t xig_gen; /* generation count at this time */ 22098271db4SGarrett Wollman so_gen_t xig_sogen; /* socket generation count at this time */ 22198271db4SGarrett Wollman }; 22298271db4SGarrett Wollman #endif /* _SYS_SOCKETVAR_H_ */ 22398271db4SGarrett Wollman 224c3229e05SDavid Greenman struct inpcbport { 225e3975643SJake Burkholder LIST_ENTRY(inpcbport) phd_hash; 226c3229e05SDavid Greenman struct inpcbhead phd_pcblist; 227c3229e05SDavid Greenman u_short phd_port; 228df8bae1dSRodney W. Grimes }; 229df8bae1dSRodney W. Grimes 2303d4d47f3SGarrett Wollman struct inpcbinfo { /* XXX documentation, prefixes */ 23115bd2b43SDavid Greenman struct inpcbhead *hashbase; 2323d4d47f3SGarrett Wollman u_long hashmask; 233c3229e05SDavid Greenman struct inpcbporthead *porthashbase; 2343d4d47f3SGarrett Wollman u_long porthashmask; 235c3229e05SDavid Greenman struct inpcbhead *listhead; 2363d4d47f3SGarrett Wollman u_short lastport; 2373d4d47f3SGarrett Wollman u_short lastlow; 2383d4d47f3SGarrett Wollman u_short lasthi; 23969c2d429SJeff Roberson uma_zone_t ipi_zone; /* zone to allocate pcbs from */ 2403d4d47f3SGarrett Wollman u_int ipi_count; /* number of pcbs in this list */ 2413d4d47f3SGarrett Wollman u_quad_t ipi_gencnt; /* current generation count */ 24215bd2b43SDavid Greenman }; 24315bd2b43SDavid Greenman 244ddd79a97SDavid Greenman #define INP_PCBHASH(faddr, lport, fport, mask) \ 245c3229e05SDavid Greenman (((faddr) ^ ((faddr) >> 16) ^ ntohs((lport) ^ (fport))) & (mask)) 246c3229e05SDavid Greenman #define INP_PCBPORTHASH(lport, mask) \ 247c3229e05SDavid Greenman (ntohs((lport)) & (mask)) 248ddd79a97SDavid Greenman 249df8bae1dSRodney W. Grimes /* flags in inp_flags: */ 250df8bae1dSRodney W. Grimes #define INP_RECVOPTS 0x01 /* receive incoming IP options */ 251df8bae1dSRodney W. Grimes #define INP_RECVRETOPTS 0x02 /* receive IP options for reply */ 252df8bae1dSRodney W. Grimes #define INP_RECVDSTADDR 0x04 /* receive IP dst address */ 253df8bae1dSRodney W. Grimes #define INP_HDRINCL 0x08 /* user supplies entire IP header */ 25433b3ac06SPeter Wemm #define INP_HIGHPORT 0x10 /* user wants "high" port binding */ 25533b3ac06SPeter Wemm #define INP_LOWPORT 0x20 /* user wants "low" port binding */ 256321a2846SPoul-Henning Kamp #define INP_ANONPORT 0x40 /* port chosen for user */ 25782c23ebaSBill Fenner #define INP_RECVIF 0x80 /* receive incoming interface */ 25857bf258eSGarrett Wollman #define INP_MTUDISC 0x100 /* user can do MTU discovery */ 25982cd038dSYoshinobu Inoue #define INP_FAITH 0x200 /* accept FAITH'ed connections */ 26033841545SHajimu UMEMOTO 26133841545SHajimu UMEMOTO #define IN6P_IPV6_V6ONLY 0x008000 /* restrict AF_INET6 socket for v6 */ 26233841545SHajimu UMEMOTO 26333841545SHajimu UMEMOTO #define IN6P_PKTINFO 0x010000 /* receive IP6 dst and I/F */ 26433841545SHajimu UMEMOTO #define IN6P_HOPLIMIT 0x020000 /* receive hoplimit */ 26533841545SHajimu UMEMOTO #define IN6P_HOPOPTS 0x040000 /* receive hop-by-hop options */ 26633841545SHajimu UMEMOTO #define IN6P_DSTOPTS 0x080000 /* receive dst options after rthdr */ 26733841545SHajimu UMEMOTO #define IN6P_RTHDR 0x100000 /* receive routing header */ 26833841545SHajimu UMEMOTO #define IN6P_RTHDRDSTOPTS 0x200000 /* receive dstoptions before rthdr */ 26933841545SHajimu UMEMOTO #define IN6P_AUTOFLOWLABEL 0x800000 /* attach flowlabel automatically */ 27033841545SHajimu UMEMOTO #define IN6P_BINDV6ONLY 0x10000000 /* do not grab IPv4 traffic */ 27133841545SHajimu UMEMOTO 27282c23ebaSBill Fenner #define INP_CONTROLOPTS (INP_RECVOPTS|INP_RECVRETOPTS|INP_RECVDSTADDR|\ 27382cd038dSYoshinobu Inoue INP_RECVIF|\ 27433841545SHajimu UMEMOTO IN6P_PKTINFO|IN6P_HOPLIMIT|IN6P_HOPOPTS|\ 27533841545SHajimu UMEMOTO IN6P_DSTOPTS|IN6P_RTHDR|IN6P_RTHDRDSTOPTS|\ 27633841545SHajimu UMEMOTO IN6P_AUTOFLOWLABEL) 27733841545SHajimu UMEMOTO #define INP_UNMAPPABLEOPTS (IN6P_HOPOPTS|IN6P_DSTOPTS|IN6P_RTHDR|\ 27833841545SHajimu UMEMOTO IN6P_AUTOFLOWLABEL) 27982cd038dSYoshinobu Inoue 28082cd038dSYoshinobu Inoue /* for KAME src sync over BSD*'s */ 28182cd038dSYoshinobu Inoue #define IN6P_HIGHPORT INP_HIGHPORT 28282cd038dSYoshinobu Inoue #define IN6P_LOWPORT INP_LOWPORT 28382cd038dSYoshinobu Inoue #define IN6P_ANONPORT INP_ANONPORT 28482cd038dSYoshinobu Inoue #define IN6P_RECVIF INP_RECVIF 28582cd038dSYoshinobu Inoue #define IN6P_MTUDISC INP_MTUDISC 28682cd038dSYoshinobu Inoue #define IN6P_FAITH INP_FAITH 28782cd038dSYoshinobu Inoue #define IN6P_CONTROLOPTS INP_CONTROLOPTS 28882cd038dSYoshinobu Inoue /* 28982cd038dSYoshinobu Inoue * socket AF version is {newer than,or include} 29082cd038dSYoshinobu Inoue * actual datagram AF version 29182cd038dSYoshinobu Inoue */ 292df8bae1dSRodney W. Grimes 293df8bae1dSRodney W. Grimes #define INPLOOKUP_WILDCARD 1 294df8bae1dSRodney W. Grimes #define sotoinpcb(so) ((struct inpcb *)(so)->so_pcb) 29582cd038dSYoshinobu Inoue #define sotoin6pcb(so) sotoinpcb(so) /* for KAME src sync over BSD*'s */ 29682cd038dSYoshinobu Inoue 29782cd038dSYoshinobu Inoue #define INP_SOCKAF(so) so->so_proto->pr_domain->dom_family 29882cd038dSYoshinobu Inoue 29982cd038dSYoshinobu Inoue #define INP_CHECK_SOCKAF(so, af) (INP_SOCKAF(so) == af) 300df8bae1dSRodney W. Grimes 301664a31e4SPeter Wemm #ifdef _KERNEL 30282cd038dSYoshinobu Inoue extern int ipport_lowfirstauto; 30382cd038dSYoshinobu Inoue extern int ipport_lowlastauto; 30482cd038dSYoshinobu Inoue extern int ipport_firstauto; 30582cd038dSYoshinobu Inoue extern int ipport_lastauto; 30682cd038dSYoshinobu Inoue extern int ipport_hifirstauto; 30782cd038dSYoshinobu Inoue extern int ipport_hilastauto; 30882cd038dSYoshinobu Inoue 3094d77a549SAlfred Perlstein void in_pcbpurgeif0(struct inpcb *, struct ifnet *); 3104d77a549SAlfred Perlstein void in_losing(struct inpcb *); 3114d77a549SAlfred Perlstein void in_rtchange(struct inpcb *, int); 3124d77a549SAlfred Perlstein int in_pcballoc(struct socket *, struct inpcbinfo *, struct thread *); 3134d77a549SAlfred Perlstein int in_pcbbind(struct inpcb *, struct sockaddr *, struct thread *); 3144d77a549SAlfred Perlstein int in_pcbconnect(struct inpcb *, struct sockaddr *, struct thread *); 3154d77a549SAlfred Perlstein void in_pcbdetach(struct inpcb *); 3164d77a549SAlfred Perlstein void in_pcbdisconnect(struct inpcb *); 3174d77a549SAlfred Perlstein int in_pcbinshash(struct inpcb *); 3184d77a549SAlfred Perlstein int in_pcbladdr(struct inpcb *, struct sockaddr *, 3194d77a549SAlfred Perlstein struct sockaddr_in **); 320df8bae1dSRodney W. Grimes struct inpcb * 3214d77a549SAlfred Perlstein in_pcblookup_local(struct inpcbinfo *, 3224d77a549SAlfred Perlstein struct in_addr, u_int, int); 32315bd2b43SDavid Greenman struct inpcb * 324c1cd65baSBruce Evans in_pcblookup_hash(struct inpcbinfo *, struct in_addr, u_int, 325c1cd65baSBruce Evans struct in_addr, u_int, int, struct ifnet *); 3264d77a549SAlfred Perlstein void in_pcbnotifyall(struct inpcbhead *, struct in_addr, 3274d77a549SAlfred Perlstein int, void (*)(struct inpcb *, int)); 3284d77a549SAlfred Perlstein void in_pcbrehash(struct inpcb *); 3294d77a549SAlfred Perlstein int in_setpeeraddr(struct socket *so, struct sockaddr **nam); 3304d77a549SAlfred Perlstein int in_setsockaddr(struct socket *so, struct sockaddr **nam); 3314d77a549SAlfred Perlstein void in_pcbremlists(struct inpcb *inp); 3324d77a549SAlfred Perlstein int prison_xinpcb(struct proc *p, struct inpcb *inp); 333664a31e4SPeter Wemm #endif /* _KERNEL */ 3343d4d47f3SGarrett Wollman 3358781d8e9SBruce Evans #endif /* !_NETINET_IN_PCB_H_ */ 336