options.c: Add an add_option_clientid() variant for ndhs to use, and silence

an unused function warning that triggers when compiling ndhs.
This commit is contained in:
Nicholas J. Kain 2014-03-18 01:51:58 -04:00
parent 742baf6d7b
commit 3d0f46580a
2 changed files with 9 additions and 0 deletions

View File

@ -195,6 +195,7 @@ static size_t add_u8_option(struct dhcpmsg *packet, uint8_t code, uint8_t data)
return 3;
}
#ifndef NDHS_BUILD
// Data should be in network byte order.
static size_t add_u16_option(struct dhcpmsg *packet, uint8_t code,
uint16_t data)
@ -210,6 +211,7 @@ static size_t add_u16_option(struct dhcpmsg *packet, uint8_t code,
packet->options[end+4] = DCODE_END;
return 4;
}
#endif
// Data should be in network byte order.
size_t add_u32_option(struct dhcpmsg *packet, uint8_t code, uint32_t data)
@ -311,6 +313,11 @@ void add_option_hostname(struct dhcpmsg *packet)
if (len)
add_option_string(packet, DCODE_HOSTNAME, client_config.hostname, len);
}
#else
void add_option_clientid(struct dhcpmsg *packet, char *clientid, size_t clen)
{
add_option_string(packet, DCODE_CLIENT_ID, clientid, clen);
}
#endif
uint32_t get_option_router(struct dhcpmsg *packet)

View File

@ -76,6 +76,8 @@ void add_option_maxsize(struct dhcpmsg *packet);
void add_option_vendor(struct dhcpmsg *packet);
void add_option_clientid(struct dhcpmsg *packet);
void add_option_hostname(struct dhcpmsg *packet);
#else
void add_option_clientid(struct dhcpmsg *packet, char *clientid, size_t clen);
#endif
uint32_t get_option_router(struct dhcpmsg *packet);
uint8_t get_option_msgtype(struct dhcpmsg *packet);