1 #ifndef __LINUX_ATALK_H__
2 #define __LINUX_ATALK_H__
5 * AppleTalk networking structures
7 * The following are directly referenced from the University Of Michigan
8 * netatalk for compatibility reasons.
10 #define ATPORT_FIRST 1
11 #define ATPORT_RESERVED 128
12 #define ATPORT_LAST 254 /* 254 is only legal on localtalk */
13 #define ATADDR_ANYNET (__u16)0
14 #define ATADDR_ANYNODE (__u8)0
15 #define ATADDR_ANYPORT (__u8)0
16 #define ATADDR_BCAST (__u8)255
18 #define DDP_MAXHOPS 15 /* 4 bits of hop counter */
20 #define SIOCATALKDIFADDR (SIOCPROTOPRIVATE + 0)
28 sa_family_t sat_family
;
30 struct atalk_addr sat_addr
;
34 struct atalk_netrange
{
45 struct net_device
*dev
;
46 struct atalk_addr target
;
47 struct atalk_addr gateway
;
49 struct atalk_route
*next
;
53 * struct atalk_iface - AppleTalk Interface
54 * @dev - Network device associated with this interface
55 * @address - Our address
56 * @status - What are we doing?
57 * @nets - Associated direct netrange
58 * @next - next element in the list of interfaces
61 struct net_device
*dev
;
62 struct atalk_addr address
;
64 #define ATIF_PROBE 1 /* Probing for an address */
65 #define ATIF_PROBE_FAIL 2 /* Probe collided */
66 struct atalk_netrange nets
;
67 struct atalk_iface
*next
;
71 /* struct sock has to be the first member of atalk_sock */
75 unsigned char dest_node
;
76 unsigned char src_node
;
77 unsigned char dest_port
;
78 unsigned char src_port
;
81 static inline struct atalk_sock
*at_sk(struct sock
*sk
)
83 return (struct atalk_sock
*)sk
;
86 #include <asm/byteorder.h>
89 #ifdef __LITTLE_ENDIAN_BITFIELD
105 /* And netatalk apps expect to stick the type in themselves */
108 static __inline__
struct ddpehdr
*ddp_hdr(struct sk_buff
*skb
)
110 return (struct ddpehdr
*)skb
->h
.raw
;
114 * Don't drop the struct into the struct above. You'll get some
118 #ifdef __LITTLE_ENDIAN_BITFIELD
129 /* Short form header */
131 #ifdef __LITTLE_ENDIAN_BITFIELD
140 /* And netatalk apps expect to stick the type in themselves */
143 /* AppleTalk AARP headers */
146 #define AARP_HW_TYPE_ETHERNET 1
147 #define AARP_HW_TYPE_TOKENRING 2
151 #define AARP_PA_ALEN 4
153 #define AARP_REQUEST 1
156 __u8 hw_src
[ETH_ALEN
] __attribute__ ((packed
));
157 __u8 pa_src_zero
__attribute__ ((packed
));
158 __be16 pa_src_net
__attribute__ ((packed
));
159 __u8 pa_src_node
__attribute__ ((packed
));
160 __u8 hw_dst
[ETH_ALEN
] __attribute__ ((packed
));
161 __u8 pa_dst_zero
__attribute__ ((packed
));
162 __be16 pa_dst_net
__attribute__ ((packed
));
163 __u8 pa_dst_node
__attribute__ ((packed
));
166 static __inline__
struct elapaarp
*aarp_hdr(struct sk_buff
*skb
)
168 return (struct elapaarp
*)skb
->h
.raw
;
171 /* Not specified - how long till we drop a resolved entry */
172 #define AARP_EXPIRY_TIME (5 * 60 * HZ)
173 /* Size of hash table */
174 #define AARP_HASH_SIZE 16
175 /* Fast retransmission timer when resolving */
176 #define AARP_TICK_TIME (HZ / 5)
177 /* Send 10 requests then give up (2 seconds) */
178 #define AARP_RETRANSMIT_LIMIT 10
180 * Some value bigger than total retransmit time + a bit for last reply to
181 * appear and to stop continual requests
183 #define AARP_RESOLVE_TIME (10 * HZ)
185 extern struct datalink_proto
*ddp_dl
, *aarp_dl
;
186 extern void aarp_proto_init(void);
188 /* Inter module exports */
190 /* Give a device find its atif control structure */
191 static inline struct atalk_iface
*atalk_find_dev(struct net_device
*dev
)
193 return dev
->atalk_ptr
;
196 extern struct atalk_addr
*atalk_find_dev_addr(struct net_device
*dev
);
197 extern struct net_device
*atrtr_get_dev(struct atalk_addr
*sa
);
198 extern int aarp_send_ddp(struct net_device
*dev
,
200 struct atalk_addr
*sa
, void *hwaddr
);
201 extern void aarp_device_down(struct net_device
*dev
);
202 extern void aarp_probe_network(struct atalk_iface
*atif
);
203 extern int aarp_proxy_probe_network(struct atalk_iface
*atif
,
204 struct atalk_addr
*sa
);
205 extern void aarp_proxy_remove(struct net_device
*dev
,
206 struct atalk_addr
*sa
);
208 extern void aarp_cleanup_module(void);
210 extern struct hlist_head atalk_sockets
;
211 extern rwlock_t atalk_sockets_lock
;
213 extern struct atalk_route
*atalk_routes
;
214 extern rwlock_t atalk_routes_lock
;
216 extern struct atalk_iface
*atalk_interfaces
;
217 extern rwlock_t atalk_interfaces_lock
;
219 extern struct atalk_route atrtr_default
;
221 extern struct file_operations atalk_seq_arp_fops
;
223 extern int sysctl_aarp_expiry_time
;
224 extern int sysctl_aarp_tick_time
;
225 extern int sysctl_aarp_retransmit_limit
;
226 extern int sysctl_aarp_resolve_time
;
229 extern void atalk_register_sysctl(void);
230 extern void atalk_unregister_sysctl(void);
232 #define atalk_register_sysctl() do { } while(0)
233 #define atalk_unregister_sysctl() do { } while(0)
236 #ifdef CONFIG_PROC_FS
237 extern int atalk_proc_init(void);
238 extern void atalk_proc_exit(void);
240 #define atalk_proc_init() ({ 0; })
241 #define atalk_proc_exit() do { } while(0)
242 #endif /* CONFIG_PROC_FS */
244 #endif /* __KERNEL__ */
245 #endif /* __LINUX_ATALK_H__ */