Lines Matching +defs:code +defs:string
8 #include <string.h>
19 /* name[10] flags code */
64 unsigned char *get_option(struct dhcpMessage *packet, int code)
78 if (optionptr[i + OPT_CODE] == code) {
131 /* add an option string to the options (an option string contains an option code,
133 int add_option_string(unsigned char *optionptr, unsigned char *string)
137 /* end position + string length + option code/length + end option */
138 if (end + string[OPT_LEN] + 2 + 1 >= 308) {
139 LOG(LOG_ERR, "Option 0x%02x did not fit into the packet!", string[OPT_CODE]);
142 DEBUG(LOG_INFO, "adding option 0x%02x", string[OPT_CODE]);
143 memcpy(optionptr + end, string, string[OPT_LEN] + 2);
144 optionptr[end + string[OPT_LEN] + 2] = DHCP_END;
145 return string[OPT_LEN] + 2;
150 int add_simple_option(unsigned char *optionptr, unsigned char code, u_int32_t data)
163 for (i = 0; options[i].code; i++)
164 if (options[i].code == code) {
169 DEBUG(LOG_ERR, "Could not add option 0x%02x", code);
173 option[OPT_CODE] = code;
186 /* find option 'code' in opt_list */
187 struct option_set *find_option(struct option_set *opt_list, char code)
189 while (opt_list && opt_list->data[OPT_CODE] < code)
192 if (opt_list && opt_list->data[OPT_CODE] == code) return opt_list;
203 if ((existing = find_option(*opt_list, option->code))) {
219 new->data[OPT_CODE] = option->code;
224 while (*curr && (*curr)->data[OPT_CODE] < option->code)