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   
Text File  |  1993-09-28  |  13KB  |  423 lines

  1. /*
  2. **      Copyright (c) 1992 Novell, Inc.  All Rights Reserved.
  3. **
  4. **      THIS WORK IS SUBJECT TO U.S. AND INTERNATIONAL COPYRIGHT LAWS 
  5. **      AND TREATIES. NO PART OF THIS WORK MAY BE USED, PRACTICED, 
  6. **      PERFORMED COPIED, DISTRIBUTED, REVISED, MODIFIED, TRANSLATED, 
  7. **      ABRIDGED, CONDENSED, EXPANDED, COLLECTED, COMPILED, LINKED, 
  8. **      RECAST, TRANSFORMED OR ADAPTED WITHOUT THE PRIOR WRITTEN CONSENT
  9. **      OF NOVELL, INC.  ANY USE OR EXPLOITATION OF THIS WORK WITHOUT 
  10. **      AUTHORIZATION COULD SUBJECT THE PERPETRATOR TO CRIMINAL AND CIVIL
  11. **      LIABILITY.
  12. */
  13.  
  14. syntax (1.1); 
  15.  
  16. component (
  17.     /* CompID     */    WS_TCPIP,
  18.     /* CompVer    */    4.1,
  19.     /* CompStatus */    Retail
  20. );
  21.  
  22.  
  23.     string    targetName[18];
  24.     string    sourceDirectory;
  25.     string    targetDirectory;
  26.     int    i;
  27.     int    fh;
  28.     int    rc;
  29.     int    rc1;
  30.     string    IPAddress;
  31.     int    bootPUsed;
  32.     string    subnetMask;
  33.     string    routerAddress;
  34.     string    resolvPath;
  35.     string    domainName;
  36.     string    DNSAddress;
  37. static    string    pathKeyName[4];
  38. static    string    pathKeyValue[4];
  39. static    string    oldpathKeyValue[4];
  40.     int    sVer;
  41.     int    dVer;
  42.  
  43.  
  44. /*
  45. =======================
  46. =  COMPONENT = TCPIP  =
  47. =======================
  48. */
  49. targetName[0] = "dialup.exe";
  50. targetName[1] = "iptunnel.exe";
  51. targetName[2] = "lwpcon.exe";
  52. targetName[3] = "lwpcon.hlp";
  53. targetName[4] = "lwpcon.msg";
  54. targetName[5] = "ping.exe";
  55. targetName[6] = "ping.msg";
  56. targetName[7] = "rarpd.exe";
  57. targetName[8] = "rfcnbios.exe";
  58. targetName[9] = "snmp.exe";
  59. targetName[10] = "tcpip.exe";
  60. targetName[11] = "vtcpip.386";
  61. targetName[12] = "version.exe";
  62. targetName[13] = "wlibsock.dll";
  63. targetName[14] = "winsock.dll";
  64. targetName[15] = "novasync.exe";
  65. targetName[16] = "slip_ppp.com";
  66. targetName[17] = "yesno.exe";
  67.  
  68. sourceDirectory = GetSourcePath() + "NET\\BIN\\";
  69. targetDirectory = targetPath + "\\BIN";
  70.  
  71. i = 0;
  72. do {
  73.     if (i != 3 && i != 4 && i != 6) {
  74.         if (dVer = GetLwpFileVersion (targetDirectory + "\\" + targetName[i])) {
  75.             sVer = GetLwpFileVersion (sourceDirectory + targetName[i]);
  76.         }
  77.     }
  78.     if (!dVer || sVer > dVer) {
  79.         if (copy (sourceDirectory + targetName[i], targetDirectory)) {
  80.             DisplayErrorCondition (FATAL);
  81.         } /* end if */
  82.     }
  83.  
  84.     i = i + 1;
  85. } while (i <= 17);
  86.  
  87.  
  88. /*========================================*/
  89. targetName[0] = "networks";
  90. targetName[1] = "protocol";
  91. targetName[2] = "services";
  92.  
  93. targetName[3] = "ethers";
  94. targetName[4] = "hosts";
  95. targetName[5] = "resolv.cfg";
  96.  
  97. sourceDirectory = GetSourcePath() + "NET\\SAMPLE\\";
  98. targetDirectory = targetPath + "\\SAMPLE";
  99. i = 0;
  100. do {
  101.     if (copy (sourceDirectory + targetName[i], targetDirectory)) {
  102.         DisplayErrorCondition (FATAL);
  103.     } /* end if */
  104.  
  105.     i = i + 1;
  106. } while (i <= 5);
  107.  
  108. sourceDirectory = targetPath + "\\SAMPLE\\";
  109. targetDirectory = targetPath + "\\TCP";
  110. i = 0;
  111. do {
  112.     if (copy (sourceDirectory + targetName[i], targetDirectory)) {
  113.         DisplayErrorCondition (FATAL);
  114.     } /* end if */
  115.  
  116.     i = i + 1;
  117. } while (i <= 2);
  118.  
  119.  
  120. /*
  121. ===================================================================
  122. =  Set the BUFFERS and MEMPOOL values in the local NET.CFG file.  =
  123. ===================================================================
  124. */
  125. AddStatus (EDITING, NET_CFG, NO_MESSAGE);
  126.  
  127. rc = PutProfileString ("Link Support",    /* appName */
  128.                "MemPool",    /* keyName */
  129.                "4096",        /* valueString */
  130.                pathNET_CFG,    /* fileName */
  131.                "CFG");        /* file type */
  132.  
  133. rc = PutProfileString ("Link Support",    /* appName */
  134.                "Buffers",    /* keyName */
  135.                "8 1500",    /* valueString */
  136.                pathNET_CFG,    /* fileName */
  137.                "CFG");        /* file type */
  138.  
  139.  
  140. /*
  141. ==============================================================================
  142. =  Find out if BootP is already used.  A brand new installation will appear  =
  143. =  as if BootP is being used, so confirm this with the user.             =
  144. ==============================================================================
  145. */
  146. rc = GetProfileString ("Protocol TCPIP",    /* appName */
  147.                "ip_address",        /* keyName */
  148.                "",            /* defaultString */
  149.                IPAddress,        /* returnedString */
  150.                pathNET_CFG,        /* fileName */
  151.                "CFG");            /* fileType */
  152. if (rc) {
  153.     bootPUsed = 0;
  154. } else {
  155.     PushHelpContext (BOOTP_USED_HELP);
  156.     bootPUsed = Confirm (BOOTP_USED_QUESTION, 18, 0, 0);
  157.     PopHelpContext();
  158. } /* end if */
  159. if (bootPUsed) goto pathData;
  160.  
  161. /*
  162. ==============================================================================
  163. =  BootP is not used, so  get  the  IP  Address,  Subnet  Mask  and  Router  =
  164. =  Address.  Then ask the user to edit or confirm these values.             =
  165. ==============================================================================
  166. */
  167. /*
  168. ===============================
  169. =  Get the IP Address first.  =
  170. ===============================
  171. */
  172. if (!rc) IPAddress = "";
  173. PushHelpContext (IP_ADDRESS_HELP);
  174. PushInformationText (2, IP_ADDRESS_MSG);
  175. IPAddress = InputIPAddress (18,            /* centerLine */
  176.                 0,            /* centerColumn */
  177.                 IPAddress,        /* initialValue */
  178.                 INPUT_IP_ADDRESS,    /* headerMessage */
  179.                 NO_MESSAGE);    /* promptMessage */
  180. PopInformationText();
  181. PopHelpContext();
  182.  
  183. rc = PutProfileString ("Protocol TCPIP",    /* appName */
  184.                "ip_address",        /* keyName */
  185.                IPAddress,        /* valueString */
  186.                pathNET_CFG,        /* fileName */
  187.                "CFG");            /* fileType */
  188.  
  189. /*
  190. ==============================
  191. =  Now get the subnet Mask.  =
  192. ==============================
  193. */
  194. rc1 = GetProfileString ("Protocol TCPIP",    /* appName */
  195.                "ip_netmask",        /* keyName */
  196.                "",            /* defaultString */
  197.                subnetMask,        /* returnedString */
  198.                pathNET_CFG,        /* fileName */
  199.                "CFG");            /* fileType */
  200.  
  201. if (!rc1) subnetMask = "";
  202. PushHelpContext (SUBNETS_USED_HELP);
  203. PushInformationText (2, SUBNETS_USED_MSG);
  204. if (Confirm (SUBNET_USED_QUESTION, 18, 0, rc1)) {
  205.     PushHelpContext (SUBNET_MASK_HELP);
  206.     PushInformationText (2, SUBNET_MASK_MSG);
  207.     subnetMask = InputIPAddress (18,        /* centerLine */
  208.                      0,            /* centerColumn */
  209.                      subnetMask,    /* initialValue */
  210.                      INPUT_SUBNET_MASK,    /* headerMessage */
  211.                      NO_MESSAGE);    /* promptMessage */
  212.     PopInformationText();
  213.     PopHelpContext();
  214.  
  215.     rc = PutProfileString ("Protocol TCPIP",    /* appName */
  216.                    "ip_netmask",        /* keyName */
  217.                    subnetMask,        /* valueString */
  218.                    pathNET_CFG,        /* fileName */
  219.                    "CFG");            /* fileType */
  220. } else {
  221.     if (rc1) rc = PutProfileString ("Protocol TCPIP",    /* appName */
  222.                    "ip_netmask",        /* keyName */
  223.                    "",            /* valueString */
  224.                    pathNET_CFG,        /* fileName */
  225.                    "CFG");            /* fileType */
  226. } /* end if */
  227. PopInformationText();
  228. PopHelpContext();
  229.  
  230. /*
  231. ==================================================
  232. =  Last, but not least, get the Router address.  =
  233. ==================================================
  234. */
  235. rc1 = GetProfileString ("Protocol TCPIP",    /* appName */
  236.                "ip_router",        /* keyName */
  237.                "",            /* defaultString */
  238.                routerAddress,        /* returnedString */
  239.                pathNET_CFG,        /* fileName */
  240.                "CFG");            /* fileType */
  241.  
  242. if (!rc1) routerAddress = "";
  243. PushHelpContext (IP_ROUTER_USED_HELP);
  244. PushInformationText (2, IP_ROUTER_USED_MSG);
  245. if (Confirm (ROUTER_USED_QUESTION, 18, 0, rc1)) {
  246.     PushHelpContext (IP_ROUTER_ADDRESS_HELP);
  247.     PushInformationText (2, IP_ROUTER_ADDRESS_MSG);
  248.     routerAddress = InputIPAddress (18,        /* centerLine */
  249.                         0,        /* centerColumn */
  250.                         routerAddress,    /* initialValue */
  251.                         INPUT_ROUTER_ADDRESS,/* headerMessage */
  252.                         NO_MESSAGE);    /* promptMessage */
  253.     PopInformationText();
  254.     PopHelpContext();
  255.  
  256.     rc = PutProfileString ("Protocol TCPIP",    /* appName */
  257.                    "ip_router",        /* keyName */
  258.                    routerAddress,        /* valueString */
  259.                    pathNET_CFG,        /* fileName */
  260.                    "CFG");            /* fileType */
  261. } else {
  262.     if (rc1) rc = PutProfileString ("Protocol TCPIP",    /* appName */
  263.                    "ip_router",        /* keyName */
  264.                    "",            /* valueString */
  265.                    pathNET_CFG,        /* fileName */
  266.                    "CFG");            /* fileType */
  267. } /* end if */
  268. PopInformationText();
  269. PopHelpContext();
  270.  
  271.  
  272. /*
  273. ==============================================================================
  274. =  Look for an existing RESOLV.CFG file.  Ask  if  it  should  be  used  if  =
  275. =  found.                                     =
  276. ==============================================================================
  277. */
  278. rc1 = 0;
  279. if (IsFile (targetPath + "\\tcp\\resolv.cfg")) {
  280.     PushInformationText (2, REINSTALL_RESOLV_INFO);
  281.     PushHelpContext (RESOLV_CFG_FILE_HELP);
  282.     rc1 = Confirm (REINSTALL_RESOLV_CFG, 18, 0, 0);
  283.     PopHelpContext();
  284.     PopInformationText();
  285.  
  286.     if (!rc1) goto pathData;
  287. } /* end if */
  288.  
  289. resolvPath = getenv ("EXCELAN");
  290. if (resolvPath != "") {
  291.     AppendPath (resolvPath, "tcp\\resolv.cfg");
  292.     if (IsFile (resolvPath)) {
  293.         PushHelpContext (RESOLV_XLN_TCP_HELP);
  294.         PushInformationText (2, REUSE_RESOLV_INFO);
  295.         rc = Confirm (REUSE_RESOLV_CFG, 18, 0, 1);
  296.         PopInformationText();
  297.         PopHelpContext();
  298.  
  299.         if (rc) {
  300.             if (copy (resolvPath, targetPath + "\\TCP")) {
  301.                 DisplayErrorCondition (FATAL);
  302.             } /* end if */
  303.             goto pathData;
  304.         } /* end if */
  305.     } /* end if */
  306. } /* end if */
  307.  
  308. /*
  309. ==============================================================
  310. =  No resolv.cfg file was found, promp for DNS information.  =
  311. ==============================================================
  312. */
  313. PushHelpContext (DNS_USED_HELP);
  314. PushInformationText (2, DNS_USED_MSG);
  315. if (Confirm (DNS_USED_QUESTION, 18, 0, 0)) {
  316.     domainName = "";
  317.     PushHelpContext (DOMAIN_NAME_HELP);
  318.     PushInformationText (2, DOMAIN_NAME_MSG);
  319.     EditString (17,                /* Center Line */
  320.             0,                /* Center Column */
  321.             1,                /* Height */
  322.             70,                /* Width */
  323.             DOMAIN_NAME_HEADER,        /* Header */
  324.             DOMAIN_NAME_PROMPT,        /* Prompt */
  325.             domainName,            /* String Value */
  326.             EF_NOSPACES);        /* Edit Flags */
  327.     PopInformationText();
  328.     PopHelpContext();
  329.  
  330.     DNSAddress = "";
  331.     PushHelpContext (DNS_IP_ADDRESS_HELP);
  332.     PushInformationText (2, INPUT_DNS_ADDR_MSG);
  333.     DNSAddress = InputIPAddress (18,        /* centerLine */
  334.                      0,            /* centerColumn */
  335.                      DNSAddress,    /* initialValue */
  336.                      INPUT_DNS_ADDRESS,    /* headerMessage */
  337.                      NO_MESSAGE);    /* promptMessage */
  338.     PopInformationText();
  339.     PopHelpContext();
  340.  
  341.     fh = fopen (targetPath + "\\tcp\\resolv.cfg", "w");
  342.  
  343.     rc = fputs ("; DNS resolver file", fh);
  344.     rc = fputs (";", fh);
  345.     rc = fputs ("domain " + domainName, fh);
  346.     rc = fputs (";", fh);
  347.     rc = fputs ("nameserver " + DNSAddress, fh);
  348.  
  349.     rc = fclose (fh);
  350. } else {
  351.     if (rc1) delete (targetPath + "\\tcp\\resolv.cfg");
  352. } /* end if */
  353. PopInformationText();
  354. PopHelpContext();
  355.  
  356.  
  357. pathData:
  358. /*
  359. ================================================
  360. =  Now put the PATH data in the NET.CFG file.  =
  361. ================================================
  362. */
  363. pathKeyName[0] = "PATH TCP_CFG";
  364. pathKeyName[1] = "PATH LWP_CFG";
  365. pathKeyName[2] = "PATH PROFILE";
  366. pathKeyName[3] = "PATH SCRIPT";
  367.  
  368. /*
  369. ========================================================
  370. =  Save the PATH data in the old NET.CFG file          =
  371. =  (needed when install to different target directory  =
  372. =  from the existing LWP 4.1 software directory        =
  373. ========================================================
  374. */
  375.     rc = GetProfileString ("Protocol TCPIP",    /* appName */
  376.                    pathKeyName[0],        /* keyName */
  377.                    "",            /* defaultString */
  378.                    resolvPath,        /* returnedString */
  379.                    pathNET_CFG,        /* fileName */
  380.                    "CFG");            /* fileType */
  381.     oldpathKeyValue[0] = resolvPath;
  382.  
  383.     rc = GetProfileString ("Protocol TCPIP",    /* appName */
  384.                    pathKeyName[1],        /* keyName */
  385.                    "",            /* defaultString */
  386.                    resolvPath,        /* returnedString */
  387.                    pathNET_CFG,        /* fileName */
  388.                    "CFG");            /* fileType */
  389.     oldpathKeyValue[1] = resolvPath;
  390.  
  391.     rc = GetProfileString ("Protocol TCPIP",    /* appName */
  392.                    pathKeyName[2],        /* keyName */
  393.                    "",            /* defaultString */
  394.                    resolvPath,        /* returnedString */
  395.                    pathNET_CFG,        /* fileName */
  396.                    "CFG");            /* fileType */
  397.     oldpathKeyValue[2] = resolvPath;
  398.  
  399.     rc = GetProfileString ("Protocol TCPIP",    /* appName */
  400.                    pathKeyName[3],        /* keyName */
  401.                    "",            /* defaultString */
  402.                    resolvPath,        /* returnedString */
  403.                    pathNET_CFG,        /* fileName */
  404.                    "CFG");            /* fileType */
  405.     oldpathKeyValue[3] = resolvPath;
  406.  
  407.  
  408. pathKeyValue[0] = targetPath + "\\TCP";
  409. pathKeyValue[1] = targetPath + "\\HSTACC";
  410. pathKeyValue[2] = targetPath + "\\PROFILE";
  411. pathKeyValue[3] = targetPath + "\\SCRIPT";
  412.  
  413. i = 0;
  414. do {
  415.     rc = PutProfileString ("Protocol TCPIP",    /* appName */
  416.                    pathKeyName[i],        /* keyName */
  417.                    pathKeyValue[i],        /* valueString */
  418.                    pathNET_CFG,        /* fileName */
  419.                    "CFG");            /* file type */
  420.  
  421.     i = i + 1;
  422. } while (i <= 3);
  423.