1 /* 2 * Copyright (c) 1982, 1986, 1990 Regents of the University of California. 3 * All rights reserved. 4 * 5 * %sccs.include.redist.c% 6 * 7 * @(#)in_pcb.h 7.6 (Berkeley) 06/28/90 8 */ 9 10 /* 11 * Common structure pcb for internet protocol implementation. 12 * Here are stored pointers to local and foreign host table 13 * entries, local and foreign socket numbers, and pointers 14 * up (to a socket structure) and down (to a protocol-specific) 15 * control block. 16 */ 17 struct inpcb { 18 struct inpcb *inp_next,*inp_prev; 19 /* pointers to other pcb's */ 20 struct inpcb *inp_head; /* pointer back to chain of inpcb's 21 for this protocol */ 22 struct in_addr inp_faddr; /* foreign host table entry */ 23 u_short inp_fport; /* foreign port */ 24 struct in_addr inp_laddr; /* local host table entry */ 25 u_short inp_lport; /* local port */ 26 struct socket *inp_socket; /* back pointer to socket */ 27 caddr_t inp_ppcb; /* pointer to per-protocol pcb */ 28 struct route inp_route; /* placeholder for routing entry */ 29 int inp_flags; /* generic IP/datagram flags */ 30 struct ip inp_ip; /* header prototype; should have more */ 31 struct mbuf *inp_options; /* IP options */ 32 }; 33 34 /* flags in inp_flags: */ 35 #define INP_RECVOPTS 0x01 /* receive incoming IP options */ 36 #define INP_RECVRETOPTS 0x02 /* receive IP options for reply */ 37 #define INP_RECVDSTADDR 0x04 /* receive IP dst address */ 38 #define INP_CONTROLOPTS (INP_RECVOPTS|INP_RECVRETOPTS|INP_RECVDSTADDR) 39 40 #ifdef sotorawcb 41 /* 42 * Common structure pcb for raw internet protocol access. 43 * Here are internet specific extensions to the raw control block, 44 * and space is allocated to the necessary sockaddrs. 45 */ 46 struct raw_inpcb { 47 struct rawcb rinp_rcb; /* common control block prefix */ 48 struct mbuf *rinp_options; /* IP options */ 49 int rinp_flags; /* flags, e.g. raw sockopts */ 50 #define RINPF_HDRINCL 0x1 /* user supplies entire IP header */ 51 struct sockaddr_in rinp_faddr; /* foreign address */ 52 struct sockaddr_in rinp_laddr; /* local address */ 53 struct route rinp_route; /* placeholder for routing entry */ 54 }; 55 #endif 56 57 #define INPLOOKUP_WILDCARD 1 58 #define INPLOOKUP_SETLOCAL 2 59 60 #define sotoinpcb(so) ((struct inpcb *)(so)->so_pcb) 61 #define sotorawinpcb(so) ((struct raw_inpcb *)(so)->so_pcb) 62 63 #ifdef KERNEL 64 struct inpcb *in_pcblookup(); 65 #endif 66