#include <netinet/in_pcb.h>

netinet/in_pcb.h

includes: sys/appleapiopts.h, netinet/in.h, sys/socketvar.h, sys/types.h, sys/queue.h, TargetConditionals.h
12 macros · 7 structs · 1 typedef

typedefinp_gen_t

typedef u_quad_t inp_gen_t

structin_addr_4in6

PCB with AF_INET6 null bind'ed laddr can receive AF_INET input packet. So, AF_INET6 null laddr is also used as AF_INET null laddr, by utilizing the following structure.
size 16, align 4
u_int32_t[3]ia46_pad32
struct in_addria46_addr4

struct_inpcb_list_entry

size 8, align 4
u_int32_tle_next
u_int32_tle_prev

macro_INPCB_PTR

#define _INPCB_PTR(x) u_int32_t

macro_INPCB_LIST_ENTRY

#define _INPCB_LIST_ENTRY(x) struct _inpcb_list_entry

structinpcb

size 208, align 4
struct _inpcb_list_entryinp_hashhash list
struct in_addrreserved1reserved
struct in_addrreserved2reserved
u_shortinp_fportforeign port
u_shortinp_lportlocal port
struct _inpcb_list_entryinp_listlist for all peer PCBs
u_int32_tinp_ppcbper-protocol pcb
u_int32_tinp_pcbinfoPCB list info
u_int32_tinp_socketback pointer to socket
u_charnat_ownerUsed to NAT TCP/UDP traffic
u_int32_tnat_cookieCookie stored and returned to NAT
struct _inpcb_list_entryinp_portlistthis PCB's local port list
u_int32_tinp_phdhead of this list
inp_gen_tinp_gencntgeneration count of this instance
intinp_flagsgeneric IP/datagram flags
u_int32_tinp_flow
u_charinp_vflag
u_charinp_ip_ttltime to live proto
u_charinp_ip_pprotocol proto
unnamed union at netinet/in_pcb.h:154:2inp_dependfaddrprotocol dependent part
struct in_addr_4in6inp46_foreignforeign host table entry
struct in6_addrinp6_foreign
unnamed union at netinet/in_pcb.h:159:2inp_dependladdr
struct in_addr_4in6inp46_locallocal host table entry
struct in6_addrinp6_local
unnamed union at netinet/in_pcb.h:164:2inp_dependroute
u_char[20]inp4_routeplaceholder for routing entry
u_char[32]inp6_route
unnamed struct at netinet/in_pcb.h:169:2inp_depend4
u_charinp4_ip_tostype of service proto
u_int32_tinp4_optionsIP options
u_int32_tinp4_moptionsIP multicast options
unnamed struct at netinet/in_pcb.h:178:2inp_depend6
u_int32_tinp6_optionsIP options
u_int8_tinp6_hlim
u_int8_tunused_uint8_1
ushortunused_uint16_1
u_int32_tinp6_outputoptsIP6 options for outgoing packets
u_int32_tinp6_moptionsIP multicast options
u_int32_tinp6_icmp6filtICMPv6 code type filter
intinp6_cksumIPV6_CHECKSUM setsockopt
u_shortinp6_ifindex
shortinp6_hops
inthash_elementArray index of pcb's hash list
u_int32_tinp_saved_ppcbpointer while cached
u_int32_tinp_sp
u_int32_t[3]reservedreserved

structxinpcb

size 320, align 4
u_int32_txi_lenlength of this structure
struct inpcbxi_inp
struct xsocketxi_socket
u_quad_txi_alignment_hack

structinpcb64_list_entry

size 16, align 4
u_int64_tle_next
u_int64_tle_prev

structxinpcb64

size 260, align 4
u_int64_txi_lenlength of this structure
u_int64_txi_inpp
u_shortinp_fportforeign port
u_shortinp_lportlocal port
struct inpcb64_list_entryinp_listlist for all PCBs
u_int64_tinp_ppcbptr to per-protocol PCB
u_int64_tinp_pcbinfoPCB list info
struct inpcb64_list_entryinp_portlistthis PCB's local port list
u_int64_tinp_phdhead of this list
inp_gen_tinp_gencntcurrent generation count
intinp_flagsgeneric IP/datagram flags
u_int32_tinp_flow
u_charinp_vflag
u_charinp_ip_ttltime to live
u_charinp_ip_pprotocol
unnamed union at netinet/in_pcb.h:231:2inp_dependfaddr
struct in_addr_4in6inp46_foreign
struct in6_addrinp6_foreign
unnamed union at netinet/in_pcb.h:235:2inp_dependladdr
struct in_addr_4in6inp46_local
struct in6_addrinp6_local
unnamed struct at netinet/in_pcb.h:239:2inp_depend4
u_charinp4_ip_tostype of service
unnamed struct at netinet/in_pcb.h:242:2inp_depend6
u_int8_tinp6_hlim
intinp6_cksum
u_shortinp6_ifindex
shortinp6_hops
struct xsocket64xi_socket
u_quad_txi_alignment_hack

structxinpgen

size 24, align 4
u_int32_txig_lenlength of this structure
u_intxig_countnumber of PCBs at this time
inp_gen_txig_gengeneration count at this time
so_gen_txig_sogencurrent socket generation count

macroINP_IPV4

These defines are for use with the inpcb.
#define INP_IPV4 0x1

macroINP_IPV6

#define INP_IPV6 0x2

macroINP_V4MAPPEDV6

#define INP_V4MAPPEDV6 0x4

macroinp_faddr

#define inp_faddr inp_dependfaddr.inp46_foreign.ia46_addr4

macroinp_laddr

#define inp_laddr inp_dependladdr.inp46_local.ia46_addr4

macroin6p_faddr

#define in6p_faddr inp_dependfaddr.inp6_foreign

macroin6p_laddr

#define in6p_laddr inp_dependladdr.inp6_local

macroINP_ANONPORT

#define INP_ANONPORT 0x00000040
port chosen for user

macroIN6P_IPV6_V6ONLY

#define IN6P_IPV6_V6ONLY 0x00008000
restrict AF_INET6 socket for v6

macroIN6P_BINDV6ONLY

#define IN6P_BINDV6ONLY 0x01000000
do not grab IPv4 traffic