; Copyright (C) 1993 Microsoft Corporation
; All rights reserved.
;
; The ipinfo.inf file allows network administrators to provide smart
; defaults for TCP/IP configuration parameters. By modifying this
; template, an administrator can distribute the Windows NT TCP/IP
; software over the network or on floppy disks to users with some
; smart default configuration parameters. End users will still be 
; able to modify these values when installing TCP/IP, however, the
; default values will be automatically filled in for them.
;
; This file may contain defaults for the default gateway, IP
; addresses (per interface), and subnet mask (per interface). To modify 
; the default 'default gateway' edit the line in the [DefaultIPInfo] 
; section below that looks like this:
;
;       DefaultGateway = "xxx.xxx.xxx.xxx"
;
; xxx.xxx.xxx.xxx represents a valid IP address for the default 
; gateway. If the default gateway is unknown, it can be left blank:
;
;       DefaultGateway = ""
;
; To modify the default IP addresses and subnet mask IP addresses, 
; modify the following lines in the [DefaultIPInfo] section below:
;       
;       NumberOfIPAddress = X
;
; X represents the number of IP addresses for the machine.
;
; Add the following pair of values for each interface <X>:
;
;       IPAddress<Y>  = "xxx.xxx.xxx.xxx"
;       SubnetMask<Y> = "xxx.xxx.xxx.xxx"
;
; where 1 <= Y <=X and <Y> represents the interface(s) on the system.
; The IPAddress and SubnetMask values can be left blank ("") for no 
; default, or can be set with valid IP addresses.
;
; For example:
;
;[DefaultIPInfo]
;    DefaultGateway = "11.1.0.0"
;    NumberOfIPAddress = 3
;    IPAddress1  = "11.1.12.1"
;    SubnetMask1 = "255.255.0.1"
;    IPAddress2  = "11.1.12.2"
;    SubnetMask2 = "255.255.0.2"
;    IPAddress3  = "11.1.12.3"
;    SubnetMask3 = "255.255.0.3"

[DefaultIPInfo]
    DefaultGateway = ""
    NumberOfIPAddress = 0
    IPAddress1  = ""
    SubnetMask1 = ""


;------------------------------------------------------------------------
; GetIPInfo: Returns the default gateway IP address, a list of default IP
;       addresses and a list of default subnet mask IP addresses to the
;       caller.
;------------------------------------------------------------------------

[GetIPInfo]
    set DefaultGateway = ""
    set NumberOfIPAddress = 0
    set IPAddressList  = ""
    set SubnetMaskList = ""
    read-syms DefaultIPInfo
    set Count = 1
    set UseHostFile = TRUE
    LoadLibrary "x" $(!STF_CWDDIR)\tcpcfg.dll !TCPCFG_HANDLE
    LibraryProcedure Result, $(!TCPCFG_HANDLE), CPlGetIPAddress
    freeLibrary $(!TCPCFG_HANDLE)
    ifint *($(Result),1) == 0
        set IPAddressList = {*($(Result),2)}
    else
        set UseHostFile = FALSE
    endif
    
LOOP = +
    ifint $(Count) <= $(NumberOfIPAddress)
        ifstr(i) $(UseHostFile) == FALSE
            ifstr(i) $(IPAddressList) == ""
                set IPAddressList = $(IPAddress$(Count))
            else
                set IPAddressList = >($(IPAddressList),$(IPAddress$(Count))))
            endif
        endif
        ifstr(i) $(SubnetMaskList) == ""
            set SubnetMaskList = $(SubnetMask$(Count))
        else
            set SubnetMaskList = >($(SubnetMaskList),$(SubnetMask$(Count)))
        endif
        set-add Count = $(Count), 1
        goto LOOP
    endif

    return $(DefaultGateway), $(IPAddressList), $(SubnetMaskList)
        
