VARBIND_API - Online Linux Manual PageSection : 3
Updated : 20 Apr 2009
Source : V5.5
Note : Net-SNMP
Version : 4.2 Berkeley Distribution
NAMEsnmp_pdu_add_var, snmp_varlist_add_var, snmp_add_null_var, snmp_clone_varbind, snmp_free_varbind, snmp_free_var, print_variable, fprint_variable, snprint_variable, print_value, fprint_value, snprint_value - varbind_api functions
SYNOPSIS#include <net-snmp/varbind_api.h>
Creationnetsnmp_variable_list *snmp_pdu_add_variable("
netsnmp_pdu *pdu,
const oid *objid, size_t objidlen,
u_char type, const void *value, size_t len);
netsnmp_variable_list *snmp_varlist_add_variable("
netsnmp_variable_list *varlist,
const oid *objid, size_t objidlen,
u_char type, const void *value, size_t len);
netsnmp_variable_list *snmp_add_null_var("
netsnmp_pdu *pdu,
const oid *objid, size_t objidlen); netsnmp_variable_list *snmp_clone_varbind("
netsnmp_variable_list *varlist);
Setting Valuesint snmp_set_var_objid( netsnmp_variable_list* variable,
const oid * objid, size_t objidlen);
int snmp_set_var_value( netsnmp_variable_list* variable,
const void * value, size_t vallen);
int snmp_set_var_typed_value( netsnmp_variable_list* variable,
u_char type,
const void * value, size_t vallen);
int snmp_set_var_typed_integer( netsnmp_variable_list* variable,
u_char type, long value);
Outputvoid print_variable(const oid *objid, size_t objidlen,
const netsnmp_variable_list *variable);
void fprint_variable(FILE *fp,
const oid *objid, size_t objidlen,
const netsnmp_variable_list *variable);
int snprint_variable(char *buf, size_t len,
const oid *objid, size_t objidlen,
const netsnmp_variable_list *variable); void print_value(const oid *objid, size_t objidlen,
const netsnmp_variable_list *variable);
void fprint_value(FILE *fp,
const oid *objid, size_t objidlen,
const netsnmp_variable_list *variable);
int snprint_value(char *buf, size_t len,
const oid *objid, size_t objidlen,
const netsnmp_variable_list *variable);
Deletionvoid snmp_free_var( netsnmp_variable_list *variable);
void snmp_free_varbind( netsnmp_variable_list *variables);
DESCRIPTIONThe functions dealing with variable bindings fall into four groups - dealing with the creation, setting of values, output and deletion of varbinds.
Creationsnmp_pdu_add_variable will create a new varbind structure, initialised with the name ( objid, objidlen ), syntax ( type ) and value ( value ", " len ) provided. This varbind is then added to the end of the varbind list in the given PDU. snmp_varlist_add_variable is similar, but appends the new varbind to the end of the varbind list provided. When adding the first varbind to an empty list, simply pass the address of the head of the list: "[Insert example code here]" In both cases, the routine will return a pointer to the new varbind structure (or NULL if the varbind creation fails). snmp_add_null_var is a convenience function to add an empty varbind to the PDU. without needing to specify the NULL value explicitly. This is the normal mechanism for constructing a GET (or similar) information retrieval request.
Again, this returns a pointer to the new varbind, or NULL. snmp_clone_varbind creates a copy of each varbind in the specified list, returning a pointer to the head of the new list (or NULL if the cloning fails).
Setting of valuessnmp_set_var_objid sets the name of the varbind structure to the specified OID.
snmp_set_var_typed_value sets the syntax type and value of the varbind structure.
snmp_set_var_value sets the value of the varbind structure, leaving the syntax type unchanged.
snmp_set_var_typed_integer is a convenience function to set the syntax type and value for a 32-bit integer-based varbind. All four of these return 0 if the assignment is successful, or 1 if it is not.
Outputprint_variable will take an object identifier (as returned by read_objid, snmp_parse_oid or get_module_node) and an instance of such a variable, and prints to the standard output the textual form of the object identifier together with the value of the variable. fprint_variable does the same, but prints to the FILE pointer specified by the initial parameter. snprint_variable prints the same information into the buffer pointed to by buf which is of length len. It returns the number of characters printed, or -1 if the buffer was not large enough. In the latter case, buf will typically contained a truncated version of the information (but this behaviour is not guaranteed). This function replaces the obsolete function sprint_variable. print_value, fprint_value, and snprint_value do the same as the equivalent print_variable routines, but only displaying the value of the variable, without the corresponding object identifier.
Deletionsnmp_free_var releases all memory used by the given varbind structure.
snmp_free_varbind releases all memory used by each varbind structure in the varbind list provided.
SEE ALSOpdu_api(3)" mib_api(3)" 0
Johanes Gumabo
Data Size : 14,988 byte
man-varbind_api.3Build : 2024-12-05, 20:55 :
Visitor Screen : x
Visitor Counter ( page / site ) : 3 / 170,217
Visitor ID : :
Visitor IP : 18.118.252.215 :
Visitor Provider : AMAZON-02 :
Provider Position ( lat x lon ) : 39.962500 x -83.006100 : x
Provider Accuracy Radius ( km ) : 1000 :
Provider City : Columbus :
Provider Province : Ohio , : ,
Provider Country : United States :
Provider Continent : North America :
Visitor Recorder : Version :
Visitor Recorder : Library :
Online Linux Manual Page : Version : Online Linux Manual Page - Fedora.40 - march=x86-64 - mtune=generic - 24.12.05
Online Linux Manual Page : Library : lib_c - 24.10.03 - march=x86-64 - mtune=generic - Fedora.40
Online Linux Manual Page : Library : lib_m - 24.10.03 - march=x86-64 - mtune=generic - Fedora.40
Data Base : Version : Online Linux Manual Page Database - 24.04.13 - march=x86-64 - mtune=generic - fedora-38
Data Base : Library : lib_c - 23.02.07 - march=x86-64 - mtune=generic - fedora.36
Very long time ago, I have the best tutor, Wenzel Svojanovsky . If someone knows the email address of Wenzel Svojanovsky , please send an email to johanes_gumabo@yahoo.co.id .
If error, please print screen and send to johanes_gumabo@yahoo.co.id
Under development. Support me via PayPal.