.TITLE X25$SEND_MACRO - Example Program. .ENABL SUPPRESSION ; ;************************************************************************ ;* * ;* COPYRIGHT (c) DIGITAL EQUIPMENT CORPORATION, 1993 * ;* ALL RIGHTS RESERVED. UNPUBLISHED - RIGHTS RESERVED * ;* UNDER THE COPYRIGHT LAWS OF THE UNITED STATES. * ;* * ;* RESTRICTED RIGHTS LEGEND: USE, DUPLICATION, OR DISCLOSURE * ;* BY THE U.S. GOVERNMENT IS SUBJECT TO RESTRICTIONS AS SET * ;* FORTH IN SUBPARAGRAPH (C)(1)(II) OF DFARS 252.227-7013, * ;* OR IN FAR 52.227-19, OR IN FAR 52.227-14 ALT. III, AS * ;* APPLICABLE. * ;* * ;* THIS SOFTWARE IS PROPRIETARY TO AND EMBODIES CONFIDENTIAL * ;* TECHNOLOGY OF DIGITAL. POSSESSION, USE, OR COPYING OF THE * ;* SOFTWARE AND MEDIA IS AUTHORIZED ONLY PURSUANT TO A VALID * ;* WRITTEN LICENSE FROM DIGITAL. * ;* * ;************************************************************************ ; ;++ ; ; FACILITY: ; ; X.25 Example Program ; ; ABSTRACT: ; ; SEND PROGRAM ; ; Digital is furnishing this example software "as is" without ; warranty of any kind, express or implied, including the implied ; warranties of merchantability and fitness for a particular purpose. ; Digital disclaims any and all liability for the performance or ; non-performance of this software. ; ; ; This program is intended to run with the receive example programes. ; Data is entered via the terminal to the send program, and sent by ; X.25 to the receive program. ; ; The following NCL commands can be used to configure X.25. This ; configeration assumes the following ; - the send and recieve programs are running on the same system ; - the same gateway is used to place and outgoing call and recieve ; - the incomming call. ; - the recieve example is started by a application entity ; - the file specified by the application entity contains a DCL ; command to run the receive executable. ; ; ; create x25 access ; create x25 client ; ! ; ! Create DTE classes ; ! ; create x25 access dte class crock type remote ; set x25 access dte class crock service node {(node=dundee, - ; rating=512)} ; create x25 access dte class crock1 type remote ; set x25 access dte class crock1 service node {(node=dundee, - ; rating=512)} ; ! ; ! Create security DTE class ; ! ; create x25 access security dte class default ; ! ; ! Create remote DTE entity ; ! ; create x25 access security dte class default remote dte match_all - ; remote address prefix * ; set x25 access security dte class default remote dte match_all - ; rights identifier {match_all} ; ! ; ! Create template ; ! ; create x25 access template net_template1 ; set x25 access template net_template1 dte class crock ; create x25 access template default ; ! ; ! Create filter ; ! ; create x25 access filter receive ; set x25 access filter receive incoming dte address 12345 ; ! ; ! Create security filter ; ! ; create x25 access security filter default ; set x25 access security filter default acl - ; {(identifier=(match_all),access=all)} ; ! ; ! Create application entity ; ! ; create x25 access application receive ; set x25 access application receive filters {receive} ; set x25 access application receive user system ; set x25 access application receive file sys$system:x25$receive.com ; ! ; ! Enable everything ; ! ; enable x25 access ; enable x25 client ; enable x25 access application receive ; ; ; ; ; FUNCTIONAL DESCRIPTION: ; ; * Include library files and declare local variables ; * Define the NCB ; * Create a mailbox for the network device ; * Assign an input/output (I/O) channel to the network ; device (NWA0:) ; * Set up a virtual call ; * Read the mailbox to obtain the status of the connection ; * Loop reading data from keyboard and sending to remote ; process until control-z received ; * Clear the call ; * Deassign the mailbox and I/O channels ; ;-- .PAGE .SBTTL Definitions and Macros ;+ ; Macro Libraries: ;- .LIBRARY "SYS$LIBRARY:PSILIB" ; P.S.I. Library PM002 ;+ ; Definitions: ;- $SSDEF ; System Service Codes $IODEF ; I/O Function Codes $MSGDEF ; Mailbox Message Codes $PSIDEF ; P.S.I. Codes .PAGE .SBTTL Own Storage .psect data,rd,wrt,noexe ;+ ; RMS Control Blocks for Input stream: ;- X25S_FAB: ; File Access Block $FAB - FNM = ,- ; Filename RAT = ,- ; Record attributes FAC = ; Access mode X25S_RAB: ; Record Access Block $RAB - FAB = X25S_FAB,- ; FAB address UBF = TT_BUF,- ; User's buffer USZ = TT_SIZ,- ; User's buffer size PBF = PM_BUF,- ; Prompt buffer PSZ = PM_SIZ,- ; Prompt buffer size ROP = PMT ; Record options ;+ ; Terminal and Prompt buffers: ;- TT_BUF: .BLKB 256 TT_SIZ = . - TT_BUF PM_BUF: .ASCII /Enter message (^Z to exit): / PM_SIZ = . - PM_BUF ;+ ; Miscellaneous Buffers &c: ;- IO_STATUS: ; I/O status block .BLKQ 1 PSI_CHAN: ; Network device channel .BLKW 1 MBX_CHAN: ; Mailbox channel .BLKW 1 PSI_DEV: ; Network device name .ASCID /_NWA0:/ MBX: ; Mailbox logical name .ASCID /X25S_MBX/ MBXBUF: ; Mailbox buffer .BLKB 200 MBXBUFSIZ = .-MBXBUF ; Buffer length CTRLZ: ; End File message .BYTE 26 ;+ ; Network Connect Block: ;- ACCESS_NCB: ; NCB Descriptor .LONG ACCESS_NCB_LEN .ADDRESS ACCESS_NCB_BLK ACCESS_NCB_BLK: ; NCB to set up a call ;+ ; Define remote DTE address,sub-address and template here ;- REMOTE_DTE: ; DTE Address .WORD REMOTE_DTE_LEN .WORD PSI$C_NCB_REMDTE .ASCIC /12345/ REMOTE_DTE_LEN = .-REMOTE_DTE TEMPLATE: .WORD TEMPLATE_LEN ; Template .WORD PSI$C_NCB_TEMPLATE .ASCIC /NET_TEMPLATE1/ TEMPLATE_LEN = .-TEMPLATE ACCESS_NCB_LEN = .-ACCESS_NCB_BLK .PAGE .SBTTL Main Line Routine .psect code,rd,exe,nowrt .ENTRY EXA$PSI_SEND,^M<> ;+ ; Entry Point - Initialise input file and set up virtual call. ;- $OPEN - ; Open input file FAB = X25S_FAB $CONNECT - ; and connect record stream RAB = X25S_RAB ;+ ; Create network device mailbox and assign network channel. ;- $CREMBX_S - ; Create mailbox CHAN = MBX_CHAN,- ; channel LOGNAM = MBX ; logical name BSBW ERROR ; Check for error $ASSIGN_S - ; Assign a channel DEVNAM = PSI_DEV,- ; to network device CHAN = PSI_CHAN,- ; channel number MBXNAM = MBX ; mailbox logical name BSBW ERROR ; Check for error ;+ ; Set up a virtual call to PSI_RECEIVE and get connect information ; from the mailbox. ;- $QIOW_S - ; Issue QIO and wait CHAN = PSI_CHAN,- ; to network device FUNC = #IO$_ACCESS,- ; function is make call IOSB = IO_STATUS,- ; I/O status block P2 = #ACCESS_NCB ; address of call NCB BSBW IO_ERROR ; Check for I/O error $QIOW_S - ; Issue QIO and wait CHAN = MBX_CHAN,- ; to the mailbox FUNC = #IO$_READVBLK,- ; function is read a messg IOSB = IO_STATUS,- ; I/O status block P1 = MBXBUF,- ; mailbox buffer P2 = #MBXBUFSIZ ; and its size BSBW IO_ERROR ; Check for I/O error ;+ ; . ; . ; . ; Code to read and decode call accept mailbox message. ; . ; . ; . ;- .PAGE .SBTTL Loop to Transmit Messages. ;+ ; This loop reads a buffer from the input stream and sends it over the ; network to the remote process. When end of file is reached the call ; will be cleared. ;- READ_INPUT: $GET - ; Get a buffer RAB = X25S_RAB ; from the input file CMPL R0,#RMS$_EOF ; Status is end of file ? BEQL CLEAR_CALL ; If eql, yes BSBW ERROR ; else check for error. ;+ ; Input buffer was read - send it. ;- MOVL X25S_RAB+RAB$L_RBF,R2 ; R2 = Address of buffer MOVZWL X25S_RAB+RAB$W_RSZ,R3 ; R3 = Size of buffer $QIOW_S - ; Issue a QIO and wait CHAN = PSI_CHAN,- ; to the network device FUNC = #IO$_WRITEVBLK,- ; function is write IOSB = IO_STATUS,- ; I/O status block P1 = (R2),- ; buffer address P2 = R3 ; and size BSBW IO_ERROR ; Check for I/O error ;+ ; Continue until end of file. ;- BRB READ_INPUT ; Go read from input. .PAGE .SBTTL Clear the Call. ;+ ; End of file on input was encountered. Send a control-Z to the remote ; process on the qualified sub_channel, ; clear the call, and deassign the I/O channels. ;- CLEAR_CALL: $QIOW_S - ; Issue QIO and wait CHAN = PSI_CHAN,- ; to network device FUNC = #IO$_WRITEVBLK!IO$M_QUALIFIED,- ; write on Q-channel IOSB = IO_STATUS,- ; I/O status block P1 = CTRLZ,- ; end of file buffer P2 = #1 ; and its size BSBW IO_ERROR ; Check for I/O error ; ; Read the confirmation message ; 10$: $QIOW_S - ; Issue QIO and wait CHAN = PSI_CHAN,- ; to network device FUNC = #IO$_READVBLK,- ; read IOSB = IO_STATUS,- ; I/O status block P1 = MBXBUF,- ; input buffer P2 = #MBXBUFSIZ ; input buffer size BSBW IO_ERROR ; Check for I/O error BBC #PSI$V_QUALIFIED,IO_STATUS+4,10$; Try again if not on Q-chn $QIOW_S - ; Issue a QIO and wait CHAN = PSI_CHAN,- ; to network device FUNC = #IO$_DEACCESS,- ; function is clear call IOSB = IO_STATUS ; I/O status block BSBW IO_ERROR ; Check for I/O error $DASSGN_S - ; Deassign channel CHAN = PSI_CHAN ; to network device BSBW ERROR ; Check for error $DASSGN_S - ; Deassign channel CHAN = MBX_CHAN ; to mailbox ;+ ; Exit successful. ;- movl #SS$_NORMAL,R0 ; Exit ret ; with success status. .PAGE .SBTTL Routine to Check Return Status. ;+ ; This routine checks the I/O status block and system service return codes. ; If an error is found, the program exits. ;- IO_ERROR: .jsb_entry ; Check I/O status block BLBC R0,IO_ERR_EXIT ; If lbc, error MOVZWL IO_STATUS,R0 ; else, check I/O status BLBS R0,IO_ERR_RET ; If not lbc, return IO_ERR_EXIT: $EXIT_S - ; Error occurred - exit CODE = R0 ; with status. IO_ERR_RET: RSB ERROR: .jsb_entry BLBC R0,ERR ; If lbc, error RSB ; No errors found - return ERR: $EXIT_S - ; Error occurred - exit CODE = R0 ; with status. .END EXA$PSI_SEND ; End of module