1 #ifndef __LINUX_ATALK_H__
2 #define __LINUX_ATALK_H__
4 #include <asm/byteorder.h>
7 * AppleTalk networking structures
9 * The following are directly referenced from the University Of Michigan
10 * netatalk for compatibility reasons.
12 #define ATPORT_FIRST 1
13 #define ATPORT_RESERVED 128
14 #define ATPORT_LAST 254 /* 254 is only legal on localtalk */
15 #define ATADDR_ANYNET (__u16)0
16 #define ATADDR_ANYNODE (__u8)0
17 #define ATADDR_ANYPORT (__u8)0
18 #define ATADDR_BCAST (__u8)255
20 #define DDP_MAXHOPS 15 /* 4 bits of hop counter */
22 #define SIOCATALKDIFADDR (SIOCPROTOPRIVATE + 0)
30 sa_family_t sat_family
;
32 struct atalk_addr sat_addr
;
36 struct atalk_netrange
{
47 struct net_device
*dev
;
48 struct atalk_addr target
;
49 struct atalk_addr gateway
;
51 struct atalk_route
*next
;
55 * struct atalk_iface - AppleTalk Interface
56 * @dev - Network device associated with this interface
57 * @address - Our address
58 * @status - What are we doing?
59 * @nets - Associated direct netrange
60 * @next - next element in the list of interfaces
63 struct net_device
*dev
;
64 struct atalk_addr address
;
66 #define ATIF_PROBE 1 /* Probing for an address */
67 #define ATIF_PROBE_FAIL 2 /* Probe collided */
68 struct atalk_netrange nets
;
69 struct atalk_iface
*next
;
73 /* struct sock has to be the first member of atalk_sock */
77 unsigned char dest_node
;
78 unsigned char src_node
;
79 unsigned char dest_port
;
80 unsigned char src_port
;
83 static inline struct atalk_sock
*at_sk(struct sock
*sk
)
85 return (struct atalk_sock
*)sk
;
88 #include <asm/byteorder.h>
91 __be16 deh_len_hops
; /* lower 10 bits are length, next 4 - hops */
99 /* And netatalk apps expect to stick the type in themselves */
102 static __inline__
struct ddpehdr
*ddp_hdr(struct sk_buff
*skb
)
104 return (struct ddpehdr
*)skb
->h
.raw
;
107 /* AppleTalk AARP headers */
110 #define AARP_HW_TYPE_ETHERNET 1
111 #define AARP_HW_TYPE_TOKENRING 2
115 #define AARP_PA_ALEN 4
117 #define AARP_REQUEST 1
120 __u8 hw_src
[ETH_ALEN
];
124 __u8 hw_dst
[ETH_ALEN
];
128 } __attribute__ ((packed
));
130 static __inline__
struct elapaarp
*aarp_hdr(struct sk_buff
*skb
)
132 return (struct elapaarp
*)skb
->h
.raw
;
135 /* Not specified - how long till we drop a resolved entry */
136 #define AARP_EXPIRY_TIME (5 * 60 * HZ)
137 /* Size of hash table */
138 #define AARP_HASH_SIZE 16
139 /* Fast retransmission timer when resolving */
140 #define AARP_TICK_TIME (HZ / 5)
141 /* Send 10 requests then give up (2 seconds) */
142 #define AARP_RETRANSMIT_LIMIT 10
144 * Some value bigger than total retransmit time + a bit for last reply to
145 * appear and to stop continual requests
147 #define AARP_RESOLVE_TIME (10 * HZ)
149 extern struct datalink_proto
*ddp_dl
, *aarp_dl
;
150 extern void aarp_proto_init(void);
152 /* Inter module exports */
154 /* Give a device find its atif control structure */
155 static inline struct atalk_iface
*atalk_find_dev(struct net_device
*dev
)
157 return dev
->atalk_ptr
;
160 extern struct atalk_addr
*atalk_find_dev_addr(struct net_device
*dev
);
161 extern struct net_device
*atrtr_get_dev(struct atalk_addr
*sa
);
162 extern int aarp_send_ddp(struct net_device
*dev
,
164 struct atalk_addr
*sa
, void *hwaddr
);
165 extern void aarp_device_down(struct net_device
*dev
);
166 extern void aarp_probe_network(struct atalk_iface
*atif
);
167 extern int aarp_proxy_probe_network(struct atalk_iface
*atif
,
168 struct atalk_addr
*sa
);
169 extern void aarp_proxy_remove(struct net_device
*dev
,
170 struct atalk_addr
*sa
);
172 extern void aarp_cleanup_module(void);
174 extern struct hlist_head atalk_sockets
;
175 extern rwlock_t atalk_sockets_lock
;
177 extern struct atalk_route
*atalk_routes
;
178 extern rwlock_t atalk_routes_lock
;
180 extern struct atalk_iface
*atalk_interfaces
;
181 extern rwlock_t atalk_interfaces_lock
;
183 extern struct atalk_route atrtr_default
;
185 extern struct file_operations atalk_seq_arp_fops
;
187 extern int sysctl_aarp_expiry_time
;
188 extern int sysctl_aarp_tick_time
;
189 extern int sysctl_aarp_retransmit_limit
;
190 extern int sysctl_aarp_resolve_time
;
193 extern void atalk_register_sysctl(void);
194 extern void atalk_unregister_sysctl(void);
196 #define atalk_register_sysctl() do { } while(0)
197 #define atalk_unregister_sysctl() do { } while(0)
200 #ifdef CONFIG_PROC_FS
201 extern int atalk_proc_init(void);
202 extern void atalk_proc_exit(void);
204 #define atalk_proc_init() ({ 0; })
205 #define atalk_proc_exit() do { } while(0)
206 #endif /* CONFIG_PROC_FS */
208 #endif /* __KERNEL__ */
209 #endif /* __LINUX_ATALK_H__ */