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