> 
> > Yes, I could have a handler, but the idea was to leverage the tree
> that
> > is already built using the MIB files and not having to configure
> OIDs. 
> > 
> > On receiving a trap, the application would simply lookup the tree
> for
> > the "snmp_trap_oid" (second varbind in the v2c/v3 notifications)
> and
> > either process or drop the trap based on the the lookup return
> value. 
> > 
> > In this way the only traps that get acknowledged are the ones whose
> MIB
> > files are loaded into the snmptrapd application.
> 
> Yup - you could implement that using the existing snmptrapd
> framework.
> Define a default trap handler, called for *all* incoming traps.

ok, so far so good.

> That handler should take the trap OID (which is one of the input
> parameters), do a read_objid() lookup, and check whether the result
> had a trailing numeric subidentifier.

After a few experiments and if I understand you correctly, would this
work as:

void
default_handler(const oid *objid_rcvd_in_trap, size_t len)
{
  char oid_buf[256];
  oid oid_out[MAX_OID_LEN];
  size_t oid_out_len;

  snprint_objid(oid_buf, sizeof(oid_buf), objid_rcvd_in_trap, len);

  read_objid(oid_buf, oid_out, &oid_out_len);
                  
  if(oid_out_len < len) {
    /* failure, discard */
  } else {
    /* success, move on */
  }
}

>   If it does, then return without doing any more processing.
> Otherwise, it would continue with whatever acknowledgements, etc
> you needed to do.
> 
>   That's perfectly possible with the current Net-SNMP toolkit. I
> don't
> think you need to add any new APIs.
> 

thanks,
mrl

P.S: I dropped he first part of the email since it seems it isn't
relevant to what I wan't to achieve. 

__________________________________________________
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 


-------------------------------------------------------
SF.Net email is sponsored by: Discover Easy Linux Migration Strategies
from IBM. Find simple to follow Roadmaps, straightforward articles,
informative Webcasts and more! Get everything you need to get up to
speed, fast. http://ads.osdn.com/?ad_id=7477&alloc_id=16492&op=click
_______________________________________________
Net-snmp-users mailing list
Net-snmp-users@lists.sourceforge.net
Please see the following page to unsubscribe or change other options:
https://lists.sourceforge.net/lists/listinfo/net-snmp-users

Reply via email to