|
|
1.1 root 1: /*
2: * Copyright (c) 1999 Apple Computer, Inc. All rights reserved.
3: *
4: * @APPLE_LICENSE_HEADER_START@
5: *
6: * Portions Copyright (c) 1999 Apple Computer, Inc. All Rights
7: * Reserved. This file contains Original Code and/or Modifications of
8: * Original Code as defined in and that are subject to the Apple Public
9: * Source License Version 1.1 (the "License"). You may not use this file
10: * except in compliance with the License. Please obtain a copy of the
11: * License at http://www.apple.com/publicsource and read it before using
12: * this file.
13: *
14: * The Original Code and all software distributed under the License are
15: * distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, EITHER
16: * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
17: * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
18: * FITNESS FOR A PARTICULAR PURPOSE OR NON-INFRINGEMENT. Please see the
19: * License for the specific language governing rights and limitations
20: * under the License.
21: *
22: * @APPLE_LICENSE_HEADER_END@
23: */
24:
25: /*
26: * Copyright (c) 1996 Apple Computer, Inc.
27: *
28: * The information contained herein is subject to change without
29: * notice and should not be construed as a commitment by Apple
30: * Computer, Inc. Apple Computer, Inc. assumes no responsibility
31: * for any errors that may appear.
32: *
33: * Confidential and Proprietary to Apple Computer, Inc.
34: *
35: * Change Log:
36: * Created April 8, 1996 by Tuyen Nguyen
37: */
38:
39: #ifndef _at_aurp_h
40: #define _at_aurp_h
41:
42: #define AURPCODE_REG 0
43: #define AURPCODE_RTMPPKT 1
44: #define AURPCODE_DATAPKT 2
45: #define AURPCODE_AURPPROTO 3
46: #define AURPCODE_DEBUGINFO 10
47: #define AURPCODE_RTINFO 11
48: #define AURPCODE_RTUPDATE 12
49:
50: #define AURPSTATE_Unconnected 0
51: #define AURPSTATE_Connected 1
52: #define AURPSTATE_WaitingForOpenRsp 2
53: #define AURPSTATE_WaitingForRIRsp 3
54: #define AURPSTATE_WaitingForTickleAck 4
55: #define AURPSTATE_WaitingForRIAck1 5
56: #define AURPSTATE_WaitingForRIAck2 6
57: #define AURPSTATE_WaitingForRIAck3 7
58:
59: #define AURPCMD_RIReq 1
60: #define AURPCMD_RIRsp 2
61: #define AURPCMD_RIAck 3
62: #define AURPCMD_RIUpd 4
63: #define AURPCMD_RDReq 5
64: #define AURPCMD_ZReq 6
65: #define AURPCMD_ZRsp 7
66: #define AURPCMD_OpenReq 8
67: #define AURPCMD_OpenRsp 9
68: #define AURPCMD_Tickle 14
69: #define AURPCMD_TickleAck 15
70:
71: #define AURPSUBCODE_ZoneInfo1 1
72: #define AURPSUBCODE_ZoneInfo2 2
73: #define AURPSUBCODE_GetZoneNets 3
74: #define AURPSUBCODE_GetDomainZoneList 4
75:
76: #define AURPEV_Null 0
77: #define AURPEV_NetAdded 1
78: #define AURPEV_NetDeleted 2
79: #define AURPEV_NetRouteChange 3
80: #define AURPEV_NetDistChange 4
81: #define AURPEV_NetZoneChange 5
82:
83: #define AURP_Version 1
84: #define AURP_ProbeRetryInterval 300
85: #define AURP_MaxTickleRetry 4
86: #define AURP_TickleRetryInterval 30
87: #define AURP_MaxRetry 10
88: #define AURP_RetryInterval 3
89: #define AURP_UpdateRate 1
90: #define AURP_UDType 0
91: #define AURP_UDNode 1
92: #define AURP_UDSize 2
93: #define AURP_FirstSeqNum 1
94: #define AURP_LastSeqNum 65535
95: #define AURP_MaxPktSize 1400
96: #define AURP_MaxNetAccess 64
97: #define AURP_NetHiden 0x01
98:
99: #define AURPERR_NormalConnectionClose -1
100: #define AURPERR_RoutingLoopDetected -2
101: #define AURPERR_ConnectionOutOfSync -3
102: #define AURPERR_OptionNegotiationError -4
103: #define AURPERR_InvalidVersionNumber -5
104: #define AURPERR_InsufficientResources -6
105: #define AURPERR_AuthenticationError -7
106:
107: #define AURPFLG_NA 0x4000
108: #define AURPFLG_ND 0x2000
109: #define AURPFLG_NDC 0x1000
110: #define AURPFLG_ZC 0x0800
111: #define AURPFLG_RMA 0x4000
112: #define AURPFLG_HCRA 0x2000
113: #define AURPFLG_SZI 0x4000
114: #define AURPFLG_LAST 0x8000
115:
116: /*
117: * AURP state block
118: */
119: typedef struct {
120: unsigned char get_zi; /* get zone info flag */
121: unsigned char rem_node; /* node id of a tunnel peer */
122: unsigned char tickle_retry; /* tickle retry count */
123: unsigned char rcv_retry; /* data receiver retry count */
124: unsigned char snd_state; /* data sender state */
125: unsigned char rcv_state; /* data receiver state */
126: unsigned char filler[2];
127: unsigned short rcv_update_rate;
128: unsigned short snd_next_entry; /* next entry in RT */
129: unsigned short rcv_env;
130: unsigned short snd_sui;
131: unsigned short rcv_connection_id; /* data receiver connection id */
132: unsigned short snd_connection_id; /* data sender connection id */
133: unsigned short rcv_sequence_number; /* data receiver sequence number */
134: unsigned short snd_sequence_number; /* data sender sequence number */
135: void *rcv_tmo;
136: void *snd_tmo;
137: gbuf_t *rsp_m;
138: gbuf_t *upd_m;
139: } aurp_state_t;
140:
141: /*
142: * AURP protocol header
143: */
144: typedef struct {
145: unsigned short connection_id;
146: unsigned short sequence_number;
147: unsigned short command_code;
148: unsigned short flags;
149: } aurp_hdr_t;
150:
151: /*
152: *
153: */
154: typedef struct {
155: void *RT_table;
156: void *ZT_table;
157: short RT_maxentry;
158: short ZT_maxentry;
159: void *rt_lock;
160: void *rt_insert;
161: void *rt_delete;
162: void *rt_lookup;
163: void *zt_add_zname;
164: void *zt_set_zmap;
165: void *zt_get_zindex;
166: void *zt_remove_zones;
167: } aurp_rtinfo_t;
168:
169: /**********/
170:
171: #ifdef _AURP
172: extern short RT_maxentry;
173: extern short ZT_maxentry;
174: extern RT_entry *RT_table;
175: extern ZT_entry *ZT_table;
176: extern void *RT_lock;
177: extern RT_entry *(*RT_insert)();
178: extern RT_entry *(*RT_delete)();
179: extern RT_entry *(*RT_lookup)();
180: extern void (*ZT_set_zmap)();
181: extern int (*ZT_add_zname)();
182: extern int (*ZT_get_zindex)();
183: extern void (*ZT_remove_zones)();
184:
185: extern atlock_t aurpgen_lock;
186: extern gref_t *aurp_gref;
187: extern unsigned char opt_proto;
188: extern unsigned char dst_addr_cnt;
189: extern unsigned char net_access_cnt;
190: extern unsigned char net_export;
191: extern unsigned short rcv_connection_id;
192: extern int net_port;
193: extern void *update_tmo;
194: extern aurp_state_t aurp_state[];
195: extern unsigned short net_access[];
196: #endif
197:
198: #ifdef _KERNSYS
199: struct myq
200: { struct mbuf *q_head;
201: struct mbuf *q_tail;
202: int q_cnt;
203: };
204:
205: #ifdef _AIX
206: #define LOCK_DECL(x) Simple_lock x
207: #else
208: #define LOCK_DECL(x) atlock_t x
209: #endif
210: /*
211: * Quandry: if we use a single socket, we have to rebind on each call.
212: * If we use separate sockets per tunnel endpoint, we have to examine
213: * each one on wakeup. What to do; what to do?
214: */
215: struct aurp_global_t
216: { int src_addr; /* What's our IP address? */
217: int udp_port; /* Local UDP port */
218: unsigned short net_access[AURP_MAXNETACCESS];
219: long dst_addr[256]; /* Tunnel 'other ends', passed in from user */
220: int pid; /* Who are we? */
221: struct socket *tunnel; /* IP socket for all IP endpoints */
222: int event; /* Sleep queue anchor */
223: int event_anchor; /* Sleep queue anchor */
224: #ifdef _AIX
225: LOCK_DECL(glock); /* aurp_global lock */
226: #else
227: atlock_t glock;
228: #endif
229: struct uio auio; /* Dummy uio struct for soreceive() */
230: /* Statistics */
231: unsigned int toosmall; /* size less than domain header, from UDP */
232: unsigned int no_mbufs; /* gbuf_to_mbuf failed */
233: unsigned int no_gbufs; /* mbuf_to_gbuf failed */
234: unsigned int shutdown; /* shutdown flag */
235: unsigned int running; /* running flag */
236: };
237:
238: #define AE_ATALK 0x01 /* A/talk input event */
239: #define AE_UDPIP 0x02 /* UDP/IP input event */
240: #define AE_SHUTDOWN 0x04 /* Shutdown AURP process */
241:
242: extern struct mbuf *at_gbuf_to_mbuf(gbuf_t *);
243: extern gbuf_t *at_mbuf_to_gbuf(struct mbuf *, int);
244: #endif
245:
246: /* AURP header for IP tunneling */
247: typedef struct domain
248: { char dst_length;
249: char dst_authority;
250: short dst_distinguisher;
251: long dst_address;
252: char src_length;
253: char src_authority;
254: short src_distinguisher;
255: long src_address;
256: short version;
257: short reserved;
258: short type;
259: } domain_t;
260:
261: /* AURP/domain header constants */
262: #define AUD_Version 0x1
263: #define AUD_Atalk 0x2
264: #define AUD_AURP 0x3
265:
266: /* IP domain identifier constants */
267: #define IP_LENGTH 7
268: #define IP_AUTHORITY 1
269: #define IP_DISTINGUISHER 0
270: /* Need this because the )(*&^%$#@ compiler rounds up the size */
271: #define IP_DOMAINSIZE 22
272:
273: /****### LD 9/26/97*/
274: extern struct aurp_global_t aurp_global;
275: #endif
276:
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.