Read the snmpd.conf file
#include <snmp/snmp_api.h> int read_main_config_file( struct snmpd_conf_data * info );
libsnmp
Use the -l snmp option to qcc to link against this library.
The read_main_config_file() function fills the info structure with data from the snmpd.conf file (see the Utilities Reference). This information is useful if you wish to know what configuration information the SNMP agent was started with.
The string pointers in this structure, if not NULL, point to strings obtained by using malloc(); you can free them by calling free().
If the data for a member of the structure isn't available, the structure member isn't modified. You should use memset() to set the structure to 0 before calling read_main_config_file(). |
To locate the snmpd.conf file, this function first checks the SNMPCONFIGFILE environment variable. If this isn't found, the default, snmpd.conf, is used. If the specified file couldn't be accessed, the structure members aren't updated.
The snmpd_conf_data structure is defined in <snmp_api.h>, and contains the following members:
struct snmpd_conf_data{ char* main_config_fname; char* party_conf_fname; char* view_conf_fname; char* context_conf_fname; char* acl_conf_fname; char* sysContact; char* sysLocation; char* sysName; char* private_community; char* public_community; char* trap_sink; char* trap_community; int conf_authentraps; };
The members of this structure are:
Safety: | |
---|---|
Cancellation point | Yes |
Interrupt handler | No |
Signal handler | No |
Thread | No |
snmp_close(), snmp_free_pdu(), snmp_open(), snmp_pdu, snmp_pdu_create(), snmp_read(), snmp_select_info(), snmp_send(), snmp_session, snmp_timeout()
snmpd, snmpd.conf in the Utilities Reference