mib parsing and datatype manipulation routines.(3)

NAME
mib parsing and datatype manipulation routines. -

  Data Structures
struct _PrefixList
struct parse_hints

  Functions
int sprint_realloc_hexstring (u_char **buf, size_t *buf_len, size_t *out_len, int allow_realloc, const u_char *cp, size_t len)
Prints a hexadecimal string into a buffer.
int sprint_realloc_asciistring (u_char **buf, size_t *buf_len, size_t *out_len, int allow_realloc, const u_char *cp, size_t len)
Prints an ascii string into a buffer.
int sprint_realloc_octet_string (u_char **buf, size_t *buf_len, size_t *out_len, int allow_realloc, const netsnmp_variable_list *var, const struct enum_list *enums, const char *hint, const char *units)
Prints an octet string into a buffer.
int sprint_realloc_counter64 (u_char **buf, size_t *buf_len, size_t *out_len, int allow_realloc, const netsnmp_variable_list *var, const struct enum_list *enums, const char *hint, const char *units)
Prints a counter into a buffer.
int sprint_realloc_opaque (u_char **buf, size_t *buf_len, size_t *out_len, int allow_realloc, const netsnmp_variable_list *var, const struct enum_list *enums, const char *hint, const char *units)
Prints an object identifier into a buffer.
int sprint_realloc_object_identifier (u_char **buf, size_t *buf_len, size_t *out_len, int allow_realloc, const netsnmp_variable_list *var, const struct enum_list *enums, const char *hint, const char *units)
Prints an object identifier into a buffer.
int sprint_realloc_timeticks (u_char **buf, size_t *buf_len, size_t *out_len, int allow_realloc, const netsnmp_variable_list *var, const struct enum_list *enums, const char *hint, const char *units)
Prints a timetick variable into a buffer.
int sprint_realloc_hinted_integer (u_char **buf, size_t *buf_len, size_t *out_len, int allow_realloc, long val, const char decimaltype, const char *hint, const char *units)
Prints an integer according to the hint into a buffer.
int sprint_realloc_integer (u_char **buf, size_t *buf_len, size_t *out_len, int allow_realloc, const netsnmp_variable_list *var, const struct enum_list *enums, const char *hint, const char *units)
Prints an integer into a buffer.
int sprint_realloc_uinteger (u_char **buf, size_t *buf_len, size_t *out_len, int allow_realloc, const netsnmp_variable_list *var, const struct enum_list *enums, const char *hint, const char *units)
Prints an unsigned integer into a buffer.
int sprint_realloc_gauge (u_char **buf, size_t *buf_len, size_t *out_len, int allow_realloc, const netsnmp_variable_list *var, const struct enum_list *enums, const char *hint, const char *units)
Prints a gauge value into a buffer.
int sprint_realloc_counter (u_char **buf, size_t *buf_len, size_t *out_len, int allow_realloc, const netsnmp_variable_list *var, const struct enum_list *enums, const char *hint, const char *units)
Prints a counter value into a buffer.
int sprint_realloc_networkaddress (u_char **buf, size_t *buf_len, size_t *out_len, int allow_realloc, const netsnmp_variable_list *var, const struct enum_list *enums, const char *hint, const char *units)
Prints a network address into a buffer.
int sprint_realloc_ipaddress (u_char **buf, size_t *buf_len, size_t *out_len, int allow_realloc, const netsnmp_variable_list *var, const struct enum_list *enums, const char *hint, const char *units)
Prints an ip-address into a buffer.
int sprint_realloc_null (u_char **buf, size_t *buf_len, size_t *out_len, int allow_realloc, const netsnmp_variable_list *var, const struct enum_list *enums, const char *hint, const char *units)
Prints a null value into a buffer.
int sprint_realloc_bitstring (u_char **buf, size_t *buf_len, size_t *out_len, int allow_realloc, const netsnmp_variable_list *var, const struct enum_list *enums, const char *hint, const char *units)
Prints a bit string into a buffer.
int sprint_realloc_badtype (u_char **buf, size_t *buf_len, size_t *out_len, int allow_realloc, const netsnmp_variable_list *var, const struct enum_list *enums, const char *hint, const char *units)
Fallback routine for a bad type, prints 'Variable has bad type' into a buffer.
int sprint_realloc_by_type (u_char **buf, size_t *buf_len, size_t *out_len, int allow_realloc, const netsnmp_variable_list *var, const struct enum_list *enums, const char *hint, const char *units)
Universal print routine, prints a variable into a buffer according to the variable type.
tree * get_tree_head (void)
Retrieves the tree head.
void snmp_in_toggle_options_usage (const char *lead, FILE *outf)
Prints out a help usage for the in* toggle options.
char * netsnmp_get_mib_directory (void)
set_string calls strdup, so if we allocated memory, free it
void netsnmp_fixup_mib_directory (void)
Not set use hard coded path.
void init_mib (void)
Initialises the mib reader.
void shutdown_mib (void)
Unloads all mibs.
void print_mib (FILE *fp)
Prints the MIBs to the file fp.
void set_function (struct tree *subtree)
Set's the printing function printomat in a subtree according it's type.
int read_objid (const char *input, oid *output, size_t *out_len)
Reads an object identifier from an input string into internal OID form.
void print_objid (const oid *objid, size_t objidlen)
Prints an oid to stdout.
void fprint_objid (FILE *f, const oid *objid, size_t objidlen)
Prints an oid to a file descriptor.
void print_variable (const oid *objid, size_t objidlen, const netsnmp_variable_list *variable)
Prints a variable to stdout.
void fprint_variable (FILE *f, const oid *objid, size_t objidlen, const netsnmp_variable_list *variable)
Prints a variable to a file descriptor.
int build_oid_segment (netsnmp_variable_list *var)
Takes the value in VAR and turns it into an OID segment in var->name.
int parse_oid_indexes (oid *oidIndex, size_t oidLen, netsnmp_variable_list *data)
xxx-rks: should free previous value?
tree * get_tree (const oid *objid, size_t objidlen, struct tree *subtree)
Clone of get_symbol that doesn't take a buffer argument.
void print_description (oid *objid, size_t objidlen, int width)
Prints on oid description on stdout.
void fprint_description (FILE *f, oid *objid, size_t objidlen, int width)
Prints on oid description into a file descriptor.
int get_wild_node (const char *name, oid *objid, size_t *objidlen)
char * uptime_string (u_long timeticks, char *buf)
Converts timeticks to hours, minutes, seconds string.
oid * snmp_parse_oid (const char *argv, oid *root, size_t *rootlen)
Given a string, parses an oid out of it (if possible).
int netsnmp_str2oid (const char *S, oid *O, int L)
Converts a string to its OID form.
int netsnmp_oid2chars (char *C, int L, const oid *O)
Converts an OID to its character form.
int netsnmp_oid2str (char *S, int L, oid *O)
Converts an OID to its string form.

FUNCTION DOCUMENTATION

  int build_oid_segment (netsnmp_variable_list * var)

Takes the value in VAR and turns it into an OID segment in var->name.

Parameters:

var The variable.

Returns:
SNMPERR_SUCCESS or SNMPERR_GENERR

Definition at line 3387 of file mib.c.

References variable_list::name, variable_list::name_length, variable_list::name_loc, SNMP_FREE, variable_list::type, variable_list::val, and variable_list::val_len.

  void fprint_description (FILE * f, oid * objid, size_t objidlen, int width)

Prints on oid description into a file descriptor.

Parameters:

f   The file descriptor to print to.

objid
    The object identifier.

objidlen
    The object id length.

width
    Number of subidentifiers.

Definition at line 4261 of file mib.c.

References SNMP_FREE.

Referenced by print_description().

  void fprint_objid (FILE * f, const oid * objid, size_t objidlen)

Prints an oid to a file descriptor.

Parameters:

f   The file descriptor to print to.

objid
    The oid to print

objidlen
    The length of oidid.

Definition at line 3115 of file mib.c.

References SNMP_FREE.

Referenced by print_objid().

  void fprint_variable (FILE * f, const oid * objid, size_t objidlen, const netsnmp_variable_list * variable)

Prints a variable to a file descriptor.

Parameters:

f   The file descriptor to print to.

objid
    The object id.

objidlen
    The length of teh object id.

variable
    The variable to print.

Definition at line 3262 of file mib.c.

References SNMP_FREE.

Referenced by print_variable().

  struct tree* get_tree (const oid * objid, size_t objidlen, struct tree * subtree)

Clone of get_symbol that doesn't take a buffer argument.

See also:
get_symbol

Definition at line 4216 of file mib.c.

  struct tree* get_tree_head (void)

Retrieves the tree head.

Returns:
the tree head.

Definition at line 2045 of file mib.c.

  int get_wild_node (const char * name, oid * objid, size_t * objidlen)

See also:
comments on find_best_tree_node for usage after first time.

Definition at line 5264 of file mib.c.

Referenced by snmp_parse_oid().

  void init_mib (void)

Initialises the mib reader.

Reads in all settings from the environment.

Definition at line 2516 of file mib.c.

References netsnmp_fixup_mib_directory(), netsnmp_get_mib_directory(), and SNMP_FREE.

Referenced by init_snmp().

  void netsnmp_fixup_mib_directory (void)

Not set use hard coded path.

Definition at line 2469 of file mib.c.

References netsnmp_get_mib_directory(), and SNMP_FREE.

Referenced by init_mib().

  char* netsnmp_get_mib_directory (void)

set_string calls strdup, so if we allocated memory, free it

Definition at line 2422 of file mib.c.

Referenced by init_mib(), and netsnmp_fixup_mib_directory().

  int netsnmp_oid2chars (char * C, int L, const oid * O)

Converts an OID to its character form.

in example 5 . 1 . 2 . 3 . 4 . 5 = 12345

Parameters:

C   The character buffer.

L   The length of the buffer.

O   The oid.

Returns:
0 on Sucess, 1 on failure.

Definition at line 6007 of file mib.c.

Referenced by netsnmp_oid2str().

  int netsnmp_oid2str (char * S, int L, oid * O)

Converts an OID to its string form.

in example 5 . 'h' . 'e' . 'l' . 'l' . 'o' = 'hello\0' (null terminated)

Parameters:

S   The character string buffer.

L   The length of the string buffer.

O   The oid.

Returns:
0 on Sucess, 1 on failure.

Definition at line 6035 of file mib.c.

References netsnmp_oid2chars().

  int netsnmp_str2oid (const char * S, oid * O, int L)

Converts a string to its OID form.

in example 'hello' = 5 . 'h' . 'e' . 'l' . 'l' . 'o'

Parameters:

S   The string.

O   The oid.

L   The length of the oid.

Returns:
0 on Sucess, 1 on failure.

Definition at line 5972 of file mib.c.

  int parse_oid_indexes (oid * oidIndex, size_t oidLen, netsnmp_variable_list * data)

xxx-rks: should free previous value?

Definition at line 3557 of file mib.c.

References variable_list::next_variable.

Referenced by netsnmp_update_variable_list_from_index().

  void print_description (oid * objid, size_t objidlen, int width)

Prints on oid description on stdout.

See also:
fprint_description

Definition at line 4245 of file mib.c.

References fprint_description().

  void print_mib (FILE * fp)

Prints the MIBs to the file fp.

Parameters:

fp  The file descriptor to print to.

Definition at line 2696 of file mib.c.

  void print_objid (const oid * objid, size_t objidlen)

Prints an oid to stdout.

Parameters:

objid
    The oid to print

objidlen
    The length of oidid.

Definition at line 3101 of file mib.c.

References fprint_objid().

  void print_variable (const oid * objid, size_t objidlen, const netsnmp_variable_list * variable)

Prints a variable to stdout.

Parameters:

objid
    The object id.

objidlen
    The length of teh object id.

variable
    The variable to print.

Definition at line 3246 of file mib.c.

References fprint_variable().

  int read_objid (const char * input, oid * output, size_t * out_len)

Reads an object identifier from an input string into internal OID form.

When called, out_len must hold the maximum length of the output array.

Parameters:

input
    the input string.

output
    the oid wirte.

out_len
    number of subid's in output.

Returns:
1 if successful.If an error occurs, this function returns 0 and MAY set snmp_errno. snmp_errno is NOT set if SET_SNMP_ERROR evaluates to nothing. This can make multi-threaded use a tiny bit more robust.

Definition at line 2794 of file mib.c.

References SNMP_FREE.

Referenced by snmp_parse_oid().

  void set_function (struct tree * subtree)

Set's the printing function printomat in a subtree according it's type.

Parameters:

subtree
    The subtree to set.

Definition at line 2717 of file mib.c.

References sprint_realloc_bitstring(), sprint_realloc_by_type(), sprint_realloc_counter(), sprint_realloc_counter64(), sprint_realloc_gauge(), sprint_realloc_integer(), sprint_realloc_ipaddress(), sprint_realloc_networkaddress(), sprint_realloc_null(), sprint_realloc_object_identifier(), sprint_realloc_octet_string(), sprint_realloc_opaque(), sprint_realloc_timeticks(), and sprint_realloc_uinteger().

  void shutdown_mib (void)

Unloads all mibs.

Definition at line 2673 of file mib.c.

References SNMP_FREE.

Referenced by snmp_shutdown().

  void snmp_in_toggle_options_usage (const char * lead, FILE * outf)

Prints out a help usage for the in* toggle options.

Parameters:

lead
    The lead to print for every line.

outf
    The file descriptor to write to.

Definition at line 2284 of file mib.c.

  oid* snmp_parse_oid (const char * argv, oid * root, size_t * rootlen)

Given a string, parses an oid out of it (if possible).

It will try to parse it based on predetermined configuration if present or by every method possible otherwise. If a suffix has been registered using NETSNMP_DS_LIB_OIDSUFFIX, it will be appended to the input string before processing.

Parameters:

argv
    The OID to string parse

root
    An OID array where the results are stored.

rootlen
    The max length of the array going in and the data length coming out.

Returns:
The root oid pointer if successful, or NULL otherwise.

Definition at line 5578 of file mib.c.

References get_wild_node(), and read_objid().

  int sprint_realloc_asciistring (u_char ** buf, size_t * buf_len, size_t * out_len, int allow_realloc, const u_char * cp, size_t len)

Prints an ascii string into a buffer.

The characters pointed by *cp are encoded as an ascii string.

If allow_realloc is true the buffer will be (re)allocated to fit in the needed size. (Note: *buf may change due to this.)

Parameters:

buf address of the buffer to print to.

buf_len
    address to an integer containing the size of buf.

out_len
    incremented by the number of characters printed.

allow_realloc
    if not zero reallocate the buffer to fit the needed size.

cp  the array of characters to encode.

len the array length of cp.

Returns:
1 on success, or 0 on failure (out of memory, or buffer to small when not allowed to realloc.)

Definition at line 365 of file mib.c.

References snmp_realloc().

Referenced by sprint_realloc_octet_string().

  int sprint_realloc_badtype (u_char ** buf, size_t * buf_len, size_t * out_len, int allow_realloc, const netsnmp_variable_list * var, const struct enum_list * enums, const char * hint, const char * units)

Fallback routine for a bad type, prints 'Variable has bad type' into a buffer.

If allow_realloc is true the buffer will be (re)allocated to fit in the needed size. (Note: *buf may change due to this.)

Parameters:

buf Address of the buffer to print to.

buf_len
    Address to an integer containing the size of buf.

out_len
    Incremented by the number of characters printed.

allow_realloc
    if not zero reallocate the buffer to fit the needed size.

var The variable to encode.

enums
    The enumeration ff this variable is enumerated. may be NULL.

hint
    Contents of the DISPLAY-HINT clause of the MIB. See RFC 1903 Section 3.1 for details. may be NULL.

units
    Contents of the UNITS clause of the MIB. may be NULL.

Returns:
1 on success, or 0 on failure (out of memory, or buffer to small when not allowed to realloc.)

Definition at line 1930 of file mib.c.

Referenced by sprint_realloc_by_type().

  int sprint_realloc_bitstring (u_char ** buf, size_t * buf_len, size_t * out_len, int allow_realloc, const netsnmp_variable_list * var, const struct enum_list * enums, const char * hint, const char * units)

Prints a bit string into a buffer.

If allow_realloc is true the buffer will be (re)allocated to fit in the needed size. (Note: *buf may change due to this.)

Parameters:

buf Address of the buffer to print to.

buf_len
    Address to an integer containing the size of buf.

out_len
    Incremented by the number of characters printed.

allow_realloc
    if not zero reallocate the buffer to fit the needed size.

var The variable to encode.

enums
    The enumeration ff this variable is enumerated. may be NULL.

hint
    Contents of the DISPLAY-HINT clause of the MIB. See RFC 1903 Section 3.1 for details. may be NULL.

units
    Contents of the UNITS clause of the MIB. may be NULL.

Returns:
1 on success, or 0 on failure (out of memory, or buffer to small when not allowed to realloc.)

Definition at line 1791 of file mib.c.

References sprint_realloc_by_type(), sprint_realloc_hexstring(), variable_list::type, variable_list::val, and variable_list::val_len.

Referenced by set_function(), and sprint_realloc_by_type().

  int sprint_realloc_by_type (u_char ** buf, size_t * buf_len, size_t * out_len, int allow_realloc, const netsnmp_variable_list * var, const struct enum_list * enums, const char * hint, const char * units)

Universal print routine, prints a variable into a buffer according to the variable type.

If allow_realloc is true the buffer will be (re)allocated to fit in the needed size. (Note: *buf may change due to this.)

Parameters:

buf Address of the buffer to print to.

buf_len
    Address to an integer containing the size of buf.

out_len
    Incremented by the number of characters printed.

allow_realloc
    if not zero reallocate the buffer to fit the needed size.

var The variable to encode.

enums
    The enumeration ff this variable is enumerated. may be NULL.

hint
    Contents of the DISPLAY-HINT clause of the MIB. See RFC 1903 Section 3.1 for details. may be NULL.

units
    Contents of the UNITS clause of the MIB. may be NULL.

Returns:
1 on success, or 0 on failure (out of memory, or buffer to small when not allowed to realloc.)

Definition at line 1965 of file mib.c.

References sprint_realloc_badtype(), sprint_realloc_bitstring(), sprint_realloc_counter(), sprint_realloc_counter64(), sprint_realloc_gauge(), sprint_realloc_integer(), sprint_realloc_ipaddress(), sprint_realloc_null(), sprint_realloc_object_identifier(), sprint_realloc_octet_string(), sprint_realloc_opaque(), sprint_realloc_timeticks(), sprint_realloc_uinteger(), and variable_list::type.

Referenced by set_function(), sprint_realloc_bitstring(), sprint_realloc_counter(), sprint_realloc_counter64(), sprint_realloc_gauge(), sprint_realloc_integer(), sprint_realloc_ipaddress(), sprint_realloc_networkaddress(), sprint_realloc_null(), sprint_realloc_object_identifier(), sprint_realloc_octet_string(), sprint_realloc_opaque(), sprint_realloc_timeticks(), sprint_realloc_uinteger(), and table_helper_handler().

  int sprint_realloc_counter (u_char ** buf, size_t * buf_len, size_t * out_len, int allow_realloc, const netsnmp_variable_list * var, const struct enum_list * enums, const char * hint, const char * units)

Prints a counter value into a buffer.

If allow_realloc is true the buffer will be (re)allocated to fit in the needed size. (Note: *buf may change due to this.)

Parameters:

buf Address of the buffer to print to.

buf_len
    Address to an integer containing the size of buf.

out_len
    Incremented by the number of characters printed.

allow_realloc
    if not zero reallocate the buffer to fit the needed size.

var The variable to encode.

enums
    The enumeration ff this variable is enumerated. may be NULL.

hint
    Contents of the DISPLAY-HINT clause of the MIB. See RFC 1903 Section 3.1 for details. may be NULL.

units
    Contents of the UNITS clause of the MIB. may be NULL.

Returns:
1 on success, or 0 on failure (out of memory, or buffer to small when not allowed to realloc.)

Definition at line 1558 of file mib.c.

References sprint_realloc_by_type(), variable_list::type, and variable_list::val.

Referenced by set_function(), and sprint_realloc_by_type().

  int sprint_realloc_counter64 (u_char ** buf, size_t * buf_len, size_t * out_len, int allow_realloc, const netsnmp_variable_list * var, const struct enum_list * enums, const char * hint, const char * units)

Prints a counter into a buffer.

The variable var is encoded as a counter value.

If allow_realloc is true the buffer will be (re)allocated to fit in the needed size. (Note: *buf may change due to this.)

Parameters:

buf Address of the buffer to print to.

buf_len
    Address to an integer containing the size of buf.

out_len
    Incremented by the number of characters printed.

allow_realloc
    if not zero reallocate the buffer to fit the needed size.

var The variable to encode.

enums
    The enumeration ff this variable is enumerated. may be NULL.

hint
    Contents of the DISPLAY-HINT clause of the MIB. See RFC 1903 Section 3.1 for details. may be NULL.

units
    Contents of the UNITS clause of the MIB. may be NULL.

Returns:
1 on success, or 0 on failure (out of memory, or buffer to small when not allowed to realloc.)

Definition at line 863 of file mib.c.

References sprint_realloc_by_type(), variable_list::type, and variable_list::val.

Referenced by set_function(), sprint_realloc_by_type(), and sprint_realloc_opaque().

  int sprint_realloc_gauge (u_char ** buf, size_t * buf_len, size_t * out_len, int allow_realloc, const netsnmp_variable_list * var, const struct enum_list * enums, const char * hint, const char * units)

Prints a gauge value into a buffer.

If allow_realloc is true the buffer will be (re)allocated to fit in the needed size. (Note: *buf may change due to this.)

Parameters:

buf Address of the buffer to print to.

buf_len
    Address to an integer containing the size of buf.

out_len
    Incremented by the number of characters printed.

allow_realloc
    if not zero reallocate the buffer to fit the needed size.

var The variable to encode.

enums
    The enumeration ff this variable is enumerated. may be NULL.

hint
    Contents of the DISPLAY-HINT clause of the MIB. See RFC 1903 Section 3.1 for details. may be NULL.

units
    Contents of the UNITS clause of the MIB. may be NULL.

Returns:
1 on success, or 0 on failure (out of memory, or buffer to small when not allowed to realloc.)

Definition at line 1485 of file mib.c.

References sprint_realloc_by_type(), sprint_realloc_hinted_integer(), variable_list::type, and variable_list::val.

Referenced by set_function(), and sprint_realloc_by_type().

  int sprint_realloc_hexstring (u_char ** buf, size_t * buf_len, size_t * out_len, int allow_realloc, const u_char * cp, size_t len)

Prints a hexadecimal string into a buffer.

The characters pointed by *cp are encoded as hexadecimal string.

If allow_realloc is true the buffer will be (re)allocated to fit in the needed size. (Note: *buf may change due to this.)

Parameters:

buf address of the buffer to print to.

buf_len
    address to an integer containing the size of buf.

out_len
    incremented by the number of characters printed.

allow_realloc
    if not zero reallocate the buffer to fit the needed size.

cp  the array of characters to encode.

len the array length of cp.

Returns:
1 on success, or 0 on failure (out of memory, or buffer to small when not allowed to realloc.)

Definition at line 263 of file mib.c.

References snmp_realloc().

Referenced by sprint_realloc_bitstring(), sprint_realloc_octet_string(), and sprint_realloc_opaque().

  int sprint_realloc_hinted_integer (u_char ** buf, size_t * buf_len, size_t * out_len, int allow_realloc, long val, const char decimaltype, const char * hint, const char * units)

Prints an integer according to the hint into a buffer.

If allow_realloc is true the buffer will be (re)allocated to fit in the needed size. (Note: *buf may change due to this.)

Parameters:

buf Address of the buffer to print to.

buf_len
    Address to an integer containing the size of buf.

out_len
    Incremented by the number of characters printed.

allow_realloc
    if not zero reallocate the buffer to fit the needed size.

var The variable to encode.

enums
    The enumeration ff this variable is enumerated. may be NULL.

hint
    Contents of the DISPLAY-HINT clause of the MIB. See RFC 1903 Section 3.1 for details. may _NOT_ be NULL.

units
    Contents of the UNITS clause of the MIB. may be NULL.

Returns:
1 on success, or 0 on failure (out of memory, or buffer to small when not allowed to realloc.)

Definition at line 1211 of file mib.c.

Referenced by sprint_realloc_gauge(), sprint_realloc_integer(), and sprint_realloc_uinteger().

  int sprint_realloc_integer (u_char ** buf, size_t * buf_len, size_t * out_len, int allow_realloc, const netsnmp_variable_list * var, const struct enum_list * enums, const char * hint, const char * units)

Prints an integer into a buffer.

If allow_realloc is true the buffer will be (re)allocated to fit in the needed size. (Note: *buf may change due to this.)

Parameters:

buf Address of the buffer to print to.

buf_len
    Address to an integer containing the size of buf.

out_len
    Incremented by the number of characters printed.

allow_realloc
    if not zero reallocate the buffer to fit the needed size.

var The variable to encode.

enums
    The enumeration ff this variable is enumerated. may be NULL.

hint
    Contents of the DISPLAY-HINT clause of the MIB. See RFC 1903 Section 3.1 for details. may be NULL.

units
    Contents of the UNITS clause of the MIB. may be NULL.

Returns:
1 on success, or 0 on failure (out of memory, or buffer to small when not allowed to realloc.)

Definition at line 1285 of file mib.c.

References sprint_realloc_by_type(), sprint_realloc_hinted_integer(), variable_list::type, and variable_list::val.

Referenced by set_function(), and sprint_realloc_by_type().

  int sprint_realloc_ipaddress (u_char ** buf, size_t * buf_len, size_t * out_len, int allow_realloc, const netsnmp_variable_list * var, const struct enum_list * enums, const char * hint, const char * units)

Prints an ip-address into a buffer.

If allow_realloc is true the buffer will be (re)allocated to fit in the needed size. (Note: *buf may change due to this.)

Parameters:

buf Address of the buffer to print to.

buf_len
    Address to an integer containing the size of buf.

out_len
    Incremented by the number of characters printed.

allow_realloc
    if not zero reallocate the buffer to fit the needed size.

var The variable to encode.

enums
    The enumeration ff this variable is enumerated. may be NULL.

hint
    Contents of the DISPLAY-HINT clause of the MIB. See RFC 1903 Section 3.1 for details. may be NULL.

units
    Contents of the UNITS clause of the MIB. may be NULL.

Returns:
1 on success, or 0 on failure (out of memory, or buffer to small when not allowed to realloc.)

Definition at line 1687 of file mib.c.

References snmp_realloc(), sprint_realloc_by_type(), variable_list::type, and variable_list::val.

Referenced by set_function(), and sprint_realloc_by_type().

  int sprint_realloc_networkaddress (u_char ** buf, size_t * buf_len, size_t * out_len, int allow_realloc, const netsnmp_variable_list * var, const struct enum_list * enums, const char * hint, const char * units)

Prints a network address into a buffer.

If allow_realloc is true the buffer will be (re)allocated to fit in the needed size. (Note: *buf may change due to this.)

Parameters:

buf Address of the buffer to print to.

buf_len
    Address to an integer containing the size of buf.

out_len
    Incremented by the number of characters printed.

allow_realloc
    if not zero reallocate the buffer to fit the needed size.

var The variable to encode.

enums
    The enumeration ff this variable is enumerated. may be NULL.

hint
    Contents of the DISPLAY-HINT clause of the MIB. See RFC 1903 Section 3.1 for details. may be NULL.

units
    Contents of the UNITS clause of the MIB. may be NULL.

Returns:
1 on success, or 0 on failure (out of memory, or buffer to small when not allowed to realloc.)

Definition at line 1621 of file mib.c.

References snmp_realloc(), sprint_realloc_by_type(), variable_list::type, variable_list::val, and variable_list::val_len.

Referenced by set_function().

  int sprint_realloc_null (u_char ** buf, size_t * buf_len, size_t * out_len, int allow_realloc, const netsnmp_variable_list * var, const struct enum_list * enums, const char * hint, const char * units)

Prints a null value into a buffer.

If allow_realloc is true the buffer will be (re)allocated to fit in the needed size. (Note: *buf may change due to this.)

Parameters:

buf Address of the buffer to print to.

buf_len
    Address to an integer containing the size of buf.

out_len
    Incremented by the number of characters printed.

allow_realloc
    if not zero reallocate the buffer to fit the needed size.

var The variable to encode.

enums
    The enumeration ff this variable is enumerated. may be NULL.

hint
    Contents of the DISPLAY-HINT clause of the MIB. See RFC 1903 Section 3.1 for details. may be NULL.

units
    Contents of the UNITS clause of the MIB. may be NULL.

Returns:
1 on success, or 0 on failure (out of memory, or buffer to small when not allowed to realloc.)

Definition at line 1747 of file mib.c.

References sprint_realloc_by_type(), and variable_list::type.

Referenced by set_function(), and sprint_realloc_by_type().

  int sprint_realloc_object_identifier (u_char ** buf, size_t * buf_len, size_t * out_len, int allow_realloc, const netsnmp_variable_list * var, const struct enum_list * enums, const char * hint, const char * units)

Prints an object identifier into a buffer.

If allow_realloc is true the buffer will be (re)allocated to fit in the needed size. (Note: *buf may change due to this.)

Parameters:

buf Address of the buffer to print to.

buf_len
    Address to an integer containing the size of buf.

out_len
    Incremented by the number of characters printed.

allow_realloc
    if not zero reallocate the buffer to fit the needed size.

var The variable to encode.

enums
    The enumeration ff this variable is enumerated. may be NULL.

hint
    Contents of the DISPLAY-HINT clause of the MIB. See RFC 1903 Section 3.1 for details. may be NULL.

units
    Contents of the UNITS clause of the MIB. may be NULL.

Returns:
1 on success, or 0 on failure (out of memory, or buffer to small when not allowed to realloc.)

Definition at line 1067 of file mib.c.

References sprint_realloc_by_type(), variable_list::type, variable_list::val, and variable_list::val_len.

Referenced by set_function(), and sprint_realloc_by_type().

  int sprint_realloc_octet_string (u_char ** buf, size_t * buf_len, size_t * out_len, int allow_realloc, const netsnmp_variable_list * var, const struct enum_list * enums, const char * hint, const char * units)

Prints an octet string into a buffer.

The variable var is encoded as octet string.

If allow_realloc is true the buffer will be (re)allocated to fit in the needed size. (Note: *buf may change due to this.)

Parameters:

buf Address of the buffer to print to.

buf_len
    Address to an integer containing the size of buf.

out_len
    Incremented by the number of characters printed.

allow_realloc
    if not zero reallocate the buffer to fit the needed size.

var The variable to encode.

enums
    The enumeration ff this variable is enumerated. may be NULL.

hint
    Contents of the DISPLAY-HINT clause of the MIB. See RFC 1903 Section 3.1 for details. may be NULL.

units
    Contents of the UNITS clause of the MIB. may be NULL.

Returns:
1 on success, or 0 on failure (out of memory, or buffer to small when not allowed to realloc.)

Definition at line 425 of file mib.c.

References snmp_realloc(), sprint_realloc_asciistring(), sprint_realloc_by_type(), sprint_realloc_hexstring(), variable_list::type, variable_list::val, and variable_list::val_len.

Referenced by set_function(), and sprint_realloc_by_type().

  int sprint_realloc_opaque (u_char ** buf, size_t * buf_len, size_t * out_len, int allow_realloc, const netsnmp_variable_list * var, const struct enum_list * enums, const char * hint, const char * units)

Prints an object identifier into a buffer.

If allow_realloc is true the buffer will be (re)allocated to fit in the needed size. (Note: *buf may change due to this.)

Parameters:

buf Address of the buffer to print to.

buf_len
    Address to an integer containing the size of buf.

out_len
    Incremented by the number of characters printed.

allow_realloc
    if not zero reallocate the buffer to fit the needed size.

var The variable to encode.

enums
    The enumeration ff this variable is enumerated. may be NULL.

hint
    Contents of the DISPLAY-HINT clause of the MIB. See RFC 1903 Section 3.1 for details. may be NULL.

units
    Contents of the UNITS clause of the MIB. may be NULL.

Returns:
1 on success, or 0 on failure (out of memory, or buffer to small when not allowed to realloc.)

Definition at line 977 of file mib.c.

References sprint_realloc_by_type(), sprint_realloc_counter64(), sprint_realloc_hexstring(), variable_list::type, variable_list::val, and variable_list::val_len.

Referenced by set_function(), and sprint_realloc_by_type().

  int sprint_realloc_timeticks (u_char ** buf, size_t * buf_len, size_t * out_len, int allow_realloc, const netsnmp_variable_list * var, const struct enum_list * enums, const char * hint, const char * units)

Prints a timetick variable into a buffer.

If allow_realloc is true the buffer will be (re)allocated to fit in the needed size. (Note: *buf may change due to this.)

Parameters:

buf Address of the buffer to print to.

buf_len
    Address to an integer containing the size of buf.

out_len
    Incremented by the number of characters printed.

allow_realloc
    if not zero reallocate the buffer to fit the needed size.

var The variable to encode.

enums
    The enumeration ff this variable is enumerated. may be NULL.

hint
    Contents of the DISPLAY-HINT clause of the MIB. See RFC 1903 Section 3.1 for details. may be NULL.

units
    Contents of the UNITS clause of the MIB. may be NULL.

Returns:
1 on success, or 0 on failure (out of memory, or buffer to small when not allowed to realloc.)

Definition at line 1137 of file mib.c.

References sprint_realloc_by_type(), variable_list::type, and variable_list::val.

Referenced by set_function(), and sprint_realloc_by_type().

  int sprint_realloc_uinteger (u_char ** buf, size_t * buf_len, size_t * out_len, int allow_realloc, const netsnmp_variable_list * var, const struct enum_list * enums, const char * hint, const char * units)

Prints an unsigned integer into a buffer.

If allow_realloc is true the buffer will be (re)allocated to fit in the needed size. (Note: *buf may change due to this.)

Parameters:

buf Address of the buffer to print to.

buf_len
    Address to an integer containing the size of buf.

out_len
    Incremented by the number of characters printed.

allow_realloc
    if not zero reallocate the buffer to fit the needed size.

var The variable to encode.

enums
    The enumeration ff this variable is enumerated. may be NULL.

hint
    Contents of the DISPLAY-HINT clause of the MIB. See RFC 1903 Section 3.1 for details. may be NULL.

units
    Contents of the UNITS clause of the MIB. may be NULL.

Returns:
1 on success, or 0 on failure (out of memory, or buffer to small when not allowed to realloc.)

Definition at line 1388 of file mib.c.

References sprint_realloc_by_type(), sprint_realloc_hinted_integer(), variable_list::type, and variable_list::val.

Referenced by set_function(), and sprint_realloc_by_type().

  char* uptime_string (u_long timeticks, char * buf)

Converts timeticks to hours, minutes, seconds string.

CMU compatible does not show centiseconds.

Parameters:

timeticks
    The timeticks to convert.

buf Buffer to write to, has to be at least 40 Bytes large.

Returns:
The buffer

See also:
uptimeString

Definition at line 5549 of file mib.c.

VARIABLE DOCUMENTATION

  PrefixList mib_prefixes[]

Initial value:

 {
    {&Standard_Prefix[0]},
    {'.iso.org.dod.internet.mgmt.mib-2'},
    {'.iso.org.dod.internet.experimental'},
    {'.iso.org.dod.internet.private'},
    {'.iso.org.dod.internet.snmpParties'},
    {'.iso.org.dod.internet.snmpSecrets'},
    {NULL, 0}
}

Definition at line 160 of file mib.c.