Lines Matching refs:buflen
44 static int option_append_hdr(uint8_t **buf, size_t *buflen, uint16_t optcode,
50 assert_return(buflen, -EINVAL);
52 if (optlen > 0xffff || *buflen < optlen + sizeof(DHCP6Option))
59 *buflen -= sizeof(DHCP6Option);
64 int dhcp6_option_append(uint8_t **buf, size_t *buflen, uint16_t code,
70 r = option_append_hdr(buf, buflen, code, optlen);
78 *buflen -= optlen;
83 int dhcp6_option_append_ia(uint8_t **buf, size_t *buflen, DHCP6IA *ia) {
90 assert_return(buf && *buf && buflen && ia, -EINVAL);
105 if (*buflen < len)
109 ia_buflen = *buflen;
112 *buflen -= sizeof(DHCP6Option);
117 *buflen -= len;
120 r = option_append_hdr(buf, buflen, SD_DHCP6_OPTION_IAADDR,
128 *buflen -= sizeof(addr->iaaddr);
141 static int option_parse_hdr(uint8_t **buf, size_t *buflen, uint16_t *optcode, size_t *optlen) {
149 if (*buflen < sizeof(DHCP6Option))
154 if (len > *buflen)
161 *buflen -= 4;
166 int dhcp6_option_parse(uint8_t **buf, size_t *buflen, uint16_t *optcode,
170 assert_return(buf && buflen && optcode && optlen && optvalue, -EINVAL);
172 r = option_parse_hdr(buf, buflen, optcode, optlen);
176 if (*optlen > *buflen)
180 *buflen -= *optlen;
186 int dhcp6_option_parse_ia(uint8_t **buf, size_t *buflen, uint16_t iatype,
201 if (*buflen < DHCP6_OPTION_IA_NA_LEN + sizeof(DHCP6Option) +
223 if (*buflen < DHCP6_OPTION_IA_TA_LEN + sizeof(DHCP6Option) +
244 *buflen -= iaaddr_offset;
247 while ((r = option_parse_hdr(buf, buflen, &opt, &optlen)) >= 0) {
296 *buflen -= optlen;
313 if (*buflen)
317 *buf += *buflen;
318 *buflen = 0;