*DECK IPPBEGN
USETEXT TEXTIPL
PROC IPPBEGN (APPNAME, MESSCOUNT, HOSTUN, COMPSTATUS);
*CALL COPYRITE CDCNET - COPYRIGHT CONTROL DATA. 1992.
# TITLE IPPBEGN - BEGIN NETWORK #
BEGIN # IPPBEGN #
#
**** IPPBEGN BEGIN NETWORK
*
* THIS PROCEDURE ESTABLISHES A CONNENTION TO THE NETWORK VIA
* NAM.
*
* PROC IPPBEGN
*
* ENTRY APPNAME = APPLICATION NAME. MUST BE DEFINED IN
* SYSTEM COMMON DECK *COMTNAP*.
* MESSCOUNT = INTEGER OF MESSAGE COUNT FOR RELEASING DEBUG
* FILE. IF 0, DONT RELEASE.
* HOSTUN = USERNAME OF TCPHOST FILE.
*
* EXIT COMPSTATUS = NETON STATUS.
*
* METHOD OBTAIN THE LOCAL HOST MACHINE ID. BASED ON THE ID
* THE TCP/IP GATEWAY TITLE IS INITIALIZED AND THE LOCAL
* HOSTNAME IS INTIALIZED. THE TCPHOST FILE IS ATTACHED
* AND THE LOCAL HOST IP ADDRESS IS OBTAINED FROM THE FILE.
* NETON IS CALLED TO INITIATE THE NAM CONNECTION.
* IF THE NETON WAS SUCCESSFUL, THEN THE ACNST IS
* INITIALIZED.
#
#
**** PROC IPPBEGN - XREF LIST
#
XREF
BEGIN
FUNC IPUGHBN B; # GET HOST BY NAME #
PROC IPUMCLR; # CLEAR MEMORY #
PROC MACHID; # -MACREL- TO GET MACHINE ID #
PROC NETON; # CONNECT APPLICATION TO NETWORK #
PROC NETREL; # RELEASE LOG FILE #
END
#
**
#
ITEM APPNAME C(10); # NETON APPLICATION NAME #
ITEM MESSCOUNT I; # NAM MESSGE COUNT FOR LOGGING #
ITEM HOSTUN C(10); # TCPHOST USERNAME #
ITEM COMPSTATUS S:NETON$STATUS; # STATUS RETURNED FROM *NETON* #
ITEM ACNENTRY I; # ACN LOOP COUNTER #
ITEM HOSTNAME C(30); # LOCAL HOST NAME #
CONTROL EJECT;
#
**** START MAIN PROCEDURE
#
IPMC = MESSCOUNT;
IPHOSTUN = HOSTUN;
NDLFILE = NLFILE;
DFLAG = FALSE; # DEBUG FLAG #
MACHID (TGW$GWNAME); # SETUP TCP GATEWAY NAME #
TGW$BASENAME [0] = BASENAME$;
C<0,1>TGW$MID [0] = "H";
#
**** SEARCH TCPHOST FILE FOR THE LOCAL HOST IP ADDRESS.
#
C<0,30>HOSTNAME = HOSTNAME$;
C<10,2>HOSTNAME = C<1,2>TGW$MID [0];
IF NOT IPUGHBN (HOSTNAME, HST$ADDR, IPHOSTUN)
THEN
BEGIN # HOST FILE NOT FOUND #
COMPSTATUS = NETON$STATUS"HSTNOTFOUND";
RETURN;
END
IF IPMC NQ 0
THEN
NETREL (NDLFILE, 0, 0); # INITIALIZE *ZZZZZDN* FILE #
NETON (APPNAME, NSUP, COMPSTATUS, MINACN$, MAXACN$);
#
**** INITIALIZE THE ACN SOCKET TABLE IF NETTED ON
#
IF COMPSTATUS EQ S"SUCCESS"
THEN
BEGIN # NAM AVAILABLE #
IPUMCLR (LOC (ACN$ST), MAXACN$ * ACNSIZE$);# CLEAR ACN TABLES #
#
**** INITIALIZE FIXED FIELDS IN THE OUTPUT DATA ABH.
#
P<ABH> = LOC(DABH); # OUTPUT DATA BLOCK ABH #
ABHWORD [0] = 0; # CLEAR WHOLE ABH WORD #
ABHABT [0] = APPQMSG; # BLOCK TYPE IS *MSG* #
ABHACT [0] = CT8ASCII; # CHARACTER TYPE IS 8-BIT ASCII #
#
**** INITIALIZE FIXED FIELDS IN THE OUTPUT SUPERVISORY MESSAGE ABH.
#
P<ABH> = LOC(SABH); # OUTPUT SUPERVISORY MSG ABH #
ABHWORD [0] = 0; # CLEAR WHOLE ABH WORD #
ABHABT [0] = APPCMD; # BLOCK TYPE IS *CMD* #
ABHACT [0] = CT60TRANS; # CHARACTER TYPE IS 60-BIT XPT #
UDP$VERSION [0] = UDPVERS$; # INITIALIZE UDP CALL HEADER #
UDP$NOTUSED [0] = 0; # CLEAR UNUSED BYTE #
NUMACN = 0; # OUTSTANDING CONNECTIONS #
END # NAM AVAILABLE #
RETURN; # RETURN TO CALLER #
END # IPPBEGN #
TERM