1 /* SPDX-License-Identifier: GPL-2.0 */
2 #ifndef __LINUX_ATALK_H__
3 #define __LINUX_ATALK_H__
7 #include <uapi/linux/atalk.h>
10 struct net_device *dev;
11 struct atalk_addr target;
12 struct atalk_addr gateway;
14 struct atalk_route *next;
18 * struct atalk_iface - AppleTalk Interface
19 * @dev - Network device associated with this interface
20 * @address - Our address
21 * @status - What are we doing?
22 * @nets - Associated direct netrange
23 * @next - next element in the list of interfaces
26 struct net_device *dev;
27 struct atalk_addr address;
29 #define ATIF_PROBE 1 /* Probing for an address */
30 #define ATIF_PROBE_FAIL 2 /* Probe collided */
31 struct atalk_netrange nets;
32 struct atalk_iface *next;
36 /* struct sock has to be the first member of atalk_sock */
40 unsigned char dest_node;
41 unsigned char src_node;
42 unsigned char dest_port;
43 unsigned char src_port;
46 static inline struct atalk_sock *at_sk(struct sock *sk)
48 return (struct atalk_sock *)sk;
52 __be16 deh_len_hops; /* lower 10 bits are length, next 4 - hops */
60 /* And netatalk apps expect to stick the type in themselves */
63 static __inline__ struct ddpehdr *ddp_hdr(struct sk_buff *skb)
65 return (struct ddpehdr *)skb_transport_header(skb);
68 /* AppleTalk AARP headers */
71 #define AARP_HW_TYPE_ETHERNET 1
72 #define AARP_HW_TYPE_TOKENRING 2
76 #define AARP_PA_ALEN 4
78 #define AARP_REQUEST 1
81 __u8 hw_src[ETH_ALEN];
85 __u8 hw_dst[ETH_ALEN];
89 } __attribute__ ((packed));
91 static __inline__ struct elapaarp *aarp_hdr(struct sk_buff *skb)
93 return (struct elapaarp *)skb_transport_header(skb);
96 /* Not specified - how long till we drop a resolved entry */
97 #define AARP_EXPIRY_TIME (5 * 60 * HZ)
98 /* Size of hash table */
99 #define AARP_HASH_SIZE 16
100 /* Fast retransmission timer when resolving */
101 #define AARP_TICK_TIME (HZ / 5)
102 /* Send 10 requests then give up (2 seconds) */
103 #define AARP_RETRANSMIT_LIMIT 10
105 * Some value bigger than total retransmit time + a bit for last reply to
106 * appear and to stop continual requests
108 #define AARP_RESOLVE_TIME (10 * HZ)
110 extern struct datalink_proto *ddp_dl, *aarp_dl;
111 extern void aarp_proto_init(void);
113 /* Inter module exports */
115 /* Give a device find its atif control structure */
116 #if IS_ENABLED(CONFIG_IRDA) || IS_ENABLED(CONFIG_ATALK)
117 static inline struct atalk_iface *atalk_find_dev(struct net_device *dev)
119 return dev->atalk_ptr;
123 extern struct atalk_addr *atalk_find_dev_addr(struct net_device *dev);
124 extern struct net_device *atrtr_get_dev(struct atalk_addr *sa);
125 extern int aarp_send_ddp(struct net_device *dev,
127 struct atalk_addr *sa, void *hwaddr);
128 extern void aarp_device_down(struct net_device *dev);
129 extern void aarp_probe_network(struct atalk_iface *atif);
130 extern int aarp_proxy_probe_network(struct atalk_iface *atif,
131 struct atalk_addr *sa);
132 extern void aarp_proxy_remove(struct net_device *dev,
133 struct atalk_addr *sa);
135 extern void aarp_cleanup_module(void);
137 extern struct hlist_head atalk_sockets;
138 extern rwlock_t atalk_sockets_lock;
140 extern struct atalk_route *atalk_routes;
141 extern rwlock_t atalk_routes_lock;
143 extern struct atalk_iface *atalk_interfaces;
144 extern rwlock_t atalk_interfaces_lock;
146 extern struct atalk_route atrtr_default;
148 struct aarp_iter_state {
150 struct aarp_entry **table;
153 extern const struct seq_operations aarp_seq_ops;
155 extern int sysctl_aarp_expiry_time;
156 extern int sysctl_aarp_tick_time;
157 extern int sysctl_aarp_retransmit_limit;
158 extern int sysctl_aarp_resolve_time;
161 extern void atalk_register_sysctl(void);
162 extern void atalk_unregister_sysctl(void);
164 #define atalk_register_sysctl() do { } while(0)
165 #define atalk_unregister_sysctl() do { } while(0)
168 #ifdef CONFIG_PROC_FS
169 extern int atalk_proc_init(void);
170 extern void atalk_proc_exit(void);
172 #define atalk_proc_init() ({ 0; })
173 #define atalk_proc_exit() do { } while(0)
174 #endif /* CONFIG_PROC_FS */
176 #endif /* __LINUX_ATALK_H__ */