SNMPpp  v0.0.3-20-7eeb228
Classes, methods, and functions to use net-snmp from C++
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
Trap.hpp
Go to the documentation of this file.
1 // SNMPpp: https://sourceforge.net/p/snmppp/
2 // SNMPpp project uses the MIT license. See LICENSE for details.
3 // Copyright (C) 2013 Stephane Charette <stephanecharette@gmail.com>
4 
5 #pragma once
6 
7 #include <string>
8 #include <SNMPpp/OID.hpp>
9 #include <SNMPpp/PDU.hpp>
10 #include <SNMPpp/Varlist.hpp>
11 #include <SNMPpp/net-snmppp.hpp>
12 #include <sys/types.h>
13 #include <time.h>
14 
15 
16 namespace SNMPpp
17 {
57  void initializeNetSnmpAgent( const std::string &name = "snmppp" );
59 
61  void shutdownNetSnmpAgent( const std::string &name = "snmppp" );
62 
64  long centisecondsSince( const time_t t );
65 
71 #if defined WIN32 && ! defined pid_t
72  typedef int pid_t;
73 #endif
74  long centisecondsPidStarted( pid_t pid = 0 );
75 
77  long centisecondsUptime( void );
78 
85  long centisecondsNetSnmpUptime( void );
86 
93  void sendV2Trap( const SNMPpp::OID &o, const long uptime = SNMPpp::centisecondsNetSnmpUptime() );
94 
101  void sendV2Trap( SNMPpp::Varlist &varlist );
102 
106  void sendV2Trap( SNMPpp::PDU &pdu );
107 
116 };