AgentXcpp
Revision:0.2
Internals Documentation
All
Classes
Namespaces
Files
Functions
Variables
Enumerations
Enumerator
Friends
Pages
helpers.hpp
Go to the documentation of this file.
1
/*
2
* Copyright 2011-2012 Tanjeff-Nicolai Moos <tanjeff@cccmz.de>
3
*
4
* This file is part of the agentXcpp library.
5
*
6
* AgentXcpp is free software: you can redistribute it and/or modify
7
* it under the terms of the AgentXcpp library license, version 1, which
8
* consists of the GNU General Public License and some additional
9
* permissions.
10
*
11
* AgentXcpp is distributed in the hope that it will be useful,
12
* but WITHOUT ANY WARRANTY; without even the implied warranty of
13
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14
* GNU General Public License for more details.
15
*
16
* See the AgentXcpp library license in the LICENSE file of this package
17
* for more details.
18
*/
19
#ifndef _UPTIME_HPP_
20
#define _UPTIME_HPP_
21
22
#include <boost/optional/optional.hpp>
23
24
#include "
TimeTicksValue.hpp
"
25
#include "
OidValue.hpp
"
26
27
namespace
agentxcpp
28
{
29
/**
30
* \brief Calculate the uptime of the current process.
31
*
32
* This function calculates the uptime of the current process, in
33
* hundreths of a second. The result may be given as sysUpTime.0.
34
* parameter to \ref agentxcpp::MasterProxy::send_notification(
35
* const boost::optional<TimeTicksValue>&,
36
* const OidValue&, const vector<varbind>&).
37
*
38
* \internal
39
* The time is measured using a global variable which is
40
* initialized to the current time just be before main() starts.
41
* \endinternal
42
*
43
* \return The current uptime, in hundreths of a second.
44
*/
45
TimeTicksValue
processUpTime
();
46
47
/**
48
* \brief The allowed values for specific-trap (SNMPv1 trap).
49
*
50
* According to RFC 1157, these values can be used for the
51
* generic-trap field in SNMPv1 Traps.
52
*/
53
enum
generic_trap_t
54
{
55
coldStart
=0,
56
warmStart
=1,
57
linkDown
=2,
58
linkUp
=3,
59
authenticationFailure
=4,
60
egpNeighborLoss
=5,
61
enterpriseSpecific
=6
62
};
63
64
/**
65
* \brief Create snmpTrapOID.0 value from SNMPv1 trap data.
66
*
67
* Each notification must have an snmpTrapOID.0 object. In SNMPv1
68
* no notifications were available; traps were used instead. This
69
* function takes parameters which would be present in an SNMPv1
70
* trap and converts them to the corresponding an snmpTrapOID.0
71
* value, which can be included in a notification. The master agent
72
* extracts the SNMPv1 trap information while generating a trap (only
73
* if sending an SNMPv1 trap, of course).
74
*
75
* The conversion is done according to RFC 1908,
76
* 3.1.2 "SNMPv1 -> SNMPv2".
77
*
78
* \param generic_trap The type of trap. If it is
79
* <tt>enterpriseSpecific</tt>, then the
80
* parameter <tt>specific_trap</tt> must also be given.
81
*
82
* \param specific_trap Only used if generic_trap is
83
* <tt>enterpriseSpecific</tt>. It can be any
84
* value specific to the subagent.
85
*
86
* \return The value of the snmpTrapOID.0 object.
87
*
88
* \exception inval_param If the generic_trap parameter has an
89
* invalid value or if generic_trap is
90
* <tt>enterpriseSpecific</tt> and
91
* specific_trap was not given.
92
*/
93
OidValue
generate_v1_snmpTrapOID
(
generic_trap_t
generic_trap,
94
boost::optional<uint32_t> specific_trap = boost::optional<uint32_t>());
95
96
97
}
// namespace agentxcpp
98
99
#endif // _UPTIME_HPP_
src
helpers.hpp
Generated by
1.8.1.2