19 size_t octets = (**ptr) & 0x7f;
22 len = (len << 8) + (**ptr);
35 asn1_tag_c(
const uint8_t **ptr,
int *constructed,
int *
class)
41 *constructed = (
byte & 0x20) ? 1 : 0;
51 tag = (tag << 7) + (
byte & 0x7F);
56 tag = (tag << 7) + (
byte & 0x7F);
68 const uint8_t *acp = ptr;
69 uint8_t tag =
asn1_tag_c(&acp, &constructed, &
class);
73 while (tlen > 0 && len <= tlen) {
74 if (
class == 2 && constructed == 1) {
80 if (!validate || validate(acp, len)) {
85 memcpy(tag_data->
s, acp, len);
89 if (tag == 0x10 && constructed == 1) {
Pulls together all the internal only header files.
coap_asn1_tag_t asn1_tag_c(const uint8_t **ptr, int *constructed, int *class)
Get the asn1 tag from the current ptr.
size_t asn1_len(const uint8_t **ptr)
Get the asn1 length from the current ptr.
coap_binary_t * get_asn1_tag(coap_asn1_tag_t ltag, const uint8_t *ptr, size_t tlen, asn1_validate validate)
Get the asn1 tag and data from the current ptr.
int(* asn1_validate)(const uint8_t *data, size_t size)
Callback to validate the asn1 tag and data.
coap_binary_t * coap_new_binary(size_t size)
Returns a new binary object with at least size bytes storage allocated.
CoAP binary data definition.
size_t length
length of binary data