Machine-Independent MDL for TOPS-20 and VAX.
[pdp10-muddle.git] / mim / development / mim / vax / mimlib / l-netdefs.mud
1 <DEFINITIONS "L-NETDEFS">
2
3 ;"*****************************************************************************
4
5   This file defines constants and macros related to library format, local
6   library operations, and other random cruft.
7
8   L-NETDEFS.MUD: EDIT HISTORY            Machine Dependent (For use under UNIX)
9
10   COMPILATION: Include when compiling.
11
12   JUN84   [Shane] - Created.
13   4OCT84  [Shane] - Commented, cleaned up.
14   20OCT84 [Shane] - More sensible protocols.
15
16   ****************************************************************************"
17
18 <USE "NEWSTRUC" "NETBASE" "HOSTS">
19
20 <INCLUDE "NETDEFS">
21
22 ;"HOST NUMBERS FOR HOSTS RECOGNIZED BY LIBRARY SERVER.
23   For some reason, calling HOST in MIMC loses, so abstract this DEFINITIONS
24   so that the abstract will be included instead."
25
26 <MSETG MIT-AJAX         <HOST "MIT-AJAX">>
27 <MSETG MIT-LCS-HQ       <HOST "MIT-LCS-HQ">>
28 <MSETG MIT-HEINEKEN     <HOST "MIT-HEINEKEN">>
29 <MSETG MIT-GRAPE-NEHI   <HOST "MIT-GRAPE-NEHI">>
30 <MSETG MIT-MOLSON       <HOST "MIT-MOLSON">>
31 <MSETG MIT-KIRIN        <HOST "MIT-KIRIN">>
32 <MSETG MIT-MACEWAN      <HOST "MIT-MACEWAN">>
33 <MSETG MIT-DM           <HOST "MIT-DM">>
34
35 ;"SERVICE DESCRIPTOR FOR OBTAINING LIBRARY SERVICE."
36
37 <MSETG LIB-SERVICE <PUTLHW ,SERV-MIN-NONPRIV ,PROT-TCP>>
38
39 ;"REQUEST TYPES RECOGNIZED BY LIBRARY SERVER."
40
41 <MSETG ABORT-REQUEST            0>          ;"Toplevel request type codes."
42 <MSETG FILE-REQUEST             1>
43 <MSETG PACKAGE-REQUEST          2>
44 <MSETG MAP-RECORDS-REQUEST      3>
45 <MSETG RECORD-REQUEST           4>
46 <MSETG ENTRY-REQUEST            5>
47 <MSETG COUNT-REQUEST            6>
48 <MSETG UPDATE-REQUEST           7>
49
50 ;"*******************************************************************************
51   ABORT-REQUEST: Abort request in progress. If an update request is aborted, this
52                  includes deletion of temporary files.
53
54         *------------------------*--------*
55         |XXXXXXXXXXXXXXXXXXXXXXXX|00000000|
56         *------------------------*--------*
57
58         RESPONSE:       NACK (0) and the request is terminated.
59
60   *******************************************************************************"
61 \f
62 <MSETG FILE-CLOSE       0>
63 <MSETG FILE-READ        1>
64 <MSETG FILE-ACCESS      2>
65
66 ;"*******************************************************************************
67   FILE-REQUEST: Open and access files accessible to server.
68
69         *--------*-----------------*--------*
70         |XXXXXXXX|      NAME LENGTH|00000001|
71         *--------*--------*--------*--------*
72         |   MASK3|   MASK2|   MASK1|   MASK0|
73         *--------*--------*--------*--------*
74         /                                   /
75         / NAME (8-BIT ASCII)                /
76         /                                   /
77         *-----------------------------------*
78
79         NAME LENGTH =   size(NAME), 0 < size(NAME) < 1025
80
81         RESPONSE:       Either length of file in bytes or NACK (0).
82
83   PACKAGE-REQUEST: Open and access a library module.
84
85         Same picture, different type code.
86
87         RESPONSE:       Either length of file in bytes or NACK (0).
88
89         The only difference between FILE-REQUEST and PACKAGE-REQUEST is that
90         PACKAGE-REQUEST looks up NAME of file in library but FILE-REQUEST
91         assumes that NAME is a file name (which may contain a directory path
92         other than server's directory). For FILE-REQUEST, DEV and SNM default
93         to server's DEV and SNM. NM2 is not defaulted unless the MASK word is
94         non-zero, in which case the implied second names will be tried in turn.
95         The MASK word must be non-zero for PACKAGE-REQUEST. The MASK word is
96         interpreted as an encoding of L-SECOND-NAMES, lower numbered bytes
97         taking precedence; a zero byte denotes the end of the list. The allowed
98         MASKS are:
99
100         00000001 - MSUBR
101         00000010 - MUD
102         00000100 - ABSTR
103         00001000 - DOC
104
105   File requests honored after initial request is acknowledged.
106
107         FILE-CLOSE:     Same as ABORT-REQUEST.
108
109                         *-----------------------*--------*
110         FILE-READ:      |                 AMOUNT|00000001|
111                         *-----------------------*--------*
112
113         RESPONSE:       The requested number of bytes is written from current
114                         position in file (provided end of file is not seen).
115                         It is the responsibility of the user to guarantee that
116                         the network pipe is empty at the time of the request.
117
118                         *-----------------------*--------*
119         FILE-ACCESS:    |                ADDRESS|00000010|
120                         *-----------------------*--------*
121
122         RESPONSE:       ACK (-1). The file pointer becomes ADDRESS.
123   *******************************************************************************"
124 \f
125 <MSETG MAP-NEXT-RECORD  3>
126 <MSETG MAP-SHORT-RECORD *20000000000*>
127
128 ;"*******************************************************************************
129   MAP-RECORDS-REQUEST: Obtain every record in the library in bucket order.
130
131         *------------------------*--------*
132         |XXXXXXXXXXXXXXXXXXXXXXXX|00000011|
133         *------------------------*--------*
134
135   RESPONSE:     ACK (-1)
136
137   Once the request has been acknowledged:
138
139                                 *------------------------*--------*
140         MAP-NEXT-RECORD:        |SXXXXXXXXXXXXXXXXXXXXXXX|00000011|
141                                 *------------------------*--------*
142
143         RESPONSE:               NACK (0) if all the records have been seen, and
144                                 the request is terminated. Otherwise the record
145                                 itself. The length of the record (including the
146                                 first word) is BITS[31:16] in the first word of
147                                 the record. If S is set (MAP-SHORT-RECORD) a short
148                                 record is sent, otherwise, a long record is sent
149                                 (see LIBRARY.FORMAT).
150
151   *******************************************************************************"
152
153 <MSETG RECORD-SHORT     *20000000000*>
154
155 ;"*******************************************************************************
156   RECORD-REQUEST: Obtain library record by name.
157
158         *--------*----------------*--------*
159         |SXXXXXXX|     NAME LENGTH|00000100|
160         *--------*----------------*--------*
161         /                                  /
162         / NAME (8-BIT ASCII)               /
163         /                                  /
164         *----------------------------------*
165
166         NAME LENGTH = mod(size(NAME), 1024), 0 < size(NAME) < 1024
167
168         RESPONSE:       NACK (0) if record is not found, otherwise the record
169                         itself. The length of the record (including the first
170                         word) is BITS[31:16] in the first word of the record.
171                         If S is set (RECORD-SHORT) a short record is sent,
172                         otherwise, a long record is sent (see LIBRARY.FORMAT).
173                         The request is terminated after response is transmitted.
174   *******************************************************************************"
175 \f
176 ;"*******************************************************************************
177   ENTRY-REQUEST: Obtain library information about every entry for given name.
178
179         *--------*----------------*--------*
180         |XXXXXXXX|     NAME LENGTH|00000101|
181         *--------*----------------*--------*
182         /                                  /
183         / NAME (8-BIT ASCII)               /
184         /                                  /
185         *----------------------------------*
186
187         NAME LENGTH = mod(size(NAME), 1024), 0 < size(NAME) < 1024
188
189         RESPONSE:       NACK (0) if no information is found, otherwise entry
190                         data block. The length of the block (including first
191                         word is in BITS[15:0] of the first word of block.
192                         BITS[31:16] contain count of entry descriptors in data
193                         block (see L-BASE.MUD, comment for ENTRY-DATA). The
194                         request is terminated after response is transmitted.
195   *******************************************************************************"
196
197 ;"*******************************************************************************
198   COUNT-REQUEST: Obtain count of number of packages and entries.
199
200         *------------------------*--------*
201         |XXXXXXXXXXXXXXXXXXXXXXXX|00000110|
202         *------------------------*--------*
203
204         RESPONSE:       The number of entries/rentries followed by the number of
205                         packages/definitions as (32-BIT fixes). The request is
206                         terminated after response is transmitted.
207   *******************************************************************************"
208
209 ;"*******************************************************************************
210   UPDATE-REQUEST: Lock library for update transactions.
211
212         *------------------------*--------*
213         |XXXXXXXXXXXXXXXXXXXXXXXX|00000111|
214         *------------------------*--------*
215
216         RESPONSE:       ACK (-1) if the library is locked. NACK (0), otherwise,
217                         and the request is terminated.
218   *******************************************************************************"
219
220 <MSETG UPDATE-ABORT     0>                  ;"Toplevel update requests."
221 <MSETG UPDATE-EXISTS?   1>
222 <MSETG UPDATE-ADD       2>
223 <MSETG UPDATE-DEL       3>
224 <MSETG UPDATE-GC        4>
225 <MSETG UPDATE-INSTALL   5>
226 <MSETG UPDATE-UNLOCK    6>
227 <MSETG UPDATE-FILE      *20000000000*>      ;"Modifier for ADD, DEL, EXISTS?"
228 \f
229 ;"*******************************************************************************
230   Update requests honored after REQUEST-UPDATE is acknowledged.
231
232                         *------------------------*--------*
233   UPDATE-ABORT:         |XXXXXXXXXXXXXXXXXXXXXXXX|00000000|
234                         *------------------------*--------*
235
236   RESPONSE:             NACK (0). All transactions occurring since the last
237                         install operation are aborted and the request
238                         is terminated.
239
240                         *--------*----------------*--------*
241   UPDATE-EXISTS?:       |FXXXXXXX|     NAME LENGTH|00000001|
242                         *--------*----------------*--------*
243                         /                                  /
244                         / NAME (8-BIT ASCII)               / size(NAME) < 1025
245                         /                                  /
246                         *----------------------------------*
247
248   RESPONSE:             If F = 0 then ACK (-1) if record named NAME is in
249                         library, otherwise NACK (0). If F = 1 then ACK (-1)
250                         if file named NAME is in library directory, else NACK.
251
252                         *------------------------*--------*
253   UPDATE-ADD:           |0XXXXXXXXXXXXXXXXXXXXXXX|00000010| F = 0
254                         *------------------------*--------*
255                         /                                 /
256                         / LIBRARY RECORD                  /
257                         /                                 /
258                         *---------------------------------*
259                         / DATA ADDRESS (4 WORDS)          /
260                         *---------------------------------*
261                         |                      FILE LENGTH| CONTROL
262                         *---------------------------------*
263                         / FILE (MSUBR)                    / DATA
264                         *---------------------------------*          -> ACK
265                         |                      FILE LENGTH| CONTROL
266                         *---------------------------------*
267                         / FILE (MUD)                      / DATA
268                         *---------------------------------*          -> ACK
269                         |                      FILE LENGTH| CONTROL
270                         *---------------------------------*
271                         / FILE (ABSTR)                    / DATA
272                         *---------------------------------*          -> ACK
273                         |                      FILE LENGTH| CONTROL
274                         *---------------------------------*
275                         / FILE (DOC)                      / DATA
276                         *---------------------------------*          -> ACK
277                                                                      -> ACK
278
279   RESPONSE:             Files are transferred in order shown, although not all
280                         types need be present (names and types specified by
281                         LIBRARY RECORD). The server responds with ACK (-1) after
282                         each file is received. The server responds with ACK (-1)
283                         when the request is serviced. Otherwise NACK (0) and the
284                         update is terminated. The protocol shown if for library
285                         records (F bit = 0). The protocol for file is similar
286                         and shown below.
287 \f
288                         *--------*----------------*--------*
289   UPDATE-ADD:           |1XXXXXXX|     NAME LENGTH|00000010| F = 1
290                         *--------*----------------*--------*
291                         / NAME (8-BIT ASCII)               /
292                         *----------------------------------*
293                         / DATA ADDRESS (4 WORDS)           /
294                         *----------------------------------*
295                         |                       FILE LENGTH| CONTROL
296                         *----------------------------------*
297                         / FILE                             / DATA
298                         *----------------------------------*          -> ACK
299                                                                     -> ACK
300                         *--------*----------------*--------*
301   UPDATE-DEL:           |FXXXXXXX|     NAME LENGTH|00000011|
302                         *--------*----------------*--------*
303                         /                                  /
304                         / NAME (8-BIT ASCII)               / size(NAME) < 1025
305                         /                                  /
306                         *----------------------------------*
307
308   RESPONSE:             If F = 0 then ACK (-1) if record named NAME is
309                         successfully removed from library, otherwise NACK (0)
310                         and update is aborted. If F = 1, then NAME is
311                         interpreted as a file name instead.
312
313                         *------------------------*--------*
314   UPDATE-GC:            |XXXXXXXXXXXXXXXXXXXXXXXX|00000100|
315                         *------------------------*--------*
316
317   RESPONSE:             ACK (-1) if library is successfully garbage collected,
318                         otherwise NACK (0) and update is terminated.
319
320                         *------------------------*--------*
321   UPDATE-INSTALL:       |XXXXXXXXXXXXXXXXXXXXXXXX|00000101|
322                         *------------------------*--------*
323
324   RESPONSE:             ACK (-1) if modified library is successfully installed
325                         and locked, otherwise NACK (0) and update is
326                         terminated.
327
328                         *------------------------*--------*
329   UPDATE-UNLOCK:        |XXXXXXXXXXXXXXXXXXXXXXXX|00000110|
330                         *------------------------*--------*
331
332   RESPONSE:             ACK (-1) if modified library is successfully installed
333                         and released, otherwise NACK (0). Update is terminated.
334   *******************************************************************************"
335
336 <MSETG ACK -1>                   ;"Acknowledge."
337 <MSETG NACK 0>                   ;"Negative acknowledge."
338
339 ;"REMOTE -- Return T if CHANNEL is NETWORK channel."
340
341 <DEFMAC REMOTE? ('CHANNEL)
342    <CHTYPE (==? <CHTYPE (CHANNEL-TYPE .CHANNEL) FORM> NETWORK) FORM>>
343
344 ;"Channel type synonym."
345
346 <PUT-DECL NET '<CHANNEL 'NETWORK>>
347 \f
348 ;"NFDATA -- Channel data for NETFILE channel."
349
350 <NEWSTRUC NFDATA VECTOR
351           NF-FSIZ FIX                 ;"File size in bytes."
352           NF-FPTR FIX                 ;"Current position in file."
353           NF-NAME STRING              ;"File name."
354           NF-CONN <CHANNEL 'NETWORK>> ;"Channel to network server."
355
356 ;"TIMEOUTS (seconds)."
357
358 <MSETG STANDARD-TIMEOUT 4>        ;"Timeout for non-update requests."
359 <MSETG UPDATE-TIMEOUT   30>       ;"Timeout for update requests."
360
361 <END-DEFINITIONS>