nfs-ganesha 1.4
|
snmp_adm.h : 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>
Go to the source code of this file.
snmp_adm.h : snmp_adm API
Definition in file snmp_adm.h.
#define INPUT_OID 0 |
OID number for inputs.
Definition at line 67 of file snmp_adm.h.
#define OUTPUT_OID 1 |
OID number for outputs.
Definition at line 69 of file snmp_adm.h.
#define SNMP_ADM_ACCESS_RO HANDLER_CAN_RONLY |
Read only value
Definition at line 16 of file snmp_adm.h.
#define SNMP_ADM_ACCESS_RW HANDLER_CAN_RWRITE |
Read write value
Definition at line 18 of file snmp_adm.h.
#define SNMP_ADM_MAX_STR 4096 |
Maximum length for a string
Definition at line 88 of file snmp_adm.h.
#define TRIGGER_OID 3 |
OID number for trigger.
Definition at line 65 of file snmp_adm.h.
typedef int(* fct_get)(snmp_adm_type_union *param, void *opt_arg) |
A getter.
param | the function have to fill the value. |
opt_arg | optionnal argument, the optional argument set during registration is available here. |
Definition at line 122 of file snmp_adm.h.
typedef int(* fct_set)(const snmp_adm_type_union *param, void *opt_arg) |
A setter.
param | the function have to read this value to change internal data. |
opt_arg | optionnal argument, the optional argument set during registration is available here. |
Definition at line 131 of file snmp_adm.h.
typedef int(* proc)(const snmp_adm_type_union **tab_in, snmp_adm_type_union **tab_out, void *opt_arg) |
A procedure.
tab_in | Array of inputs. The length is set during registration. |
tab_in | Array of outputs. The length is set during registration. |
opt_arg | optionnal argument, the optional argument set during registration is available here. |
Definition at line 155 of file snmp_adm.h.
typedef struct register_get_set_s register_get_set |
get/set information.
typedef struct register_proc_s register_proc |
Procedure information.
typedef struct register_scal_s register_scal |
Scalar information.
typedef union type_union_e snmp_adm_type_union |
The type of variables handle by the library.
typedef int(* trap_test)(void *arg) |
A trap testing function.
arg | argument of the function. |
Definition at line 178 of file snmp_adm.h.
anonymous enum |
Definition at line 20 of file snmp_adm.h.
anonymous enum |
A var is made of this two
Definition at line 28 of file snmp_adm.h.
anonymous enum |
Definition at line 34 of file snmp_adm.h.
enum trigger_state |
The different states of the trigger branch of a procedure. ROOT.prodid.PROC_OID.numproc.TRIGGER_OID.
Definition at line 75 of file snmp_adm.h.
enum type_number |
Enum of available type number
Definition at line 47 of file snmp_adm.h.
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" 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". |
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 and desc in snmp_adm_register_* : 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. |
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. |
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 and desc in snmp_adm_register_* : 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. |
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 and desc in snmp_adm_register_* : 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. |
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. |
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.
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.