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