diff --git a/ndhc/dhcpd.h b/ndhc/dhcpd.h index 8e4fd05..7a8431c 100644 --- a/ndhc/dhcpd.h +++ b/ndhc/dhcpd.h @@ -13,54 +13,8 @@ #define SERVER_PORT 67 #define CLIENT_PORT 68 -#define DHCP_MAGIC 0x63825363 #define DHCP_OPTIONS_BUFSIZE 308 -/* DHCP option codes (partial list) */ -#define DHCP_PADDING 0x00 -#define DHCP_SUBNET 0x01 -#define DHCP_TIME_OFFSET 0x02 -#define DHCP_ROUTER 0x03 -#define DHCP_TIME_SERVER 0x04 -#define DHCP_NAME_SERVER 0x05 -#define DHCP_DNS_SERVER 0x06 -#define DHCP_LOG_SERVER 0x07 -#define DHCP_COOKIE_SERVER 0x08 -#define DHCP_LPR_SERVER 0x09 -#define DHCP_HOST_NAME 0x0c -#define DHCP_BOOT_SIZE 0x0d -#define DHCP_DOMAIN_NAME 0x0f -#define DHCP_SWAP_SERVER 0x10 -#define DHCP_ROOT_PATH 0x11 -#define DHCP_IP_TTL 0x17 -#define DHCP_MTU 0x1a -#define DHCP_BROADCAST 0x1c -#define DHCP_NIS_DOMAIN 0x28 -#define DHCP_NIS_SERVER 0x29 -#define DHCP_NTP_SERVER 0x2a -#define DHCP_WINS_SERVER 0x2c -#define DHCP_REQUESTED_IP 0x32 -#define DHCP_LEASE_TIME 0x33 -#define DHCP_OPTION_OVERLOAD 0x34 -#define DHCP_MESSAGE_TYPE 0x35 -#define DHCP_SERVER_ID 0x36 -#define DHCP_PARAM_REQ 0x37 -#define DHCP_MESSAGE 0x38 -#define DHCP_MAX_SIZE 0x39 -#define DHCP_T1 0x3a -#define DHCP_T2 0x3b -#define DHCP_VENDOR 0x3c -#define DHCP_CLIENT_ID 0x3d -#define DHCP_TFTP_SERVER_NAME 0x42 -#define DHCP_BOOT_FILE 0x43 -#define DHCP_USER_CLASS 0x4d -#define DHCP_FQDN 0x51 -#define DHCP_DOMAIN_SEARCH 0x77 -#define DHCP_SIP_SERVERS 0x78 -#define DHCP_STATIC_ROUTES 0x79 -#define DHCP_WPAD 0xfc -#define DHCP_END 0xff - enum { BOOTREQUEST = 1, BOOTREPLY = 2 diff --git a/ndhc/dhcpmsg.h b/ndhc/dhcpmsg.h index 42dabba..d139665 100644 --- a/ndhc/dhcpmsg.h +++ b/ndhc/dhcpmsg.h @@ -3,6 +3,8 @@ #include +#define DHCP_MAGIC 0x63825363 + uint32_t random_xid(void); int send_discover(uint32_t xid, uint32_t requested); int send_selecting(uint32_t xid, uint32_t server, uint32_t requested); diff --git a/ndhc/options.h b/ndhc/options.h index 9654269..4d9c6cf 100644 --- a/ndhc/options.h +++ b/ndhc/options.h @@ -6,6 +6,51 @@ #define TYPE_MASK 0x0F +/* DHCP option codes (partial list) */ +#define DHCP_PADDING 0x00 +#define DHCP_SUBNET 0x01 +#define DHCP_TIME_OFFSET 0x02 +#define DHCP_ROUTER 0x03 +#define DHCP_TIME_SERVER 0x04 +#define DHCP_NAME_SERVER 0x05 +#define DHCP_DNS_SERVER 0x06 +#define DHCP_LOG_SERVER 0x07 +#define DHCP_COOKIE_SERVER 0x08 +#define DHCP_LPR_SERVER 0x09 +#define DHCP_HOST_NAME 0x0c +#define DHCP_BOOT_SIZE 0x0d +#define DHCP_DOMAIN_NAME 0x0f +#define DHCP_SWAP_SERVER 0x10 +#define DHCP_ROOT_PATH 0x11 +#define DHCP_IP_TTL 0x17 +#define DHCP_MTU 0x1a +#define DHCP_BROADCAST 0x1c +#define DHCP_NIS_DOMAIN 0x28 +#define DHCP_NIS_SERVER 0x29 +#define DHCP_NTP_SERVER 0x2a +#define DHCP_WINS_SERVER 0x2c +#define DHCP_REQUESTED_IP 0x32 +#define DHCP_LEASE_TIME 0x33 +#define DHCP_OPTION_OVERLOAD 0x34 +#define DHCP_MESSAGE_TYPE 0x35 +#define DHCP_SERVER_ID 0x36 +#define DHCP_PARAM_REQ 0x37 +#define DHCP_MESSAGE 0x38 +#define DHCP_MAX_SIZE 0x39 +#define DHCP_T1 0x3a +#define DHCP_T2 0x3b +#define DHCP_VENDOR 0x3c +#define DHCP_CLIENT_ID 0x3d +#define DHCP_TFTP_SERVER_NAME 0x42 +#define DHCP_BOOT_FILE 0x43 +#define DHCP_USER_CLASS 0x4d +#define DHCP_FQDN 0x51 +#define DHCP_DOMAIN_SEARCH 0x77 +#define DHCP_SIP_SERVERS 0x78 +#define DHCP_STATIC_ROUTES 0x79 +#define DHCP_WPAD 0xfc +#define DHCP_END 0xff + enum { OPTION_IP=1, OPTION_IP_PAIR,