xref: /freebsd-src/sys/netinet6/in6_pcb.h (revision 52ef944b0f6f1df8eebe1cb877c6aadb1c247da0)
1caf43b02SWarner Losh /*-
251369649SPedro F. Giffuni  * SPDX-License-Identifier: BSD-3-Clause
351369649SPedro F. Giffuni  *
482cd038dSYoshinobu Inoue  * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project.
582cd038dSYoshinobu Inoue  * All rights reserved.
682cd038dSYoshinobu Inoue  *
782cd038dSYoshinobu Inoue  * Redistribution and use in source and binary forms, with or without
882cd038dSYoshinobu Inoue  * modification, are permitted provided that the following conditions
982cd038dSYoshinobu Inoue  * are met:
1082cd038dSYoshinobu Inoue  * 1. Redistributions of source code must retain the above copyright
1182cd038dSYoshinobu Inoue  *    notice, this list of conditions and the following disclaimer.
1282cd038dSYoshinobu Inoue  * 2. Redistributions in binary form must reproduce the above copyright
1382cd038dSYoshinobu Inoue  *    notice, this list of conditions and the following disclaimer in the
1482cd038dSYoshinobu Inoue  *    documentation and/or other materials provided with the distribution.
1582cd038dSYoshinobu Inoue  * 3. Neither the name of the project nor the names of its contributors
1682cd038dSYoshinobu Inoue  *    may be used to endorse or promote products derived from this software
1782cd038dSYoshinobu Inoue  *    without specific prior written permission.
1882cd038dSYoshinobu Inoue  *
1982cd038dSYoshinobu Inoue  * THIS SOFTWARE IS PROVIDED BY THE PROJECT AND CONTRIBUTORS ``AS IS'' AND
2082cd038dSYoshinobu Inoue  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
2182cd038dSYoshinobu Inoue  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
2282cd038dSYoshinobu Inoue  * ARE DISCLAIMED.  IN NO EVENT SHALL THE PROJECT OR CONTRIBUTORS BE LIABLE
2382cd038dSYoshinobu Inoue  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
2482cd038dSYoshinobu Inoue  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
2582cd038dSYoshinobu Inoue  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
2682cd038dSYoshinobu Inoue  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
2782cd038dSYoshinobu Inoue  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
2882cd038dSYoshinobu Inoue  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
2982cd038dSYoshinobu Inoue  * SUCH DAMAGE.
3082cd038dSYoshinobu Inoue  *
31b48287a3SDavid E. O'Brien  *	$KAME: in6_pcb.h,v 1.13 2001/02/06 09:16:53 itojun Exp $
3282cd038dSYoshinobu Inoue  */
3382cd038dSYoshinobu Inoue 
34caf43b02SWarner Losh /*-
3582cd038dSYoshinobu Inoue  * Copyright (c) 1982, 1986, 1990, 1993
3682cd038dSYoshinobu Inoue  *	The Regents of the University of California.  All rights reserved.
3782cd038dSYoshinobu Inoue  *
3882cd038dSYoshinobu Inoue  * Redistribution and use in source and binary forms, with or without
3982cd038dSYoshinobu Inoue  * modification, are permitted provided that the following conditions
4082cd038dSYoshinobu Inoue  * are met:
4182cd038dSYoshinobu Inoue  * 1. Redistributions of source code must retain the above copyright
4282cd038dSYoshinobu Inoue  *    notice, this list of conditions and the following disclaimer.
4382cd038dSYoshinobu Inoue  * 2. Redistributions in binary form must reproduce the above copyright
4482cd038dSYoshinobu Inoue  *    notice, this list of conditions and the following disclaimer in the
4582cd038dSYoshinobu Inoue  *    documentation and/or other materials provided with the distribution.
46fbbd9655SWarner Losh  * 3. Neither the name of the University nor the names of its contributors
4782cd038dSYoshinobu Inoue  *    may be used to endorse or promote products derived from this software
4882cd038dSYoshinobu Inoue  *    without specific prior written permission.
4982cd038dSYoshinobu Inoue  *
5082cd038dSYoshinobu Inoue  * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
5182cd038dSYoshinobu Inoue  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
5282cd038dSYoshinobu Inoue  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
5382cd038dSYoshinobu Inoue  * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
5482cd038dSYoshinobu Inoue  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
5582cd038dSYoshinobu Inoue  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
5682cd038dSYoshinobu Inoue  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
5782cd038dSYoshinobu Inoue  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
5882cd038dSYoshinobu Inoue  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
5982cd038dSYoshinobu Inoue  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
6082cd038dSYoshinobu Inoue  * SUCH DAMAGE.
6182cd038dSYoshinobu Inoue  */
6282cd038dSYoshinobu Inoue 
6382cd038dSYoshinobu Inoue #ifndef _NETINET6_IN6_PCB_H_
6482cd038dSYoshinobu Inoue #define	_NETINET6_IN6_PCB_H_
6582cd038dSYoshinobu Inoue 
66664a31e4SPeter Wemm #ifdef _KERNEL
6782cd038dSYoshinobu Inoue #define	satosin6(sa)	((struct sockaddr_in6 *)(sa))
6882cd038dSYoshinobu Inoue #define	sin6tosa(sin6)	((struct sockaddr *)(sin6))
6982cd038dSYoshinobu Inoue #define	ifatoia6(ifa)	((struct in6_ifaddr *)(ifa))
7082cd038dSYoshinobu Inoue 
716f56329aSXin LI void	in6_pcbpurgeif0(struct inpcbinfo *, struct ifnet *);
726f56329aSXin LI void	in6_losing(struct inpcb *);
7396871af0SGleb Smirnoff int	in6_pcbbind(struct inpcb *, struct sockaddr_in6 *, struct ucred *);
74a9d22cceSGleb Smirnoff int	in6_pcbconnect(struct inpcb *, struct sockaddr_in6 *, struct ucred *,
75a9d22cceSGleb Smirnoff 	    bool);
766f56329aSXin LI void	in6_pcbdisconnect(struct inpcb *);
77*52ef944bSMark Johnston struct inpcb *in6_pcblookup_local(struct inpcbinfo *, const struct in6_addr *,
78*52ef944bSMark Johnston 	    u_short, int, struct ucred *);
79*52ef944bSMark Johnston struct inpcb *in6_pcblookup_hash_locked(struct inpcbinfo *pcbinfo,
807b92493aSMark Johnston 	    const struct in6_addr *faddr, u_int fport_arg,
817b92493aSMark Johnston 	    const struct in6_addr *laddr, u_int lport_arg,
827b92493aSMark Johnston 	    int lookupflags, uint8_t);
83*52ef944bSMark Johnston struct inpcb *in6_pcblookup(struct inpcbinfo *, const struct in6_addr *, u_int,
84*52ef944bSMark Johnston 	    const struct in6_addr *, u_int, int, struct ifnet *);
85*52ef944bSMark Johnston struct inpcb *in6_pcblookup_mbuf(struct inpcbinfo *, const struct in6_addr *,
86*52ef944bSMark Johnston 	    u_int, const struct in6_addr *, u_int, int, struct ifnet *ifp,
87*52ef944bSMark Johnston 	    struct mbuf *);
8843d39ca7SGleb Smirnoff void	in6_pcbnotify(struct inpcbinfo *, struct sockaddr_in6 *, u_int,
8943d39ca7SGleb Smirnoff 			   const struct sockaddr_in6 *, u_int, int, void *,
906f56329aSXin LI 			   struct inpcb *(*)(struct inpcb *, int));
913ce144eaSJeffrey Hsu struct inpcb *
926f56329aSXin LI 	in6_rtchange(struct inpcb *, int);
930fac350cSGleb Smirnoff int	in6_getpeeraddr(struct socket *, struct sockaddr *);
940fac350cSGleb Smirnoff int	in6_getsockaddr(struct socket *, struct sockaddr *);
950fac350cSGleb Smirnoff int	in6_mapped_sockaddr(struct socket *, struct sockaddr *);
960fac350cSGleb Smirnoff int	in6_mapped_peeraddr(struct socket *, struct sockaddr *);
970ecd976eSBjoern A. Zeeb int	in6_selecthlim(struct inpcb *, struct ifnet *);
984616026fSErmal Luçi int	in6_pcbsetport(struct in6_addr *, struct inpcb *, struct ucred *);
99dce33a45SErmal Luçi void	init_sin6(struct sockaddr_in6 *sin6, struct mbuf *m, int);
100664a31e4SPeter Wemm #endif /* _KERNEL */
10182cd038dSYoshinobu Inoue 
10282cd038dSYoshinobu Inoue #endif /* !_NETINET6_IN6_PCB_H_ */
103