[BACK]Return to in6_pcb.h CVS log [TXT][DIR] Up to [cvs.NetBSD.org] / src / sys / netinet6

Annotation of src/sys/netinet6/in6_pcb.h, Revision 1.8

1.8     ! itojun      1: /*     $NetBSD: in6_pcb.h,v 1.7 1999/12/27 06:38:47 itojun Exp $       */
1.3       thorpej     2:
1.2       itojun      3: /*
                      4:  * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project.
                      5:  * All rights reserved.
                      6:  *
                      7:  * Redistribution and use in source and binary forms, with or without
                      8:  * modification, are permitted provided that the following conditions
                      9:  * are met:
                     10:  * 1. Redistributions of source code must retain the above copyright
                     11:  *    notice, this list of conditions and the following disclaimer.
                     12:  * 2. Redistributions in binary form must reproduce the above copyright
                     13:  *    notice, this list of conditions and the following disclaimer in the
                     14:  *    documentation and/or other materials provided with the distribution.
                     15:  * 3. Neither the name of the project nor the names of its contributors
                     16:  *    may be used to endorse or promote products derived from this software
                     17:  *    without specific prior written permission.
                     18:  *
                     19:  * THIS SOFTWARE IS PROVIDED BY THE PROJECT AND CONTRIBUTORS ``AS IS'' AND
                     20:  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
                     21:  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
                     22:  * ARE DISCLAIMED.  IN NO EVENT SHALL THE PROJECT OR CONTRIBUTORS BE LIABLE
                     23:  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
                     24:  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
                     25:  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
                     26:  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
                     27:  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
                     28:  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
                     29:  * SUCH DAMAGE.
                     30:  */
                     31:
                     32: /*
                     33:  * Copyright (c) 1982, 1986, 1990, 1993
                     34:  *     The Regents of the University of California.  All rights reserved.
                     35:  *
                     36:  * Redistribution and use in source and binary forms, with or without
                     37:  * modification, are permitted provided that the following conditions
                     38:  * are met:
                     39:  * 1. Redistributions of source code must retain the above copyright
                     40:  *    notice, this list of conditions and the following disclaimer.
                     41:  * 2. Redistributions in binary form must reproduce the above copyright
                     42:  *    notice, this list of conditions and the following disclaimer in the
                     43:  *    documentation and/or other materials provided with the distribution.
                     44:  * 3. All advertising materials mentioning features or use of this software
                     45:  *    must display the following acknowledgement:
                     46:  *     This product includes software developed by the University of
                     47:  *     California, Berkeley and its contributors.
                     48:  * 4. Neither the name of the University nor the names of its contributors
                     49:  *    may be used to endorse or promote products derived from this software
                     50:  *    without specific prior written permission.
                     51:  *
                     52:  * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
                     53:  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
                     54:  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
                     55:  * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
                     56:  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
                     57:  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
                     58:  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
                     59:  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
                     60:  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
                     61:  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
                     62:  * SUCH DAMAGE.
                     63:  *
                     64:  *     @(#)in_pcb.h    8.1 (Berkeley) 6/10/93
                     65:  */
                     66:
                     67: #ifndef _NETINET6_IN6_PCB_H_
                     68: #define _NETINET6_IN6_PCB_H_
                     69:
                     70: #include <sys/queue.h>
                     71:
                     72: /*
                     73:  * Common structure pcb for internet protocol implementation.
                     74:  * Here are stored pointers to local and foreign host table
                     75:  * entries, local and foreign socket numbers, and pointers
                     76:  * up (to a socket structure) and down (to a protocol-specific)
                     77:  * control block.
                     78:  */
                     79: struct icmp6_filter;
1.8     ! itojun     80: struct inpcbpolicy;
1.2       itojun     81:
                     82: struct in6pcb {
                     83:        struct  in6pcb *in6p_next, *in6p_prev;
                     84:                                        /* pointers to other pcb's */
                     85:        struct  in6pcb *in6p_head;      /* pointer back to chain of
                     86:                                           in6pcb's for this protocol */
                     87:        struct  in6_addr in6p_faddr;    /* foreign host table entry */
                     88:        u_short in6p_fport;             /* foreign port */
                     89:        struct  in6_addr in6p_laddr;    /* local host table entry */
                     90:        u_short in6p_lport;             /* local port */
1.5       itojun     91:        u_int32_t in6p_flowinfo;        /* priority and flowlabel */
1.2       itojun     92:        struct  socket *in6p_socket;    /* back pointer to socket */
                     93:        caddr_t in6p_ppcb;              /* pointer to per-protocol pcb */
                     94:        struct  route_in6 in6p_route;   /* placeholder for routing entry */
                     95:        int     in6p_flags;             /* generic IP6/datagram flags */
                     96:        int     in6p_hops;              /* default hop limit */
                     97:        struct  ip6_hdr in6p_ip6;       /* header prototype */
                     98:        struct  mbuf *in6p_options;   /* IP6 options */
                     99:        struct  ip6_pktopts *in6p_outputopts; /* IP6 options for outgoing packets */
                    100:        struct  ip6_moptions *in6p_moptions; /* IP6 multicast options */
                    101:        u_short in6p_ifindex;
                    102:        /* should move the following just after next/prev */
                    103:        LIST_ENTRY(in6pcb) in6p_hlist;  /* hash chain */
                    104:        u_long  in6p_hash;              /* hash value */
                    105: #if 1 /*IPSEC*/
1.8     ! itojun    106:        struct inpcbpolicy *in6p_sp;    /* security policy. */
1.2       itojun    107: #endif
                    108:        struct icmp6_filter *in6p_icmp6filt;
                    109:        int     in6p_cksum;             /* IPV6_CHECKSUM setsockopt */
                    110: };
                    111:
                    112: #define in6p_ip6_nxt in6p_ip6.ip6_nxt  /* for KAME src sync over BSD*'s */
                    113:
1.7       itojun    114: /*
                    115:  * Flags in in6p_flags
                    116:  * We define KAME's original flags in higher 16 bits as much as possible
                    117:  * for compatibility with *bsd*s.
                    118:  */
                    119: #define IN6P_RECVOPTS          0x001000 /* receive incoming IP6 options */
                    120: #define IN6P_RECVRETOPTS       0x002000 /* receive IP6 options for reply */
                    121: #define IN6P_RECVDSTADDR       0x004000 /* receive IP6 dst address */
                    122: #define IN6P_PKTINFO           0x010000 /* receive IP6 dst and I/F */
                    123: #define IN6P_HOPLIMIT          0x020000 /* receive hoplimit */
                    124: #define IN6P_HOPOPTS           0x040000 /* receive hop-by-hop options */
                    125: #define IN6P_DSTOPTS           0x080000 /* receive dst options after rthdr */
                    126: #define IN6P_RTHDR             0x100000 /* receive routing header */
                    127: #define IN6P_RTHDRDSTOPTS      0x200000 /* receive dstoptions before rthdr */
                    128:
                    129: #define IN6P_HIGHPORT          0x1000000 /* user wants "high" port binding */
                    130: #define IN6P_LOWPORT           0x2000000 /* user wants "low" port binding */
                    131: #define IN6P_ANONPORT          0x4000000 /* port chosen for user */
                    132: #define IN6P_FAITH             0x8000000 /* accept FAITH'ed connections */
                    133: #define IN6P_BINDV6ONLY                0x10000000 /* do not grab IPv4 traffic */
                    134:
                    135: #define IN6P_CONTROLOPTS       (IN6P_PKTINFO|IN6P_HOPLIMIT|IN6P_HOPOPTS|\
                    136:                                 IN6P_DSTOPTS|IN6P_RTHDR|IN6P_RTHDRDSTOPTS)
                    137:
1.2       itojun    138:
                    139: #define IN6PLOOKUP_WILDCARD    1
                    140: #define IN6PLOOKUP_SETLOCAL    2
                    141:
                    142: /* compute hash value for foreign and local in6_addr and port */
                    143: #define IN6_HASH(faddr, fport, laddr, lport)                   \
                    144:        (((faddr)->s6_addr32[0] ^ (faddr)->s6_addr32[1] ^       \
                    145:          (faddr)->s6_addr32[2] ^ (faddr)->s6_addr32[3] ^       \
                    146:          (laddr)->s6_addr32[0] ^ (laddr)->s6_addr32[1] ^       \
                    147:          (laddr)->s6_addr32[2] ^ (laddr)->s6_addr32[3])        \
                    148:         + (fport) + (lport))
                    149:
                    150: #define sotoin6pcb(so) ((struct in6pcb *)(so)->so_pcb)
                    151:
                    152: #ifdef _KERNEL
                    153: void   in6_losing __P((struct in6pcb *));
                    154: int    in6_pcballoc __P((struct socket *, struct in6pcb *));
                    155: int    in6_pcbbind __P((struct in6pcb *, struct mbuf *));
                    156: int    in6_pcbconnect __P((struct in6pcb *, struct mbuf *));
                    157: void   in6_pcbdetach __P((struct in6pcb *));
                    158: void   in6_pcbdisconnect __P((struct in6pcb *));
                    159: struct in6pcb *
                    160:        in6_pcblookup __P((struct in6pcb *,
                    161:                           struct in6_addr *, u_int, struct in6_addr *,
                    162:                           u_int, int));
                    163: int    in6_pcbnotify __P((struct in6pcb *, struct sockaddr *,
                    164:                           u_int, struct in6_addr *, u_int, int,
                    165:                           void (*)(struct in6pcb *, int)));
1.6       itojun    166: int    in6_pcbsetport __P((struct in6_addr *, struct in6pcb *));
1.2       itojun    167: void   in6_rtchange __P((struct in6pcb *, int));
                    168: void   in6_setpeeraddr __P((struct in6pcb *, struct mbuf *));
                    169: void   in6_setsockaddr __P((struct in6pcb *, struct mbuf *));
                    170: struct         in6_addr *in6_selectsrc __P((struct sockaddr_in6 *,
1.6       itojun    171:                                     struct ip6_pktopts *,
                    172:                                     struct ip6_moptions *,
                    173:                                     struct route_in6 *,
                    174:                                     struct in6_addr *, int *));
                    175: int    in6_selecthlim __P((struct in6pcb *, struct ifnet *));
1.2       itojun    176:
                    177: #ifndef TCP6
                    178: extern struct rtentry *
                    179:        in6_pcbrtentry __P((struct in6pcb *));
                    180: extern struct in6pcb *in6_pcblookup_connect __P((struct in6pcb *,
1.4       itojun    181:        struct in6_addr *, u_int, struct in6_addr *, u_int, int));
1.2       itojun    182: extern struct in6pcb *in6_pcblookup_bind __P((struct in6pcb *,
1.4       itojun    183:        struct in6_addr *, u_int, int));
1.2       itojun    184: #endif
                    185: #endif /* _KERNEL */
                    186:
                    187: #endif /* !_NETINET6_IN6_PCB_H_ */

CVSweb <webmaster@jp.NetBSD.org>