read the snmpd.conf file
#include <snmp/snmp_api.h> int read_main_config_file( struct snmpd_conf_data *info );
The read_main_config_file() function fills the info structure with data from the snmpd.conf file. 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(), and can be freed by using 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:
If an error occurred, errno could contain the following:
SNMP
Safety: | |
---|---|
Interrupt handler | No |
Signal handler | No |
Thread | No |
<snmp_api.h>
/etc/snmpd.conf, snmpd in the TCP/IP User's Guide