OBER_SET_HEADER(3) FreeBSD Library Functions Manual OBER_SET_HEADER(3)
NAME
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_elements - change and
destroy ASN.1 objects for BER encoding
SYNOPSIS
#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
DESCRIPTION
ober_set_header() sets the class and type of elm.
ober_calc_len() determines the total length of root.
ober_set_writecallback() registers the br_cb callback function.
ober_link_elements() links prev and elm.
ober_replace_elements() replaces prev with new and frees any dynamically
allocated storage associated with prev.
ober_dup() duplicates an element and all linked elements.
ober_unlink_elements() unlinks prev.
ober_free_element() and ober_free_elements() free any dynamically
allocated storage associated with root.
RETURN VALUES
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.
SEE ALSO
ober_add_string(3), ober_get_string(3), ober_oid_cmp(3),
ober_read_elements(3)
STANDARDS
ITU-T Recommendation X.690, also known as ISO/IEC 8825-1: Information
technology - ASN.1 encoding rules.
HISTORY
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.
AUTHORS
The BER library was written by Claudio Jeker <
[email protected]>, Marc
Balmer <
[email protected]> and Reyk Floeter <
[email protected]>.
FreeBSD 14.1-RELEASE-p8 August 29, 2021 FreeBSD 14.1-RELEASE-p8