]> git.saurik.com Git - apple/xnu.git/blob - bsd/netat/asp.h
xnu-123.5.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
34 #define ASP_Version 0x100
35
36 #define ASPFUNC_CloseSess 1
37 #define ASPFUNC_Command 2
38 #define ASPFUNC_GetStatus 3
39 #define ASPFUNC_OpenSess 4
40 #define ASPFUNC_Tickle 5
41 #define ASPFUNC_Write 6
42 #define ASPFUNC_WriteContinue 7
43 #define ASPFUNC_Attention 8
44 #define ASPFUNC_CmdReply 9
45
46 #define ASPIOC 210 /* AT_MID_ASP */
47 #define ASPIOC_ClientBind ((ASPIOC<<8) | 1)
48 #define ASPIOC_CloseSession ((ASPIOC<<8) | 2)
49 #define ASPIOC_GetLocEntity ((ASPIOC<<8) | 3)
50 #define ASPIOC_GetRemEntity ((ASPIOC<<8) | 4)
51 #define ASPIOC_GetSession ((ASPIOC<<8) | 5)
52 #define ASPIOC_GetStatus ((ASPIOC<<8) | 6)
53 #define ASPIOC_ListenerBind ((ASPIOC<<8) | 7)
54 #define ASPIOC_OpenSession ((ASPIOC<<8) | 8)
55 #define ASPIOC_StatusBlock ((ASPIOC<<8) | 9)
56 #define ASPIOC_SetPid ((ASPIOC<<8) |10)
57 #define ASPIOC_GetSessId ((ASPIOC<<8) |11)
58 #define ASPIOC_EnableSelect ((ASPIOC<<8) |12) /* not needed */
59 #define ASPIOC_Look ((ASPIOC<<8) |13)
60
61 #define MOREDATA 1
62
63 /* The following ASP error codes are defined in Inside AppleTalk: */
64
65 #define ASPERR_NoError 0
66 #define ASPERR_BadVersNum -1066
67 #define ASPERR_BufTooSmall -1067
68 #define ASPERR_NoMoreSessions -1068
69 #define ASPERR_NoServers -1069
70 #define ASPERR_ParamErr -1070
71 #define ASPERR_ServerBusy -1071
72 #define ASPERR_SessClosed -1072
73 #define ASPERR_SizeErr -1073
74 #define ASPERR_TooManyClients -1074
75 #define ASPERR_NoAck -1075
76
77 /* These ASP error codes were apparently defined later: */
78
79 #define ASPERR_NoSuchDevice -1058
80 #define ASPERR_BindErr -1059
81 #define ASPERR_CmdReply -1060
82 #define ASPERR_CmdRequest -1061
83 #define ASPERR_SystemErr -1062
84 #define ASPERR_ProtoErr -1063
85 #define ASPERR_NoSuchEntity -1064
86 #define ASPERR_RegisterErr -1065
87
88 typedef struct {
89 at_inet_t SLSEntityIdentifier;
90 at_retry_t Retry;
91 int StatusBufferSize;
92 } asp_status_cmd_t;
93
94 typedef struct {
95 at_inet_t SLSEntityIdentifier;
96 at_retry_t Retry;
97 unsigned short TickleInterval;
98 unsigned short SessionTimer;
99 } asp_open_cmd_t;
100
101 typedef struct {
102 int Primitive;
103 int CmdResult;
104 unsigned short ReqRefNum;
105 unsigned short Filler;
106 } asp_cmdreply_req_t;
107
108 typedef struct {
109 int Primitive;
110 int CmdResult;
111 } asp_cmdreply_ind_t;
112
113 typedef struct {
114 int Primitive;
115 unsigned short ReqRefNum;
116 unsigned char ReqType;
117 unsigned char Filler;
118 } asp_command_ind_t;
119
120 union asp_primitives {
121 int Primitive;
122 asp_cmdreply_ind_t CmdReplyInd;
123 asp_cmdreply_req_t CmdReplyReq;
124 asp_command_ind_t CommandInd;
125 };
126
127 #ifdef KERNEL
128
129 #define ASPSTATE_Close 0
130 #define ASPSTATE_Idle 1
131 #define ASPSTATE_WaitingForGetStatusRsp 2
132 #define ASPSTATE_WaitingForOpenSessRsp 3
133 #define ASPSTATE_WaitingForCommandRsp 4
134 #define ASPSTATE_WaitingForWriteContinue 5
135 #define ASPSTATE_WaitingForWriteRsp 6
136 #define ASPSTATE_WaitingForWriteContinueRsp 7
137 #define ASPSTATE_WaitingForCloseSessRsp 8
138 #ifdef NOT_USED
139 #define ASPSTATE_WaitingForCfgAck 9
140 #endif
141
142 /*
143 * ATP state block
144 */
145 typedef struct {
146 gref_t *atp_gref; /* gref must be the first entry */
147 int pid; /* process id, must be the second entry */
148 gbuf_t *atp_msgq; /* data msg, must be the third entry */
149 unsigned char dflag; /* structure flag, must be the fourth entry */
150 unsigned char filler[3];
151 } atp_state_t;
152
153 /*
154 * ASP word
155 */
156 typedef struct {
157 unsigned char func;
158 unsigned char param1;
159 unsigned short param2;
160 } asp_word_t;
161
162 /*
163 * ASP session control block
164 */
165 typedef struct asp_scb {
166 gref_t *gref; /* read queue pointer, must be the first entry */
167 int pid; /* process id, must be the second entry */
168 atp_state_t *atp_state; /* atp state info, must be the third entry */
169 unsigned char dflag; /* structure flag, must be the fourth entry */
170 unsigned char state;
171 unsigned char sess_id;
172 unsigned char tmo_delta;
173 unsigned char tmo_cnt;
174 unsigned char rem_socket;
175 unsigned char rem_node;
176 unsigned char magic_num;
177 unsigned short snd_seq_num;
178 unsigned short rcv_seq_num;
179 unsigned short filler;
180 unsigned short tickle_tid;
181 unsigned short tickle_interval;
182 unsigned short session_timer;
183 unsigned short attn_tid;
184 unsigned char attn_flag;
185 unsigned char req_flag;
186 gbuf_t *req_msgq;
187 unsigned short wrt_seq_num;
188 unsigned char get_wait;
189 unsigned char ioc_wait;
190 at_retry_t cmd_retry;
191 at_inet_t loc_addr;
192 at_inet_t rem_addr;
193 at_inet_t svc_addr;
194 gbuf_t *sess_ioc;
195 gbuf_t *stat_msg;
196 void (*tmo_func)();
197 struct asp_scb *next_tmo;
198 struct asp_scb *prev_tmo;
199 struct asp_scb *sess_scb;
200 struct asp_scb *next_scb;
201 struct asp_scb *prev_scb;
202 unsigned char sel_on; /* not needed */
203 unsigned char user;
204 unsigned char rcv_cnt;
205 unsigned char snd_stop;
206 unsigned char reply_socket;
207 unsigned char if_num;
208 unsigned char pad[2];
209 atlock_t lock;
210 atlock_t delay_lock;
211 atevent_t event;
212 atevent_t delay_event;
213 } asp_scb_t;
214
215 #endif /* KERNEL */
216 #endif /* _NETAT_ASP_H_ */