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