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