Good evening,
I try to figure out which VLANs are allowed on a Cisco Switch port configured as Trunk.
I read via SNMP the Cisco_VTP_MIB which returns me this information in the form :
Index : blabla, blabla beeing a 1024 bits field.
Example (obtained with a MIB browser)
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
02 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 10 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
16 Bytes/ Line x 8 Lines = 128 Bytes x 8 bits or Vlans = 1024 Vlans
16 Bytes / Line => 1st line covers Vlan Indexes from 0 to 127
the O2 is 134th bit =>Vlan 134,
the 10 is 810th bit => Vlan 827
The port in question is condigured as
switchport trunk allowed vlan 134,827
I was hoping that a loop with the shift left (<<) would allow me to find out which bit are set to one (like in assembler, but there is no "Carry" bit in which the shifted out bit can go).
Any idea out to find out the ones - and where they are - in a 1024 bits long binary-field.
Thanks
Juju

In reply to Working with BIG binary fields by juju

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.