BER_GET_STRING(3)

NAME
ber_get_null, ber_get_eoc, ber_get_integer, ber_get_enumerated, ber_get_boolean, ber_get_string, ber_get_nstring, ber_get_ostring, ber_get_bitstring, ber_get_oid, ber_getpos, ber_scanf_elements - access properties of ASN.1 objects decoded from BER

SYNOPSIS
#include <sys/types.h>
#include <ber.h>
int
ber_get_null(struct ber_element *root);
int
ber_get_eoc(struct ber_element *root);
int
ber_get_integer(struct ber_element *root, long long *val);
int
ber_get_enumerated(struct ber_element *root, long long *val);
int
ber_get_boolean(struct ber_element *root, int *bool);
int
ber_get_string(struct ber_element *root, char **charbuf);
int
ber_get_nstring(struct ber_element *root, void **buf, size_t *size);
int
ber_get_ostring(struct ber_element *root, struct ber_octetstring *ostring);
int
ber_get_bitstring(struct ber_element *root, void **buf, size_t *size);
int
ber_get_oid(struct ber_element *root, struct ber_oid *oid);
off_t
ber_getpos(struct ber_element *elm);
int
ber_scanf_elements(struct ber_element *root, char *format, ...);

DESCRIPTION
The ber_get_*() and ber_scanf_elements() functions may be used to save ber_element values into local variables.

ber_getpos() may be used to obtain the ber_element offset be_offs.

RETURN VALUES
Upon successful completion, ber_get_null(), ber_get_eoc(), ber_get_integer(), ber_get_enumerated(), ber_get_boolean(), ber_get_string(), ber_get_nstring(), ber_get_ostring(), ber_get_bitstring(), ber_get_oid(), ber_string2oid() and ber_scanf_elements() return 0. Otherwise -1 is returned and the global variable errno is set to indicate the error.

ber_getpos() returns the value of be_offs.

SEE ALSO
ber_add_string(3), ber_oid_cmp(3), ber_read_elements(3), ber_set_header(3)

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

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

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