Class: Net::SNMP::Provider
- Inherits:
-
Object
- Object
- Net::SNMP::Provider
- Defined in:
- lib/net/snmp/agent/provider.rb
Overview
Providers are responsible for handling requests for a given subtree of the system’s MIB. The Provider object itself holds the root OID of the subtree provided, and handlers for the various request types. The handlers are executed for each varbind of the incoming message individually in the context of a ProviderDsl object.
Instance Attribute Summary collapse
-
#get_bulk_handler ⇒ Object
Returns the value of attribute get_bulk_handler.
-
#get_handler ⇒ Object
Returns the value of attribute get_handler.
-
#get_next_handler ⇒ Object
Returns the value of attribute get_next_handler.
-
#oid ⇒ Object
Returns the value of attribute oid.
-
#set_handler ⇒ Object
Returns the value of attribute set_handler.
Instance Method Summary collapse
- #handler_for(command) ⇒ Object
-
#initialize(oid) ⇒ Provider
constructor
A new instance of Provider.
Constructor Details
#initialize(oid) ⇒ Provider
Returns a new instance of Provider.
16 17 18 |
# File 'lib/net/snmp/agent/provider.rb', line 16 def initialize(oid) @oid = oid end |
Instance Attribute Details
#get_bulk_handler ⇒ Object
Returns the value of attribute get_bulk_handler.
10 11 12 |
# File 'lib/net/snmp/agent/provider.rb', line 10 def get_bulk_handler @get_bulk_handler end |
#get_handler ⇒ Object
Returns the value of attribute get_handler.
10 11 12 |
# File 'lib/net/snmp/agent/provider.rb', line 10 def get_handler @get_handler end |
#get_next_handler ⇒ Object
Returns the value of attribute get_next_handler.
10 11 12 |
# File 'lib/net/snmp/agent/provider.rb', line 10 def get_next_handler @get_next_handler end |
#oid ⇒ Object
Returns the value of attribute oid.
10 11 12 |
# File 'lib/net/snmp/agent/provider.rb', line 10 def oid @oid end |
#set_handler ⇒ Object
Returns the value of attribute set_handler.
10 11 12 |
# File 'lib/net/snmp/agent/provider.rb', line 10 def set_handler @set_handler end |
Instance Method Details
#handler_for(command) ⇒ Object
20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 |
# File 'lib/net/snmp/agent/provider.rb', line 20 def handler_for(command) # User might be tempted to just pass in the message, or pdu, # if so, just pluck the command off of it. if command.kind_of?(Message) command = command.pdu.command elsif command.kind_of?(PDU) command = command.command end case command when Constants::SNMP_MSG_GET get_handler when Constants::SNMP_MSG_GETNEXT get_next_handler when Constants::SNMP_MSG_GETBULK get_bulk_handler when Constants::SNMP_MSG_SET set_handler else raise "Invalid command type: #{command}" end end |