]> arthur.barton.de Git - netatalk.git/blob - sys/netatalk/at.h
More Linux 2.6 build fixes.
[netatalk.git] / sys / netatalk / at.h
1 /*
2  * $Id: at.h,v 1.3.4.2 2003-11-30 15:07:50 srittau Exp $
3  *
4  * Copyright (c) 1990,1991 Regents of The University of Michigan.
5  *
6  * All Rights Reserved.  See COPYRIGHT.
7  */
8
9 #ifndef __AT_HEADER__
10 #define __AT_HEADER__
11
12 #if defined(linux) /* pull in the linux header */
13
14 #include <sys/socket.h>
15 #include <asm/types.h>
16 #include <linux/atalk.h>
17
18 #ifdef HAVE_ATALK_ADDR
19 #define at_addr atalk_addr
20 #define netrange atalk_netrange
21 #endif /* HAVE_ATALK_ADDR */
22
23 #else /* linux */
24
25 #include <sys/types.h>
26 #include <netinet/in.h> /* so that we can deal with sun's s_net #define */
27
28 #ifdef MACOSX_SERVER
29 #include <netat/appletalk.h>
30 #endif /* MACOSX_SERVER */
31
32 /*
33  * Supported protocols
34  */
35 #ifdef ATPROTO_DDP
36 #undef ATPROTO_DDP
37 #endif /* ATPROTO_DDP */
38 #define ATPROTO_DDP     0
39 #define ATPROTO_AARP    254
40
41 /*
42  * Ethernet types, for DIX.
43  * These should really be in some global header file, but we can't
44  * count on them being there, and it's annoying to patch system files.
45  */
46 #define ETHERTYPE_AT    0x809B          /* AppleTalk protocol */
47 #define ETHERTYPE_AARP  0x80F3          /* AppleTalk ARP */
48
49 #define DDP_MAXSZ       587
50
51 /*
52  * If ATPORT_FIRST <= Port < ATPORT_RESERVED,
53  * Port was created by a privileged process.
54  * If ATPORT_RESERVED <= Port < ATPORT_LAST,
55  * Port was not necessarily created by a
56  * privileged process.
57  */
58 #define ATPORT_FIRST    1
59 #define ATPORT_RESERVED 128
60 #define ATPORT_LAST     254 /* 254 is reserved on ether/tokentalk networks */
61
62 /*
63  * AppleTalk address.
64  */
65 #ifndef MACOSX_SERVER
66 struct at_addr {
67 #ifdef s_net
68 #undef s_net
69 #endif /* s_net */
70     u_short     s_net;
71     u_char      s_node;
72 };
73 #endif /* MACOSX_SERVER */
74
75 #define ATADDR_ANYNET   (u_short)0x0000
76 #define ATADDR_ANYNODE  (u_char)0x00
77 #define ATADDR_ANYPORT  (u_char)0x00
78 #define ATADDR_BCAST    (u_char)0xff            /* There is no BCAST for NET */
79
80 /*
81  * Socket address, AppleTalk style.  We keep magic information in the 
82  * zero bytes.  There are three types, NONE, CONFIG which has the phase
83  * and a net range, and IFACE which has the network address of an
84  * interface.  IFACE may be filled in by the client, and is filled in
85  * by the kernel.
86  */
87 #ifndef MACOSX_SERVER
88 struct sockaddr_at {
89 #ifdef BSD4_4
90     u_char              sat_len;
91     u_char              sat_family;
92 #else /* BSD4_4 */
93     short               sat_family;
94 #endif /* BSD4_4 */
95     u_char              sat_port;
96     struct at_addr      sat_addr;
97 #ifdef notdef
98     struct {
99         u_char          sh_type;
100 # define SATHINT_NONE   0
101 # define SATHINT_CONFIG 1
102 # define SATHINT_IFACE  2
103         union {
104             char                su_zero[ 7 ];   /* XXX check size */
105             struct {
106                 u_char          sr_phase;
107                 u_short         sr_firstnet, sr_lastnet;
108             } su_range;
109             u_short             su_interface;
110         } sh_un;
111     } sat_hints;
112 #else /* notdef */
113     char                sat_zero[ 8 ];
114 #endif /* notdef */
115 };
116 #endif /* MACOSX_SERVER */
117
118 struct netrange {
119     u_char              nr_phase;
120     u_short             nr_firstnet;
121     u_short             nr_lastnet;
122 };
123
124 #ifdef KERNEL
125 extern struct domain    atalkdomain;
126 extern struct protosw   atalksw[];
127 #endif /* KERNEL */
128
129 #endif /* linux */
130 #endif /* __AT_HEADER__ */