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