AgentXcpp  Version:0.3
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-2016 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 "TimeTicksVariable.hpp"
23 #include "OidVariable.hpp"
24 
25 namespace agentxcpp
26 {
27  /**
28  * \brief Calculate the uptime of the current process.
29  *
30  * This function calculates the uptime of the current process, in
31  * hundreths of a second. The result may be given as sysUpTime.0.
32  * parameter to \ref agentxcpp::MasterProxy::send_notification(
33  * const OidVariable&, TimeTicksVariable*,
34  * const vector<varbind>&).
35  *
36  * \internal
37  * The time is measured using a global variable which is
38  * initialized to the current time just be before main() starts.
39  * \endinternal
40  *
41  * \return The current uptime, in hundreths of a second.
42  */
43  TimeTicksVariable processUpTime();
44 
45  /**
46  * \brief The allowed values for specific-trap (SNMPv1 trap).
47  *
48  * According to RFC 1157, these values can be used for the
49  * generic-trap field in SNMPv1 Traps.
50  */
52  {
56  linkUp=3,
60  };
61 
62  /**
63  * \brief Create snmpTrapOID.0 value from SNMPv1 trap data.
64  *
65  * Each notification must have an snmpTrapOID.0 object. In SNMPv1
66  * no notifications were available; traps were used instead. This
67  * function takes parameters which would be present in an SNMPv1
68  * trap and converts them to the corresponding an snmpTrapOID.0
69  * value, which can be included in a notification. The master agent
70  * extracts the SNMPv1 trap information while generating a trap (only
71  * if sending an SNMPv1 trap, of course).
72  *
73  * The conversion is done according to RFC 1908,
74  * 3.1.2 "SNMPv1 -> SNMPv2".
75  *
76  * \param generic_trap The type of trap. If it is
77  * <tt>enterpriseSpecific</tt>, then the
78  * parameter <tt>specific_trap</tt> must also be given.
79  *
80  * \param specific_trap Only used if generic_trap is
81  * <tt>enterpriseSpecific</tt>. It can be any
82  * value specific to the subagent.
83  *
84  * \return The value of the snmpTrapOID.0 object.
85  *
86  * \exception inval_param If the generic_trap parameter has an
87  * invalid value.
88  */
89  Oid generate_v1_snmpTrapOID(generic_trap_t generic_trap,
90  quint32 specific_trap=0);
91 
92 
93 } // namespace agentxcpp
94 
95 #endif // _UPTIME_HPP_
generic_trap_t
The allowed values for specific-trap (SNMPv1 trap).
Definition: helpers.hpp:51
Oid generate_v1_snmpTrapOID(generic_trap_t generic_trap, quint32 specific_trap=0)
Create snmpTrapOID.0 value from SNMPv1 trap data.
Definition: helpers.cpp:51
TimeTicksVariable processUpTime()
Calculate the uptime of the current process.
Definition: helpers.cpp:39