CGI/Perl Guide | Learning Center | Forums | Advertise | Login
Site Search: in

  Main Index MAIN
INDEX
Search Posts SEARCH
POSTS
Who's Online WHO'S
ONLINE
Log in LOG
IN

Home: Perl Programming Help: Intermediate:
Working with BIG binary fields

 



juju
New User

Sep 20, 2010, 9:57 AM

Post #1 of 2 (628 views)
Working with BIG binary fields Can't Post

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



BillKSmith
Veteran

Sep 28, 2010, 8:14 AM

Post #2 of 2 (586 views)
Re: [juju] Working with BIG binary fields [In reply to] Can't Post

I do not know how to get this data into perl, but I am nearly certain that you will want to decode it with the perl built-in unpack (Ref perldoc -f unpack).
Good Luck,
Bill

 
 


Search for (options) Powered by Gossamer Forum v.1.2.0

Web Applications & Managed Hosting Powered by Gossamer Threads
Visit our Mailing List Archives