OpenBSD manual page server

Manual Page Search Parameters

OBER_SET_HEADER(3) Library Functions Manual OBER_SET_HEADER(3)

ober_set_header, ober_calc_len, ober_set_writecallback, ober_link_elements, ober_replace_elements, ober_dup, ober_unlink_elements, ober_free_element, ober_free_elementschange and destroy ASN.1 objects for BER encoding

#include <sys/types.h>
#include <ber.h>

void
ober_set_header(struct ber_element *elm, int class, unsigned int type);

size_t
ober_calc_len(struct ber_element *root);

void
ober_set_writecallback(struct ber_element *elm, void (*cb)(void *arg, size_t offs), void *arg);

void
ober_link_elements(struct ber_element *prev, struct ber_element *elm);

void
ober_replace_elements(struct ber_element *prev, struct ber_element *elm);

struct ber_element *
ober_dup(struct ber_element *orig);

struct ber_element *
ober_unlink_elements(struct ber_element *prev);

void
ober_free_element(struct ber_element *root);

void
ober_free_elements(struct ber_element *root);


#define BER_TYPE_BOOLEAN 1
#define BER_TYPE_INTEGER 2
#define BER_TYPE_BITSTRING 3
#define BER_TYPE_OCTETSTRING 4
#define BER_TYPE_NULL 5
#define BER_TYPE_OBJECT 6
#define BER_TYPE_ENUMERATED 10
#define BER_TYPE_SEQUENCE 16
#define BER_TYPE_SET 17


#define BER_TYPE_CONSTRUCTED 0x20


#define BER_CLASS_UNIVERSAL 0x0
#define BER_CLASS_UNIV BER_CLASS_UNIVERSAL
#define BER_CLASS_APPLICATION 0x1
#define BER_CLASS_APP BER_CLASS_APPLICATION
#define BER_CLASS_CONTEXT 0x2
#define BER_CLASS_PRIVATE 0x3

() sets the class and type of elm.

() determines the total length of root.

() registers the br_cb callback function.

() replaces prev with new and frees any dynamically allocated storage associated with prev.

() duplicates an element and all linked elements.

() and () free any dynamically allocated storage associated with root.

ober_calc_len() returns the total length of a fully populated root containing one or more ber_element.

ober_dup() returns a pointer to the duplicated element or NULL on error.

ober_unlink_elements() returns a pointer to ber_element.

ober_add_string(3), ober_get_string(3), ober_oid_cmp(3), ober_read_elements(3)

ITU-T Recommendation X.690, also known as ISO/IEC 8825-1: Information technology - ASN.1 encoding rules.

ober_dup() first appeared in OpenBSD 7.0.

The other functions first appeared as internal functions in snmpd(8) in OpenBSD 4.2 and were moved to libutil in OpenBSD 6.6.

The BER library was written by Claudio Jeker <claudio@openbsd.org>, Marc Balmer <marc@openbsd.org> and Reyk Floeter <reyk@openbsd.org>.

August 29, 2021 OpenBSD-current