summaryrefslogtreecommitdiff
path: root/ASNMP/asnmp/transaction.h
blob: d94cc6798ea7915bce869c1835847cd77af4bb03 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
/* -*-C++-*- */
#ifndef TRANSACTION_
#define TRANSACTION_
// ============================================================================
//
// = LIBRARY
//    asnmp
//
// = FILENAME
//    snmp.h
//
// = DESCRIPTION
//   SNMP class defintion. The Snmp class provides an object oriented
//   approach to SNMP. The SNMP class is an encapsulation of SNMP
//   sessions, gets, sets, etc. The class manages all SNMP
//   resources and provides complete retry and timeout capability.
//
// = AUTHOR
//    Michael R. MacFaden port to ACE / use Reactor pattern 
//
// ============================================================================

#include "ace/Event_Handler.h"
#include "asnmp/target.h"
#include "asnmp/pdu.h"
#include "asnmp/wpdu.h"		// cmu adapter class
#include "ace/SOCK_Dgram.h"

class ACE_Export transaction : public ACE_Event_Handler  
  // = TITLE
  //      Used to manage the details of a particular transaction betwen
  //       two SNMP agents. Uses SnmpTarget class to implement retry/timeout  

{
 public:
  transaction(const Pdu& pdu, const UdpTarget& target, ACE_SOCK_Dgram& io);
  // constructor

  ~transaction();
  // destructor

   int run();    
   // begin polling for values

   int result(Pdu& pdu); 
   // return pdu with result from agent after run() is completed rc = 0

   virtual int handle_input (ACE_HANDLE fd);
   // called by reactor when data read on session_

   int send();
   // transmit buffer command to network...

 private:
  transaction(const transaction&);
  // disallow copy construction

  wpdu wp_;
  UdpTarget params_;		
  ACE_INET_Addr addr_;
  ACE_SOCK_Dgram session_;    
  // io object 

  iovec receive_iovec_;	// receive buffer
  // incomming msg details
  ACE_Addr receive_addr_;	
  // address msg received from
};

#endif // TRANSACTION_