Re: Convert a BITS datatypes string representation back to bit (e.g. int)

Boris Zweimueller <[email protected]>
Newsgroups gmane.network.net-snmp.user
Message-ID <[email protected]>
Thanks for your help. I do not need it as commandline argument but as code.
I maybe need to explain shortly what I want to do / I am doing.

I catch traps with snmptrapd.

I then forwar the traps to an external C program using the traphandle
directive. The C program does - something - with these traps and then
forwards them further to an NMS. To forward the traps again I call snmptrap
from the C code. (ugly, I know).

The problem is now, how to feed snmptrap with the correct oid-value pairs
from the incoming traps. The c code gets them via stdin - this is no
problem. For int and string types parsing is also very easy and the
arguments to snmptrap can be built easily. For bits datatypes is is not that
easy (and for some other probably also). Thats why I asked if there exists
some code to transform the bit value ("xx xx xx.."), which the C program
gets on the stdin, to something I can then pass to snmptrap to forward the
trap further...

It would be very nice not to invesitgate every varbind to find out the type
and construct the correct argument for snmptrap....

Maybe there is a complete other and better! way to solve my problem?. To go
from snmptrapd to an external C program and forward/issue the trap again
seems ugly, but I had no better idea. (I don't want to 'rewrite' snmptrapd
to do the trap proccessing my external C program does).
And I don't want to have a seperate external trap handler for every trap
which needs special proccessing - it must be a solution for all traps.

Any ideas on how to solve this are greatly appreciated!

Thanks

Boris


2010/6/18 Dave Shield <[email protected]>

> On 18 June 2010 09:25, Boris Zweimueller <[email protected]>
> wrote:
> > I'm looking for a way to convert the BITS datatypes string representation
> > back to an int
>
> Try the option '-Ov'   (or '-Ov -Oe')
> This will display the bit string value as a hex value,
> as well as listing the individual bits that are set
> (with or without their names)
>
> Alternatively '-Ov -Oq' will display a string
> that containes the hex value (only)
>
> Those are the cleanest representations that I can come up with
>
> Dave
>

------------------------------------------------------------------------------
ThinkGeek and WIRED's GeekDad team up for the Ultimate 
GeekDad Father's Day Giveaway. ONE MASSIVE PRIZE to the 
lucky parental unit.  See the prize list and enter to win: 
http://p.sf.net/sfu/thinkgeek-promo

_______________________________________________
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.