Consolidate license copies
[its.git] / sysdoc / ncp.100
1 Copyright (c) 1999 Massachusetts Institute of Technology
2
3 This program is free software; you can redistribute it and/or modify
4 it under the terms of the GNU General Public License as published by
5 the Free Software Foundation; either version 3 of the License, or (at
6 your option) any later version.
7
8 This program is distributed in the hope that it will be useful, but
9 WITHOUT ANY WARRANTY; without even the implied warranty of
10 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
11 General Public License for more details.
12
13 You should have received a copy of the GNU General Public License
14 along with this program; if not, write to the Free Software
15 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
16 ------------------------------
17
18 Warning- don't believe everything in this file!
19
20
21                      ITS NCP INTERFACE
22
23 CALL:   .OPEN
24
25         FUNCTION:       OPEN channel to Network
26
27         ARGUMENT TEMPLATE:
28                 1.  Channel number in AC field of .OPEN instruction
29                 2.  4 word block addressed by @ E (X) field of 
30                     .OPEN instruction
31                     4 word block has this form:
32
33         _________________________________________________
34         |                       |                       |
35         |      MODE BITS        |   SIXBIT /NET/        |
36         |_______________________|_______________________|
37         |                                               |
38         |                 LOCAL SOCKET                  |
39         |_______________________________________________|
40         |                                               |
41         |                FOREIGN SOCKET                 |
42         |_______________________________________________|
43         |                                               |
44         |                       FOREIGN HOST            |
45         |_______________________________________________|
46
47     
48                            MODE BITS
49
50                                               |--------- don't buffer more
51                                               |          output than allocation
52                                               |
53                                               |   |----- 0-200 words
54                                               |   |      1-2000 words
55                                               |   |
56 ____________________________________________________________________________
57 |           |           |           |   |   |out|big|by- lis gen|im-        |
58 |           |     SIZE OF BYTE      |   |   |ctl|buf| te ten sok|age blk out|
59 |___________|___________|___________|___|___|___|___|___|___|_#_|___|___|___|
60                   |                               |   |   |    |_____|
61 BYTE SIZE IF      |  0-"NORMAL"                   |   |   |       |
62 MODE=44         __|  1-8 BIT BYTE SIZE     _______|   |   |       
63 (BYTE & IMAGE)         IF ASCII                       |   |    STANDARD  
64                        USE BYTE FIELD                 |   |      ITS
65                        IF IMAGE                       |   |     MODES
66                                                       |   |  ______________
67                      0-"NORMAL"                       |   |  |            |
68                      1-LISTEN ON           ___________|   |  | 0XX ASCII  |
69                        LOCAL SOCKET                       |  | 1XX IMAGE  |
70                                                           |  | X0X UNIT   |
71                      0-USE LOCAL                          |  | X1X BLOCK  |
72                        SOCKET FIELD                       |  | XX0 INPUT  |
73                      1-GENERATE            _______________|  | XX1 OUTPUT |
74                        "UNIQUE" SOCKET                       |____________|
75                        # (USE .RCHST
76                        TO FIND OUT 
77                        RESULT)
78
79 \f
80                 
81                 LOCAL SOCKET
82                         32 bit socket # for local identification
83
84                 FOREIGN SOCKET
85                         32 bit socket # determined by foreign host
86                         system
87
88                 FOREIGN HOST
89                         8 bit socket # specifying computer system
90                         with which to contact
91
92
93         RETURNS:        None
94
95         SKIPS:          No Skip If Fails
96
97         FAILURE RETURNS:
98                 Indicated in LH of .STATUS value (low order 6 bits
99                 in LH)
100                 i.e.    .STATUS ch, ac
101                         LDB ac, [220600,,ac]
102
103                 CODE\b\b\b\b____
104
105                  2      "WRONG DIRECTION"
106                         (gender of socket wrong for mode)
107
108                  6      "DEVICE FULL"
109                         (socket table full)
110
111                  7      "DEVICE NOT READY"
112                         (NCP not up, or IMP not up)
113
114                 13      "FILE ALREADY EXISTS"
115                         (socket already open by you on another channel)
116
117                 22      "CONTRADICTORY OPEN"
118                         (byte size mismatched)
119
120                 23      "FILE LOCKED"
121                         (socket number not part of your allocated 
122                         "unique" group of 8 allocated to your job)
123
124                 41      "OTHER END OF PIPELINE GONE OR NOT OPEN"
125                         (HOST dead or non-existant see NETHST call)
126 \f
127
128         SIDE EFFECTS:
129
130
131
132         EXAMPLES:
133                 ;to listen      .OPEN ch, listen
134                                 JRST fail
135                                   .
136                                   .
137
138                 Listen:         20,,'NET
139                                 1               ;waiting socket
140                                 0               ;socket determined when
141                                                  matching RFC received
142                                 0               ;host determined when
143                                                  matching RFC received
144
145
146                 :to get "unique socket"
147                                 .OPEN ch, unique
148                                 JRST fail
149
150                 :Unique         10,,'NET
151                                 0               ;determined by system
152                                 1305            ;foreign socket
153                                 6               ;foreign host
154
155 \f
156 Equivalent:
157
158         .CALL OPEN
159
160         arg 1   mode,,channel number
161         arg 2   SIXBIT/NET/
162         arg 3   local socket
163         arg 4   foreign socket
164         arg 5   host number
165 \f
166
167 CALL:   .RCHST
168
169         FUNCTION:       Read extended STatus of network CHannel
170
171         ARGUMENT TEMPLATE:      AC/ channel,,
172
173
174         RETURNS:
175                 WORD    _________________________________
176                         |               |               |
177                  0      |               |     'NET      |
178                         |_______________|_______________|
179                         |                               |
180                  1      |          LOCAL SOCKET         |
181                         |_______________________________|
182                         |                               |
183                  2      |         FOREIGN SOCKET        |
184                         |_______________________________|
185                         |   |           |  BYTE |       |
186                  3      | I | (reserved)|  SIZE |  HOST |
187                         |___|___________|_______|_______|
188                         |               |               |
189                  4      |   IMP DOWN    |     STATE     |
190                         |_______________|_______________|
191                         |               |               |
192                  5      |  (reserved)   |      CLS      |
193                         |_______________|_______________|
194                         |               |               |
195                  6      |  (reserved)   |     #BITS     |
196                         |_______________|_______________|
197
198
199                 INTERRUPT
200                         4.9 bit of word 3
201                         set by receipt over network of INR/INS
202                         control message (see protocol)
203                         cleared by .RESET
204                         causes interrupt on channel
205
206                 BYTE SIZE
207                         9 bit field
208                         byte size of connection (bits 2.9 - 2.1)
209                 
210                 HOST
211                         9 bit field (8 used by Network foreign host #)
212
213                 IMP DOWN
214                         time in 1/30 sec. until IMP going down 
215                         (if planned)
216                         -1  not going down
217                          0  down
218                         +n  planned to go down in n/30 sec.
219                         (see also NETIMP call)
220 \f
221
222                 STATE
223                         %NSCLS   0  connection closed
224                         %NSLSN   1  listening for RFC
225                         %NSRFC   2  RFC in to listen
226                         %NSRCL   3  CLS received after RFC
227                         %NSRFS   4  RFC sent
228                         %NSOPN   5  open
229                         %NSRFN   6  RFNM wait on output
230                         %NSCLW   7  CLS sent, waiting for matching CLS
231                         %NSCLI  10  CLS received data available to input
232                         %NSINP  11  input available
233
234
235                 REASON FOR CLS (state 0)
236                         %NCNTO   0  never opened connection (not .OPEN)
237                         %NCUSR   1  CLS by user (.CLOSE)
238                         %NCFRN   2  CLS by foreign host
239                         %NCRST   3  RST (reset) from foreign host (dead)
240                         %NCDED   4  host dead (see also NETHST call)
241                         %NCINC   5  incomplete transmission (see NETHST)
242                         %NCBYT   6  byte size mismatch
243                         %NCNCP   7  local NCP went down, breaking connection
244                         %NCRFS  10  connection refused by foreign host
245
246
247         SKIPS:          No skip
248
249         FAILURE RETURNS:        None
250
251
252         SIDE EFFECTS:   None
253
254
255         EXAMPLE:
256                         MOVE ac, [ch,,blk]
257                         .RCHST ac,
258                           .
259                           .
260
261                 BLK:    BLOCK 7
262 \f
263 Equivalent:
264
265         .CALL RCHST
266
267         arg 1   network channel number
268
269         val 1   'NET,,0
270         val 2   local socket number
271         val 3   foreign socket number
272         val 4   4.9 interrupt received
273                 2.1-2.9 byte size
274                 1.1-1.9 host number
275         val 5   LH IMP Down time/reason
276                 RH Socket state (%NSxxx)
277         val 6   Open mode
278         val 7   RH Close reason (%NCxxx)
279         val 8   RH Number of bits\b\b\b\b____ available
280                    (input data available or output buffer room)
281
282
283 .CALL WHYINT
284
285         arg 1   network channel number
286
287         val 1   %WYNET
288         val 2   Socket state (%NSxxx)
289         val 3   Number of bytes\b\b\b\b\b_____ available
290                    (input data available or output buffer room)
291         val 4   Close reason (%NSxxx)
292
293 This call is usually used to respond to a second-word interrupt
294 from a network channel.
295
296 \f
297
298 CALL:   .STATUS
299
300         FUNCTION:       Reads status of Network channel
301
302         ARGUMENT TEMPLATE:
303                 Channel number in AC field of .STATUS instruction
304
305         RETURNS:        Status of word in location addressed by
306                         @ E (X) fields of .STATUS instruction
307
308         SKIPS:          No skip
309
310
311         FAILURE RETURNS:        None
312
313         SIDE EFFECTS:   None
314
315         EXAMPLE:
316                         .STATUS ch, statwd
317                 Statwd: BLOCK 1
318
319
320                 FORMAT OF STATUS WORD
321
322                 _________________________________
323                 |               |               |
324                 |   ERROR CODE  |    SS0026     |
325                 |_______________|_______________|
326
327
328                 ERROR CODE
329                         if IOC (I/O channel error) or OPEN failure,
330                         codes will be stored here.
331
332                 SS
333                         state (byte 140600), same as that given for
334                         .RCHST -- see list of states
335
336                 26      
337                         code for Network device
338
339
340 Equivalent:
341
342         .CALL STATUS
343
344         arg 1   channel number
345
346         val 1   status word as above
347 \f
348
349
350 CALL:   .NETACC
351
352         FUNCTION:       NETwork ACcepts Connection (after LISTEN type
353                         .OPEN)
354                         (to REJECT, do a .CLOSE)
355
356         ARGUMENT TEMPLATE:
357                 Channel number in AC field of .NETACC instruction
358
359         RETURNS:        Nothing
360
361         SKIPS:          Skips on success
362
363         FAILURE RETURNS:
364                 Not skip --not in state 2 (RFC received to LISTEN)
365
366         SIDE EFFECTS:   Sends matching RFC (and "allocate" if input)
367
368         EXAMPLE:
369                         .NETACC ch,
370                         JRST error
371
372
373
374
375 \f
376 CALL:   .NETS
377
378         FUNCTION:       NET Send buffer now
379                 (Buffer is normally sent when "full" or after
380                 1/2 second of first activity)
381
382         ARGUMENT TEMPLATE:
383                 Channel number in AC field .NETS of instruction
384
385         RETURNS:        Nothing
386
387         SKIPS:          No skip
388
389         FAILURE RETURNS:
390                 IOC (I/O channel error)
391                 Code 1, if not SEND (write) channel
392
393         SIDE EFFECTS:   Buffer is queued to be sent immediately
394
395         EXAMPLE:
396                         .NETS ch,
397
398
399 CALL:   .CALL FORCE
400
401         arg 1   channel number
402
403         Equivalent to .NETS (see above)
404
405
406 CALL:   .CALL FLUSH
407
408         arg 1   channel number
409
410         Does FORCE then waits for all buffered data to be sent
411         and for the final RFNM to come back.
412 \f
413
414 CALL:   .CLOSE
415
416         FUNCTION:       CLOSEs channel and returns immediately
417
418         ARGUMENT TEMPLATE:
419                 Channel number in AC field of .CLOSE instruction
420
421         RETURNS:        None
422
423         SKIPS:          No skip
424
425         FAILURE RETURNS:        None
426
427         EXAMPLE:
428                         .CLOSE ch,
429
430
431 Equivalent:
432
433         .CALL CLOSE
434
435         arg 1   channel number
436 \f
437
438 CALL:   .CALL NETBLK
439
440         FUNCTION:       Hang until connection is not in specified
441                 state or until time out 
442
443         ARGUMENT TEMPLATE:
444                 Standard .CALL arguments
445                 1.  channel number
446                 2.  state -- returns when not in this state
447                 3.  (optional) time -- number of 30ths of second
448                     to wait or -- (time since system up) in 30ths
449                     of second
450
451         RETURNS:        1.  (optional) state -- new state
452                         2.  (optional) time -- time left after state
453                             change
454
455         SKIPS:          Skips on success
456
457         FAILURE RETURNS:
458                 Not skip and
459                 OPEN code 14 -- channel number not <20
460                 -- channel not Network device
461
462         SIDE EFFECTS:   None
463
464         EXAMPLE:
465                                 .CALL netblk
466                                 JRST error
467                                   .
468                                   .
469
470                 Netblk:         SETZ
471                                 SIXBIT /NETBLK/
472                                 channel
473                                 state
474                                 time
475                                 2000,,newstate
476                                 402000,,timeleft
477
478                 Channel:        ch
479         
480                 State:          <\b-wait for this state to be left>\b-
481
482                 Time:           <\b-30ths of second to wait>\b-
483
484                 Newstate:       BLOCK 1
485
486                 Timeleft:       BLOCK 1
487
488
489         The time argument is clobbered in the same way that
490         .SLEEP clobbers its AC; unless it is immediate.  In that
491         case, the time out will be restarted if the job is pclsred.
492 \f
493
494 CALL:   .RESET
495
496         FUNCTION:       Used to RESET interrupt bit
497                 (INR/INS from Network)
498
499         ARGUMENT TEMPLATE:
500                 Channel number in AC field of .RESET instruction
501
502         RETURNS:        Nothing
503
504         SKIPS:          No skip
505
506         FAILURE RETURNS:        None
507
508         SIDE EFFECTS:   Clears the Network interrupt bit (see .RCHST,
509                 bit 4.9 of word 3)
510
511         EXAMPLE:
512                         .RESET ch,
513
514 Equivalent:
515
516         .CALL RESET
517
518         arg 1   channel number
519 \f
520
521
522 CALL:   .NETINT
523
524         FUNCTION:       Sends Network INR/INS control message for
525                 link corresponding to channel.  (TELNET protocol also 
526                 demands a "data mark" to be inserted in the stream)
527
528         ARGUMENT TEMPLATE:
529                 Channel number in AC field of .NETINT instruction
530
531         RETURNS:        Nothing
532
533         SKIPS:          Skip if success
534                         No skip if Network down or not a Network
535                         channel
536
537         FAILURE RETURNS:        
538                 I/O Channel error Interrupt, NET went down
539                 Code 1
540
541         SIDE EFFECTS:   Sends NET INR/INS control message
542
543         EXAMPLE:
544                         .NETINT ch,
545                         JRST fail
546 \f
547
548
549
550 CALL:   .GETSYS areas
551                 NCPHTB
552                 NCPPQ
553                 NCPSM
554
555         FUNCTION:       Get socket map
556                         host table
557                         pending queue
558
559         ARGUMENT TEMPLATE:
560                 Name of first of 2 consecutive accumulators in AC
561                 field of .GETSYS instruction
562
563                 ac/     -<\b-length>\b-,,<\b-address>\b-    ;CPTR to block to store
564
565                 ac+1/   SIXBIT/<\b-name>\b-/      ;sixbit name of area
566                                                  desired
567
568
569         RETURNS:        Block of desired information
570
571         SKIPS:          Skips on success
572
573         FAILURE RETURNS:
574                 No skip -- area name not known in system -- not
575                 enough memory
576                 (ac+1 zeroes)
577                 (ac gets <-lng,,> for number of words needed)
578
579         SIDE EFFECTS:   None
580
581         EXAMPLE 1:
582                 ;This can be used to find out how much storage is
583                  needed for a .GETSYS block
584
585                                 HRROI ac,temp
586                                 MOVE ac+1, [SIXBIT/NCPSM/]
587                                 .GETSYS ac,
588                                 HLRES ac                ;here ac contains
589                                                          lng,,temp
590                                 MOVNS ac                ;now ac contains
591                                                          number of words
592                                                          needed
593                                 CALL FREE (ac)
594
595
596         EXAMPLE 2:
597                                 MOVE ac, [-lng,,blk]
598                                 MOVE ac+1 [SIXBIT /NCPSM/]
599                                                 or NCPHTB or NCPPQ
600                                 .GETSYS ac,
601                                 JRST error
602                                   .
603                                   .
604
605                 BLK:            BLOCK lng
606
607
608 \f
609 NCPHTB area
610
611         Length -- 400 (8) words (256(10))
612
613         Format -- one word per host number
614                 (word(i) is data for host.number (i))
615
616         Each word has info packed --
617         
618         |1|      | 2 |    9    |       18   
619         ______________________________________________
620         |R|      |   |         |  |                  |
621         |F|      |   |         |  |                  |
622         |N|unused|RST| CTL TIME|00| HOST DEAD STATUS |
623         |M|      |   |         |  |                  |
624         |_|______|___|_________|__|__________________|
625
626
627         RFNM    0-control link open
628                 1-waiting for RFNM on control link
629
630         RST     0-host down or not tried
631                 1-sent RST to see if up
632                 2-got RRP, connections may be opened
633
634         CTL TIME                            9
635                 Last time (1/30 sec module 2 )
636                 message sent to this host on control link (0)
637
638         HOST DEAD STATUS
639                 Last HOST DEAD STATUS from this host's IMP
640                 (See RFC 611)
641
642 (If data for a single host is desired, use the NETHST call)
643 \f
644         HOST DEAD STATUS in right half
645
646         Bits 20-31      (byte pointer [041400,,x])
647                         give the time of the Host's coming back up,
648                         bit-coded as follows:
649
650
651         Bits 20-22      (byte pointer [150300,,x]
652                         the day of the week the Host is coming back up
653                         Monday is day 0 and Sunday is day 6
654
655         Bits 23-27      (byte pointer [100500,,x])
656                         the hour of the day, from hour 0 to hour 23,
657                         that the Host is coming back up
658
659         Bits 28-31      (byte pointer [040400,,x])
660                         the five minute interval, from 0 to 11, in the
661                         hour that the Host is coming back up
662
663
664         All three of the above are specified in Universal Time
665         (i.e., G.M.T.).  The Host may indicate that it will be
666         coming back up more than a week away by setting bits 20-31
667         all to ones (7777).  Setting all bits 20-30 to one and bit
668         31 to zero (20-31 = 7776) means it is unknown when the Host
669         is coming back up. 
670
671 \fBits 32-35 have the follwing meanings:
672
673           Value  Meaning
674           -----  -------
675
676           0    The destination Host is not communicating with the
677                network -- the destination IMP has no information
678                about the cause.  Note that this is the message most
679                likely to occur if the destination IMP has gone down
680                since the destination Host went down.
681
682           1    The destination Host is not communicating with the
683                network -- it took its ready-line down without saying
684                why.
685
686           2    The destination Host is not communicating with the
687                network -- the Host was tardy in taking traffic from
688                the network and the network had to declare the Host
689                down.
690
691           3    The destination Host does not exist to the knowledge
692                of the NCC.
693
694           4    Currently unused.
695
696           5    The destination Host is down for scheduled P.M.
697
698           6    The destination Host is down for scheduled hardware
699                work.
700
701           7    The destination Host is down for scheduled software
702                work.
703
704           8    The destination Host is down for emergency restart.
705
706           9    The destination Host is down because of power outage.
707
708           10   The destination Host is stopped at a software
709                breakpoint.
710
711           11   The destination Host is down because of a hardware
712                failure.
713
714           12-15 Currently Unused.
715
716      When the value of this 4-bit field is 0,1,2, or 3, bits 20-31
717 will have the "unknown" indication.
718 \fNCPPQ area -- pending queue of RFC's
719
720         Length -- variable 3+4*n where n is currently 40 (8) but
721                   may change
722
723         Format -- 
724                 word 0 -- relocation word, tells location in system
725                 core where first slot begins
726
727                 word 1 -- pointer to first queue entry
728
729                 word 2 thru 4*n+1 -- 4 word slot for queue or -1 if
730                         last one on queue
731                      (0) -- pointer to next one (must un-relocate, 
732                             using word 0
733                      (1) -- local socket number
734                      (2) -- foreign socket number
735                      (3) -- sign bit 0 = STR  1 = RTS
736                             low order 8 bits (byte pointer [001000,,X])
737                             link number if RTS
738                             byte size if STR
739                             next 8 bits (byte pointer [101000,,x])
740                             foreign Host number
741
742
743 Example of unrelocating for the NCPPQ area.
744         ;Let ac,ac+1 and b be accumulators
745
746                 MOVE ac, [-lng,,blk]
747                 MOVE ac+1, [SIXBIT /NCPPQ/]
748                 GETSYS ac,
749                 JRST error
750                 MOVEI ac, blk
751                 MOVN b,(ac)                     ;-system address
752         loop:   ADD ac,b                        ;ac now points to
753                                                 ;first queue entry
754
755                         ;0(ac) is next pointer word
756                         ;1(ac) is local socket word
757                         ;2(ac) is foreign socket word
758                         ;3(ac) is Host -- lind/byte word
759
760                 MOVE ac,0(ac)                   ;get next
761                 JUMPGE ac,loop                  ;loop if not last one
762
763 \fNCPSM area
764
765         Length -- 1+13.*20. = 261(10) or 405(8)
766                   there are 13 (or more) blocks each of length
767                   IMPSTL (an assebly parameter, currintly 20(n))
768
769         Format -- 
770                   word 0 -- contains IMPSTL, the number of words
771                             in each block
772                   word 1 -- begins first block -- the blocks are:
773
774 IMSOC1: REPEAT IMPSTL,0         ; 0 => FREE
775                                 ; 4.9 = 1 => SOCKET IN USE
776                                 ; 4.8 = 1 => CHNL TRYING TO BE CLOSED
777                                 ; 3.1-4.7 MASK FOR INTERRUPT BIT (LSH 1 CHNL#)
778                                 ; RH = USER INDEX
779 IMSOC2: BLOCK IMPSTL            ; 1.1-4.5 = LOCAL SOCKET NUMBER
780                                 ; 4.6-4.9  0 (MAKES COMPARISONS EASIER)
781 IMSOC3: BLOCK IMPSTL            ; 1.1-4.5 = FOREIGN SOCKET NUMBER
782                                 ; 4.6-4.9 = 0
783 IMSOC4: BLOCK IMPSTL            ; RH = SOCKET STATE
784                                 ; 3.1-3.8 = LINK NUMBER
785                                 ; 3.9-4.7 = FOREIGN HOST NUMBER
786                                 ; 4.8 = SET BY RCV CLS - MAKES MATCH USING IMSCHD FAIL
787                                 ; 4.9 = SEND THIS BUFFER NOW
788 IMSOC5: BLOCK IMPSTL            ; 1.1-1.8 = CONNECTION BYTE SIZE
789                                 ; 2.1-2.9 = CLOSE REASON
790                                 ; 3.1-3.8 = USER BYTE SIZE
791                                 ; 3.9 => ASCII MODE - 7 BIT
792                                 ; 4.1 => ASCII MODE - 8 BIT
793                                 ; 4.2 => 1 BIT BYTES
794                                 ; 4.3 => NET INTERRUPT (INR/INS) RECEIVED
795                                 ; 4.4 => HAVE BEGUN CLOSE TIMEOUT
796                                 ; 4.5 => CLOSED WHILE IN RFNM WAIT, EXPECT ANOTHER RFNM
797                                 ; 4.9 => TRANSFER IN 32 BIT MODE
798 IMSOC6: BLOCK IMPSTL            ; RH => BUFFER ADDRESS
799                                 ; 4.9 => LOCKED BY CORE JOB
800                                 ; 4.8 => ACTIVE AT PI LEVEL
801                                 ; 4.7 => INPUT OCCURRED WHILE BUFFER LOCKED
802                                 ; 3.1-3.8 => IOBFT INDEX, OR 377 IF BIG BUFFER
803 IMSOC7: BLOCK IMPSTL            ; BIT ALLOCATION
804 IMSOC8: BLOCK IMPSTL            ; MESSAGE ALLOCATION
805 IMSC7I: BLOCK IMPSTL            ; AMOUNT TO INCREASE BIT ALLOCATION BY IN NEXT ALL MSG
806 IMSC8I: BLOCK IMPSTL            ; AMOUNT TO INCREASE MESSAGE ALLOCATION BY " " " "
807 IMSOCT: BLOCK IMPSTL            ; TIME WHEN FIRST MESS PUT INTO BUF
808                                 ; (DURING INPUT HAS NUMBER OF DATA BYTES LEFT IN MSG)
809                                 ; (DURING CLOSE HAS TIME TIMEOUT STARTED)
810 IMSMPP: BLOCK IMPSTL            ; MAIN PROGRAM POINTER, ILDB OR IDPB FOR NEXT BYTE
811 IMSMPC: BLOCK IMPSTL            ; MAIN PROGRAM COUNTER, FOR OUTPUT HAS ROOM LEFT
812                                 ; IN BUFFER IN BYTES.  FOR INPUT HAS TOTAL NUMBER
813                                 ; OF DATA BYTES IN THE BUFFER.
814 IMSPIP: BLOCK IMPSTL            ; INTERRUPT LEVEL POINTER.  FOR OUTPUT ILDB GETS
815                                 ; FIRST BYTE OF NEXT MESSAGE OUT.  FOR INPUT RH
816                                 ; HAS ADDRESS OF HEADER WORD OF NEXT MESSAGE IN.
817 IMSBFE: BLOCK IMPSTL            ; BYTE POINTER TO LAST BYTE IN BUFFER.
818 \f
819 CALL:   .IOT
820
821         FUNCTION:       Transfer data in or out over Network
822
823         ARGUMENT TEMPLATE:
824                 Channel number in AC field of .IOT in struction
825                 <\b-word>\b- or pointer to block
826
827         RETURNS:        None (unit output mode)
828                         Datum (unit input mode)
829                         Updated pointer (block mode)
830
831         SKIPS:          No skip
832
833         FAILURE RETURNS:
834                 I/O Channel error INTERRUPT
835                 Code 1 -- Network went down
836                 Code 8 -- Attempted output mode IOT when not in
837                           State 5 (open) or State 6 (RFNM wait)
838                           Or attempted input IOT when in bad state
839                           or when closed other than by foreign host.
840                 End of file is sensed when input is done from
841                 a socket closed by the foreign host.  In unit
842                 image mode this gives I/O channel error code 2.
843
844         SIDE EFFECTS:
845                 Output -- data buffered to be sent
846                 Input  -- data copied from buffer ALLOCATE sent if
847                           buffer empty (enough)
848
849         EXAMPLE:        .IOT ch, foo
850
851
852 In image block mode, one byte per word is transferred,
853 right-justified.
854
855 In ascii block mode, five bytes per word are transferred,
856 or four bytes per word (8-bit) if mode bit 1.6 was on in
857 the OPEN.
858