Lines Matching +defs:code +defs:string
8 #include <string.h>
19 /* name[10] flags code */
70 unsigned char *get_option(struct dhcpMessage *packet, int code)
96 if (optionptr[i + OPT_CODE] == code) {
149 /* add an option string to the options (an option string contains an option code,
151 int add_option_string(unsigned char *optionptr, unsigned char *string)
155 /* end position + string length + option code/length + end option */
156 if (end + string[OPT_LEN] + 2 + 1 >= 308) {
157 LOG(LOG_ERR, "Option 0x%02x did not fit into the packet!", string[OPT_CODE]);
160 DEBUG(LOG_INFO, "adding option 0x%02x", string[OPT_CODE]);
161 memcpy(optionptr + end, string, string[OPT_LEN] + 2);
162 optionptr[end + string[OPT_LEN] + 2] = DHCP_END;
163 return string[OPT_LEN] + 2;
168 int add_simple_option(unsigned char *optionptr, unsigned char code, u_int32_t data)
181 for (i = 0; options[i].code; i++)
182 if (options[i].code == code) {
187 DEBUG(LOG_ERR, "Could not add option 0x%02x", code);
191 option[OPT_CODE] = code;
204 /* find option 'code' in opt_list */
205 struct option_set *find_option(struct option_set *opt_list, char code)
207 while (opt_list && opt_list->data[OPT_CODE] < code)
210 if (opt_list && opt_list->data[OPT_CODE] == code) return opt_list;
221 if ((existing = find_option(*opt_list, option->code))) {
237 new->data[OPT_CODE] = option->code;
242 while (*curr && (*curr)->data[OPT_CODE] < option->code)