summaryrefslogtreecommitdiffstats
path: root/src/customdhcpcd/dhcp.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/customdhcpcd/dhcp.h')
-rw-r--r--src/customdhcpcd/dhcp.h191
1 files changed, 96 insertions, 95 deletions
diff --git a/src/customdhcpcd/dhcp.h b/src/customdhcpcd/dhcp.h
index ef97b75..019d3b3 100644
--- a/src/customdhcpcd/dhcp.h
+++ b/src/customdhcpcd/dhcp.h
@@ -1,4 +1,4 @@
-/*
+/*
* dhcpcd - DHCP client daemon
* Copyright 2006-2008 Roy Marples <roy@marples.name>
* All rights reserved
@@ -65,105 +65,106 @@
/* DHCP options */
enum DHCP_OPTIONS
{
- DHCP_PAD = 0,
- DHCP_NETMASK = 1,
- DHCP_TIMEROFFSET = 2,
- DHCP_ROUTERS = 3,
- DHCP_TIMESERVER = 4,
- DHCP_NAMESERVER = 5,
- DHCP_DNSSERVER = 6,
- DHCP_LOGSERVER = 7,
- DHCP_COOKIESERVER = 8,
- DHCP_HOSTNAME = 12,
- DHCP_DNSDOMAIN = 15,
- DHCP_ROOTPATH = 17,
- DHCP_DEFAULTIPTTL = 23,
- DHCP_MTU = 26,
- DHCP_BROADCAST = 28,
- DHCP_MASKDISCOVERY = 29,
- DHCP_ROUTERDISCOVERY = 31,
- DHCP_STATICROUTE = 33,
- DHCP_NISDOMAIN = 40,
- DHCP_NISSERVER = 41,
- DHCP_NTPSERVER = 42,
- DHCP_ADDRESS = 50,
- DHCP_LEASETIME = 51,
- DHCP_OPTIONSOVERLOADED = 52,
- DHCP_MESSAGETYPE = 53,
- DHCP_SERVERIDENTIFIER = 54,
- DHCP_PARAMETERREQUESTLIST = 55,
- DHCP_MESSAGE = 56,
- DHCP_MAXMESSAGESIZE = 57,
- DHCP_RENEWALTIME = 58,
- DHCP_REBINDTIME = 59,
- DHCP_CLASSID = 60,
- DHCP_CLIENTID = 61,
- DHCP_USERCLASS = 77, /* RFC 3004 */
- DHCP_FQDN = 81,
- DHCP_DNSSEARCH = 119, /* RFC 3397 */
- DHCP_SIPSERVER = 120, /* RFC 3361 */
- DHCP_CSR = 121, /* RFC 3442 */
- DHCP_MSCSR = 249, /* MS code for RFC 3442 */
- DHCP_END = 255
+ DHCP_PAD = 0,
+ DHCP_NETMASK = 1,
+ DHCP_TIMEROFFSET = 2,
+ DHCP_ROUTERS = 3,
+ DHCP_TIMESERVER = 4,
+ DHCP_NAMESERVER = 5,
+ DHCP_DNSSERVER = 6,
+ DHCP_LOGSERVER = 7,
+ DHCP_COOKIESERVER = 8,
+ DHCP_HOSTNAME = 12,
+ DHCP_DNSDOMAIN = 15,
+ DHCP_ROOTPATH = 17,
+ DHCP_DEFAULTIPTTL = 23,
+ DHCP_MTU = 26,
+ DHCP_BROADCAST = 28,
+ DHCP_MASKDISCOVERY = 29,
+ DHCP_ROUTERDISCOVERY = 31,
+ DHCP_STATICROUTE = 33,
+ DHCP_NISDOMAIN = 40,
+ DHCP_NISSERVER = 41,
+ DHCP_NTPSERVER = 42,
+ DHCP_ADDRESS = 50,
+ DHCP_LEASETIME = 51,
+ DHCP_OPTIONSOVERLOADED = 52,
+ DHCP_MESSAGETYPE = 53,
+ DHCP_SERVERIDENTIFIER = 54,
+ DHCP_PARAMETERREQUESTLIST = 55,
+ DHCP_MESSAGE = 56,
+ DHCP_MAXMESSAGESIZE = 57,
+ DHCP_RENEWALTIME = 58,
+ DHCP_REBINDTIME = 59,
+ DHCP_CLASSID = 60,
+ DHCP_CLIENTID = 61,
+ DHCP_USERCLASS = 77, /* RFC 3004 */
+ DHCP_FQDN = 81,
+ DHCP_DNSSEARCH = 119, /* RFC 3397 */
+ DHCP_SIPSERVER = 120, /* RFC 3361 */
+ DHCP_CSR = 121, /* RFC 3442 */
+ DHCP_MSCSR = 249, /* MS code for RFC 3442 */
+ DHCP_END = 255
};
/* SetFQDNHostName values - lsnybble used in flags
* byte (see buildmsg.c), hsnybble to create order
* and to allow 0x00 to mean disable
*/
-enum FQQN {
- FQDN_DISABLE = 0x00,
- FQDN_NONE = 0x18,
- FQDN_PTR = 0x20,
- FQDN_BOTH = 0x31
+enum FQQN
+{
+ FQDN_DISABLE = 0x00,
+ FQDN_NONE = 0x18,
+ FQDN_PTR = 0x20,
+ FQDN_BOTH = 0x31
};
typedef struct fqdn_t
{
- uint8_t flags;
- uint8_t r1;
- uint8_t r2;
- char *name;
+ uint8_t flags;
+ uint8_t r1;
+ uint8_t r2;
+ char *name;
} fqdn_t;
typedef struct dhcp_t
{
- char version[11];
+ char version[11];
- struct in_addr serveraddress;
- char serverhw[IF_NAMESIZE];
- char servername[64];
+ struct in_addr serveraddress;
+ char serverhw[IF_NAMESIZE];
+ char servername[64];
- struct in_addr address;
- struct in_addr netmask;
- struct in_addr broadcast;
- unsigned short mtu;
+ struct in_addr address;
+ struct in_addr netmask;
+ struct in_addr broadcast;
+ unsigned short mtu;
- uint32_t leasedfrom;
- uint32_t leasetime;
- uint32_t renewaltime;
- uint32_t rebindtime;
+ uint32_t leasedfrom;
+ uint32_t leasetime;
+ uint32_t renewaltime;
+ uint32_t rebindtime;
- struct route_head *routes;
+ struct route_head *routes;
- char *hostname;
- fqdn_t *fqdn;
+ char *hostname;
+ fqdn_t *fqdn;
- struct address_head *dnsservers;
- char *dnsdomain;
- char *dnssearch;
+ struct address_head *dnsservers;
+ char *dnsdomain;
+ char *dnssearch;
- struct address_head *ntpservers;
+ struct address_head *ntpservers;
- struct address_head *nisservers;
- char *nisdomain;
+ struct address_head *nisservers;
+ char *nisdomain;
- char *sipservers;
+ char *sipservers;
- char *message;
- char *rootpath;
+ char *message;
+ char *rootpath;
- bool frominfo;
+ bool frominfo;
} dhcp_t;
/* Sizes for DHCP options */
@@ -183,33 +184,33 @@ typedef struct dhcp_t
typedef struct dhcpmessage_t
{
- unsigned char op; /* message type */
- unsigned char hwtype; /* hardware address type */
- unsigned char hwlen; /* hardware address length */
- unsigned char hwopcount; /* should be zero in client message */
- uint32_t xid; /* transaction id */
- uint16_t secs; /* elapsed time in sec. from boot */
- uint16_t flags;
- uint32_t ciaddr; /* (previously allocated) client IP */
- uint32_t yiaddr; /* 'your' client IP address */
- uint32_t siaddr; /* should be zero in client's messages */
- uint32_t giaddr; /* should be zero in client's messages */
- unsigned char chaddr[DHCP_CHADDR_LEN]; /* client's hardware address */
- unsigned char servername[SERVERNAME_LEN]; /* server host name */
- unsigned char bootfile[BOOTFILE_LEN]; /* boot file name */
- uint32_t cookie;
- unsigned char options[DHCP_OPTION_LEN]; /* message options - cookie */
+ unsigned char op; /* message type */
+ unsigned char hwtype; /* hardware address type */
+ unsigned char hwlen; /* hardware address length */
+ unsigned char hwopcount; /* should be zero in client message */
+ uint32_t xid; /* transaction id */
+ uint16_t secs; /* elapsed time in sec. from boot */
+ uint16_t flags;
+ uint32_t ciaddr; /* (previously allocated) client IP */
+ uint32_t yiaddr; /* 'your' client IP address */
+ uint32_t siaddr; /* should be zero in client's messages */
+ uint32_t giaddr; /* should be zero in client's messages */
+ unsigned char chaddr[DHCP_CHADDR_LEN]; /* client's hardware address */
+ unsigned char servername[SERVERNAME_LEN]; /* server host name */
+ unsigned char bootfile[BOOTFILE_LEN]; /* boot file name */
+ uint32_t cookie;
+ unsigned char options[DHCP_OPTION_LEN]; /* message options - cookie */
} dhcpmessage_t;
struct udp_dhcp_packet
{
- struct ip ip;
- struct udphdr udp;
- dhcpmessage_t dhcp;
+ struct ip ip;
+ struct udphdr udp;
+ dhcpmessage_t dhcp;
};
ssize_t send_message (const interface_t *iface, const dhcp_t *dhcp,
- uint32_t xid, char type, const options_t *options);
+ uint32_t xid, char type, const options_t *options);
void free_dhcp (dhcp_t *dhcp);
int parse_dhcpmessage (dhcp_t *dhcp, const dhcpmessage_t *message);
#endif