1 /*	$OpenBSD: at.h,v 1.3 2003/05/14 02:02:55 itojun Exp $	*/
2 
3 /*
4  * Copyright (c) 1990,1991 Regents of The University of Michigan.
5  * All Rights Reserved.
6  *
7  * Permission to use, copy, modify, and distribute this software and
8  * its documentation for any purpose and without fee is hereby granted,
9  * provided that the above copyright notice appears in all copies and
10  * that both that copyright notice and this permission notice appear
11  * in supporting documentation, and that the name of The University
12  * of Michigan not be used in advertising or publicity pertaining to
13  * distribution of the software without specific, written prior
14  * permission. This software is supplied as is without expressed or
15  * implied warranties of any kind.
16  *
17  *	Research Systems Unix Group
18  *	The University of Michigan
19  *	c/o Mike Clark
20  *	535 W. William Street
21  *	Ann Arbor, Michigan
22  *	+1-313-763-0525
23  *	netatalk@itd.umich.edu
24  */
25 
26 /*
27  * The following is the contents of the COPYRIGHT file from the
28  * netatalk-1.4a2 distribution, from which this file is derived.
29  */
30 /*
31  * Copyright (c) 1990,1996 Regents of The University of Michigan.
32  *
33  * All Rights Reserved.
34  *
35  *    Permission to use, copy, modify, and distribute this software and
36  *    its documentation for any purpose and without fee is hereby granted,
37  *    provided that the above copyright notice appears in all copies and
38  *    that both that copyright notice and this permission notice appear
39  *    in supporting documentation, and that the name of The University
40  *    of Michigan not be used in advertising or publicity pertaining to
41  *    distribution of the software without specific, written prior
42  *    permission. This software is supplied as is without expressed or
43  *    implied warranties of any kind.
44  *
45  * This product includes software developed by the University of
46  * California, Berkeley and its contributors.
47  *
48  * Solaris code is encumbered by the following:
49  *
50  *     Copyright (C) 1996 by Sun Microsystems Computer Co.
51  *
52  *     Permission to use, copy, modify, and distribute this software and
53  *     its documentation for any purpose and without fee is hereby
54  *     granted, provided that the above copyright notice appear in all
55  *     copies and that both that copyright notice and this permission
56  *     notice appear in supporting documentation.  This software is
57  *     provided "as is" without express or implied warranty.
58  *
59  * Research Systems Unix Group
60  * The University of Michigan
61  * c/o Wesley Craig
62  * 535 W. William Street
63  * Ann Arbor, Michigan
64  * +1-313-764-2278
65  * netatalk@umich.edu
66  */
67 /*
68  * None of the Solaris code mentioned is included in OpenBSD.
69  * This code also relies heavily on previous effort in FreeBSD and NetBSD.
70  */
71 
72 #ifndef __AT_HEADER__
73 #define __AT_HEADER__
74 /*
75  * Supported protocols
76  */
77 #define ATPROTO_DDP	0
78 #define ATPROTO_AARP	254
79 
80 #include <net/ethertypes.h>
81 
82 #define DDP_MAXSZ	587
83 
84 #define	AT_LLC_SIZE	8
85 
86 /*
87  * If ATPORT_FIRST <= Port < ATPORT_RESERVED,
88  * Port was created by a privileged process.
89  * If ATPORT_RESERVED <= Port < ATPORT_LAST,
90  * Port was not necessarily created by a
91  * privileged process.
92  */
93 #define ATPORT_FIRST	1
94 #define ATPORT_RESERVED	128
95 #define ATPORT_LAST	255
96 
97 /*
98  * AppleTalk address.
99  */
100 struct at_addr {
101     u_int16_t	s_net;
102     u_int8_t	s_node;
103 };
104 
105 #define ATADDR_ANYNET	(u_int16_t)0x0000
106 #define ATADDR_ANYNODE	(u_int8_t)0x00
107 #define ATADDR_ANYPORT	(u_int8_t)0x00
108 #define ATADDR_BCAST	(u_int8_t)0xff		/* There is no BCAST for NET */
109 
110 struct netrange {
111 	u_int8_t	nr_phase;
112 	u_int16_t	nr_firstnet;
113 	u_int16_t	nr_lastnet;
114 };
115 
116 /*
117  * Socket address, AppleTalk style.  We keep magic information in the
118  * zero bytes.  There are three types, NONE, CONFIG which has the phase
119  * and a net range, and IFACE which has the network address of an
120  * interface.  IFACE may be filled in by the client, and is filled in
121  * by the kernel.
122  */
123 struct sockaddr_at {
124     u_int8_t		sat_len;
125     u_int8_t		sat_family;
126     u_int8_t		sat_port;
127     struct at_addr	sat_addr;
128     union {
129 	struct netrange	r_netrange;
130 	int8_t		r_zero[ 8 ];    /* Hide a struct netrange in here */
131     } sat_range;
132 };
133 
134 #define	sat_zero	sat_range.r_zero
135 
136 #ifdef _KERNEL
137 extern struct domain	atalkdomain;
138 extern struct protosw	atalksw[];
139 #endif
140 
141 #endif	/* __AT_HEADER__ */
142