]> git.saurik.com Git - apple/xnu.git/blob - bsd/netat/asp.h
xnu-1228.tar.gz
[apple/xnu.git] / bsd / netat / asp.h
1 /*
2 * Copyright (c) 2000 Apple Computer, Inc. All rights reserved.
3 *
4 * @APPLE_OSREFERENCE_LICENSE_HEADER_START@
5 *
6 * This file contains Original Code and/or Modifications of Original Code
7 * as defined in and that are subject to the Apple Public Source License
8 * Version 2.0 (the 'License'). You may not use this file except in
9 * compliance with the License. The rights granted to you under the License
10 * may not be used to create, or enable the creation or redistribution of,
11 * unlawful or unlicensed copies of an Apple operating system, or to
12 * circumvent, violate, or enable the circumvention or violation of, any
13 * terms of an Apple operating system software license agreement.
14 *
15 * Please obtain a copy of the License at
16 * http://www.opensource.apple.com/apsl/ and read it before using this file.
17 *
18 * The Original Code and all software distributed under the License are
19 * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
20 * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
21 * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
22 * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
23 * Please see the License for the specific language governing rights and
24 * limitations under the License.
25 *
26 * @APPLE_OSREFERENCE_LICENSE_HEADER_END@
27 */
28 /*
29 *
30 * ORIGINS: 82
31 *
32 * (C) COPYRIGHT Apple Computer, Inc. 1992-1996
33 * All Rights Reserved
34 *
35 */
36
37 #ifndef _NETAT_ASP_H_
38 #define _NETAT_ASP_H_
39 #include <sys/appleapiopts.h>
40
41 #ifdef __APPLE_API_OBSOLETE
42
43 #define ASP_Version 0x100
44
45 #define ASPFUNC_CloseSess 1
46 #define ASPFUNC_Command 2
47 #define ASPFUNC_GetStatus 3
48 #define ASPFUNC_OpenSess 4
49 #define ASPFUNC_Tickle 5
50 #define ASPFUNC_Write 6
51 #define ASPFUNC_WriteContinue 7
52 #define ASPFUNC_Attention 8
53 #define ASPFUNC_CmdReply 9
54
55 #define ASPIOC 210 /* AT_MID_ASP */
56 #define ASPIOC_ClientBind ((ASPIOC<<8) | 1)
57 #define ASPIOC_CloseSession ((ASPIOC<<8) | 2)
58 #define ASPIOC_GetLocEntity ((ASPIOC<<8) | 3)
59 #define ASPIOC_GetRemEntity ((ASPIOC<<8) | 4)
60 #define ASPIOC_GetSession ((ASPIOC<<8) | 5)
61 #define ASPIOC_GetStatus ((ASPIOC<<8) | 6)
62 #define ASPIOC_ListenerBind ((ASPIOC<<8) | 7)
63 #define ASPIOC_OpenSession ((ASPIOC<<8) | 8)
64 #define ASPIOC_StatusBlock ((ASPIOC<<8) | 9)
65 #define ASPIOC_SetPid ((ASPIOC<<8) |10)
66 #define ASPIOC_GetSessId ((ASPIOC<<8) |11)
67 #define ASPIOC_EnableSelect ((ASPIOC<<8) |12) /* not needed */
68 #define ASPIOC_Look ((ASPIOC<<8) |13)
69
70 #define MOREDATA 1
71
72 /* The following ASP error codes are defined in Inside AppleTalk: */
73
74 #define ASPERR_NoError 0
75 #define ASPERR_BadVersNum -1066
76 #define ASPERR_BufTooSmall -1067
77 #define ASPERR_NoMoreSessions -1068
78 #define ASPERR_NoServers -1069
79 #define ASPERR_ParamErr -1070
80 #define ASPERR_ServerBusy -1071
81 #define ASPERR_SessClosed -1072
82 #define ASPERR_SizeErr -1073
83 #define ASPERR_TooManyClients -1074
84 #define ASPERR_NoAck -1075
85
86 /* These ASP error codes were apparently defined later: */
87
88 #define ASPERR_NoSuchDevice -1058
89 #define ASPERR_BindErr -1059
90 #define ASPERR_CmdReply -1060
91 #define ASPERR_CmdRequest -1061
92 #define ASPERR_SystemErr -1062
93 #define ASPERR_ProtoErr -1063
94 #define ASPERR_NoSuchEntity -1064
95 #define ASPERR_RegisterErr -1065
96
97 typedef struct {
98 at_inet_t SLSEntityIdentifier;
99 at_retry_t Retry;
100 int StatusBufferSize;
101 } asp_status_cmd_t;
102
103 typedef struct {
104 at_inet_t SLSEntityIdentifier;
105 at_retry_t Retry;
106 unsigned short TickleInterval;
107 unsigned short SessionTimer;
108 } asp_open_cmd_t;
109
110 typedef struct {
111 int Primitive;
112 int CmdResult;
113 unsigned short ReqRefNum;
114 unsigned short Filler;
115 } asp_cmdreply_req_t;
116
117 typedef struct {
118 int Primitive;
119 int CmdResult;
120 } asp_cmdreply_ind_t;
121
122 typedef struct {
123 int Primitive;
124 unsigned short ReqRefNum;
125 unsigned char ReqType;
126 unsigned char Filler;
127 } asp_command_ind_t;
128
129 union asp_primitives {
130 int Primitive;
131 asp_cmdreply_ind_t CmdReplyInd;
132 asp_cmdreply_req_t CmdReplyReq;
133 asp_command_ind_t CommandInd;
134 };
135
136 #ifdef KERNEL_PRIVATE
137
138 #define ASPSTATE_Close 0
139 #define ASPSTATE_Idle 1
140 #define ASPSTATE_WaitingForGetStatusRsp 2
141 #define ASPSTATE_WaitingForOpenSessRsp 3
142 #define ASPSTATE_WaitingForCommandRsp 4
143 #define ASPSTATE_WaitingForWriteContinue 5
144 #define ASPSTATE_WaitingForWriteRsp 6
145 #define ASPSTATE_WaitingForWriteContinueRsp 7
146 #define ASPSTATE_WaitingForCloseSessRsp 8
147 #ifdef NOT_USED
148 #define ASPSTATE_WaitingForCfgAck 9
149 #endif
150
151 /*
152 * ATP state block
153 */
154 typedef struct {
155 gref_t *atp_gref; /* gref must be the first entry */
156 int pid; /* process id, must be the second entry */
157 gbuf_t *atp_msgq; /* data msg, must be the third entry */
158 unsigned char dflag; /* structure flag, must be the fourth entry */
159 unsigned char filler[3];
160 } atp_state_t;
161
162 /*
163 * ASP word
164 */
165 typedef struct {
166 unsigned char func;
167 unsigned char param1;
168 unsigned short param2;
169 } asp_word_t;
170
171 struct asp_scb;
172 typedef void (*asp_tmo_func)(struct asp_scb *);
173
174 /*
175 * ASP session control block
176 */
177 typedef struct asp_scb {
178 gref_t *gref; /* read queue pointer, must be the first entry */
179 int pid; /* process id, must be the second entry */
180 atp_state_t *atp_state; /* atp state info, must be the third entry */
181 unsigned char dflag; /* structure flag, must be the fourth entry */
182 unsigned char state;
183 unsigned char sess_id;
184 unsigned char tmo_delta;
185 unsigned char tmo_cnt;
186 unsigned char rem_socket;
187 unsigned char rem_node;
188 unsigned char magic_num;
189 unsigned short snd_seq_num;
190 unsigned short rcv_seq_num;
191 unsigned short filler;
192 unsigned short tickle_tid;
193 unsigned short tickle_interval;
194 unsigned short session_timer;
195 unsigned short attn_tid;
196 unsigned char attn_flag;
197 unsigned char req_flag;
198 gbuf_t *req_msgq;
199 unsigned short wrt_seq_num;
200 unsigned char get_wait;
201 unsigned char ioc_wait;
202 at_retry_t cmd_retry;
203 at_inet_t loc_addr;
204 at_inet_t rem_addr;
205 at_inet_t svc_addr;
206 gbuf_t *sess_ioc;
207 gbuf_t *stat_msg;
208 asp_tmo_func tmo_func;
209 struct asp_scb *next_tmo;
210 struct asp_scb *prev_tmo;
211 struct asp_scb *sess_scb;
212 struct asp_scb *next_scb;
213 struct asp_scb *prev_scb;
214 unsigned char sel_on; /* not needed */
215 unsigned char user;
216 unsigned char rcv_cnt;
217 unsigned char snd_stop;
218 unsigned char reply_socket;
219 unsigned char if_num;
220 unsigned char pad[2];
221 atlock_t lock;
222 atlock_t delay_lock;
223 atevent_t event;
224 atevent_t delay_event;
225 } asp_scb_t;
226
227
228 int ASPgetmsg(gref_t *, strbuf_t *, strbuf_t *, gbuf_t **, int *, int *);
229 int ASPputmsg(gref_t *, strbuf_t *, strbuf_t *, gbuf_t *, int , int *);
230 void asp_init(void);
231 void asp_ack_reply(gref_t *, gbuf_t *);
232 void asp_nak_reply(gref_t *, gbuf_t *);
233 int asp_wput(gref_t *, gbuf_t *);
234 void asp_clock(void *);
235 void asp_clock_locked(void *);
236 int asp_open(gref_t *);
237 int asp_close(gref_t *);
238
239
240 #endif /* KERNEL_PRIVATE */
241 #endif /* __APPLE_API_OBSOLETE */
242 #endif /* _NETAT_ASP_H_ */