The Net-SNMP librarySection: C Library Functions (3)Updated: 7 Aug 2004 |
The Net-SNMP librarySection: C Library Functions (3)Updated: 7 Aug 2004 |
groupasn1 parsing and datatype manipulation routines.
groupA generic callback mechanism
groupgeneric linked-list data handling with a string as a key.
groupstorage space for defaults
The purpose of the default storage is three-fold:.
groupmib parsing and datatype manipulation routines.
groupStore and retrieve data referenced by an OID.
This is essentially a way of storing data associated with a given OID.
groupparsing various configuration files at run time
The read_config related functions are a fairly extensible system of parsing various configuration files at the run time.
groupgeneric library based alarm timers for various parts of an application
groupvarious PDU processing routines
groupgeneric logging for net-snmp
groupMemory Utility Routines
struct snmp_internal_session
struct session_list
#define MIN(a, b) (((a) < (b)) ? (a) : (b))
#define MIB_CLIENTS_ARE_EVIL 1
#define _init_agent_callback_transport()
#define SNMP_NEED_REQUEST_LIST
#define timercmp(tvp, uvp, cmp)
#define timerclear(tvp) (tvp)->tv_sec = (tvp)->tv_usec = 0
#define MAX_PACKET_LENGTH (0x7fffffff)
#define NETSNMP_STREAM_QUEUE_LEN 5
#define BSD4_2
#define NFDBITS (sizeof(fd_mask) * NBBY) /* bits per mask */
#define FD_SET(n, p) ((p)->fds_bits[(n)/NFDBITS] |= (1 << ((n) % NFDBITS)))
#define FD_CLR(n, p) ((p)->fds_bits[(n)/NFDBITS] &= ~(1 << ((n) % NFDBITS)))
#define FD_ISSET(n, p) ((p)->fds_bits[(n)/NFDBITS] & (1 << ((n) % NFDBITS)))
#define FD_ZERO(p) memset((p), 0, sizeof(*(p)))
#define DEFAULT_COMMUNITY 'public'
#define DEFAULT_RETRIES 5
#define DEFAULT_TIMEOUT 1000000L
#define DEFAULT_REMPORT SNMP_PORT
#define DEFAULT_ENTERPRISE default_enterprise
#define DEFAULT_TIME 0
#define MAXIMUM_PACKET_SIZE 0x7fffffff
#define DEBUGPRINTPDUTYPE(token, type)
#define ERROR_STAT_LENGTH 11
int init_agent (const char *app)
Initialize the agent.
void shutdown_agent (void)
int snmp_build (u_char **pkt, size_t *pkt_len, size_t *offset, netsnmp_session *pss, netsnmp_pdu *pdu)
int snmp_get_errno (void)
void snmp_synch_reset (netsnmp_session *notused)
void snmp_synch_setup (netsnmp_session *notused)
const char * strerror (int err)
long snmp_get_next_reqid (void)
long snmp_get_next_msgid (void)
long snmp_get_next_sessid (void)
long snmp_get_next_transid (void)
void snmp_perror (const char *prog_string)
void snmp_set_detail (const char *detail_string)
const char * snmp_api_errstring (int snmp_errnumber)
void snmp_error (netsnmp_session *psess, int *p_errno, int *p_snmp_errno, char **p_str)
void snmp_sess_error (void *sessp, int *p_errno, int *p_snmp_errno, char **p_str)
void netsnmp_sess_log_error (int priority, const char *prog_string, netsnmp_session *ss)
void snmp_sess_perror (const char *prog_string, netsnmp_session *ss)
void snmp_sess_init (netsnmp_session *session)
void init_snmp_enums (void)
void init_snmp (const char *type)
Calls the functions to do config file loading and mib module parsing in the correct order.
void snmp_store (const char *type)
void snmp_shutdown (const char *type)
Shuts down the application, saving any needed persistent storage, and appropriate clean up.
netsnmp_session * snmp_open (netsnmp_session *session)
netsnmp_session * snmp_open_ex (netsnmp_session *session, int(*fpre_parse)(netsnmp_session *, netsnmp_transport *, void *, int), int(*fparse)(netsnmp_session *, netsnmp_pdu *, u_char *, size_t), int(*fpost_parse)(netsnmp_session *, netsnmp_pdu *, int), int(*fbuild)(netsnmp_session *, netsnmp_pdu *, u_char *, size_t *), int(*frbuild)(netsnmp_session *, netsnmp_pdu *, u_char **, size_t *, size_t *), int(*fcheck)(u_char *, size_t))
int snmpv3_engineID_probe (struct session_list *slp, netsnmp_session *in_session)
netsnmp_session * snmp_add (netsnmp_session *in_session, netsnmp_transport *transport, int(*fpre_parse)(netsnmp_session *, netsnmp_transport *, void *, int), int(*fpost_parse)(netsnmp_session *, netsnmp_pdu *, int))
netsnmp_session * snmp_add_full (netsnmp_session *in_session, netsnmp_transport *transport, int(*fpre_parse)(netsnmp_session *, netsnmp_transport *, void *, int), int(*fparse)(netsnmp_session *, netsnmp_pdu *, u_char *, size_t), int(*fpost_parse)(netsnmp_session *, netsnmp_pdu *, int), int(*fbuild)(netsnmp_session *, netsnmp_pdu *, u_char *, size_t *), int(*frbuild)(netsnmp_session *, netsnmp_pdu *, u_char **, size_t *, size_t *), int(*fcheck)(u_char *, size_t), netsnmp_pdu *(*fcreate_pdu)(netsnmp_transport *, void *, size_t))
void * snmp_sess_add_ex (netsnmp_session *in_session, netsnmp_transport *transport, int(*fpre_parse)(netsnmp_session *, netsnmp_transport *, void *, int), int(*fparse)(netsnmp_session *, netsnmp_pdu *, u_char *, size_t), int(*fpost_parse)(netsnmp_session *, netsnmp_pdu *, int), int(*fbuild)(netsnmp_session *, netsnmp_pdu *, u_char *, size_t *), int(*frbuild)(netsnmp_session *, netsnmp_pdu *, u_char **, size_t *, size_t *), int(*fcheck)(u_char *, size_t), netsnmp_pdu *(*fcreate_pdu)(netsnmp_transport *, void *, size_t))
void * snmp_sess_add (netsnmp_session *in_session, netsnmp_transport *transport, int(*fpre_parse)(netsnmp_session *, netsnmp_transport *, void *, int), int(*fpost_parse)(netsnmp_session *, netsnmp_pdu *, int))
void * snmp_sess_open (netsnmp_session *pss)
int create_user_from_session (netsnmp_session *session)
int snmp_sess_close (void *sessp)
int snmp_close (netsnmp_session *session)
int snmp_close_sessions (void)
int snmpv3_packet_build (netsnmp_session *session, netsnmp_pdu *pdu, u_char *packet, size_t *out_length, u_char *pdu_data, size_t pdu_data_len)
u_char * snmp_pdu_build (netsnmp_pdu *pdu, u_char *cp, size_t *out_length)
int snmpv3_parse (netsnmp_pdu *pdu, u_char *data, size_t *length, u_char **after_header, netsnmp_session *sess)
int snmpv3_make_report (netsnmp_pdu *pdu, int error)
int snmpv3_get_report_type (netsnmp_pdu *pdu)
int snmp_pdu_parse (netsnmp_pdu *pdu, u_char *data, size_t *length)
u_char * snmpv3_scopedPDU_parse (netsnmp_pdu *pdu, u_char *cp, size_t *length)
int snmp_send (netsnmp_session *session, netsnmp_pdu *pdu)
int snmp_sess_send (void *sessp, netsnmp_pdu *pdu)
int snmp_async_send (netsnmp_session *session, netsnmp_pdu *pdu, snmp_callback callback, void *cb_data)
int snmp_sess_async_send (void *sessp, netsnmp_pdu *pdu, snmp_callback callback, void *cb_data)
void snmp_free_var (netsnmp_variable_list *var)
void snmp_free_varbind (netsnmp_variable_list *var)
void snmp_free_pdu (netsnmp_pdu *pdu)
netsnmp_pdu * snmp_create_sess_pdu (netsnmp_transport *transport, void *opaque, size_t olength)
void snmp_read (fd_set *fdset)
int _sess_read (void *sessp, fd_set *fdset)
int snmp_sess_read (void *sessp, fd_set *fdset)
int snmp_select_info (int *numfds, fd_set *fdset, struct timeval *timeout, int *block)
int snmp_sess_select_info (void *sessp, int *numfds, fd_set *fdset, struct timeval *timeout, int *block)
void snmp_timeout (void)
void snmp_sess_timeout (void *sessp)
int snmp_oid_ncompare (const oid *in_name1, size_t len1, const oid *in_name2, size_t len2, size_t max_len)
int snmp_oid_compare (const oid *in_name1, size_t len1, const oid *in_name2, size_t len2)
lexicographical compare two object identifiers.
int snmp_oidtree_compare (const oid *in_name1, size_t len1, const oid *in_name2, size_t len2)
Compares 2 OIDs to determine if they are equal up until the shortest length.
int netsnmp_oid_equals (const oid *in_name1, size_t len1, const oid *in_name2, size_t len2)
Compares 2 OIDs to determine if they are exactly equal.
int netsnmp_oid_is_subtree (const oid *in_name1, size_t len1, const oid *in_name2, size_t len2)
Identical to netsnmp_oid_equals, except only the length up to len1 is compared.
int netsnmp_oid_find_prefix (const oid *in_name1, size_t len1, const oid *in_name2, size_t len2)
Given two OIDs, determine the common prefix to them both.
netsnmp_variable_list * snmp_pdu_add_variable (netsnmp_pdu *pdu, const oid *name, size_t name_length, u_char type, const u_char *value, size_t len)
netsnmp_variable_list * snmp_varlist_add_variable (netsnmp_variable_list **varlist, const oid *name, size_t name_length, u_char type, const u_char *value, size_t len)
int snmp_add_var (netsnmp_pdu *pdu, const oid *name, size_t name_length, char type, const char *value)
void * snmp_sess_pointer (netsnmp_session *session)
netsnmp_session * snmp_sess_session (void *sessp)
netsnmp_transport * snmp_sess_transport (void *sessp)
void snmp_sess_transport_set (void *sp, netsnmp_transport *t)
oid * snmp_duplicate_objid (const oid *objToCopy, size_t objToCopyLen)
u_int snmp_increment_statistic (int which)
u_int snmp_increment_statistic_by (int which, int count)
u_int snmp_get_statistic (int which)
void snmp_init_statistics (void)
netsnmp_subtree * subtrees
long long_return
uint32_t ipaddr_return
u_char return_buf [258]
timeval starttime
int callback_master_num = -1
oid nullOid [] = { 0, 0 }
int nullOidLen = sizeof(nullOid)
session_list * Sessions = NULL
int snmp_errno = 0
int snmp_errno
long long_return
uint32_t ipaddr_return
u_char return_buf []
oid nullOid []
int nullOidLen
Value:.nf
switch(type) {
case SNMP_MSG_GET: DEBUGDUMPSECTION(token, 'PDU-GET'); break; case SNMP_MSG_GETNEXT: DEBUGDUMPSECTION(token, 'PDU-GETNEXT'); break; case SNMP_MSG_RESPONSE: DEBUGDUMPSECTION(token, 'PDU-RESPONSE'); break; case SNMP_MSG_SET: DEBUGDUMPSECTION(token, 'PDU-SET'); break; case SNMP_MSG_GETBULK: DEBUGDUMPSECTION(token, 'PDU-GETBULK'); break; case SNMP_MSG_INFORM: DEBUGDUMPSECTION(token, 'PDU-INFORM'); break; case SNMP_MSG_TRAP2: DEBUGDUMPSECTION(token, 'PDU-TRAP2'); break; case SNMP_MSG_REPORT: DEBUGDUMPSECTION(token, 'PDU-REPORT'); break; default: DEBUGDUMPSECTION(token, 'PDU-UNKNOWN'); break; }
Definition at line 375 of file snmp_api.c.
Value:.nf
/* CSTYLED */
((tvp)->tv_sec cmp (uvp)->tv_sec || ((tvp)->tv_sec == (uvp)->tv_sec && /* CSTYLED */ (tvp)->tv_usec cmp (uvp)->tv_usec))
Definition at line 145 of file snmp_api.c.
Initialize the agent. Calls into init_agent_read_config to set tha app's configuration file in the appropriate default storage space, NETSNMP_DS_LIB_APPTYPE. Need to call init_agent before calling init_snmp.
Parameters:
Returns:
See also:
Definition at line 263 of file snmp_vars.c.
References netsnmp_ds_set_boolean(), and netsnmp_init_helpers().
Calls the functions to do config file loading and mib module parsing in the correct order. Parameters:
Returns:
See also:
Definition at line 767 of file snmp_api.c.
Compares 2 OIDs to determine if they are exactly equal. This should be faster than doing a snmp_oid_compare for different length OIDs, since the length is checked first and if != returns immediately. Might be very slighly faster if lengths are ==.
Parameters:
Returns:
Definition at line 6120 of file snmp_api.c.
Referenced by netsnmp_old_api_helper(), and unregister_mib_context().
Given two OIDs, determine the common prefix to them both. Parameters:
Returns:
Definition at line 6176 of file snmp_api.c.
References SNMP_MIN.
Referenced by netsnmp_add_varbind_to_cache().
Identical to netsnmp_oid_equals, except only the length up to len1 is compared. Functionally, this determines if in_name2 is equal or a subtree of in_name1
Parameters:
Returns:
Definition at line 6156 of file snmp_api.c.
lexicographical compare two object identifiers. Caution: this method is called often by command responder applications (ie, agent).
Returns:
Definition at line 6052 of file snmp_api.c.
Referenced by check_getnext_results(), netsnmp_check_getnext_reply(), netsnmp_insert_iterator_context(), netsnmp_row_merge_helper_handler(), netsnmp_table_data_add_row(), netsnmp_table_data_get_from_oid(), netsnmp_table_data_helper_handler(), netsnmp_table_iterator_helper_handler(), snmp_oidtree_compare(), and table_helper_handler().
Compares 2 OIDs to determine if they are equal up until the shortest length. Parameters:
Returns:
Definition at line 6101 of file snmp_api.c.
References snmp_oid_compare().
Shuts down the application, saving any needed persistent storage, and appropriate clean up. Parameters:
Returns:
Definition at line 835 of file snmp_api.c.
References shutdown_mib(), snmp_alarm_unregister_all(), and snmp_call_callbacks().