Lines Matching defs:opt

23     coap_log_debug("cannot advance opt past end\n"); \
31 * Used to prevent access to *opt when pointing to after end of buffer
41 coap_opt_parse(const coap_opt_t *opt, size_t length, coap_option_t *result) {
43 const coap_opt_t *opt_start = opt; /* store where parsing starts */
45 assert(opt);
51 result->delta = (*opt & 0xf0) >> 4;
52 result->length = *opt & 0x0f;
56 if (*opt != COAP_PAYLOAD_START) {
64 ADVANCE_OPT_CHECK(opt,length,1);
65 result->delta = ((*opt & 0xff) << 8) + 269;
72 ADVANCE_OPT_CHECK(opt,length,1);
73 result->delta += *opt & 0xff;
88 ADVANCE_OPT_CHECK(opt,length,1);
89 result->length = ((*opt & 0xff) << 8) + 269;
92 ADVANCE_OPT_CHECK(opt,length,1);
93 result->length += *opt & 0xff;
101 ADVANCE_OPT(opt,length,1);
102 /* opt now points to value, if present */
104 result->value = opt;
113 return (opt + result->length) - opt_start;
212 coap_opt_length(const coap_opt_t *opt) {
215 length = *opt & 0x0f;
216 switch (*opt & 0xf0) {
221 ++opt;
225 ++opt;
229 ++opt;
237 length = (*opt++ << 8) + 269;
240 length += *opt++;
249 coap_opt_value(const coap_opt_t *opt) {
252 switch (*opt & 0xf0) {
266 switch (*opt & 0x0f) {
280 return (const uint8_t *)opt + ofs;
284 coap_opt_size(const coap_opt_t *opt) {
287 /* we must assume that opt is encoded correctly */
288 return coap_opt_parse(opt, (size_t)-1, &option);
292 coap_opt_setheader(coap_opt_t *opt, size_t maxlen,
296 assert(opt);
302 opt[0] = (coap_opt_t)(delta << 4);
310 opt[0] = 0xd0;
311 opt[++skip] = (coap_opt_t)(delta - 13);
319 opt[0] = 0xe0;
320 opt[++skip] = ((delta - 269) >> 8) & 0xff;
321 opt[++skip] = (delta - 269) & 0xff;
325 opt[0] |= length & 0x0f;
333 opt[0] |= 0x0d;
334 opt[++skip] = (coap_opt_t)(length - 13);
342 opt[0] |= 0x0e;
343 opt[++skip] = ((length - 269) >> 8) & 0xff;
344 opt[++skip] = (length - 269) & 0xff;
372 coap_opt_encode(coap_opt_t *opt, size_t maxlen, uint16_t delta,
376 l = coap_opt_setheader(opt, maxlen, delta, length);
385 opt += l;
393 memcpy(opt, val, length);
552 coap_optlist_t *opt;
562 LL_FOREACH((*options), opt) {
563 coap_add_option_internal(pdu, opt->number, opt->length, opt->data);