1 /* $OpenBSD: ipx_pcb.h,v 1.6 2003/06/02 23:28:16 millert Exp $ */ 2 3 /*- 4 * 5 * Copyright (c) 1996 Michael Shalayeff 6 * Copyright (c) 1995, Mike Mitchell 7 * Copyright (c) 1984, 1985, 1986, 1987, 1993 8 * The Regents of the University of California. All rights reserved. 9 * 10 * Redistribution and use in source and binary forms, with or without 11 * modification, are permitted provided that the following conditions 12 * are met: 13 * 1. Redistributions of source code must retain the above copyright 14 * notice, this list of conditions and the following disclaimer. 15 * 2. Redistributions in binary form must reproduce the above copyright 16 * notice, this list of conditions and the following disclaimer in the 17 * documentation and/or other materials provided with the distribution. 18 * 3. Neither the name of the University nor the names of its contributors 19 * may be used to endorse or promote products derived from this software 20 * without specific prior written permission. 21 * 22 * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND 23 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 24 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 25 * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE 26 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 27 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 28 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 29 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 30 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 31 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 32 * SUCH DAMAGE. 33 * 34 * @(#)ipx_pcb.h 35 * 36 * from FreeBSD Id: ipx_pcb.h,v 1.5 1995/11/24 12:25:10 bde Exp 37 */ 38 39 #ifndef _NETIPX_IPX_PCB_H_ 40 #define _NETIPX_IPX_PCB_H_ 41 42 /* 43 * IPX protocol interface control block. 44 */ 45 struct ipxpcb { 46 LIST_ENTRY(ipxpcb) ipxp_hash; 47 CIRCLEQ_ENTRY(ipxpcb) ipxp_queue; 48 struct ipxpcbtable *ipxp_table; /* back pointer to the table */ 49 struct socket *ipxp_socket; /* back pointer to socket */ 50 struct ipx_addr ipxp_faddr; /* destination address */ 51 struct ipx_addr ipxp_laddr; /* socket's address */ 52 #define ipxp_lport ipxp_laddr.ipx_port 53 #define ipxp_fport ipxp_faddr.ipx_port 54 caddr_t ipxp_ppcb; /* protocol specific stuff */ 55 struct route ipxp_route; /* routing information */ 56 struct ipx_addr ipxp_lastdst; /* validate cached route for dg socks*/ 57 u_long ipxp_notify_param; /* extra info passed via ipx_pcbnotify*/ 58 u_short ipxp_flags; 59 u_char ipxp_dpt; /* default packet type for ipx_output */ 60 u_char ipxp_rpt; /* last received packet type by ipx_input() */ 61 }; 62 63 struct ipxpcbtable { 64 CIRCLEQ_HEAD(, ipxpcb) ipxpt_queue; 65 LIST_HEAD(ipxppcbhead, ipxpcb) *ipxpt_hashtbl; 66 u_long ipxpt_hash; 67 u_int16_t ipxpt_lport; 68 }; 69 70 /* possible flags */ 71 72 #define IPXP_IN_ABORT 0x1 /* calling abort through socket */ 73 #define IPXP_RAWIN 0x2 /* show headers on input */ 74 #define IPXP_RAWOUT 0x4 /* show header on output */ 75 #define IPXP_ALL_PACKETS 0x8 /* Turn off higher proto processing */ 76 77 #define IPX_WILDCARD 1 78 79 #define sotoipxpcb(so) ((struct ipxpcb *)((so)->so_pcb)) 80 81 /* 82 * Nominal space allocated to a IPX socket. 83 */ 84 #define IPXSNDQ 16384 85 #define IPXRCVQ 40960 86 87 #ifdef _KERNEL 88 extern struct ipxpcbtable ipxcbtable, ipxrawcbtable; /* head of list */ 89 90 void ipx_pcbinit(struct ipxpcbtable *, int); 91 int ipx_pcballoc(struct socket *so, struct ipxpcbtable *head); 92 int ipx_pcbbind(struct ipxpcb *ipxp, struct mbuf *nam); 93 int ipx_pcbconnect(struct ipxpcb *ipxp, struct mbuf *nam); 94 void ipx_pcbdetach(struct ipxpcb *ipxp); 95 void ipx_pcbdisconnect(struct ipxpcb *ipxp); 96 struct ipxpcb *ipx_pcblookup(struct ipx_addr *faddr, int lport, int wildp); 97 void ipx_pcbnotify(struct ipx_addr *dst, int errno, 98 void (*notify)(struct ipxpcb *), long param); 99 void ipx_setpeeraddr(struct ipxpcb *ipxp, struct mbuf *nam); 100 void ipx_setsockaddr(struct ipxpcb *ipxp, struct mbuf *nam); 101 #endif 102 103 #endif /* !_NETIPX_IPX_PCB_H_ */ 104