fedora core 6 1.2949 + vserver 2.2.0
[linux-2.6.git] / include / linux / atalk.h
index 2a9b820..75b8bac 100644 (file)
@@ -1,5 +1,8 @@
 #ifndef __LINUX_ATALK_H__
 #define __LINUX_ATALK_H__
+
+#include <asm/byteorder.h>
+
 /*
  * AppleTalk networking structures
  *
@@ -19,7 +22,7 @@
 #define SIOCATALKDIFADDR       (SIOCPROTOPRIVATE + 0)
 
 struct atalk_addr {
-       __u16   s_net;
+       __be16  s_net;
        __u8    s_node;
 };
 
@@ -32,10 +35,14 @@ struct sockaddr_at {
 
 struct atalk_netrange {
        __u8    nr_phase;
-       __u16   nr_firstnet;
-       __u16   nr_lastnet;
+       __be16  nr_firstnet;
+       __be16  nr_lastnet;
 };
 
+#ifdef __KERNEL__
+
+#include <net/sock.h>
+
 struct atalk_route {
        struct net_device  *dev;
        struct atalk_addr  target;
@@ -63,31 +70,28 @@ struct atalk_iface {
 };
        
 struct atalk_sock {
-       unsigned short  dest_net;
-       unsigned short  src_net;
+       /* struct sock has to be the first member of atalk_sock */
+       struct sock     sk;
+       __be16          dest_net;
+       __be16          src_net;
        unsigned char   dest_node;
        unsigned char   src_node;
        unsigned char   dest_port;
        unsigned char   src_port;
 };
 
-#ifdef __KERNEL__
+static inline struct atalk_sock *at_sk(struct sock *sk)
+{
+       return (struct atalk_sock *)sk;
+}
 
 #include <asm/byteorder.h>
 
 struct ddpehdr {
-#ifdef __LITTLE_ENDIAN_BITFIELD
-       __u16   deh_len:10,
-               deh_hops:4,
-               deh_pad:2;
-#else
-       __u16   deh_pad:2,
-               deh_hops:4,
-               deh_len:10;
-#endif
-       __u16   deh_sum;
-       __u16   deh_dnet;
-       __u16   deh_snet;
+       __be16  deh_len_hops;   /* lower 10 bits are length, next 4 - hops */
+       __be16  deh_sum;
+       __be16  deh_dnet;
+       __be16  deh_snet;
        __u8    deh_dnode;
        __u8    deh_snode;
        __u8    deh_dport;
@@ -100,58 +104,28 @@ static __inline__ struct ddpehdr *ddp_hdr(struct sk_buff *skb)
        return (struct ddpehdr *)skb->h.raw;
 }
 
-/*
- *     Don't drop the struct into the struct above.  You'll get some
- *     surprise padding.
- */
-struct ddpebits {
-#ifdef __LITTLE_ENDIAN_BITFIELD
-       __u16   deh_len:10,
-               deh_hops:4,
-               deh_pad:2;
-#else
-       __u16   deh_pad:2,
-               deh_hops:4,
-               deh_len:10;
-#endif
-};
-
-/* Short form header */
-struct ddpshdr {
-#ifdef __LITTLE_ENDIAN_BITFIELD
-       __u16   dsh_len:10,
-               dsh_pad:6;
-#else
-       __u16   dsh_pad:6,
-               dsh_len:10;
-#endif
-       __u8    dsh_dport;
-       __u8    dsh_sport;
-       /* And netatalk apps expect to stick the type in themselves */
-};
-
 /* AppleTalk AARP headers */
 struct elapaarp {
-       __u16   hw_type;
+       __be16  hw_type;
 #define AARP_HW_TYPE_ETHERNET          1
 #define AARP_HW_TYPE_TOKENRING         2
-       __u16   pa_type;
+       __be16  pa_type;
        __u8    hw_len;
        __u8    pa_len;
 #define AARP_PA_ALEN                   4
-       __u16   function;
+       __be16  function;
 #define AARP_REQUEST                   1
 #define AARP_REPLY                     2
 #define AARP_PROBE                     3
-       __u8    hw_src[ETH_ALEN]        __attribute__ ((packed));
-       __u8    pa_src_zero             __attribute__ ((packed));
-       __u16   pa_src_net              __attribute__ ((packed));
-       __u8    pa_src_node             __attribute__ ((packed));
-       __u8    hw_dst[ETH_ALEN]        __attribute__ ((packed));
-       __u8    pa_dst_zero             __attribute__ ((packed));
-       __u16   pa_dst_net              __attribute__ ((packed));
-       __u8    pa_dst_node             __attribute__ ((packed));       
-};
+       __u8    hw_src[ETH_ALEN];
+       __u8    pa_src_zero;
+       __be16  pa_src_net;
+       __u8    pa_src_node;
+       __u8    hw_dst[ETH_ALEN];
+       __u8    pa_dst_zero;
+       __be16  pa_dst_net;
+       __u8    pa_dst_node;
+} __attribute__ ((packed));
 
 static __inline__ struct elapaarp *aarp_hdr(struct sk_buff *skb)
 {
@@ -188,8 +162,6 @@ extern struct net_device *atrtr_get_dev(struct atalk_addr *sa);
 extern int              aarp_send_ddp(struct net_device *dev,
                                       struct sk_buff *skb,
                                       struct atalk_addr *sa, void *hwaddr);
-extern void             aarp_send_probe(struct net_device *dev,
-                                        struct atalk_addr *addr);
 extern void             aarp_device_down(struct net_device *dev);
 extern void             aarp_probe_network(struct atalk_iface *atif);
 extern int              aarp_proxy_probe_network(struct atalk_iface *atif,
@@ -199,8 +171,6 @@ extern void          aarp_proxy_remove(struct net_device *dev,
 
 extern void            aarp_cleanup_module(void);
 
-#define at_sk(__sk) ((struct atalk_sock *)(__sk)->sk_protinfo)
-
 extern struct hlist_head atalk_sockets;
 extern rwlock_t atalk_sockets_lock;
 
@@ -231,7 +201,7 @@ extern void atalk_unregister_sysctl(void);
 extern int atalk_proc_init(void);
 extern void atalk_proc_exit(void);
 #else
-#define atalk_proc_init()      0
+#define atalk_proc_init()      ({ 0; })
 #define atalk_proc_exit()      do { } while(0)
 #endif /* CONFIG_PROC_FS */