|
nfs-ganesha 1.4
|
libdaemon.c : snmp_adm API More...
#include <net-snmp/net-snmp-config.h>#include <net-snmp/net-snmp-includes.h>#include <net-snmp/agent/net-snmp-agent-includes.h>#include <pthread.h>#include <unistd.h>#include "snmp_adm.h"#include "register.h"#include "get_set_proc.h"#include "parse_type.h"#include "config_daemon.h"Go to the source code of this file.
Functions | |
| int | snmp_adm_config_daemon (char *agent_x_socket, char *filelog, int prod_id) |
| int | snmp_adm_register_scalars (int branch, register_scal *tab, int len) |
| int | snmp_adm_register_get_set_function (int branch, register_get_set *tab, int len) |
| int | snmp_adm_register_procedure (register_proc *tab, int len) |
| int | snmp_adm_unregister (char *label) |
| void | snmp_adm_send_trap (unsigned char type, snmp_adm_type_union value) |
| int | snmp_adm_register_poll_trap (unsigned int second, trap_test test_fct, void *args, unsigned char type, snmp_adm_type_union value) |
| void | snmp_adm_close () |
| int | snmp_adm_start () |
| void | snmp_adm_log (char *format,...) |
Variables | |
| register_info * | register_info_list = NULL |
| pthread_t * | polling_threads = NULL |
| polling_arg * | polling_args = NULL |
| int | polling_list_size = 0 |
| oid * | root_oid = NULL |
| int | root_oid_len = 0 |
| int | branch_num [NUM_BRANCH] |
libdaemon.c : snmp_adm API
Definition in file libdaemon.c.
| void snmp_adm_close | ( | ) |
Close the snmp thread.
Definition at line 711 of file libdaemon.c.
| int snmp_adm_config_daemon | ( | char * | agent_x_socket, |
| char * | filelog, | ||
| int | prod_id | ||
| ) |
Configure daemon. Should be called before registering values.
| agent_x_socket | agentX socket name (eg:"/tmp/agentx/master" or "tcp:192.168.67.19:31415"). This parametre should be set according to the snmpd config. |
| prod_id | product id, unique identifier of this daemon. |
| filelog | file to record log messages or "syslog". |
Definition at line 426 of file libdaemon.c.
| void snmp_adm_log | ( | char * | format, |
| ... | |||
| ) |
| int snmp_adm_register_get_set_function | ( | int | branch, |
| register_get_set * | tab, | ||
| int | len | ||
| ) |
Register get/set functions. Note for label & desc in register_scal* : they are copied in the library own memory, so user can safely free them or reuse them after this call.
| branch | the branch number (STAT_OID or CONF_OID). |
| tab | the functions to register. |
| len | the array's length. |
Definition at line 515 of file libdaemon.c.
| int snmp_adm_register_poll_trap | ( | unsigned int | second, |
| trap_test | test_fct, | ||
| void * | args, | ||
| unsigned char | type, | ||
| snmp_adm_type_union | value | ||
| ) |
Register a polling fonction.
| second | polling time. |
| test_fct | fonction called each "second", send a trap if return 1. |
| args | arguments of test_fct. |
| type | type of the variable. |
| value | value of the variable. |
Definition at line 661 of file libdaemon.c.
| int snmp_adm_register_procedure | ( | register_proc * | tab, |
| int | len | ||
| ) |
Register procedures. Note for label & desc in register_scal* : they are copied in the library own memory, so user can safely free them or reuse them after this call.
| tab | the procedures to register. |
| len | the array's length. |
Definition at line 547 of file libdaemon.c.
| int snmp_adm_register_scalars | ( | int | branch, |
| register_scal * | tab, | ||
| int | len | ||
| ) |
Register scalars. Note for strings : string provided in code MUST be readonly (ACCESS_RO). string MUST be allocated with SNMP_ADM_MAX_STR. Note for label & desc in register_scal* : they are copied in the library own memory, so user can safely free them or reuse them after this call.
| branch | the branch number (STAT_OID or CONF_OID). |
| tab | the values to register. |
| len | the array's length. |
Definition at line 485 of file libdaemon.c.
| void snmp_adm_send_trap | ( | unsigned char | type, |
| snmp_adm_type_union | value | ||
| ) |
Send a SNMPv2 trap.
| type | type of the variable. |
| value | value of the variable. |
Definition at line 607 of file libdaemon.c.
| int snmp_adm_start | ( | ) |
Launch the thread. FIXME after this, nothing should be registered, net-snmp bug?
Definition at line 763 of file libdaemon.c.
| int snmp_adm_unregister | ( | char * | label | ) |
Unregister an instance.
| label | name of the instance. |
Definition at line 572 of file libdaemon.c.
| int branch_num[NUM_BRANCH] |
Definition at line 169 of file libdaemon.c.
| polling_arg* polling_args = NULL |
| int polling_list_size = 0 |
sizeof polling_thread and polling_args
Definition at line 44 of file libdaemon.c.
| pthread_t* polling_threads = NULL |
array of thread id for polling
Definition at line 40 of file libdaemon.c.
| register_info* register_info_list = NULL |
linked list of registred objects
Definition at line 38 of file libdaemon.c.
| oid* root_oid = NULL |
Definition at line 46 of file libdaemon.c.
| int root_oid_len = 0 |
Definition at line 47 of file libdaemon.c.
1.7.3