Revised OpenFlow Library  v0.6.0dev
 All Classes Files Functions Variables Friends Groups Pages
ctransaction.h
1 /*
2  * ctransaction.h
3  *
4  * Created on: 31.12.2013
5  * Author: andreas
6  */
7 
8 #ifndef CTRANSACTION_H_
9 #define CTRANSACTION_H_ 1
10 
11 #include <inttypes.h>
12 
13 #include "rofl/common/cclock.h"
14 
15 namespace rofl {
16 
17 class ctransaction {
18 
19  uint32_t xid;
20  cclock since; // time this transaction was created
21  cclock expires; // time this transaction expires
22  uint8_t msg_type; // message type
23  uint16_t msg_sub_type; // message sub-type
24 
25 public:
26 
30  ctransaction();
31 
35  ctransaction(uint32_t xid, cclock const& delta, uint8_t msg_type = 0, uint16_t msg_sub_type = 0);
36 
40  virtual
41  ~ctransaction();
42 
46  ctransaction(ctransaction const& ta);
47 
52  operator= (ctransaction const& ta);
53 
54 public:
55 
59  uint32_t
60  get_xid() const { return xid; };
61 
65  cclock&
66  get_since() { return since; };
67 
71  cclock&
72  get_expires() { return expires; };
73 
77  uint8_t
78  get_msg_type() const { return msg_type; };
79 
83  uint16_t
84  get_msg_sub_type() const { return msg_sub_type; };
85 
86 public:
87 
88  friend std::ostream&
89  operator<< (std::ostream& os, ctransaction const& ta) {
90  os << indent(0) << "<transaction ";
91  os << "xid:" << std::hex << (int)ta.xid << std::dec
92  << " msg-type:" << (int)ta.msg_type
93  << " msg-subtype:" << (int)ta.msg_sub_type << " >" << std::endl;
94  cclock delta(ta.since); delta -= ta.expires;
95  os << indent(2) << "<expires: >" << std::endl;
96  { indent i(4); os << delta; }
97 #if 0
98  os << indent(2) << "<since: >" << std::endl;
99  { indent i(4); os << ta.since; }
100  os << indent(2) << "<expires: >" << std::endl;
101  { indent i(4); os << ta.expires; }
102 #endif
103  return os;
104  };
105 };
106 
107 }; /* namespace rofl */
108 
109 #endif /* CTRANSACTION_H_ */
Definition: cclock.h:25
Definition: ctransaction.h:17
Definition: logging.h:76