AgentXcpp  Revision:0.2
Internals Documentation
 All Classes Namespaces Files Functions Variables Enumerations Enumerator Friends Pages
agentxcpp Namespace Reference

Classes

class  AbstractValue
 This class represents a value. More...
class  AbstractVariable
 Base class for SNMP variables. More...
class  AddAgentCapsPDU
 Represents an AddAgentCaps-PDU. More...
class  binary
 A type representing a contigous byte stream. More...
class  CleanupSetPDU
 Represents an CleanupSet-PDU. More...
class  ClosePDU
 This class represents a Close-PDU. More...
class  CommitSetPDU
 Represents an CommitSet-PDU. More...
class  Counter32Value
 Represents an Counter32 as described in RFC 2741. More...
class  Counter64Value
 Represents an Counter64 as descibed in RFC 2741. More...
class  parse_error
 Exception for parse errors. More...
class  inval_param
 Exception for invalid parameter. More...
class  version_error
 Exception for reception of PDU with invalid version number. More...
class  disconnected
 Exception to indicate a disconnected state. More...
class  timeout_error
 Exception to indicate a timeout. More...
class  network_error
 Exception to indicate a network error. More...
class  internal_error
 Exception to indicate an internal error. More...
class  master_is_unable
 Exception to indicate that the master agent was unable to process a request. More...
class  master_is_unwilling
 Exception to indicate that the master agent was not willing to process a request. More...
class  duplicate_registration
 Exception to indicate that a MIB region was registered twice with the same priority. More...
class  unknown_registration
 Exception to indicate that a MIB region registration was not found. More...
class  generic_error
 Exception to indicate that obtaining the value of an SNMP variable failed. More...
class  unsupported_context
 Exception to indicate that the master agent does not support the context. More...
class  Gauge32Value
 Represents a Gauge32 as descibed in RFC 2741. More...
class  GetBulkPDU
 Represents an GetBulk-PDU. More...
class  GetNextPDU
 Represents an GetNext-PDU. More...
class  GetPDU
 Represents an Get-PDU. More...
class  IndexAllocatePDU
 Represents a IndexAllocate-PDU. More...
class  IndexDeallocatePDU
 Represents a IndexDeallocate-PDU. More...
class  IntegerValue
 Represents an Integer as described in RFC 2741. More...
class  IpAddressValue
 Represents an IP address as described in RFC 2741, section 5.4. More...
class  MasterProxy
 This class represents the master agent in a subagent program. More...
class  NotifyPDU
 Represents an Notify-PDU. More...
class  OctetStringValue
 Represents an Octet String as described in RFC 2741, section 5.3. More...
class  OidValue
 Represents an SNMP object identifier (OID). More...
class  OpaqueValue
 Represents an Opaque object as described in RFC 2741, section 5.4. More...
class  OpenPDU
 Represents an Open-PDU. More...
class  PDU
 The base class of all PDU's. More...
class  PDUwithContext
class  PingPDU
 Represents a Ping-PDU. More...
class  RegisterPDU
 This class represents a Register-PDU. More...
class  RemoveAgentCapsPDU
 Represents an RemoveAgentCaps-PDU. More...
class  ResponsePDU
 Represents an Response-PDU. More...
class  TestSetPDU
 Represents an TestSet-PDU. More...
class  TimeTicksValue
 Represents an TimeTicks as described in RFC 2741. More...
class  UndoSetPDU
 Represents an UndoSet-PDU. More...
class  UnixDomainConnector
 Connect to a unix domain socket. More...
class  UnregisterPDU
 This class represents an Unregister-PDU. More...
class  varbind
 Represents a VarBind according to RFC 2741, section 5.4. More...
class  Variable
 Class template to implement primitive SNMP variables. More...

Enumerations

enum  generic_trap_t {
  coldStart = 0, warmStart = 1, linkDown = 2, linkUp = 3,
  authenticationFailure = 4, egpNeighborLoss = 5, enterpriseSpecific = 6
}
 The allowed values for specific-trap (SNMPv1 trap). More...

Functions

std::ostream & operator<< (std::ostream &out, const binary &data)
 Output operator for binary.
TimeTicksValue processUpTime ()
 Calculate the uptime of the current process.
OidValue generate_v1_snmpTrapOID (generic_trap_t generic_trap, boost::optional< uint32_t > specific_trap=boost::optional< uint32_t >())
 Create snmpTrapOID.0 value from SNMPv1 trap data.
std::ostream & operator<< (std::ostream &out, const agentxcpp::OidValue &o)
 The output operator for the OidValue class.
uint64_t read64 (binary::const_iterator &pos, bool big_endian)
void write64 (binary &serialized, uint64_t value)
 Write a 64-bit value into a string.
uint32_t read32 (binary::const_iterator &pos, bool big_endian)
void write32 (binary &serialized, uint32_t value)
 Write a 32-bit value into a string.
uint16_t read16 (binary::const_iterator &pos, bool big_endian)
void write16 (binary &serialized, uint16_t value)
 Write a 16-bit value into a string.

Enumeration Type Documentation

The allowed values for specific-trap (SNMPv1 trap).

According to RFC 1157, these values can be used for the generic-trap field in SNMPv1 Traps.

Enumerator:
coldStart 
warmStart 
linkDown 
linkUp 
authenticationFailure 
egpNeighborLoss 
enterpriseSpecific 

Definition at line 53 of file helpers.hpp.

Function Documentation

OidValue agentxcpp::generate_v1_snmpTrapOID ( generic_trap_t  generic_trap,
boost::optional< uint32_t >  specific_trap = boost::optional<uint32_t>() 
)

Create snmpTrapOID.0 value from SNMPv1 trap data.

Each notification must have an snmpTrapOID.0 object. In SNMPv1 no notifications were available; traps were used instead. This function takes parameters which would be present in an SNMPv1 trap and converts them to the corresponding an snmpTrapOID.0 value, which can be included in a notification. The master agent extracts the SNMPv1 trap information while generating a trap (only if sending an SNMPv1 trap, of course).

The conversion is done according to RFC 1908, 3.1.2 "SNMPv1 -> SNMPv2".

Parameters
generic_trapThe type of trap. If it is enterpriseSpecific, then the parameter specific_trap must also be given.
specific_trapOnly used if generic_trap is enterpriseSpecific. It can be any value specific to the subagent.
Returns
The value of the snmpTrapOID.0 object.
Exceptions
inval_paramIf the generic_trap parameter has an invalid value or if generic_trap is enterpriseSpecific and specific_trap was not given.

Definition at line 56 of file helpers.cpp.

References authenticationFailure, coldStart, egpNeighborLoss, enterpriseSpecific, linkDown, linkUp, and warmStart.

std::ostream& agentxcpp::operator<< ( std::ostream &  out,
const binary &  data 
)
inline

Output operator for binary.

Definition at line 42 of file binary.hpp.

std::ostream & agentxcpp::operator<< ( std::ostream &  out,
const agentxcpp::OidValue o 
)

The output operator for the OidValue class.

Object identifiers (OidValue objects) can be output as follows:

OidValue led_state(enterprises_oid, "1.3.3.1");
cout << "LED state OID: " << led_state << endl;

The last line will output "LED state OID: .1.3.6.1.4.1.3.3.1".

Parameters
outThe stream to which to write the output.
oThe OID to output.
Returns
The 'out' parameter.

Definition at line 87 of file OidValue.cpp.

TimeTicksValue agentxcpp::processUpTime ( )

Calculate the uptime of the current process.

This function calculates the uptime of the current process, in hundreths of a second. The result may be given as sysUpTime.0. parameter to agentxcpp::MasterProxy::send_notification( const boost::optional<TimeTicksValue>&, const OidValue&, const vector<varbind>&).

The time is measured using a global variable which is initialized to the current time just be before main() starts.

Returns
The current uptime, in hundreths of a second.

Definition at line 43 of file helpers.cpp.

uint16_t agentxcpp::read16 ( binary::const_iterator &  pos,
bool  big_endian 
)
inline
uint64_t agentxcpp::read64 ( binary::const_iterator &  pos,
bool  big_endian 
)
inline

Definition at line 33 of file util.hpp.

Referenced by agentxcpp::Counter64Value::Counter64Value().

void agentxcpp::write16 ( binary &  serialized,
uint16_t  value 
)
inline

Write a 16-bit value into a string.

Parameters
serializedThe string to which the value is appended.
valueThe value which is appended to the string.

Definition at line 145 of file util.hpp.

Referenced by agentxcpp::GetBulkPDU::serialize(), and agentxcpp::ResponsePDU::serialize().

void agentxcpp::write32 ( binary &  serialized,
uint32_t  value 
)
inline
void agentxcpp::write64 ( binary &  serialized,
uint64_t  value 
)
inline

Write a 64-bit value into a string.

Parameters
serializedThe string to which the value is appended.
valueThe value which is appended to the string.

Definition at line 69 of file util.hpp.

Referenced by agentxcpp::Counter64Value::serialize().