static private DHCP.optionsResponse InitializeResponse()
        {
            DHCP.optionsResponse option = new DHCP.optionsResponse();
            option.messageType.optionHeader.option = DHCP.TAG_DHCP_MESSAGE;
            option.messageType.optionHeader.lenght = 1;
            option.messageType.type = DHCP.DHCPACK;

            option.serverID.optionHeader.option = DHCP.TAG_SERVER_ID;
            option.serverID.optionHeader.lenght = 4;
            option.serverID.id = 0;  //To fill with the Server IP

            option.addressLeaseTime.optionHeader.option = DHCP.TAG_IP_LEASE;
            option.addressLeaseTime.optionHeader.lenght = 4;
            option.addressLeaseTime.time = (uint)IPAddress.HostToNetworkOrder((int)86400);  //1 days in mins

            option.subnetMask.optionHeader.option = DHCP.TAG_SUBNET_MASK;
            option.subnetMask.optionHeader.lenght = 4;
            option.subnetMask.mask = (uint)IPAddress.Parse("255.255.255.0").Address;

            option.route.optionHeader.option = DHCP.TAG_GATEWAY;
            option.route.optionHeader.lenght = 4;
            option.route.ip = 0;  //To fill with the gateway

            option.domainNameServer.optionHeader.option = DHCP.TAG_DOMAIN_SERVER;
            option.domainNameServer.optionHeader.lenght = 4;
            option.domainNameServer.ip = 0;  //To fill with the DNS

            option.endOptions = 0xFF;
            return option;
        }
Exemple #2
0
        static private DHCP.optionsResponse InitializeResponse()
        {
            DHCP.optionsResponse option = new DHCP.optionsResponse();
            option.messageType.optionHeader.option = DHCP.TAG_DHCP_MESSAGE;
            option.messageType.optionHeader.lenght = 1;
            option.messageType.type = DHCP.DHCPACK;

            option.serverID.optionHeader.option = DHCP.TAG_SERVER_ID;
            option.serverID.optionHeader.lenght = 4;
            option.serverID.id = 0;  //To fill with the Server IP

            option.addressLeaseTime.optionHeader.option = DHCP.TAG_IP_LEASE;
            option.addressLeaseTime.optionHeader.lenght = 4;
            option.addressLeaseTime.time = (uint)IPAddress.HostToNetworkOrder((int)86400);  //1 days in mins

            option.subnetMask.optionHeader.option = DHCP.TAG_SUBNET_MASK;
            option.subnetMask.optionHeader.lenght = 4;
            option.subnetMask.mask = (uint)IPAddress.Parse("255.255.255.0").Address;

            option.route.optionHeader.option = DHCP.TAG_GATEWAY;
            option.route.optionHeader.lenght = 4;
            option.route.ip = 0;  //To fill with the gateway

            option.domainNameServer.optionHeader.option = DHCP.TAG_DOMAIN_SERVER;
            option.domainNameServer.optionHeader.lenght = 4;
            option.domainNameServer.ip = 0;  //To fill with the DNS

            option.endOptions = 0xFF;
            return(option);
        }