Lines Matching refs:dhcp
6 #include "dhcp.h"
129 struct dhcp_message *dhcp;
135 dhcp = malloc(sizeof(*dhcp));
136 memset(dhcp, 0, sizeof(*dhcp));
137 bytes = read(fd, dhcp, sizeof(*dhcp));
140 free(dhcp);
141 dhcp = NULL;
143 return dhcp;
190 #define get_option_raw(dhcp, opt) get_option(dhcp, opt, NULL, NULL)
192 get_option(const struct dhcp_message *dhcp, uint8_t opt, int *len, int *type)
194 const uint8_t *p = dhcp->options;
195 const uint8_t *e = p + sizeof(dhcp->options);
227 p = dhcp->bootfile;
228 e = p + sizeof(dhcp->bootfile);
232 p = dhcp->servername;
233 e = p + sizeof(dhcp->servername);
265 get_option_addr32(uint32_t *a, const struct dhcp_message *dhcp, uint8_t option)
267 const uint8_t *p = get_option_raw(dhcp, option);
276 get_option_uint32(uint32_t *i, const struct dhcp_message *dhcp, uint8_t option)
280 if (get_option_addr32(&a, dhcp, option) == -1)
320 struct dhcp_message *dhcp;
329 if ((dhcp = get_lease_from_file(leasefile)) == NULL) {
335 lease->addr.s_addr = dhcp->yiaddr;
337 if (get_option_addr32(&lease->net.s_addr, dhcp, DHO_SUBNETMASK) == -1)
338 lease->net.s_addr = get_netmask(dhcp->yiaddr);
339 if (get_option_uint32(&lease->leasetime, dhcp, DHO_LEASETIME) != 0)
341 get_option_addr32(&lease->server.s_addr, dhcp, DHO_SERVERID);
346 if (get_option_uint32(&lease->renewaltime, dhcp, DHO_RENEWALTIME) != 0)
348 if (get_option_uint32(&lease->rebindtime, dhcp, DHO_REBINDTIME) != 0)