How to add rocommunity public without using conf-files

"Sebastian Fabig" <[email protected]>
Newsgroups gmane.network.net-snmp.user
Message-ID <[email protected]>
Hi guys,

I implemented an agent with the following code (sorry if it looks terrible, I don't know how to layout code here):

init_snmpAgent
{
    netsnmp_ds_set_boolean(NETSNMP_DS_APPLICATION_ID, NETSNMP_DS_AGENT_ROLE, 0);
    
    netsnmp_ds_set_string(NETSNMP_DS_LIBRARY_ID, NETSNMP_DS_LIB_OPTIONALCONFIG, "c:\\snmpd.conf");

    init_agent("test");
    netsnmp_register_read_only_int_instance(name, id, id_len, NULL, &callbackHandler);

    init_mib_modules();
    init_snmp("pl");
    
    init_master_agent();
}

int callbackHandler(netsnmp_mib_handler *handler,
                    netsnmp_handler_registration *reginfo,
		    netsnmp_agent_request_info *reqinfo,
                    netsnmp_request_info *requests)
{
	netsnmp_request_info* request = requests;
		
	switch(reqinfo->mode)
	{
	case MODE_GETNEXT:
	case MODE_GET:
		for(; request; request = request->next)
		{
			//handle request
                        int tmp = 3;
			request->delegated = 0;
			snmp_set_var_typed_value(request->vb, ASN_INTEGER, &tmp, sizeof(tmp));
		}
		break;
	default:
		break;
	}
	return SNMP_ERR_NOERROR;
}


What do I have to do to get rid of the conf-file? Right now I only need it to set the rocommunity public. If it is not possible to set it without a conf-file, is there at least a possibility to disable the creation of other other-files (e.g. I found some in the folder usr\bin)?

If there are any errors in my code, feel free to name them. ;)

Thanks Sebastian
-- 
GRATIS: Spider-Man 1-3 sowie 300 weitere Videos!
Jetzt freischalten! http://portal.gmx.net/de/go/maxdome

------------------------------------------------------------------------------
Start uncovering the many advantages of virtual appliances
and start using them to simplify application deployment and
accelerate your shift to cloud computing.
http://p.sf.net/sfu/novell-sfdev2dev
_______________________________________________
Net-snmp-users mailing list
[email protected]
Please see the following page to unsubscribe or change other options:
https://lists.sourceforge.net/lists/listinfo/net-snmp-users
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.