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