Lines Matching refs:optptr

1036 static uint8_t* set_optval(uint8_t *optptr, uint16_t opt, void *var, size_t len)  in set_optval()  argument
1038 while (*optptr != DHCP_OPT_END) optptr++; in set_optval()
1039 *optptr++ = (uint8_t)(opt & 0x00FF); in set_optval()
1040 *optptr++ = (uint8_t) len; in set_optval()
1041 memcpy(optptr, var, len); in set_optval()
1042 optptr += len; in set_optval()
1043 *optptr = DHCP_OPT_END; in set_optval()
1044 return optptr; in set_optval()
1047 static uint8_t* set_optval6(uint8_t *optptr, uint16_t opt, void *var, size_t len) in set_optval6() argument
1049 *((uint16_t*)optptr) = htons(opt); in set_optval6()
1050 *(uint16_t*)(optptr+2) = htons(len); in set_optval6()
1051 memcpy(optptr+4, var, len); in set_optval6()
1052 optptr += len+4; in set_optval6()
1053 return optptr; in set_optval6()
1057 static uint8_t* get_optval(uint8_t *optptr, uint16_t opt, void *var) in get_optval() argument
1063 while (*optptr == DHCP_OPT_PADDING) optptr++; in get_optval()
1064 if ((*optptr & 0x00FF) == DHCP_OPT_END) break; in get_optval()
1065 if ((*optptr & 0x00FF) == DHCP_OPT_OPTION_OVERLOAD) { in get_optval()
1066 overloaded = optptr[2]; in get_optval()
1067 optptr += optptr[1] + 2; in get_optval()
1069 len = optptr[1]; in get_optval()
1070 if (*optptr == (opt & 0x00FF)) in get_optval()
1074 memcpy(var, optptr+2, sizeof(uint32_t)); in get_optval()
1075 optptr += len + 2; in get_optval()
1076 return optptr; in get_optval()
1079 memcpy(var, optptr+2, sizeof(uint16_t)); in get_optval()
1080 optptr += len + 2; in get_optval()
1081 return optptr; in get_optval()
1084 memcpy(var, optptr+2, sizeof(uint8_t)); in get_optval()
1085 optptr += len + 2; in get_optval()
1086 return optptr; in get_optval()
1089 var = xstrndup((char*) optptr, len); in get_optval()
1090 optptr += len + 2; in get_optval()
1091 return optptr; in get_optval()
1094 optptr += len + 2; in get_optval()
1098 return optptr; in get_optval()
1101 static uint8_t* get_optval6(uint8_t *optptr, uint16_t opt, uint16_t *datalen, void **var) in get_optval6() argument
1106 memcpy(&optcode, optptr, sizeof(uint16_t)); in get_optval6()
1107 memcpy(&len, optptr+2, sizeof(uint16_t)); in get_optval6()
1110 return optptr; in get_optval6()
1117 memcpy(*var, optptr+4, len); in get_optval6()
1118 optptr = optptr + len + 4; in get_optval6()
1122 optptr = get_optval6(optptr+len+4, opt, datalen, var); in get_optval6()
1125 return optptr; in get_optval6()
1131 uint8_t len, *optptr; in get_reqparam() local
1133 for (optptr = gstate.rcvd.rcvd_pkt.options; in get_reqparam()
1134 *optptr && *optptr!=((DHCP_OPT_PARAM_REQ) & 0x00FF); optptr+=optptr[1]+2); in get_reqparam()
1135 len = *++optptr; in get_reqparam()
1137 memcpy(*list, ++optptr, len); in get_reqparam()
1142 static uint8_t* set_reqparam(uint8_t *optptr, uint8_t *list) in set_reqparam() argument
1152 for (; *optptr && *optptr!=DHCP_OPT_END; optptr+=optptr[1]+2); in set_reqparam()
1153 *optptr++ = (uint8_t) (options_list[count].code & 0x00FF); in set_reqparam()
1154 *optptr++ = (uint8_t) options_list[count].len; in set_reqparam()
1155 memcpy(optptr, options_list[count].val, options_list[count].len); in set_reqparam()
1156 optptr += options_list[count].len; in set_reqparam()
1157 *optptr = DHCP_OPT_END; in set_reqparam()
1162 return optptr; in set_reqparam()
1609 uint8_t *optptr, msgtype = 0; in dhcpd_main() local
1761 optptr = prepare_send_pkt6(DHCP6ADVERTISE); in dhcpd_main()
1842 optptr = set_optval6(optptr, DHCP6_OPT_IA_NA, server_ia_na, in dhcpd_main()
1872 optptr = set_optval6(optptr, DHCP6_OPT_SERVERID, server_duid, in dhcpd_main()
1876 optptr = set_optval6(optptr, DHCP6_OPT_CLIENTID, client_duid, in dhcpd_main()
1887 optptr = prepare_send_pkt6(DHCP6REPLY); in dhcpd_main()
1893 optptr = set_optval6(optptr, DHCP6_OPT_CLIENTID, client_duid, in dhcpd_main()
1950 optptr = set_optval6(optptr, DHCP6_OPT_IA_NA, in dhcpd_main()
1959 optptr = set_optval6(optptr, DHCP6_OPT_SERVERID, in dhcpd_main()
1973 optptr = prepare_send_pkt6(DHCP6REPLY); in dhcpd_main()
2012 optptr = prepare_send_pkt(); in dhcpd_main()
2017 optptr = set_optval(optptr, DHCP_OPT_MESSAGE_TYPE, &msgtype, 1); in dhcpd_main()
2024 optptr = set_optval(optptr, DHCP_OPT_MESSAGE_TYPE, &msgtype, 1); in dhcpd_main()
2025 optptr = set_optval(optptr, DHCP_OPT_SERVER_ID, &gconfig.server_nip, 4); in dhcpd_main()
2026 optptr = set_optval(optptr, DHCP_OPT_LEASE_TIME, &reqested_lease, 4); in dhcpd_main()
2027 optptr = set_reqparam(optptr, gstate.rqopt); in dhcpd_main()
2033 optptr = prepare_send_pkt(); in dhcpd_main()
2045 optptr = set_optval(optptr, DHCP_OPT_MESSAGE_TYPE, &msgtype, 1); in dhcpd_main()
2049 optptr = set_optval(optptr, DHCP_OPT_MESSAGE_TYPE, &msgtype, 1); in dhcpd_main()
2050 optptr = set_optval(optptr, DHCP_OPT_SERVER_ID, &gconfig.server_nip, 4); in dhcpd_main()
2052 optptr = set_optval(optptr, DHCP_OPT_LEASE_TIME, &reqested_lease, 4); in dhcpd_main()