On Thu, 14 Apr 2005 14:17:39 +0200 Christian wrote:
CJ> I am brand new at this (snmp, net-snmp, etc) and I am writing an agent 
CJ> using the mib2c.mfd.conf generated code-framework (container-cached) 
CJ> from net-snmp 5.2.1,

Great! Stop by the IRC channel if you want more interactive help. You might
also want to try the latest CVS version. I've been busy improving it. (In that
case, you would also probably want to switch to using mib2c-update, to help
automate merging in changes as I make them.)

CJ> 1) I'm trying to figure out a way to get ahold of the IP-address on 
CJ> which the snmp-request was received inside my *_cache_load() function 
CJ> (in *_data_access.c), is this at all possible without altering the snmplib?

Trying to figure out where a packet came from is strongly discouraged. Once a
PDU has been authenticated and accepted, it shouldn't matter where it came
from. If you need different data from different hosts, SNMP contexts is the
right way to do it.

That said, if you really really want to do it, you could probably poke about in
the structures passed to the cache_load wrapper in *_interface.c, and pass the
info to the cache_load routine.

CJ> 2) I'm also trying to get ahold of the user-context (*_registration_ptr) 
CJ> from my *_cache_load() function (again in *_data_access.c), can this be 
CJ> done?
CJ> 
CJ> If anyone could shine some light on these issues I'd be very greatful! :)

Sure. Just add these simple functions in *_interface.c (they are auto-generated
for you in the CVS versions):

xxxTable_registration *
xxxTable_registration_get(void)
{
    return xxxTable_if_ctx.user_ctx;
}

xxxTable_registration *
xxxTable_registration_set(auditConfigTable_registration * new)
{
    xxxTable_registration *old = xxxTable_if_ctx.user_ctx;
    xxxConfigTable_if_ctx.user_ctx = new;
    return old;
}


-- 
NOTE: messages sent directly to me, instead of the lists, will be deleted
      unless they are requests for paid consulting services.

Robert Story; NET-SNMP Junkie
Support: <http://www.net-snmp.org/> <irc://irc.freenode.net/#net-snmp>  
Archive: <http://sourceforge.net/mailarchive/forum.php?forum=net-snmp-users>

You are lost in a twisty maze of little standards, all different. 


-------------------------------------------------------
SF email is sponsored by - The IT Product Guide
Read honest & candid reviews on hundreds of IT Products from real users.
Discover which products truly live up to the hype. Start reading now.
http://ads.osdn.com/?ad_id=6595&alloc_id=14396&op=click
_______________________________________________
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

Reply via email to