Lines Matching defs:options

1 /*	$OpenBSD: options.c,v 1.15 2004/12/26 03:17:07 deraadt Exp $	*/
3 /* DHCP options parsing and reassembly. */
44 __FBSDID("$FreeBSD: releng/10.2/sbin/dhclient/options.c 229778 2012-01-07 16:09:33Z uqs $");
65 * Parse all available options out of the specified packet.
71 memset(packet->options, 0, sizeof(packet->options));
74 if (memcmp(packet->raw->options, DHCP_OPTIONS_COOKIE, 4)) {
80 * Go through the options field, up to the end of the packet or
83 parse_option_buffer(packet, &packet->raw->options[4],
88 * options out of the buffer(s) containing them.
91 packet->options[DHO_DHCP_OPTION_OVERLOAD].data) {
92 if (packet->options[DHO_DHCP_OPTION_OVERLOAD].data[0] & 1)
96 if (packet->options[DHO_DHCP_OPTION_OVERLOAD].data[0] & 2)
109 * Parse options out of the specified buffer, storing addresses of
110 * option values in packet->options and setting packet->options_valid if
123 /* Pad options don't have a length - just skip them. */
156 warning("Many bogus options seen in offers. "
158 "options - hope for the best!");
169 if (!packet->options[code].data) {
179 packet->options[code].len = len;
180 packet->options[code].data = t;
187 t = calloc(1, len + packet->options[code].len + 1);
191 memcpy(t, packet->options[code].data,
192 packet->options[code].len);
193 memcpy(t + packet->options[code].len,
195 packet->options[code].len += len;
196 t[packet->options[code].len] = 0;
197 free(packet->options[code].data);
198 packet->options[code].data = t;
218 if (packet->options[DHO_DOMAIN_SEARCH].data == NULL)
221 option = &packet->options[DHO_DOMAIN_SEARCH];
371 * cons options into a big buffer, and then split them out into the
373 * vendor options using the same routine.
377 int mms, struct tree_cache **options,
395 inpacket->options[DHO_DHCP_MAX_MESSAGE_SIZE].data &&
396 (inpacket->options[DHO_DHCP_MAX_MESSAGE_SIZE].len >=
399 inpacket->options[DHO_DHCP_MAX_MESSAGE_SIZE].data);
411 /* Preload the option priority list with mandatory options. */
419 * If the client has provided a list of options that it wishes
424 inpacket->options[DHO_DHCP_PARAMETER_REQUEST_LIST].data) {
426 inpacket->options[DHO_DHCP_PARAMETER_REQUEST_LIST].len;
431 inpacket->options[DHO_DHCP_PARAMETER_REQUEST_LIST].data,
449 /* Copy the options into the big buffer... */
454 options, priority_list, priority_len, main_buffer_size,
459 memcpy(outpacket->options, DHCP_OPTIONS_COOKIE, 4);
468 memcpy(&outpacket->options[mainbufix],
472 outpacket->options[mainbufix++] = DHO_END;
475 outpacket->options[mainbufix++] = DHO_DHCP_OPTION_OVERLOAD;
476 outpacket->options[mainbufix++] = 1;
479 outpacket->options[mainbufix++] = 3;
481 outpacket->options[mainbufix++] = 1;
483 memcpy(&outpacket->options[mainbufix],
517 * Store all the requested options into the requested buffer.
520 store_options(unsigned char *buffer, int buflen, struct tree_cache **options,
530 * Copy out the options in the order that they appear in the
545 if (!options[code]) {
558 length = options[code]->len;
608 options[code]->value + ix, incr - 1);
612 options[code]->value + ix, incr);
883 tp.options[DHO_DHCP_MESSAGE_TYPE].data)
884 tp.packet_type = tp.options[DHO_DHCP_MESSAGE_TYPE].data[0];
890 /* Free the data associated with the options. */
892 if (tp.options[i].len && tp.options[i].data)
893 free(tp.options[i].data);