Changes to attempt to silence bcc64x
[ACE_TAO.git] / ACE / ASNMP / asnmp / transaction.h
blobecb2908c33e84628508961b816b4cf092bddab39
1 /* -*-C++-*- */
2 #ifndef TRANSACTION_
3 #define TRANSACTION_
4 //=============================================================================
5 /**
6 * @file transaction.h
8 * @brief
10 * @author Michael R. MacFaden port to ACE / use Reactor pattern
12 //=============================================================================
15 #include "ace/Event_Handler.h"
17 #if !defined (ACE_LACKS_PRAGMA_ONCE)
18 # pragma once
19 #endif /* ACE_LACKS_PRAGMA_ONCE */
21 #include "asnmp/target.h"
22 #include "asnmp/pdu.h"
23 #include "asnmp/transaction_result.h"
24 #include "asnmp/wpdu.h" // cmu adapter class
25 #include "ace/SOCK_Dgram.h"
27 /**
28 * @class transaction
30 * @brief Used to manage the details of a particular transaction between
31 * two SNMP agents. Uses SnmpTarget class to implement retry/timeout
33 class ASNMP_Export transaction : public ACE_Event_Handler
35 int retry_counter_;
36 transaction_result * result_;
38 public:
39 /// constructor
40 /// destructor
41 transaction(const Pdu& pdu, const UdpTarget& target, ACE_SOCK_Dgram& io);
42 transaction(ACE_SOCK_Dgram& io);
43 ~transaction();
45 /// begin polling for values
46 int run();
47 int run(transaction_result *r); // Async interface, with callback object
49 /// return pdu with result from agent after run() is completed rc = 0
50 /// optionally get community str
51 int result(Pdu& pdu, char *comm_str = 0, ACE_INET_Addr *from_addr = 0);
53 /// called by reactor when data is ready to be read in from OS memory
54 /// used for resend in asynchronous run()
55 virtual int handle_input (ACE_HANDLE fd);
56 virtual int handle_timeout (const ACE_Time_Value &, const void *);
58 /// transmit buffer command to network...
59 int send();
61 /// pre: handle_input called
62 /// retrieve the sender's from address from the last pkt
63 const ACE_INET_Addr& get_from_addr() const;
65 /// Return session_ handle.
66 ACE_HANDLE get_handle () const;
68 private:
69 /// disallow copy construction
70 transaction(const transaction&);
72 wpdu wp_; // wire pdu
73 UdpTarget params_; // params
74 ACE_INET_Addr addr_; // to address
75 ACE_SOCK_Dgram session_; // io object
76 iovec receive_iovec_; // receive buffer
77 ACE_INET_Addr receive_addr_; // from address
80 #endif // TRANSACTION_