.TITLE SBNARP arpanet leader processing .NLIST BEX .ENABL LC ; ; Pdp11/dcn - arpanet leader processing ; ; This module adds and removes arpanet leaders. ; ; External symbols ; .GLOBL RDRIN,RDROT ;redirect processing ; ; Entry symbols ; .GLOBL SBNARP ;transfer vector .GLOBL SBNHDH ;transfer vector ; ; System definitions ; .ASECT .MCALL .COM,.PSA,.GAT,.TRDEF ;dcnlib definitions .MCALL .TRAP ;dcnlib macros .MCALL $DFIH,$DFAH ;moslib definitions .COM ;define common data .PSA ;define process storage areas .GAT ;define gateway/bridge storage areas .TRDEF ;define trap codes $DFIH ;define internet header $DFAH ;define arpanet leader ; ; Procedure segment ; ; Process-state procedure ; Dsects: r3 = par, r5 = psa ; .PSECT $SUPI,RO,I ; ; Initialize input ; Initialize output ; ARPINI: MOV PARVEC(R3),R0 ;initialize EMT INI+EXTBAS RTS PC ; ; Start input ; R2 = data area length, r4 = buffer pointer, returns c(cc) = c if error ; ARPINP: MOV R2,-(SP) ;adjust for arpanet leader ADD #AH.LEN,@SP MOV R4,R1 ADD #BUFLDR-AH.LEN,R1 1$: MOV @SP,R0 ;restore length CCC ;(clean condition codes) EMT SIO+EXTBAS ;wait for device completion BCS 2$ ;branch if reset CMP R0,#AH.ML BLO 6$ ;branch if too short (format error) CMPB AH.FMT(R1),#FMT.IP ;is this 96-bit leader BNE 5$ ;branch if no (format error) CMPB AH.LNK(R1),#LNK.IP ;yes. is this ip link number BNE 4$ ;branch if no (format error) SUB #AH.LEN,R0 ;correct packet length BLE 3$ ;branch if leader only MOVB PARADR(R3),NTRLNA(R5) ;save local source address MOVB AH.HID(R1),NTRLNA+1(R5) MOV AH.IMP(R1),NTRLNA+2(R5) CLC ;return ok 2$: BIT (SP)+,R0 ;pop off temporaries (preserve cc) RTS PC ; 3$: CMPB AH.TYP(R1),#5 ;is this rfnm BNE 4$ ;branch if no INC PARLDR(R3) ;yes. leader only BR 1$ ; 4$: BIT #DLMBIT,PAROPT(R3) ;are link advisories disabled BNE 103$ ;branch if yes ; 101$: MOV AH.LNK(R1),R0 ;get the message link and sub-link in R0 BIC #170377,R0 ;get rid of the uninteresting link part BISB PARADR(R3),R0 ; and instead store the class-A net number ; CMPB AH.TYP(R1),#6 ;is this a dead host status message? BEQ 102$ ;yes, format it CMPB AH.TYP(R1),#7 ;is this a destination dead message? BEQ 102$ ;yes, format it CMPB AH.TYP(R1),#9. ;is this an incomplete transmission message? BNE 5$ ;no, print in octal 102$: .TRAP #TR.PSN,@R1,2(R1),4(R1),6(R1),R0 ;PSN error message BR 6$ ; 103$: CMPB AH.TYP(R1),#1 ;link advisories disabled; is this reset? BNE 6$ ;branch if no 5$: .TRAP #TR.LDR,@R1,2(R1),4(R1),6(R1),10(R1) ;leader error 6$: INC PARLDE(R3) BR 1$ ; ; Reset output ; ARPRST: CCC ;(clean condition codes) EMT RSX+EXTBAS ;reset device BCS ARPRST ;branch if error MOV #3,R2 ;(three nop messages) 1$: MOV #10.,R0 MOV #IMPNOP,R1 ;send nop message EMT SIO+EXTBAS ;wait for device completion BCS ARPRST ;branch if error SOB R2,1$ MOV #10.,R0 ;send interface reset message MOV #IMPRST,R1 EMT SIO+EXTBAS ;wait for device completion BCS ARPRST ;branch if error RTS PC ; ; Start output ; R2 = data area length, r4 = buffer pointer, returns c(cc) = c if error ; ARPOUT: MOV R2,-(SP) ;save registers ADD #AH.LEN,R2 ;adjust for arpanet leader MOV R2,-(SP) MOV R4,R2 ADD #BUFLDR-AH.LEN,R2 MOV R2,-(SP) MOV PH.LDR+2(R4),R0 ;save destination address BIC #377,R0 MOV PH.LDR+4(R4),R1 BIC #377,R1 ;(suppress logical-host field) MOV #FMT.IP,(R2)+ ;ah.fmt, ah.net. construct arpanet leader CLR (R2)+ ;ah.flg, ah.typ MOV R0,(R2)+ ;ah.hnd, ah.hid MOV R1,(R2)+ ;ah.imp MOV #LNK.IP,(R2)+ ;ah.lnk, ah.sbl MOV IH.FL(R4),(R2)+ ;ah.ml MOV (SP)+,R1 ;restore transfer parameters MOV (SP)+,R0 CCC ;(clean condition codes) EMT SIO+EXTBAS ;wait for device completion MOV (SP)+,R2 ;restore registers RTS PC ; ; Process redirect ; R1 = icmp packet pointer, r2 = icmp header pointer, r4 = data packet pointer ; ARPRDR: MOV NTRLNA(R5),PH.LDR+2(R1) ;insert local address MOV NTRLNA+2(R5),PH.LDR+4(R1) MOV PARADR(R3),IH.SRC(R1) ;and believable source address MOV PARADR+2(R3),IH.SRC+2(R1) JSR PC,RDROT ;construct redirect RTS PC .PAGE ; ; Data segment ; .PSECT $SUPD,RO,D ; ; Transfer vector ; SBNHDH = . ;hdh SBNARP: .WORD ARPINI ;0 initialize input .WORD ARPINP ;1 start input .WORD RDRIN ;2 process leader .WORD ARPRDR ;3 process redirect .WORD ARPINI ;4 initialize output .WORD ARPOUT ;5 start output .WORD ARPRST ;6 reset output ; ; Arpanet imp control messages ; IMPNOP: .BYTE 17,0,0,4,0,0,0,0,0,0 ;nop message IMPRST: .BYTE 17,0,0,12,0,0,0,0,0,0 ;interface reset message .EVEN ; .END