libcoap 4.3.2rc2

coap_asn1_internal.h
Go to the documentation of this file.
1/*
2 * coap_asn1_internal.h -- ASN.1 functions for libcoap
3 *
4 * Copyright (C) 2020-2023 Jon Shallow <supjps-libcoap@jpshallow.com>
5 *
6 * SPDX-License-Identifier: BSD-2-Clause
7 *
8 * This file is part of the CoAP library libcoap. Please see README for terms
9 * of use.
10 */
11
17#ifndef COAP_ASN1_INTERNAL_H_
18#define COAP_ASN1_INTERNAL_H_
19
20#include "coap_internal.h"
21
29 typedef enum {
30 COAP_ASN1_NONE = 0,
31 COAP_ASN1_INTEGER = 2,
32 COAP_ASN1_BITSTRING = 3,
33 COAP_ASN1_OCTETSTRING = 4,
34 COAP_ASN1_IDENTIFIER = 6,
35} coap_asn1_tag_t;
36
47 typedef int (*asn1_validate)(const uint8_t *data, size_t size);
48
58 size_t asn1_len(const uint8_t **ptr);
59
71 coap_asn1_tag_t asn1_tag_c(const uint8_t **ptr, int *constructed, int *cls);
72
86 coap_binary_t *get_asn1_tag(coap_asn1_tag_t ltag, const uint8_t *ptr,
87 size_t tlen, asn1_validate validate);
88
91#endif /* COAP_ASN1_INTERNAL_H_ */
coap_internal.h
Pulls together all the internal only header files.
get_asn1_tag
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.
Definition: coap_asn1.c:65
asn1_tag_c
coap_asn1_tag_t asn1_tag_c(const uint8_t **ptr, int *constructed, int *cls)
Get the asn1 tag from the current ptr.
Definition: coap_asn1.c:38
asn1_len
size_t asn1_len(const uint8_t **ptr)
Get the asn1 length from the current ptr.
Definition: coap_asn1.c:19
coap_asn1_tag_t
coap_asn1_tag_t
Definition: coap_asn1_internal.h:29
asn1_validate
int(* asn1_validate)(const uint8_t *data, size_t size)
Callback to validate the asn1 tag and data.
Definition: coap_asn1_internal.h:47
COAP_ASN1_NONE
@ COAP_ASN1_NONE
Definition: coap_asn1_internal.h:30
COAP_ASN1_OCTETSTRING
@ COAP_ASN1_OCTETSTRING
Definition: coap_asn1_internal.h:33
COAP_ASN1_INTEGER
@ COAP_ASN1_INTEGER
Definition: coap_asn1_internal.h:31
COAP_ASN1_BITSTRING
@ COAP_ASN1_BITSTRING
Definition: coap_asn1_internal.h:32
COAP_ASN1_IDENTIFIER
@ COAP_ASN1_IDENTIFIER
Definition: coap_asn1_internal.h:34
coap_binary_t
CoAP binary data definition.
Definition: coap_str.h:56