Warning: main(/www/www/htdocs/style/globals.php) [function.main]: failed to open stream: No such file or directory in /www/www/docs/6.4.1/neutrino/lib_ref/r/read_main_config_file.html on line 1

Warning: main() [function.include]: Failed opening '/www/www/htdocs/style/globals.php' for inclusion (include_path='.:/www/www/common:/www/www/php/lib/php') in /www/www/docs/6.4.1/neutrino/lib_ref/r/read_main_config_file.html on line 1

Warning: main(/www/www/htdocs/style/header.php) [function.main]: failed to open stream: No such file or directory in /www/www/docs/6.4.1/neutrino/lib_ref/r/read_main_config_file.html on line 8

Warning: main() [function.include]: Failed opening '/www/www/htdocs/style/header.php' for inclusion (include_path='.:/www/www/common:/www/www/php/lib/php') in /www/www/docs/6.4.1/neutrino/lib_ref/r/read_main_config_file.html on line 8

read_main_config_file()

Read the snmpd.conf file

Synopsis:

#include <snmp/snmp_api.h>

int read_main_config_file(
              struct snmpd_conf_data * info );

Arguments:

info
A pointer to a snmpd_conf_data structure that the function can fill with the configuration information. For more information about this structure, see below.

Library:

libsnmp

Use the -l snmp option to qcc to link against this library.

Description:

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().


Note: 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:

main_config_fname
snmpd.conf file location.
party_conf_fname
party.conf file location.
view_conf_fname
view.conf file location.
context_conf_fname
context.conf file location.
acl_conf_fname
acl.conf file location.
sysContact
system.sysContact string.
sysLocation
system.sysLocation string.
sysName
system.sysName string.
private_community
Private level community string name to use.
public_community
Public level community string name to use.
trap_sink
Destination host to send trap messages.
trap_community
Community name to use for trap messages.
conf_authentraps
Enable authentication traps (1 means enable, 2 means disable).

Returns:

0
Success.
-1
An error occurred (errno is set).

Errors:

ENOENT
The snmpd.conf file wasn't found.

Files:

snmpd.conf
Default SNMP configuration file. For more information, see the Utilities Reference.

Environment variables:

SNMPCONFIGFILE
Location of the SNMP configuration file.

Classification:

SNMP

Safety:
Cancellation point Yes
Interrupt handler No
Signal handler No
Thread No

See also:

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


Warning: main(/www/www/htdocs/style/footer.php) [function.main]: failed to open stream: No such file or directory in /www/www/docs/6.4.1/neutrino/lib_ref/r/read_main_config_file.html on line 301

Warning: main() [function.include]: Failed opening '/www/www/htdocs/style/footer.php' for inclusion (include_path='.:/www/www/common:/www/www/php/lib/php') in /www/www/docs/6.4.1/neutrino/lib_ref/r/read_main_config_file.html on line 301