Class: SNMP::VarBindList

### Home Classes Methods

### In Files

- lib/snmp/varbind.rb

### Parent

Array

### Methods

- ::decode
- ::new
- #asn1_type
- #encode

### Files

- README.rdoc

### Class/Module Index

Quicksearch

- SNMP
- SNMP::BER
- SNMP::Counter32
- SNMP::Counter64
- SNMP::EndOfMibView
- SNMP::Gauge32
- SNMP::GetBulkRequest
- SNMP::GetNextRequest
- SNMP::GetRequest
- SNMP::InformRequest
- SNMP::Integer
- SNMP::Integer32
- SNMP::InvalidErrorStatus
- SNMP::InvalidGenericTrap
- SNMP::InvalidIpAddress
- SNMP::InvalidPduTag
- SNMP::InvalidTrapVarbind
- SNMP::IpAddress
- SNMP::MIB
- SNMP::MIB::ModuleNotLoadedError
- SNMP::Manager
- SNMP::Manager::Config
- SNMP::Message
- SNMP::NoSuchInstance
- SNMP::NoSuchObject
- SNMP::Null
- SNMP::ObjectId
- SNMP::ObjectName
- SNMP::OctetString
- SNMP::Opaque
- SNMP::PDU
- SNMP::ParseError
- SNMP::RequestId
- SNMP::RequestTimeout
- SNMP::Response
- SNMP::SNMPv1_Trap
- SNMP::SNMPv2_Trap
- SNMP::SetRequest
- SNMP::TimeTicks
- SNMP::TrapListener
- SNMP::TrapListener::Config
- SNMP::UDPServerTransport
- SNMP::UDPTransport
- SNMP::Unsigned32
- SNMP::UnsignedInteger
- SNMP::UnsupportedPduTag
- SNMP::UnsupportedValueTag
- SNMP::UnsupportedVersion
- SNMP::VarBind
- SNMP::VarBindList
- Fixnum
- Object

No matching classes.

# SNMP::VarBindList

### Public Class Methods

decode(data, mib=nil) click to toggle source

    # File lib/snmp/varbind.rb, line 20
    def self.decode(data, mib=nil)
      list = VarBindList.new
      varbind_data, remainder = decode_sequence(data)
      while varbind_data != ""
        varbind, varbind_data = VarBind.decode(varbind_data, mib)
        list << varbind
      end
      return list, remainder
    end

new(varbind_list=[]) click to toggle source

    # File lib/snmp/varbind.rb, line 30
    def initialize(varbind_list=[])
      super()
      if varbind_list.respond_to? :to_str
        self << ObjectId.new(varbind_list.to_str).to_varbind
      elsif varbind_list.respond_to? :to_varbind
        self << varbind_list.to_varbind
      else
        varbind_list.each do |item|
          if item.respond_to? :to_str
            self << ObjectId.new(item.to_str).to_varbind
          else
            self << item.to_varbind
          end
        end
      end
    end

### Public Instance Methods

asn1_type() click to toggle source

    # File lib/snmp/varbind.rb, line 47
    def asn1_type
      "VarBindList"
    end

encode() click to toggle source

    # File lib/snmp/varbind.rb, line 51
    def encode
      varbind_data = ""
      self.each do |varbind|
        varbind_data << varbind.encode
      end
      encode_sequence(varbind_data)
    end

[Validate]

Generated with the Darkfish Rdoc Generator 2.