Home | History | Annotate | Line # | Download | only in netinet6
in6_pcb.h revision 1.37.4.1
      1  1.37.4.1     rmind /*	$NetBSD: in6_pcb.h,v 1.37.4.1 2013/07/17 03:16:31 rmind Exp $	*/
      2      1.15    itojun /*	$KAME: in6_pcb.h,v 1.45 2001/02/09 05:59:46 itojun Exp $	*/
      3       1.3   thorpej 
      4       1.2    itojun /*
      5       1.2    itojun  * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project.
      6       1.2    itojun  * All rights reserved.
      7      1.11    itojun  *
      8       1.2    itojun  * Redistribution and use in source and binary forms, with or without
      9       1.2    itojun  * modification, are permitted provided that the following conditions
     10       1.2    itojun  * are met:
     11       1.2    itojun  * 1. Redistributions of source code must retain the above copyright
     12       1.2    itojun  *    notice, this list of conditions and the following disclaimer.
     13       1.2    itojun  * 2. Redistributions in binary form must reproduce the above copyright
     14       1.2    itojun  *    notice, this list of conditions and the following disclaimer in the
     15       1.2    itojun  *    documentation and/or other materials provided with the distribution.
     16       1.2    itojun  * 3. Neither the name of the project nor the names of its contributors
     17       1.2    itojun  *    may be used to endorse or promote products derived from this software
     18       1.2    itojun  *    without specific prior written permission.
     19      1.11    itojun  *
     20       1.2    itojun  * THIS SOFTWARE IS PROVIDED BY THE PROJECT AND CONTRIBUTORS ``AS IS'' AND
     21       1.2    itojun  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
     22       1.2    itojun  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
     23       1.2    itojun  * ARE DISCLAIMED.  IN NO EVENT SHALL THE PROJECT OR CONTRIBUTORS BE LIABLE
     24       1.2    itojun  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
     25       1.2    itojun  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
     26       1.2    itojun  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
     27       1.2    itojun  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
     28       1.2    itojun  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
     29       1.2    itojun  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
     30       1.2    itojun  * SUCH DAMAGE.
     31       1.2    itojun  */
     32       1.2    itojun 
     33       1.2    itojun /*
     34       1.2    itojun  * Copyright (c) 1982, 1986, 1990, 1993
     35       1.2    itojun  *	The Regents of the University of California.  All rights reserved.
     36       1.2    itojun  *
     37       1.2    itojun  * Redistribution and use in source and binary forms, with or without
     38       1.2    itojun  * modification, are permitted provided that the following conditions
     39       1.2    itojun  * are met:
     40       1.2    itojun  * 1. Redistributions of source code must retain the above copyright
     41       1.2    itojun  *    notice, this list of conditions and the following disclaimer.
     42       1.2    itojun  * 2. Redistributions in binary form must reproduce the above copyright
     43       1.2    itojun  *    notice, this list of conditions and the following disclaimer in the
     44       1.2    itojun  *    documentation and/or other materials provided with the distribution.
     45      1.22       agc  * 3. Neither the name of the University nor the names of its contributors
     46       1.2    itojun  *    may be used to endorse or promote products derived from this software
     47       1.2    itojun  *    without specific prior written permission.
     48       1.2    itojun  *
     49       1.2    itojun  * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
     50       1.2    itojun  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
     51       1.2    itojun  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
     52       1.2    itojun  * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
     53       1.2    itojun  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
     54       1.2    itojun  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
     55       1.2    itojun  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
     56       1.2    itojun  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
     57       1.2    itojun  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
     58       1.2    itojun  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
     59       1.2    itojun  * SUCH DAMAGE.
     60       1.2    itojun  *
     61       1.2    itojun  *	@(#)in_pcb.h	8.1 (Berkeley) 6/10/93
     62       1.2    itojun  */
     63       1.2    itojun 
     64       1.2    itojun #ifndef _NETINET6_IN6_PCB_H_
     65       1.2    itojun #define _NETINET6_IN6_PCB_H_
     66       1.2    itojun 
     67       1.2    itojun #include <sys/queue.h>
     68  1.37.4.1     rmind #include <netinet/in_pcb.h>
     69       1.2    itojun 
     70       1.2    itojun /*
     71       1.2    itojun  * Common structure pcb for internet protocol implementation.
     72       1.2    itojun  * Here are stored pointers to local and foreign host table
     73       1.2    itojun  * entries, local and foreign socket numbers, and pointers
     74       1.2    itojun  * up (to a socket structure) and down (to a protocol-specific)
     75       1.2    itojun  * control block.
     76       1.2    itojun  */
     77  1.37.4.1     rmind struct inpcb_hdr;
     78       1.2    itojun struct icmp6_filter;
     79       1.2    itojun 
     80       1.2    itojun struct	in6pcb {
     81      1.24    itojun 	struct inpcb_hdr in6p_head;
     82      1.36  christos #define in6p_hash	 in6p_head.inph_hash
     83      1.36  christos #define in6p_queue	 in6p_head.inph_queue
     84      1.36  christos #define in6p_af		 in6p_head.inph_af
     85      1.36  christos #define in6p_ppcb	 in6p_head.inph_ppcb
     86      1.36  christos #define in6p_state	 in6p_head.inph_state
     87      1.37  christos #define in6p_portalgo	 in6p_head.inph_portalgo
     88      1.36  christos #define in6p_socket	 in6p_head.inph_socket
     89      1.36  christos #define in6p_table	 in6p_head.inph_table
     90      1.36  christos #define in6p_sp		 in6p_head.inph_sp
     91      1.32    dyoung 	struct	route in6p_route;	/* placeholder for routing entry */
     92      1.10    itojun 	u_int16_t in6p_fport;		/* foreign port */
     93      1.10    itojun 	u_int16_t in6p_lport;		/* local port */
     94       1.5    itojun 	u_int32_t in6p_flowinfo;	/* priority and flowlabel */
     95       1.2    itojun 	int	in6p_flags;		/* generic IP6/datagram flags */
     96       1.2    itojun 	int	in6p_hops;		/* default hop limit */
     97       1.2    itojun 	struct	ip6_hdr in6p_ip6;	/* header prototype */
     98       1.2    itojun 	struct	mbuf *in6p_options;   /* IP6 options */
     99       1.2    itojun 	struct	ip6_pktopts *in6p_outputopts; /* IP6 options for outgoing packets */
    100       1.2    itojun 	struct	ip6_moptions *in6p_moptions; /* IP6 multicast options */
    101       1.2    itojun 	struct icmp6_filter *in6p_icmp6filt;
    102       1.2    itojun 	int	in6p_cksum;		/* IPV6_CHECKSUM setsockopt */
    103      1.36  christos 	bool    in6p_bindportonsend;
    104       1.2    itojun };
    105       1.2    itojun 
    106      1.23    itojun #define in6p_faddr	in6p_ip6.ip6_dst
    107      1.23    itojun #define in6p_laddr	in6p_ip6.ip6_src
    108       1.2    itojun 
    109      1.24    itojun /* states in inp_state: */
    110      1.24    itojun #define	IN6P_ATTACHED		INP_ATTACHED
    111      1.24    itojun #define	IN6P_BOUND		INP_BOUND
    112      1.24    itojun #define	IN6P_CONNECTED		INP_CONNECTED
    113      1.24    itojun 
    114       1.7    itojun /*
    115       1.7    itojun  * Flags in in6p_flags
    116       1.7    itojun  * We define KAME's original flags in higher 16 bits as much as possible
    117       1.7    itojun  * for compatibility with *bsd*s.
    118       1.7    itojun  */
    119       1.7    itojun #define IN6P_RECVOPTS		0x001000 /* receive incoming IP6 options */
    120       1.7    itojun #define IN6P_RECVRETOPTS	0x002000 /* receive IP6 options for reply */
    121       1.7    itojun #define IN6P_RECVDSTADDR	0x004000 /* receive IP6 dst address */
    122      1.18    itojun #define IN6P_IPV6_V6ONLY	0x008000 /* restrict AF_INET6 socket for v6 */
    123       1.7    itojun #define IN6P_PKTINFO		0x010000 /* receive IP6 dst and I/F */
    124       1.7    itojun #define IN6P_HOPLIMIT		0x020000 /* receive hoplimit */
    125       1.7    itojun #define IN6P_HOPOPTS		0x040000 /* receive hop-by-hop options */
    126       1.7    itojun #define IN6P_DSTOPTS		0x080000 /* receive dst options after rthdr */
    127       1.7    itojun #define IN6P_RTHDR		0x100000 /* receive routing header */
    128       1.7    itojun #define IN6P_RTHDRDSTOPTS	0x200000 /* receive dstoptions before rthdr */
    129      1.29    rpaulo #define IN6P_TCLASS		0x400000 /* traffic class */
    130       1.7    itojun 
    131       1.7    itojun #define IN6P_HIGHPORT		0x1000000 /* user wants "high" port binding */
    132       1.7    itojun #define IN6P_LOWPORT		0x2000000 /* user wants "low" port binding */
    133       1.7    itojun #define IN6P_ANONPORT		0x4000000 /* port chosen for user */
    134       1.7    itojun #define IN6P_FAITH		0x8000000 /* accept FAITH'ed connections */
    135      1.29    rpaulo 
    136      1.29    rpaulo #define IN6P_RFC2292		0x40000000 /* RFC2292 */
    137      1.29    rpaulo #define IN6P_MTU		0x80000000 /* use minimum MTU */
    138       1.7    itojun 
    139       1.7    itojun #define IN6P_CONTROLOPTS	(IN6P_PKTINFO|IN6P_HOPLIMIT|IN6P_HOPOPTS|\
    140      1.25    itojun 				 IN6P_DSTOPTS|IN6P_RTHDR|IN6P_RTHDRDSTOPTS|\
    141      1.29    rpaulo 				 IN6P_TCLASS|IN6P_RFC2292|\
    142      1.29    rpaulo 				 IN6P_MTU)
    143       1.7    itojun 
    144      1.35    dyoung #ifdef _KERNEL
    145       1.2    itojun /* compute hash value for foreign and local in6_addr and port */
    146       1.2    itojun #define IN6_HASH(faddr, fport, laddr, lport) 			\
    147       1.2    itojun 	(((faddr)->s6_addr32[0] ^ (faddr)->s6_addr32[1] ^	\
    148       1.2    itojun 	  (faddr)->s6_addr32[2] ^ (faddr)->s6_addr32[3] ^	\
    149       1.2    itojun 	  (laddr)->s6_addr32[0] ^ (laddr)->s6_addr32[1] ^	\
    150       1.2    itojun 	  (laddr)->s6_addr32[2] ^ (laddr)->s6_addr32[3])	\
    151       1.2    itojun 	 + (fport) + (lport))
    152       1.2    itojun 
    153       1.2    itojun #define sotoin6pcb(so)	((struct in6pcb *)(so)->so_pcb)
    154       1.2    itojun 
    155  1.37.4.1     rmind inpcbtable_t *in6_pcbinit(size_t, size_t, int);
    156      1.28    rpaulo void	in6_losing(struct in6pcb *);
    157      1.28    rpaulo int	in6_pcballoc(struct socket *, void *);
    158      1.30        ad int	in6_pcbbind(void *, struct mbuf *, struct lwp *);
    159      1.30        ad int	in6_pcbconnect(void *, struct mbuf *, struct lwp *);
    160      1.28    rpaulo void	in6_pcbdetach(struct in6pcb *);
    161      1.28    rpaulo void	in6_pcbdisconnect(struct in6pcb *);
    162      1.28    rpaulo struct	in6pcb *in6_pcblookup_port(struct inpcbtable *, struct in6_addr *,
    163      1.35    dyoung 				   u_int, int, struct vestigial_inpcb *);
    164      1.31    dyoung int	in6_pcbnotify(struct inpcbtable *, const struct sockaddr *,
    165      1.26  christos 	u_int, const struct sockaddr *, u_int, int, void *,
    166      1.28    rpaulo 	void (*)(struct in6pcb *, int));
    167      1.28    rpaulo void	in6_pcbpurgeif0(struct inpcbtable *, struct ifnet *);
    168      1.28    rpaulo void	in6_pcbpurgeif(struct inpcbtable *, struct ifnet *);
    169      1.28    rpaulo void	in6_pcbstate(struct in6pcb *, int);
    170      1.28    rpaulo void	in6_rtchange(struct in6pcb *, int);
    171      1.28    rpaulo void	in6_setpeeraddr(struct in6pcb *, struct mbuf *);
    172      1.28    rpaulo void	in6_setsockaddr(struct in6pcb *, struct mbuf *);
    173      1.12    itojun 
    174      1.12    itojun /* in in6_src.c */
    175      1.28    rpaulo int	in6_selecthlim(struct in6pcb *, struct ifnet *);
    176      1.34      elad int	in6_pcbsetport(struct sockaddr_in6 *, struct in6pcb *, struct lwp *);
    177       1.2    itojun 
    178       1.2    itojun extern struct rtentry *
    179      1.28    rpaulo 	in6_pcbrtentry(struct in6pcb *);
    180      1.28    rpaulo extern struct in6pcb *in6_pcblookup_connect(struct inpcbtable *,
    181      1.35    dyoung 					    const struct in6_addr *, u_int, const struct in6_addr *, u_int, int,
    182      1.35    dyoung 					    struct vestigial_inpcb *);
    183      1.28    rpaulo extern struct in6pcb *in6_pcblookup_bind(struct inpcbtable *,
    184      1.31    dyoung 	const struct in6_addr *, u_int, int);
    185       1.2    itojun #endif /* _KERNEL */
    186       1.2    itojun 
    187       1.2    itojun #endif /* !_NETINET6_IN6_PCB_H_ */
    188