> I am in the middle of writing an agentx subagent. I have the handler all 
> set up and registered using netsnmp_register_handler, it get my 
> requests. The problem is I don't know what to do from there.

OK - first question:  what sort of objects is this handler dealing with?
One scalar?   A group of scalars?   A table?   A whole subtree?

The 'netsnmp_register_handler' API is a fairly general-purpose call.
You may find it easier to use one of the more specialised helpers,
that will handle much of the work for you.

>                                                            If I try to 
> set the value of the requests->requestvp

How are you doing this?
What's the code?


> Does anyone know of an example subagent that is a little more in depth 
> than the tutorial?

Bear in mind that the MIB module API is independent of whether it is
part of an AgentX subagent, or a master SNMP agent.   So any of the
techniques used in the v5-style MIB modules in the main source
distribution should be applicable to your subagent.

>              I am using netsnmp_create_handler_registration and 
> netsnmp_register_handler. My handler function returns 0. Is that 
> correct?

Ideally, I'd suggest you return SNMP_ERR_NOERROR (i.e. 0) for a
successful request, and the appropriate SNMP_ERR_xxx for a failure.
But it doesn't actually matter - this return value is ignored anyway!

It's more important to set the error using netsnmp_set_request_error()


>    Also what is the expected way to return the values, just malloc 
> the correct val and set it or what?

        snmp_set_var_typed_value( requests->requestvb, ASN_TYPE,
                                  (u_char *)&value, sizeof( value ));


But remember that 'requests' is actually a *list* of varbinds for
this handler, so you really need to wrap the processing in a loop
to pick up each one.

Again, see the main source code for examples.

Dave




-------------------------------------------------------
This SF.Net email is sponsored by: GNOME Foundation
Hackers Unite!  GUADEC: The world's #1 Open Source Desktop Event.
GNOME Users and Developers European Conference, 28-30th June in Norway
http://2004/guadec.org
_______________________________________________
Net-snmp-coders mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/net-snmp-coders

Reply via email to