home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Network Support Encyclopedia 96-1
/
novell-nsepro-1996-1-cd2.iso
/
download
/
netware
/
vlmkt6.exe
/
WS_TCPIP.CPF
< prev
Wrap
Text File
|
1993-09-28
|
13KB
|
423 lines
/*
** Copyright (c) 1992 Novell, Inc. All Rights Reserved.
**
** THIS WORK IS SUBJECT TO U.S. AND INTERNATIONAL COPYRIGHT LAWS
** AND TREATIES. NO PART OF THIS WORK MAY BE USED, PRACTICED,
** PERFORMED COPIED, DISTRIBUTED, REVISED, MODIFIED, TRANSLATED,
** ABRIDGED, CONDENSED, EXPANDED, COLLECTED, COMPILED, LINKED,
** RECAST, TRANSFORMED OR ADAPTED WITHOUT THE PRIOR WRITTEN CONSENT
** OF NOVELL, INC. ANY USE OR EXPLOITATION OF THIS WORK WITHOUT
** AUTHORIZATION COULD SUBJECT THE PERPETRATOR TO CRIMINAL AND CIVIL
** LIABILITY.
*/
syntax (1.1);
component (
/* CompID */ WS_TCPIP,
/* CompVer */ 4.1,
/* CompStatus */ Retail
);
string targetName[18];
string sourceDirectory;
string targetDirectory;
int i;
int fh;
int rc;
int rc1;
string IPAddress;
int bootPUsed;
string subnetMask;
string routerAddress;
string resolvPath;
string domainName;
string DNSAddress;
static string pathKeyName[4];
static string pathKeyValue[4];
static string oldpathKeyValue[4];
int sVer;
int dVer;
/*
=======================
= COMPONENT = TCPIP =
=======================
*/
targetName[0] = "dialup.exe";
targetName[1] = "iptunnel.exe";
targetName[2] = "lwpcon.exe";
targetName[3] = "lwpcon.hlp";
targetName[4] = "lwpcon.msg";
targetName[5] = "ping.exe";
targetName[6] = "ping.msg";
targetName[7] = "rarpd.exe";
targetName[8] = "rfcnbios.exe";
targetName[9] = "snmp.exe";
targetName[10] = "tcpip.exe";
targetName[11] = "vtcpip.386";
targetName[12] = "version.exe";
targetName[13] = "wlibsock.dll";
targetName[14] = "winsock.dll";
targetName[15] = "novasync.exe";
targetName[16] = "slip_ppp.com";
targetName[17] = "yesno.exe";
sourceDirectory = GetSourcePath() + "NET\\BIN\\";
targetDirectory = targetPath + "\\BIN";
i = 0;
do {
if (i != 3 && i != 4 && i != 6) {
if (dVer = GetLwpFileVersion (targetDirectory + "\\" + targetName[i])) {
sVer = GetLwpFileVersion (sourceDirectory + targetName[i]);
}
}
if (!dVer || sVer > dVer) {
if (copy (sourceDirectory + targetName[i], targetDirectory)) {
DisplayErrorCondition (FATAL);
} /* end if */
}
i = i + 1;
} while (i <= 17);
/*========================================*/
targetName[0] = "networks";
targetName[1] = "protocol";
targetName[2] = "services";
targetName[3] = "ethers";
targetName[4] = "hosts";
targetName[5] = "resolv.cfg";
sourceDirectory = GetSourcePath() + "NET\\SAMPLE\\";
targetDirectory = targetPath + "\\SAMPLE";
i = 0;
do {
if (copy (sourceDirectory + targetName[i], targetDirectory)) {
DisplayErrorCondition (FATAL);
} /* end if */
i = i + 1;
} while (i <= 5);
sourceDirectory = targetPath + "\\SAMPLE\\";
targetDirectory = targetPath + "\\TCP";
i = 0;
do {
if (copy (sourceDirectory + targetName[i], targetDirectory)) {
DisplayErrorCondition (FATAL);
} /* end if */
i = i + 1;
} while (i <= 2);
/*
===================================================================
= Set the BUFFERS and MEMPOOL values in the local NET.CFG file. =
===================================================================
*/
AddStatus (EDITING, NET_CFG, NO_MESSAGE);
rc = PutProfileString ("Link Support", /* appName */
"MemPool", /* keyName */
"4096", /* valueString */
pathNET_CFG, /* fileName */
"CFG"); /* file type */
rc = PutProfileString ("Link Support", /* appName */
"Buffers", /* keyName */
"8 1500", /* valueString */
pathNET_CFG, /* fileName */
"CFG"); /* file type */
/*
==============================================================================
= Find out if BootP is already used. A brand new installation will appear =
= as if BootP is being used, so confirm this with the user. =
==============================================================================
*/
rc = GetProfileString ("Protocol TCPIP", /* appName */
"ip_address", /* keyName */
"", /* defaultString */
IPAddress, /* returnedString */
pathNET_CFG, /* fileName */
"CFG"); /* fileType */
if (rc) {
bootPUsed = 0;
} else {
PushHelpContext (BOOTP_USED_HELP);
bootPUsed = Confirm (BOOTP_USED_QUESTION, 18, 0, 0);
PopHelpContext();
} /* end if */
if (bootPUsed) goto pathData;
/*
==============================================================================
= BootP is not used, so get the IP Address, Subnet Mask and Router =
= Address. Then ask the user to edit or confirm these values. =
==============================================================================
*/
/*
===============================
= Get the IP Address first. =
===============================
*/
if (!rc) IPAddress = "";
PushHelpContext (IP_ADDRESS_HELP);
PushInformationText (2, IP_ADDRESS_MSG);
IPAddress = InputIPAddress (18, /* centerLine */
0, /* centerColumn */
IPAddress, /* initialValue */
INPUT_IP_ADDRESS, /* headerMessage */
NO_MESSAGE); /* promptMessage */
PopInformationText();
PopHelpContext();
rc = PutProfileString ("Protocol TCPIP", /* appName */
"ip_address", /* keyName */
IPAddress, /* valueString */
pathNET_CFG, /* fileName */
"CFG"); /* fileType */
/*
==============================
= Now get the subnet Mask. =
==============================
*/
rc1 = GetProfileString ("Protocol TCPIP", /* appName */
"ip_netmask", /* keyName */
"", /* defaultString */
subnetMask, /* returnedString */
pathNET_CFG, /* fileName */
"CFG"); /* fileType */
if (!rc1) subnetMask = "";
PushHelpContext (SUBNETS_USED_HELP);
PushInformationText (2, SUBNETS_USED_MSG);
if (Confirm (SUBNET_USED_QUESTION, 18, 0, rc1)) {
PushHelpContext (SUBNET_MASK_HELP);
PushInformationText (2, SUBNET_MASK_MSG);
subnetMask = InputIPAddress (18, /* centerLine */
0, /* centerColumn */
subnetMask, /* initialValue */
INPUT_SUBNET_MASK, /* headerMessage */
NO_MESSAGE); /* promptMessage */
PopInformationText();
PopHelpContext();
rc = PutProfileString ("Protocol TCPIP", /* appName */
"ip_netmask", /* keyName */
subnetMask, /* valueString */
pathNET_CFG, /* fileName */
"CFG"); /* fileType */
} else {
if (rc1) rc = PutProfileString ("Protocol TCPIP", /* appName */
"ip_netmask", /* keyName */
"", /* valueString */
pathNET_CFG, /* fileName */
"CFG"); /* fileType */
} /* end if */
PopInformationText();
PopHelpContext();
/*
==================================================
= Last, but not least, get the Router address. =
==================================================
*/
rc1 = GetProfileString ("Protocol TCPIP", /* appName */
"ip_router", /* keyName */
"", /* defaultString */
routerAddress, /* returnedString */
pathNET_CFG, /* fileName */
"CFG"); /* fileType */
if (!rc1) routerAddress = "";
PushHelpContext (IP_ROUTER_USED_HELP);
PushInformationText (2, IP_ROUTER_USED_MSG);
if (Confirm (ROUTER_USED_QUESTION, 18, 0, rc1)) {
PushHelpContext (IP_ROUTER_ADDRESS_HELP);
PushInformationText (2, IP_ROUTER_ADDRESS_MSG);
routerAddress = InputIPAddress (18, /* centerLine */
0, /* centerColumn */
routerAddress, /* initialValue */
INPUT_ROUTER_ADDRESS,/* headerMessage */
NO_MESSAGE); /* promptMessage */
PopInformationText();
PopHelpContext();
rc = PutProfileString ("Protocol TCPIP", /* appName */
"ip_router", /* keyName */
routerAddress, /* valueString */
pathNET_CFG, /* fileName */
"CFG"); /* fileType */
} else {
if (rc1) rc = PutProfileString ("Protocol TCPIP", /* appName */
"ip_router", /* keyName */
"", /* valueString */
pathNET_CFG, /* fileName */
"CFG"); /* fileType */
} /* end if */
PopInformationText();
PopHelpContext();
/*
==============================================================================
= Look for an existing RESOLV.CFG file. Ask if it should be used if =
= found. =
==============================================================================
*/
rc1 = 0;
if (IsFile (targetPath + "\\tcp\\resolv.cfg")) {
PushInformationText (2, REINSTALL_RESOLV_INFO);
PushHelpContext (RESOLV_CFG_FILE_HELP);
rc1 = Confirm (REINSTALL_RESOLV_CFG, 18, 0, 0);
PopHelpContext();
PopInformationText();
if (!rc1) goto pathData;
} /* end if */
resolvPath = getenv ("EXCELAN");
if (resolvPath != "") {
AppendPath (resolvPath, "tcp\\resolv.cfg");
if (IsFile (resolvPath)) {
PushHelpContext (RESOLV_XLN_TCP_HELP);
PushInformationText (2, REUSE_RESOLV_INFO);
rc = Confirm (REUSE_RESOLV_CFG, 18, 0, 1);
PopInformationText();
PopHelpContext();
if (rc) {
if (copy (resolvPath, targetPath + "\\TCP")) {
DisplayErrorCondition (FATAL);
} /* end if */
goto pathData;
} /* end if */
} /* end if */
} /* end if */
/*
==============================================================
= No resolv.cfg file was found, promp for DNS information. =
==============================================================
*/
PushHelpContext (DNS_USED_HELP);
PushInformationText (2, DNS_USED_MSG);
if (Confirm (DNS_USED_QUESTION, 18, 0, 0)) {
domainName = "";
PushHelpContext (DOMAIN_NAME_HELP);
PushInformationText (2, DOMAIN_NAME_MSG);
EditString (17, /* Center Line */
0, /* Center Column */
1, /* Height */
70, /* Width */
DOMAIN_NAME_HEADER, /* Header */
DOMAIN_NAME_PROMPT, /* Prompt */
domainName, /* String Value */
EF_NOSPACES); /* Edit Flags */
PopInformationText();
PopHelpContext();
DNSAddress = "";
PushHelpContext (DNS_IP_ADDRESS_HELP);
PushInformationText (2, INPUT_DNS_ADDR_MSG);
DNSAddress = InputIPAddress (18, /* centerLine */
0, /* centerColumn */
DNSAddress, /* initialValue */
INPUT_DNS_ADDRESS, /* headerMessage */
NO_MESSAGE); /* promptMessage */
PopInformationText();
PopHelpContext();
fh = fopen (targetPath + "\\tcp\\resolv.cfg", "w");
rc = fputs ("; DNS resolver file", fh);
rc = fputs (";", fh);
rc = fputs ("domain " + domainName, fh);
rc = fputs (";", fh);
rc = fputs ("nameserver " + DNSAddress, fh);
rc = fclose (fh);
} else {
if (rc1) delete (targetPath + "\\tcp\\resolv.cfg");
} /* end if */
PopInformationText();
PopHelpContext();
pathData:
/*
================================================
= Now put the PATH data in the NET.CFG file. =
================================================
*/
pathKeyName[0] = "PATH TCP_CFG";
pathKeyName[1] = "PATH LWP_CFG";
pathKeyName[2] = "PATH PROFILE";
pathKeyName[3] = "PATH SCRIPT";
/*
========================================================
= Save the PATH data in the old NET.CFG file =
= (needed when install to different target directory =
= from the existing LWP 4.1 software directory =
========================================================
*/
rc = GetProfileString ("Protocol TCPIP", /* appName */
pathKeyName[0], /* keyName */
"", /* defaultString */
resolvPath, /* returnedString */
pathNET_CFG, /* fileName */
"CFG"); /* fileType */
oldpathKeyValue[0] = resolvPath;
rc = GetProfileString ("Protocol TCPIP", /* appName */
pathKeyName[1], /* keyName */
"", /* defaultString */
resolvPath, /* returnedString */
pathNET_CFG, /* fileName */
"CFG"); /* fileType */
oldpathKeyValue[1] = resolvPath;
rc = GetProfileString ("Protocol TCPIP", /* appName */
pathKeyName[2], /* keyName */
"", /* defaultString */
resolvPath, /* returnedString */
pathNET_CFG, /* fileName */
"CFG"); /* fileType */
oldpathKeyValue[2] = resolvPath;
rc = GetProfileString ("Protocol TCPIP", /* appName */
pathKeyName[3], /* keyName */
"", /* defaultString */
resolvPath, /* returnedString */
pathNET_CFG, /* fileName */
"CFG"); /* fileType */
oldpathKeyValue[3] = resolvPath;
pathKeyValue[0] = targetPath + "\\TCP";
pathKeyValue[1] = targetPath + "\\HSTACC";
pathKeyValue[2] = targetPath + "\\PROFILE";
pathKeyValue[3] = targetPath + "\\SCRIPT";
i = 0;
do {
rc = PutProfileString ("Protocol TCPIP", /* appName */
pathKeyName[i], /* keyName */
pathKeyValue[i], /* valueString */
pathNET_CFG, /* fileName */
"CFG"); /* file type */
i = i + 1;
} while (i <= 3);