Source code of HPW routine I255611

Client program that runs on Host

 

*********************************************************************
*
*                                I255611
*
*                        TCP/IP Password client
*
*             Written by William van den Heuvel, 1998
*
*             Update: 1998-11-10
*
*********************************************************************
*
* this program uses the EZASMI assembler macro API:
* EZASMI TYPE=INITAPI     - initialize the API for TCP calls
* EZASMI TYPE=TERMAPI     - terminate the API for TCP calls
*
***********************************************************************
*
* on entry,
* register 1 points to the API parameters.
*
*......................................................................
*
* on completion,
* register 15 will contain a return code (RC):
*
* RC=0 - normal completion (always)
*
***********************************************************************




**********************************************************************
*
I255611  CSECT
I255611  AMODE ANY
I255611  RMODE ANY
*
R0       EQU   0
R1       EQU   1
R2       EQU   2
R3       EQU   3
R4       EQU   4
R5       EQU   5
R6       EQU   6
R7       EQU   7
R8       EQU   8
R9       EQU   9
R10      EQU   10   PARM - address of pointer to PARM-string)
R11      EQU   11   BASE - base register of this program
R12      EQU   12   CAA  - reserved for LE
R13      EQU   13   DSA  - Dynamic Storage Area
R14      EQU   14   return address
R15      EQU   15   entry point address
*
DSA      EQU   R13
CAA      EQU   R12
BASE     EQU   R11
API      EQU   R10        API parameters
GWA      EQU   R9         GLOBAL storage
TIE      EQU   R8         TASK storage
*
         USING API_DSECT,API
         USING DSA_DSECT,DSA
         USING GWA_DSECT,GWA
         USING TIE_DSECT,TIE
*
*********************************************************************



*********************************************************************
*
         LEMENTRY BASE=BASE,LENGTH=DSA_DSECT_LENGTH,PARAM=API,TRACE=0
*
* note:
*        API -> API_DSECT
*        DSA -> DSA_DSECT
*
***********************************************************************
*
         LEMTRACE 0,'I255611: entry'
*
***********************************************************************
*
*        make GLOBAL storage (GWA)
         XC    DSA_GWA,DSA_GWA     clear GWA
         LA    GWA,DSA_GWA         address GWA
         ST    GWA,API_GWA         set pointer to GWA
*
*        make TASK storage (TIE)
         XC    DSA_TIE,DSA_TIE     clear TIE
         LA    TIE,DSA_TIE         address TIE
         ST    TIE,API_TIE         set pointer to TIE
*
***********************************************************************
*
*        initialize the API
*
B100     EQU   *
         LEMTRACE 0,'I255611: INITAPI'
*
*        get input parameters for INITAPI
         MVC   DSA_MAXSOC,API_MAXSOC  maximum number of sockets
*
         EZASMI TYPE=INITAPI,                                          X
               TASK=(TIE),            TASK storage (TIE)               X
               MAXSOC=DSA_MAXSOC,     maximum number of sockets        X
               MAXSNO=DSA_MAXSNO,     highest socket descriptor        X
               RETCODE=DSA_RETCODE,   return code (0 or -1)            X
               ERRNO=DSA_ERRNO,       error number (if RETCODE = -1)   X
               ERROR=B110             if API error occurs
         B     B120
*
*......................................................................
*
*        INITAPI failed (ERROR exit)
B110     EQU   *
         LEMTRACE 8,'I255611: INITAPI failed - ERROR exit'
         B     X100
*
*......................................................................
*
*        if RETCODE is -1 (error) then ERRNO contains the error code
*        else DSA_MAXSNO contains the highest possible socket number
*
*        error?
B120     EQU   *
         L    R15,DSA_RETCODE    R15 = RETCODE
         C    R15,=F'-1'         RETCODE = -1?
         BNE  B130               no; successful
*
*......................................................................
*
*        unsuccessful
*        ERRNO contains the error code
         LEMTRACE 8,'I255611: INITAPI failed - ERRNO=',(DSA_ERRNO,4,B)
         B     X100
*
*......................................................................
*
*        successful - get output from INITAPI
B130     EQU   *
*
*        DSA_MAXSNO contains the highest possible socket number
*
*        save MAXSNO
         ICM   R15,B'1111',DSA_MAXSNO  (fullword)
         STCM  R15,B'0011',API_MAXSNO  (halfword)
*
*......................................................................
*
*        TRACE:
         LEMTRACE 0,'I255611: MAXSNO=',(API_MAXSNO,2,B)
*
***********************************************************************
*
*        call I255612 passing API
*
         LR    R1,API
         L     R15,=V(I255612)
         BASR  R14,R15
*
***********************************************************************
*
*        terminate the API
         LEMTRACE 0,'I255611: TERMAPI'
*
         EZASMI TYPE=TERMAPI,                                          X
               TASK=(TIE)             task storage area (TIE)
*
*        Register 15 contains the return code (0 or -1)
*
***********************************************************************
*
X100     EQU *
         LEMTRACE 0,'I255611: exit'
*
***********************************************************************
*
*        return to caller
         LEMEXIT
*
*********************************************************************




**********************************************************************
*
*  GWA   Global Work Area
*
GWA_DSECT EZASMI TYPE=GLOBAL,STORAGE=DSECT
*
*********************************************************************





**********************************************************************
*
*  TIE   Task Work Area
*
TIE_DSECT EZASMI TYPE=TASK,STORAGE=DSECT
*
*********************************************************************




***********************************************************************
*
* DSA - Dynamic Storage Area (pointed to by register 13)
*
DSA_DSECT     LEMDSA
*
*......................................................................
*
* GLOBAL storage (GWA)
*
* mapped by GWA_DSECT
* addressed by register GWA
*
              DS   0D   D-align what follows
DSA_GWA       DS   XL(GWALENTH)
*
*......................................................................
*
* TASK storage (TIE)
*
* mapped by TIE_DSECT
* addressed by register TIE
*
              DS   0D   D-align what follows
DSA_TIE       DS   XL(TIELENTH)
*
*......................................................................
*
DSA_MAXSOC    DS     H     maximum number of sockets  (input  INITAPI)
*
DSA_MAXSNO    DS     F     highest socket number (output INITAPI)
*
DSA_RETCODE   DS     F     return code
*                           0 = successful
*                          -1 = check ERRNO for error code
*
DSA_ERRNO     DS     F     error code (only if RETCODE=-1)
*
*......................................................................
*
              DS   0D   D-align what follows
DSA_DSECT_LENGTH EQU  *-DSA_DSECT
*
***********************************************************************
*
* API - parameters passed between modules
* this dsect is address via register API
*
API_DSECT       DSECT
*
*......................................................................
*
* following fields were set by I25561:
API_MAXSOC       DS  H    maximum number of sockets         for INITAPI
API_CONNECT_IP   DS  XL4 IP-address of server               for CONNECT
API_CONNECT_PORT DS  H   port number of server              for CONNECT
*
*......................................................................
*
* following fields are set by I255611:
API_GWA         DS  A    pointer to GLOBAL storage for EZASMI macro
API_TIE         DS  A    pointer to TASK   storage for EZASMI macro
API_MAXSNO      DS  H    highest socket number             from INITAPI
                DS  H    unused
*
***********************************************************************
        END