ipx_pcb.h revision 139823
1/*-
2 * Copyright (c) 2004, Robert N. M. Watson
3 * Copyright (c) 1995, Mike Mitchell
4 * Copyright (c) 1984, 1985, 1986, 1987, 1993
5 *	The Regents of the University of California.  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. All advertising materials mentioning features or use of this software
16 *    must display the following acknowledgement:
17 *	This product includes software developed by the University of
18 *	California, Berkeley and its contributors.
19 * 4. Neither the name of the University nor the names of its contributors
20 *    may be used to endorse or promote products derived from this software
21 *    without specific prior written permission.
22 *
23 * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
24 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
25 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
26 * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
27 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
28 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
29 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
30 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
31 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
32 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
33 * SUCH DAMAGE.
34 *
35 *	@(#)ipx_pcb.h
36 *
37 * $FreeBSD: head/sys/netipx/ipx_pcb.h 139823 2005-01-07 01:45:51Z imp $
38 */
39
40#ifndef _NETIPX_IPX_PCB_H_
41#define	_NETIPX_IPX_PCB_H_
42
43/*
44 * IPX protocol interface control block.
45 */
46struct ipxpcb {
47	LIST_ENTRY(ipxpcb) ipxp_list;
48	struct	socket *ipxp_socket;	/* back pointer to socket */
49	struct	ipx_addr ipxp_faddr;	/* destination address */
50	struct	ipx_addr ipxp_laddr;	/* socket's address */
51	caddr_t	ipxp_pcb;		/* protocol specific stuff */
52	struct	route ipxp_route;	/* routing information */
53	struct	ipx_addr ipxp_lastdst;	/* validate cached route for dg socks*/
54	short	ipxp_flags;
55	u_char	ipxp_dpt;		/* default packet type for ipx_output */
56	u_char	ipxp_rpt;		/* last received packet type by ipx_input() */
57};
58
59/*
60 * Additional IPX pcb-related types and variables.
61 */
62LIST_HEAD(ipxpcbhead, ipxpcb);
63extern struct ipxpcbhead ipxpcb_list;
64extern struct ipxpcbhead ipxrawpcb_list;
65
66/* possible flags */
67
68#define IPXP_IN_ABORT		0x1	/* calling abort through socket */
69#define IPXP_RAWIN		0x2	/* show headers on input */
70#define IPXP_RAWOUT		0x4	/* show header on output */
71#define IPXP_ALL_PACKETS	0x8	/* Turn off higher proto processing */
72#define	IPXP_CHECKSUM		0x10	/* use checksum on this socket */
73
74#define	IPX_WILDCARD		1
75
76#define ipxp_lport ipxp_laddr.x_port
77#define ipxp_fport ipxp_faddr.x_port
78
79#define	sotoipxpcb(so)		((struct ipxpcb *)((so)->so_pcb))
80
81/*
82 * Nominal space allocated to an IPX socket.
83 */
84#define	IPXSNDQ		16384
85#define	IPXRCVQ		40960
86
87#ifdef _KERNEL
88int	ipx_pcballoc(struct socket *so, struct ipxpcbhead *head,
89			  struct thread *p);
90int	ipx_pcbbind(struct ipxpcb *ipxp, struct sockaddr *nam,
91			 struct thread *p);
92int	ipx_pcbconnect(struct ipxpcb *ipxp, struct sockaddr *nam,
93			    struct thread *p);
94void	ipx_pcbdetach(struct ipxpcb *ipxp);
95void	ipx_pcbdisconnect(struct ipxpcb *ipxp);
96struct ipxpcb *
97	ipx_pcblookup(struct ipx_addr *faddr, int lport, int wildp);
98void	ipx_setpeeraddr(struct ipxpcb *ipxp, struct sockaddr **nam);
99void	ipx_setsockaddr(struct ipxpcb *ipxp, struct sockaddr **nam);
100#endif /* _KERNEL */
101
102#endif /* !_NETIPX_IPX_PCB_H_ */
103