in reply to Re: Re: integer encoder/decoder
in thread integer encoder/decoder

yes, i think i understand. but i don't see the reason to limit yourself to a 9 digit sessionid. just use more than one OID slot and give the client people a sessionid with a dots in it.

enterprise.10000.10182.192.168.254.12.3888206 for NAS 192.168.254.12 session 3888206 or take IP and convert to two 16bit numbers and do ...10182.49128.64782.3888206 ( give person 49128.64782.3888206 as sessionid )

i've seen both. another really cool thing i came across recently is to use a timestamp as part of the OID, like ...1.3.1.$time.$id = $value. then you can keep a history of values in your MIB and the user can walk your table from ...1.3.1 and get all of the history or walk the table from ...1.3.1.$last and get all of the updates that have happend since they last walked the table.

Update: if all of your NAS IPs are in the same subnet (/16 or less) you could just forget about the first two octets. give them: 64782.3888206 as the session id if all your NAS are in 192.168.0.0/16.

Replies are listed 'Best First'.
Re: Re: Re: Re: integer encoder/decoder
by Anonymous Monk on Mar 14, 2003 at 00:47 UTC
    I thought about splitting it up actually. I didn't want to just do the whole ip like
    enterprise.10000.10182.192.168.254.12.3888206
    even though I have seen that before because I don't really want them knowing the IP.

    I also could split to two 16bit numbers, but it just comes down to simplicity. Why add 3 extra oid levels if I can just make one? That also makes it easier on the client, only having to remember one.

    That was the whole point of this node. To find a way to get one unique 9 digit number out of the IP and sessionid.

    There must be some kind of mathematical munging formula. I don't care really..it can use mod, division, whatever. As long as it's unique for that IP and sessionid. I don't even really need to be able to decode it. Can't anybody help???
      There must be some kind of mathematical munging formula. I don't care really..it can use mod, division, whatever. As long as it's unique for that IP and sessionid. I don't even really need to be able to decode it. Can't anybody help???
      How many times must we say (at least three so far) that you can't put ten pounds of potatoes into a five pound sack?

      This can't be done. Get it?

      -- Randal L. Schwartz, Perl hacker
      Be sure to read my standard disclaimer if this is a reply.

      then you have one hope.

      and it's a slim one.

      but you might be able to wring the last bit of info out.

      the absolute max session id is 999_999_999 which in binary is: $ perl -e 'printf"%032b$/",999999999' 00111011100110101100100111111111 you have the 2 most significant bits to work with. %NASs = ( '192.168.254.12' => 0, '192.168.255.13' => 1, '192.168.256.2' => 2, '192.168.243.1' => 3 ); so you can fit 4 IP's and a session id in 32 bits. if you want to assume that your session id won't go above 463129087 th +en you can steal another bit and have 8 IPs. $ perl -le 'print unpack "N", pack "B*", "0001101110011010110010011111 +1111"' 463129087 or along the same lines, use the NAS number and session id with a dot, only because it's easier for humans. 1.4596831 12.4596831 instead of the 16bit big numbers...

      this assumes an OID part can be 32 bits.

      $ snmpget -v 1 $CENSORED sysDescr.9999999999 Error in packet Reason: (noSuchName) There is no such variable name in this MIB. Failed object: system.sysDescr.4294967295 $ snmpget -v 1 $CENSORED sysDescr.4294967294 Error in packet Reason: (noSuchName) There is no such variable name in this MIB. Failed object: system.sysDescr.4294967294 $ snmpget -v 1 $CENSORED sysDescr.4294967295 Error in packet Reason: (noSuchName) There is no such variable name in this MIB. Failed object: system.sysDescr.4294967295 $ snmpget -v 1 $CENSORED sysDescr.4294967296 Error in packet Reason: (noSuchName) There is no such variable name in this MIB. Failed object: system.sysDescr.4294967295

      which may or may not be true.