AgentXcpp  Version:0.3
Internals Documentation
 All Classes Namespaces Files Functions Variables Enumerations Enumerator Friends Pages
agentxcpp::Varbind Class Reference

Represents a VarBind according to RFC 2741, section 5.4. More...

#include <Varbind.hpp>

Collaboration diagram for agentxcpp::Varbind:

Public Types

enum  type_t { Null = 5, noSuchObject = 128, noSuchInstance = 129, endOfMibView = 130 }
 These values can be used to create a VarBind. More...
 

Public Member Functions

 Varbind (const Oid &, QSharedPointer< AbstractVariable > v)
 Create a VarBind with an oid and a var. More...
 
 Varbind (const Oid &, type_t)
 Create VarBind without var, but with a type. More...
 
 Varbind (binary::const_iterator &pos, const binary::const_iterator &end, bool big_endian=true)
 Construct the object from input stream. More...
 
Oid get_name () const
 Get the name (the OID) stored within the varbind. More...
 
QSharedPointer< AbstractVariableget_var () const
 Get the variable stored within the varbind. More...
 
binary serialize () const
 Serialize the varbind. More...
 

Private Attributes

Oid name
 The name (OID) of the VarBind. More...
 
QSharedPointer< AbstractVariablevar
 The variable inside the varbind. More...
 
quint16 type
 The type of the varbind. More...
 

Detailed Description

Represents a VarBind according to RFC 2741, section 5.4.

Definition at line 37 of file Varbind.hpp.

Member Enumeration Documentation

These values can be used to create a VarBind.

Enumerator
Null 
noSuchObject 
noSuchInstance 
endOfMibView 

Definition at line 84 of file Varbind.hpp.

Constructor & Destructor Documentation

Varbind::Varbind ( const Oid o,
QSharedPointer< AbstractVariable v 
)

Create a VarBind with an oid and a var.

The variable must be one of the following types:

  • IntegerValue
  • OctetStringValue
  • OidVariable
  • IpAddressValue
  • Counter32Value
  • Gauge32Value
  • TimeTicksValue
  • OpaqueValue
  • Counter64Value If the type of the variable cannot be determined, inval_param is thrown.

Definition at line 57 of file Varbind.cpp.

References name, type, and var.

Varbind::Varbind ( const Oid o,
type_t  t 
)

Create VarBind without var, but with a type.

Only the constants defined by varbind::type_t are allowed. A wrong type will cause an inval_param exception.

Definition at line 80 of file Varbind.cpp.

References endOfMibView, name, noSuchInstance, noSuchObject, Null, and type.

Varbind::Varbind ( binary::const_iterator &  pos,
const binary::const_iterator &  end,
bool  big_endian = true 
)

Construct the object from input stream.

This constructor parses the serialized form of the object. It takes an iterator, starts parsing at the position of the iterator and advances the iterator to the position right behind the object.

The constructor expects valid data from the stream; if parsing fails, parse_error is thrown. In this case, the iterator position is undefined.

Parameters
posIterator pointing to the current stream position. The iterator is advanced while reading the header.
endIterator pointing one element past the end of the current stream. This is needed to mark the end of the buffer.
big_endianWhether the input stream is in big endian format

Definition at line 100 of file Varbind.cpp.

References name, agentxcpp::read16(), type, agentxcpp::OidVariable::value(), and var.

Member Function Documentation

Oid agentxcpp::Varbind::get_name ( ) const
inline

Get the name (the OID) stored within the varbind.

Definition at line 131 of file Varbind.hpp.

References name.

QSharedPointer<AbstractVariable> agentxcpp::Varbind::get_var ( ) const
inline

Get the variable stored within the varbind.

Note
This returns a smart pointer to the variable, i.e. the variable can be modified in-place.

Definition at line 142 of file Varbind.hpp.

References var.

binary Varbind::serialize ( ) const

Serialize the varbind.

This creates the binary representation of the varbind.

Definition at line 35 of file Varbind.cpp.

References name, agentxcpp::OidVariable::serialize(), type, and var.

Member Data Documentation

Oid agentxcpp::Varbind::name
private

The name (OID) of the VarBind.

Definition at line 43 of file Varbind.hpp.

Referenced by get_name(), serialize(), and Varbind().

quint16 agentxcpp::Varbind::type
private

The type of the varbind.

This field represents the type as described in RFC 2741, section 5.4. The serialize() function will copy it directly into the varbind.

Definition at line 60 of file Varbind.hpp.

Referenced by serialize(), and Varbind().

QSharedPointer<AbstractVariable> agentxcpp::Varbind::var
private

The variable inside the varbind.

This pointer may be 0 if the varbind has a type without a variable (e.g. "NoSuchObject").

Definition at line 51 of file Varbind.hpp.

Referenced by get_var(), serialize(), and Varbind().


The documentation for this class was generated from the following files: