*********************************************************************
*
* I255601
*
* TCP/IP Password Server
*
* Written by William van den Heuvel, 1998
*
* Update: 1998-11-10
*
*********************************************************************
*
* This program is a TCP/IP server that listens on port x.
*
* It provides Password services submitted by the client program.
* The client is a program that may run on any platform that
* supports TCP/IP.
* The client program submits the request by sending a TCP/IP message
* to port x. The server listens on this port and returns a reply.
*
***********************************************************************
*
* 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)
*
***********************************************************************
**********************************************************************
*
I255601 CSECT
I255601 AMODE ANY
I255601 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 passed by I25560
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,'I255601: 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,'I255601: 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 0,'I255601: 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 0,'I255601: 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,'I255601: MAXSNO=',(API_MAXSNO,2,B)
*
***********************************************************************
*
* call I255602 passing API
*
LR R1,API
L R15,=V(I255602)
BASR R14,R15
*
***********************************************************************
*
* terminate the API
LEMTRACE 0,'I255601: TERMAPI'
*
EZASMI TYPE=TERMAPI, X
TASK=(TIE) task storage area (TIE)
*
* Register 15 contains the return code (0 or -1)
*
***********************************************************************
*
X100 EQU *
LEMTRACE 0,'I255601: 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 I25560:
API_BIND_IP DS XL4 IP-address to listen on (0.0.0.0 means "any")
API_BIND_PORT DS H port number to listen on (0 means "any")
API_MAXSOC DS H maximum number of sockets
API_BACKLOG DS F backlog queue incoming connections for LISTEN
*
*......................................................................
*
* following fields are set by I255601:
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 (output from INITAPI)
DS H unused
*
***********************************************************************
END