nfs-ganesha 1.4

snmp_adm.h

Go to the documentation of this file.
00001 
00008 #ifndef __LIBDAEMON_H__
00009 #define __LIBDAEMON_H__
00010 
00011 #include <net-snmp/net-snmp-config.h>
00012 #include <net-snmp/net-snmp-includes.h>
00013 #include <net-snmp/agent/net-snmp-agent-includes.h>
00014 
00016 #define SNMP_ADM_ACCESS_RO   HANDLER_CAN_RONLY
00017 
00018 #define SNMP_ADM_ACCESS_RW   HANDLER_CAN_RWRITE
00019 
00020 enum
00021 {
00022   NAME_OID,
00023   DESC_OID,
00024   VAR_OID
00025 };
00026 
00028 enum
00029 {
00030   TYPE_OID,       
00031   VAL_OID         
00032 };
00033 
00034 enum
00035 {
00036   STAT_OID,
00037   LOG_OID,
00038 #ifdef _ERROR_INJECTION
00039   INJECT_OID,
00040 #endif
00041   CONF_OID,
00042   PROC_OID,
00043   NUM_BRANCH
00044 };
00045 
00047 enum type_number
00048 {
00049   SNMP_ADM_INTEGER,       
00050   SNMP_ADM_STRING,        
00051   SNMP_ADM_IP,            
00052   SNMP_ADM_REAL,          
00053   SNMP_ADM_BIGINT,        
00054   SNMP_ADM_TIMETICKS      
00062 };
00063 
00065 #define TRIGGER_OID   3
00066 
00067 #define INPUT_OID     0
00068 
00069 #define OUTPUT_OID    1
00070 
00075 enum trigger_state
00076 {
00077   SNMP_ADM_READY,              
00078   SNMP_ADM_PROGRESS,           
00079   SNMP_ADM_DONE,               
00084   SNMP_ADM_ERROR               
00085 };
00086 
00088 #define SNMP_ADM_MAX_STR    4096
00089 
00093 typedef union type_union_e
00094 {
00095   int integer;                          
00096   char string[SNMP_ADM_MAX_STR];        
00097   in_addr_t ip;                         
00098   double real;                          
00099   int64_t bigint;                       
00100   unsigned int time;                    
00101 } snmp_adm_type_union;
00102 
00106 typedef struct register_scal_s
00107 {
00108   char *label;                         
00109   char *desc;                          
00110   unsigned char type;                  
00111   int access;                          
00112   void *value;                         
00113 } register_scal;
00114 
00122 typedef int (*fct_get) (snmp_adm_type_union * param, void *opt_arg);
00123 
00131 typedef int (*fct_set) (const snmp_adm_type_union * param, void *opt_arg);
00132 
00136 typedef struct register_get_set_s
00137 {
00138   char *label;                    
00139   char *desc;                     
00140   unsigned char type;             
00141   int access;                     
00142   fct_get getter;                 
00143   fct_set setter;                 
00144   void *opt_arg;                  
00145 } register_get_set;
00146 
00155 typedef int (*proc) (const snmp_adm_type_union ** tab_in, snmp_adm_type_union ** tab_out,
00156                      void *opt_arg);
00157 
00161 typedef struct register_proc_s
00162 {
00163   char *label;                    
00164   char *desc;                     
00165   int nb_in;                      
00166   unsigned char *type_in;         
00167   int nb_out;                     
00168   unsigned char *type_out;        
00169   void *opt_arg;                  
00170   proc myproc;                    
00171 } register_proc;
00172 
00178 typedef int (*trap_test) (void *arg);
00179 
00189 int snmp_adm_config_daemon(char *agent_x_socket, char *filelog, int prod_id);
00190 
00203 int snmp_adm_register_scalars(int branch, register_scal * tab, int len);
00204 
00215 int snmp_adm_register_get_set_function(int branch, register_get_set * tab, int len);
00216 
00226 int snmp_adm_register_procedure(register_proc * tab, int len);
00227 
00233 int snmp_adm_unregister(char *label);
00234 
00241 void snmp_adm_send_trap(unsigned char type, snmp_adm_type_union value);
00242 
00252 int snmp_adm_register_poll_trap(unsigned int second, trap_test test_fct, void *args,
00253                                 unsigned char type, snmp_adm_type_union value);
00254 
00262 int snmp_adm_start();
00263 
00267 void snmp_adm_close();
00268 
00273 void snmp_adm_log(char *format, ...);
00274 
00275 #endif                          /* __LIBDAEMON_H__ */