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