Import 2.1.42pre1
[davej-history.git] / include / linux / atalk.h
blob2e4de841ca266f621b3d3135239e54c04ded2d4f
1 /*
2 * Appletalk networking structures
4 * The following are directly referenced from the University Of Michigan
5 * netatalk for compatibility reasons.
6 */
8 #ifndef __LINUX_ATALK_H__
9 #define __LINUX_ATALK_H__
11 #define ATPORT_FIRST 1
12 #define ATPORT_RESERVED 128
13 #define ATPORT_LAST 255
14 #define ATADDR_ANYNET (__u16)0
15 #define ATADDR_ANYNODE (__u8)0
16 #define ATADDR_ANYPORT (__u8)0
17 #define ATADDR_BCAST (__u8)255
18 #define DDP_MAXSZ 587
20 struct at_addr
22 __u16 s_net;
23 __u8 s_node;
26 struct sockaddr_at
28 sa_family_t sat_family;
29 __u8 sat_port;
30 struct at_addr sat_addr;
31 char sat_zero[ 8 ];
34 struct netrange
36 __u8 nr_phase;
37 __u16 nr_firstnet;
38 __u16 nr_lastnet;
41 struct atalk_route
43 struct device *dev;
44 struct at_addr target;
45 struct at_addr gateway;
46 int flags;
47 struct atalk_route *next;
50 struct atalk_iface
52 struct device *dev;
53 struct at_addr address; /* Our address */
54 int status; /* What are we doing ?? */
55 #define ATIF_PROBE 1 /* Probing for an address */
56 #define ATIF_PROBE_FAIL 2 /* Probe collided */
57 struct netrange nets; /* Associated direct netrange */
58 struct atalk_iface *next;
61 struct atalk_sock
63 unsigned short dest_net;
64 unsigned short src_net;
65 unsigned char dest_node;
66 unsigned char src_node;
67 unsigned char dest_port;
68 unsigned char src_port;
71 #define DDP_MAXHOPS 15 /* 4 bits of hop counter */
73 #ifdef __KERNEL__
75 #include <asm/byteorder.h>
77 struct ddpehdr
79 #ifdef __LITTLE_ENDIAN_BITFIELD
80 __u16 deh_len:10, deh_hops:4, deh_pad:2;
81 #else
82 __u16 deh_pad:2, deh_hops:4, deh_len:10;
83 #endif
84 __u16 deh_sum;
85 __u16 deh_dnet;
86 __u16 deh_snet;
87 __u8 deh_dnode;
88 __u8 deh_snode;
89 __u8 deh_dport;
90 __u8 deh_sport;
91 /* And netatalk apps expect to stick the type in themselves */
95 * Short form header
98 struct ddpshdr
100 #ifdef __LITTLE_ENDIAN_BITFIELD
101 __u16 dsh_len:10, dsh_pad:6;
102 #else
103 __u16 dsh_pad:6, dsh_len:10;
104 #endif
105 __u8 dsh_dport;
106 __u8 dsh_sport;
107 /* And netatalk apps expect to stick the type in themselves */
110 /* Appletalk AARP headers */
112 struct elapaarp
114 __u16 hw_type;
115 #define AARP_HW_TYPE_ETHERNET 1
116 #define AARP_HW_TYPE_TOKENRING 2
117 __u16 pa_type;
118 __u8 hw_len;
119 __u8 pa_len;
120 #define AARP_PA_ALEN 4
121 __u16 function;
122 #define AARP_REQUEST 1
123 #define AARP_REPLY 2
124 #define AARP_PROBE 3
125 __u8 hw_src[ETH_ALEN] __attribute__ ((packed));
126 __u8 pa_src_zero __attribute__ ((packed));
127 __u16 pa_src_net __attribute__ ((packed));
128 __u8 pa_src_node __attribute__ ((packed));
129 __u8 hw_dst[ETH_ALEN] __attribute__ ((packed));
130 __u8 pa_dst_zero __attribute__ ((packed));
131 __u16 pa_dst_net __attribute__ ((packed));
132 __u8 pa_dst_node __attribute__ ((packed));
135 #define AARP_EXPIRY_TIME (5*60*HZ) /* Not specified - how long till we drop a resolved entry */
136 #define AARP_HASH_SIZE 16 /* Size of hash table */
137 #define AARP_TICK_TIME (HZ/5) /* Fast retransmission timer when resolving */
138 #define AARP_RETRANSMIT_LIMIT 10 /* Send 10 requests then give up (2 seconds) */
139 #define AARP_RESOLVE_TIME (10*HZ) /* Some value bigger than total retransmit time + a bit for last reply to appear and to stop continual requests */
141 extern struct datalink_proto *ddp_dl, *aarp_dl;
142 extern void aarp_proto_init(void);
143 /* Inter module exports */
146 * Give a device find its atif control structure
149 extern __inline__ struct atalk_iface *atalk_find_dev(struct device *dev)
151 return dev->atalk_ptr;
154 extern struct at_addr *atalk_find_dev_addr(struct device *dev);
155 extern int aarp_send_ddp(struct device *dev,struct sk_buff *skb, struct at_addr *sa, void *hwaddr);
156 extern void aarp_send_probe(struct device *dev, struct at_addr *addr);
157 #ifdef MODULE
158 extern void aarp_cleanup_module(void);
159 #endif
161 #endif
162 #endif