1 #ifndef _NET_INET_IPX_H_
2 #define _NET_INET_IPX_H_
4 * The following information is in its entirety obtained from:
6 * Novell 'IPX Router Specification' Version 1.10
7 * Part No. 107-000029-001
9 * Which is available from ftp.novell.com
12 #include <linux/netdevice.h>
13 #include <net/datalink.h>
14 #include <linux/ipx.h>
15 #include <linux/list.h>
16 #include <linux/slab.h>
20 __u8 node[IPX_NODE_LEN];
24 #define ipx_broadcast_node "\377\377\377\377\377\377"
25 #define ipx_this_node "\0\0\0\0\0\0"
27 #define IPX_MAX_PPROP_HOPS 8
30 __be16 ipx_checksum __packed;
31 #define IPX_NO_CHECKSUM cpu_to_be16(0xFFFF)
32 __be16 ipx_pktsize __packed;
35 #define IPX_TYPE_UNKNOWN 0x00
36 #define IPX_TYPE_RIP 0x01 /* may also be 0 */
37 #define IPX_TYPE_SAP 0x04 /* may also be 0 */
38 #define IPX_TYPE_SPX 0x05 /* SPX protocol */
39 #define IPX_TYPE_NCP 0x11 /* $lots for docs on this (SPIT) */
40 #define IPX_TYPE_PPROP 0x14 /* complicated flood fill brdcast */
41 struct ipx_address ipx_dest __packed;
42 struct ipx_address ipx_source __packed;
45 static __inline__ struct ipxhdr *ipx_hdr(struct sk_buff *skb)
47 return (struct ipxhdr *)skb_transport_header(skb);
50 struct ipx_interface {
53 unsigned char if_node[IPX_NODE_LEN];
56 /* physical device info */
57 struct net_device *if_dev;
58 struct datalink_proto *if_dlink;
62 unsigned short if_sknum;
63 struct hlist_head if_sklist;
64 spinlock_t if_sklist_lock;
66 /* administrative overhead */
68 unsigned char if_internal;
69 unsigned char if_primary;
71 struct list_head node; /* node in ipx_interfaces list */
76 struct ipx_interface *ir_intrfc;
77 unsigned char ir_routed;
78 unsigned char ir_router_node[IPX_NODE_LEN];
79 struct list_head node; /* node in ipx_routes list */
87 __be32 ipx_source_net;
97 /* struct sock has to be the first member of ipx_sock */
99 struct ipx_address dest_addr;
100 struct ipx_interface *intrfc;
102 #ifdef CONFIG_IPX_INTERN
103 unsigned char node[IPX_NODE_LEN];
107 * To handle special ncp connection-handling sockets for mars_nwe,
108 * the connection number must be stored in the socket.
110 unsigned short ipx_ncp_conn;
113 static inline struct ipx_sock *ipx_sk(struct sock *sk)
115 return (struct ipx_sock *)sk;
118 #define IPX_SKB_CB(__skb) ((struct ipx_cb *)&((__skb)->cb[0]))
121 #define IPX_MIN_EPHEMERAL_SOCKET 0x4000
122 #define IPX_MAX_EPHEMERAL_SOCKET 0x7fff
124 extern struct list_head ipx_routes;
125 extern rwlock_t ipx_routes_lock;
127 extern struct list_head ipx_interfaces;
128 extern struct ipx_interface *ipx_interfaces_head(void);
129 extern spinlock_t ipx_interfaces_lock;
131 extern struct ipx_interface *ipx_primary_net;
133 extern int ipx_proc_init(void);
134 extern void ipx_proc_exit(void);
136 extern const char *ipx_frame_name(__be16);
137 extern const char *ipx_device_name(struct ipx_interface *intrfc);
139 static __inline__ void ipxitf_hold(struct ipx_interface *intrfc)
141 atomic_inc(&intrfc->refcnt);
144 extern void ipxitf_down(struct ipx_interface *intrfc);
146 static __inline__ void ipxitf_put(struct ipx_interface *intrfc)
148 if (atomic_dec_and_test(&intrfc->refcnt))
152 static __inline__ void ipxrtr_hold(struct ipx_route *rt)
154 atomic_inc(&rt->refcnt);
157 static __inline__ void ipxrtr_put(struct ipx_route *rt)
159 if (atomic_dec_and_test(&rt->refcnt))
162 #endif /* _NET_INET_IPX_H_ */