]> git.proxmox.com Git - mirror_ubuntu-artful-kernel.git/blame - include/linux/atalk.h
[PATCH] parport: bring back an unused phase for ppdev ioctl
[mirror_ubuntu-artful-kernel.git] / include / linux / atalk.h
CommitLineData
1da177e4
LT
1#ifndef __LINUX_ATALK_H__
2#define __LINUX_ATALK_H__
3
32e9e25e
DM
4#include <asm/byteorder.h>
5
1da177e4
LT
6/*
7 * AppleTalk networking structures
8 *
9 * The following are directly referenced from the University Of Michigan
10 * netatalk for compatibility reasons.
11 */
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
19#define DDP_MAXSZ 587
20#define DDP_MAXHOPS 15 /* 4 bits of hop counter */
21
22#define SIOCATALKDIFADDR (SIOCPROTOPRIVATE + 0)
23
24struct atalk_addr {
f6e276ee 25 __be16 s_net;
1da177e4
LT
26 __u8 s_node;
27};
28
29struct sockaddr_at {
30 sa_family_t sat_family;
31 __u8 sat_port;
32 struct atalk_addr sat_addr;
33 char sat_zero[8];
34};
35
36struct atalk_netrange {
37 __u8 nr_phase;
f6e276ee
AD
38 __be16 nr_firstnet;
39 __be16 nr_lastnet;
1da177e4
LT
40};
41
9f3786dc
DM
42#ifdef __KERNEL__
43
44#include <net/sock.h>
45
1da177e4
LT
46struct atalk_route {
47 struct net_device *dev;
48 struct atalk_addr target;
49 struct atalk_addr gateway;
50 int flags;
51 struct atalk_route *next;
52};
53
54/**
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
61 */
62struct atalk_iface {
63 struct net_device *dev;
64 struct atalk_addr address;
65 int status;
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;
70};
71
72struct atalk_sock {
73 /* struct sock has to be the first member of atalk_sock */
74 struct sock sk;
f6e276ee
AD
75 __be16 dest_net;
76 __be16 src_net;
1da177e4
LT
77 unsigned char dest_node;
78 unsigned char src_node;
79 unsigned char dest_port;
80 unsigned char src_port;
81};
82
83static inline struct atalk_sock *at_sk(struct sock *sk)
84{
85 return (struct atalk_sock *)sk;
86}
87
1da177e4
LT
88#include <asm/byteorder.h>
89
90struct ddpehdr {
91#ifdef __LITTLE_ENDIAN_BITFIELD
92 __u16 deh_len:10,
93 deh_hops:4,
94 deh_pad:2;
95#else
96 __u16 deh_pad:2,
97 deh_hops:4,
98 deh_len:10;
99#endif
f6e276ee
AD
100 __be16 deh_sum;
101 __be16 deh_dnet;
102 __be16 deh_snet;
1da177e4
LT
103 __u8 deh_dnode;
104 __u8 deh_snode;
105 __u8 deh_dport;
106 __u8 deh_sport;
107 /* And netatalk apps expect to stick the type in themselves */
108};
109
110static __inline__ struct ddpehdr *ddp_hdr(struct sk_buff *skb)
111{
112 return (struct ddpehdr *)skb->h.raw;
113}
114
115/*
116 * Don't drop the struct into the struct above. You'll get some
117 * surprise padding.
118 */
119struct ddpebits {
120#ifdef __LITTLE_ENDIAN_BITFIELD
121 __u16 deh_len:10,
122 deh_hops:4,
123 deh_pad:2;
124#else
125 __u16 deh_pad:2,
126 deh_hops:4,
127 deh_len:10;
128#endif
129};
130
131/* Short form header */
132struct ddpshdr {
133#ifdef __LITTLE_ENDIAN_BITFIELD
134 __u16 dsh_len:10,
135 dsh_pad:6;
136#else
137 __u16 dsh_pad:6,
138 dsh_len:10;
139#endif
140 __u8 dsh_dport;
141 __u8 dsh_sport;
142 /* And netatalk apps expect to stick the type in themselves */
143};
144
145/* AppleTalk AARP headers */
146struct elapaarp {
f6e276ee 147 __be16 hw_type;
1da177e4
LT
148#define AARP_HW_TYPE_ETHERNET 1
149#define AARP_HW_TYPE_TOKENRING 2
f6e276ee 150 __be16 pa_type;
1da177e4
LT
151 __u8 hw_len;
152 __u8 pa_len;
153#define AARP_PA_ALEN 4
f6e276ee 154 __be16 function;
1da177e4
LT
155#define AARP_REQUEST 1
156#define AARP_REPLY 2
157#define AARP_PROBE 3
158 __u8 hw_src[ETH_ALEN] __attribute__ ((packed));
159 __u8 pa_src_zero __attribute__ ((packed));
f6e276ee 160 __be16 pa_src_net __attribute__ ((packed));
1da177e4
LT
161 __u8 pa_src_node __attribute__ ((packed));
162 __u8 hw_dst[ETH_ALEN] __attribute__ ((packed));
163 __u8 pa_dst_zero __attribute__ ((packed));
f6e276ee 164 __be16 pa_dst_net __attribute__ ((packed));
1da177e4
LT
165 __u8 pa_dst_node __attribute__ ((packed));
166};
167
168static __inline__ struct elapaarp *aarp_hdr(struct sk_buff *skb)
169{
170 return (struct elapaarp *)skb->h.raw;
171}
172
173/* Not specified - how long till we drop a resolved entry */
174#define AARP_EXPIRY_TIME (5 * 60 * HZ)
175/* Size of hash table */
176#define AARP_HASH_SIZE 16
177/* Fast retransmission timer when resolving */
178#define AARP_TICK_TIME (HZ / 5)
179/* Send 10 requests then give up (2 seconds) */
180#define AARP_RETRANSMIT_LIMIT 10
181/*
182 * Some value bigger than total retransmit time + a bit for last reply to
183 * appear and to stop continual requests
184 */
185#define AARP_RESOLVE_TIME (10 * HZ)
186
187extern struct datalink_proto *ddp_dl, *aarp_dl;
188extern void aarp_proto_init(void);
189
190/* Inter module exports */
191
192/* Give a device find its atif control structure */
193static inline struct atalk_iface *atalk_find_dev(struct net_device *dev)
194{
195 return dev->atalk_ptr;
196}
197
198extern struct atalk_addr *atalk_find_dev_addr(struct net_device *dev);
199extern struct net_device *atrtr_get_dev(struct atalk_addr *sa);
200extern int aarp_send_ddp(struct net_device *dev,
201 struct sk_buff *skb,
202 struct atalk_addr *sa, void *hwaddr);
203extern void aarp_device_down(struct net_device *dev);
204extern void aarp_probe_network(struct atalk_iface *atif);
205extern int aarp_proxy_probe_network(struct atalk_iface *atif,
206 struct atalk_addr *sa);
207extern void aarp_proxy_remove(struct net_device *dev,
208 struct atalk_addr *sa);
209
210extern void aarp_cleanup_module(void);
211
212extern struct hlist_head atalk_sockets;
213extern rwlock_t atalk_sockets_lock;
214
215extern struct atalk_route *atalk_routes;
216extern rwlock_t atalk_routes_lock;
217
218extern struct atalk_iface *atalk_interfaces;
219extern rwlock_t atalk_interfaces_lock;
220
221extern struct atalk_route atrtr_default;
222
223extern struct file_operations atalk_seq_arp_fops;
224
225extern int sysctl_aarp_expiry_time;
226extern int sysctl_aarp_tick_time;
227extern int sysctl_aarp_retransmit_limit;
228extern int sysctl_aarp_resolve_time;
229
230#ifdef CONFIG_SYSCTL
231extern void atalk_register_sysctl(void);
232extern void atalk_unregister_sysctl(void);
233#else
234#define atalk_register_sysctl() do { } while(0)
235#define atalk_unregister_sysctl() do { } while(0)
236#endif
237
238#ifdef CONFIG_PROC_FS
239extern int atalk_proc_init(void);
240extern void atalk_proc_exit(void);
241#else
242#define atalk_proc_init() ({ 0; })
243#define atalk_proc_exit() do { } while(0)
244#endif /* CONFIG_PROC_FS */
245
246#endif /* __KERNEL__ */
247#endif /* __LINUX_ATALK_H__ */