Lines Matching refs:buflen

214 static int option_append_hdr(uint8_t **buf, size_t *buflen, uint16_t optcode, size_t optlen) {  in option_append_hdr()  argument
217 assert_return(buflen, -EINVAL); in option_append_hdr()
219 if (optlen > 0xffff || *buflen < optlen + offsetof(DHCP6Option, data)) in option_append_hdr()
226 *buflen -= offsetof(DHCP6Option, data); in option_append_hdr()
231 int dhcp6_option_append(uint8_t **buf, size_t *buflen, uint16_t code, in dhcp6_option_append() argument
237 r = option_append_hdr(buf, buflen, code, optlen); in dhcp6_option_append()
242 *buflen -= optlen; in dhcp6_option_append()
247 int dhcp6_option_append_vendor_option(uint8_t **buf, size_t *buflen, OrderedSet *vendor_options) { in dhcp6_option_append_vendor_option() argument
253 assert(buflen); in dhcp6_option_append_vendor_option()
271 r = dhcp6_option_append(buf, buflen, SD_DHCP6_OPTION_VENDOR_OPTS, total, p); in dhcp6_option_append_vendor_option()
279 static int option_append_ia_address(uint8_t **buf, size_t *buflen, const struct iaaddr *address) { in option_append_ia_address() argument
285 assert(buflen); in option_append_ia_address()
293 r = option_append_hdr(buf, buflen, SD_DHCP6_OPTION_IAADDR, sizeof(struct iaaddr)); in option_append_ia_address()
298 *buflen -= sizeof(struct iaaddr); in option_append_ia_address()
303 static int option_append_pd_prefix(uint8_t **buf, size_t *buflen, const struct iapdprefix *prefix) { in option_append_pd_prefix() argument
309 assert(buflen); in option_append_pd_prefix()
321 r = option_append_hdr(buf, buflen, SD_DHCP6_OPTION_IA_PD_PREFIX, sizeof(struct iapdprefix)); in option_append_pd_prefix()
326 *buflen -= sizeof(struct iapdprefix); in option_append_pd_prefix()
331 int dhcp6_option_append_ia(uint8_t **buf, size_t *buflen, const DHCP6IA *ia) { in dhcp6_option_append_ia() argument
340 assert_return(buflen, -EINVAL); in dhcp6_option_append_ia()
365 if (*buflen < offsetof(DHCP6Option, data) + len) in dhcp6_option_append_ia()
369 ia_buflen = *buflen; in dhcp6_option_append_ia()
373 *buflen -= offsetof(DHCP6Option, data); in dhcp6_option_append_ia()
376 *buflen -= len; in dhcp6_option_append_ia()
380 r = option_append_pd_prefix(buf, buflen, &addr->iapdprefix); in dhcp6_option_append_ia()
382 r = option_append_ia_address(buf, buflen, &addr->iaaddr); in dhcp6_option_append_ia()
392 int dhcp6_option_append_fqdn(uint8_t **buf, size_t *buflen, const char *fqdn) { in dhcp6_option_append_fqdn() argument
396 assert_return(buf && *buf && buflen && fqdn, -EINVAL); in dhcp6_option_append_fqdn()
414 r = dhcp6_option_append(buf, buflen, SD_DHCP6_OPTION_CLIENT_FQDN, 1 + r, buffer); in dhcp6_option_append_fqdn()
419 int dhcp6_option_append_user_class(uint8_t **buf, size_t *buflen, char * const *user_class) { in dhcp6_option_append_user_class() argument
425 assert(buflen); in dhcp6_option_append_user_class()
447 return dhcp6_option_append(buf, buflen, SD_DHCP6_OPTION_USER_CLASS, total, p); in dhcp6_option_append_user_class()
450 int dhcp6_option_append_vendor_class(uint8_t **buf, size_t *buflen, char * const *vendor_class) { in dhcp6_option_append_vendor_class() argument
457 assert(buflen); in dhcp6_option_append_vendor_class()
489 return dhcp6_option_append(buf, buflen, SD_DHCP6_OPTION_VENDOR_CLASS, total, p); in dhcp6_option_append_vendor_class()
494 size_t buflen, in dhcp6_option_parse() argument
508 if (buflen < offsetof(DHCP6Option, data)) in dhcp6_option_parse()
511 if (*offset >= buflen - offsetof(DHCP6Option, data)) in dhcp6_option_parse()
516 if (len > buflen - offsetof(DHCP6Option, data) - *offset) in dhcp6_option_parse()
548 static int dhcp6_option_parse_ia_options(sd_dhcp6_client *client, const uint8_t *buf, size_t buflen in dhcp6_option_parse_ia_options() argument
551 assert(buf || buflen == 0); in dhcp6_option_parse_ia_options()
553 for (size_t offset = 0; offset < buflen;) { in dhcp6_option_parse_ia_options()
558 r = dhcp6_option_parse(buf, buflen, &offset, &code, &data_len, &data); in dhcp6_option_parse_ia_options()