Lines Matching refs:opt
31 coap_opt_t *opt = pdu->hdr->token + pdu->hdr->token_length; in options_start() local
32 return (*opt == COAP_PAYLOAD_START) ? NULL : opt; in options_start()
39 coap_opt_parse(const coap_opt_t *opt, size_t length, coap_option_t *result) { in coap_opt_parse() argument
41 const coap_opt_t *opt_start = opt; /* store where parsing starts */ in coap_opt_parse()
43 assert(opt); assert(result); in coap_opt_parse()
56 result->delta = (*opt & 0xf0) >> 4; in coap_opt_parse()
57 result->length = *opt & 0x0f; in coap_opt_parse()
61 if (*opt != COAP_PAYLOAD_START) { in coap_opt_parse()
69 ADVANCE_OPT(opt,length,1); in coap_opt_parse()
70 result->delta = ((*opt & 0xff) << 8) + 269; in coap_opt_parse()
77 ADVANCE_OPT(opt,length,1); in coap_opt_parse()
78 result->delta += *opt & 0xff; in coap_opt_parse()
93 ADVANCE_OPT(opt,length,1); in coap_opt_parse()
94 result->length = ((*opt & 0xff) << 8) + 269; in coap_opt_parse()
97 ADVANCE_OPT(opt,length,1); in coap_opt_parse()
98 result->length += *opt & 0xff; in coap_opt_parse()
105 ADVANCE_OPT(opt,length,1); in coap_opt_parse()
108 result->value = (unsigned char *)opt; in coap_opt_parse()
116 return (opt + result->length) - opt_start; in coap_opt_parse()
222 coap_opt_delta(const coap_opt_t *opt) { in coap_opt_delta() argument
225 n = (*opt++ & 0xf0) >> 4; in coap_opt_delta()
238 n = ((*opt++ & 0xff) << 8) + 269; in coap_opt_delta()
241 n += *opt & 0xff; in coap_opt_delta()
251 coap_opt_length(const coap_opt_t *opt) { in coap_opt_length() argument
254 length = *opt & 0x0f; in coap_opt_length()
255 switch (*opt & 0xf0) { in coap_opt_length()
260 ++opt; in coap_opt_length()
263 ++opt; in coap_opt_length()
266 ++opt; in coap_opt_length()
274 length = (*opt++ << 8) + 269; in coap_opt_length()
277 length += *opt++; in coap_opt_length()
286 coap_opt_value(coap_opt_t *opt) { in coap_opt_value() argument
289 switch (*opt & 0xf0) { in coap_opt_value()
303 switch (*opt & 0x0f) { in coap_opt_value()
317 return (unsigned char *)opt + ofs; in coap_opt_value()
321 coap_opt_size(const coap_opt_t *opt) { in coap_opt_size() argument
325 return coap_opt_parse(opt, (size_t)-1, &option); in coap_opt_size()
329 coap_opt_setheader(coap_opt_t *opt, size_t maxlen, in coap_opt_setheader() argument
333 assert(opt); in coap_opt_setheader()
339 opt[0] = delta << 4; in coap_opt_setheader()
346 opt[0] = 0xd0; in coap_opt_setheader()
347 opt[++skip] = delta - 13; in coap_opt_setheader()
354 opt[0] = 0xe0; in coap_opt_setheader()
355 opt[++skip] = ((delta - 269) >> 8) & 0xff; in coap_opt_setheader()
356 opt[++skip] = (delta - 269) & 0xff; in coap_opt_setheader()
360 opt[0] |= length & 0x0f; in coap_opt_setheader()
367 opt[0] |= 0x0d; in coap_opt_setheader()
368 opt[++skip] = length - 13; in coap_opt_setheader()
375 opt[0] |= 0x0e; in coap_opt_setheader()
376 opt[++skip] = ((length - 269) >> 8) & 0xff; in coap_opt_setheader()
377 opt[++skip] = (length - 269) & 0xff; in coap_opt_setheader()
384 coap_opt_encode(coap_opt_t *opt, size_t maxlen, unsigned short delta, in coap_opt_encode() argument
388 l = coap_opt_setheader(opt, maxlen, delta, length); in coap_opt_encode()
397 opt += l; in coap_opt_encode()
405 memcpy(opt, val, length); in coap_opt_encode()