Linux Kernel  3.7.1
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
atalk.h
Go to the documentation of this file.
1 #ifndef __LINUX_ATALK_H__
2 #define __LINUX_ATALK_H__
3 
4 
5 #include <net/sock.h>
6 #include <uapi/linux/atalk.h>
7 
8 struct atalk_route {
9  struct net_device *dev;
12  int flags;
13  struct atalk_route *next;
14 };
15 
24 struct atalk_iface {
25  struct net_device *dev;
27  int status;
28 #define ATIF_PROBE 1 /* Probing for an address */
29 #define ATIF_PROBE_FAIL 2 /* Probe collided */
31  struct atalk_iface *next;
32 };
33 
34 struct atalk_sock {
35  /* struct sock has to be the first member of atalk_sock */
36  struct sock sk;
39  unsigned char dest_node;
40  unsigned char src_node;
41  unsigned char dest_port;
42  unsigned char src_port;
43 };
44 
45 static inline struct atalk_sock *at_sk(struct sock *sk)
46 {
47  return (struct atalk_sock *)sk;
48 }
49 
50 struct ddpehdr {
51  __be16 deh_len_hops; /* lower 10 bits are length, next 4 - hops */
59  /* And netatalk apps expect to stick the type in themselves */
60 };
61 
62 static __inline__ struct ddpehdr *ddp_hdr(struct sk_buff *skb)
63 {
64  return (struct ddpehdr *)skb_transport_header(skb);
65 }
66 
67 /* AppleTalk AARP headers */
68 struct elapaarp {
70 #define AARP_HW_TYPE_ETHERNET 1
71 #define AARP_HW_TYPE_TOKENRING 2
75 #define AARP_PA_ALEN 4
76  __be16 function;
77 #define AARP_REQUEST 1
78 #define AARP_REPLY 2
79 #define AARP_PROBE 3
88 } __attribute__ ((packed));
89 
90 static __inline__ struct elapaarp *aarp_hdr(struct sk_buff *skb)
91 {
92  return (struct elapaarp *)skb_transport_header(skb);
93 }
94 
95 /* Not specified - how long till we drop a resolved entry */
96 #define AARP_EXPIRY_TIME (5 * 60 * HZ)
97 /* Size of hash table */
98 #define AARP_HASH_SIZE 16
99 /* Fast retransmission timer when resolving */
100 #define AARP_TICK_TIME (HZ / 5)
101 /* Send 10 requests then give up (2 seconds) */
102 #define AARP_RETRANSMIT_LIMIT 10
103 /*
104  * Some value bigger than total retransmit time + a bit for last reply to
105  * appear and to stop continual requests
106  */
107 #define AARP_RESOLVE_TIME (10 * HZ)
108 
109 extern struct datalink_proto *ddp_dl, *aarp_dl;
110 extern void aarp_proto_init(void);
111 
112 /* Inter module exports */
113 
114 /* Give a device find its atif control structure */
115 static inline struct atalk_iface *atalk_find_dev(struct net_device *dev)
116 {
117  return dev->atalk_ptr;
118 }
119 
120 extern struct atalk_addr *atalk_find_dev_addr(struct net_device *dev);
121 extern struct net_device *atrtr_get_dev(struct atalk_addr *sa);
122 extern int aarp_send_ddp(struct net_device *dev,
123  struct sk_buff *skb,
124  struct atalk_addr *sa, void *hwaddr);
125 extern void aarp_device_down(struct net_device *dev);
126 extern void aarp_probe_network(struct atalk_iface *atif);
127 extern int aarp_proxy_probe_network(struct atalk_iface *atif,
128  struct atalk_addr *sa);
129 extern void aarp_proxy_remove(struct net_device *dev,
130  struct atalk_addr *sa);
131 
132 extern void aarp_cleanup_module(void);
133 
134 extern struct hlist_head atalk_sockets;
136 
137 extern struct atalk_route *atalk_routes;
139 
140 extern struct atalk_iface *atalk_interfaces;
142 
143 extern struct atalk_route atrtr_default;
144 
145 extern const struct file_operations atalk_seq_arp_fops;
146 
147 extern int sysctl_aarp_expiry_time;
148 extern int sysctl_aarp_tick_time;
150 extern int sysctl_aarp_resolve_time;
151 
152 #ifdef CONFIG_SYSCTL
153 extern void atalk_register_sysctl(void);
154 extern void atalk_unregister_sysctl(void);
155 #else
156 #define atalk_register_sysctl() do { } while(0)
157 #define atalk_unregister_sysctl() do { } while(0)
158 #endif
159 
160 #ifdef CONFIG_PROC_FS
161 extern int atalk_proc_init(void);
162 extern void atalk_proc_exit(void);
163 #else
164 #define atalk_proc_init() ({ 0; })
165 #define atalk_proc_exit() do { } while(0)
166 #endif /* CONFIG_PROC_FS */
167 
168 #endif /* __LINUX_ATALK_H__ */