Revised OpenFlow Library  v0.6.0dev
 All Classes Files Functions Variables Friends Groups Pages
cofmsg_echo.h
1 /*
2  * cofmsg_echo.h
3  *
4  * Created on: 18.03.2013
5  * Author: andi
6  */
7 
8 #ifndef COFMSG_ECHO_H_
9 #define COFMSG_ECHO_H_ 1
10 
11 #include "rofl/common/openflow/messages/cofmsg.h"
12 
13 namespace rofl {
14 namespace openflow {
15 
20  public cofmsg
21 {
22 private:
23 
24  cmemory body;
25 
26 public:
27 
28 
33  uint8_t of_version = 0,
34  uint32_t xid = 0,
35  uint8_t* data = 0,
36  size_t datalen = 0);
37 
38 
43  cofmsg_echo_request const& echo);
44 
45 
50  operator= (
51  cofmsg_echo_request const& echo);
52 
53 
57  virtual
59 
60 
64  cofmsg_echo_request(cmemory *memarea);
65 
66 
70  virtual void
71  reset();
72 
73 
77  virtual size_t
78  length() const;
79 
80 
84  virtual void
85  pack(uint8_t *buf = (uint8_t*)0, size_t buflen = 0);
86 
87 
91  virtual void
92  unpack(uint8_t *buf, size_t buflen);
93 
94 
97  virtual void
98  validate();
99 
100 public:
101 
105  cmemory&
106  get_body();
107 
108 public:
109 
110  friend std::ostream&
111  operator<< (std::ostream& os, cofmsg_echo_request const& msg) {
112  os << indent(0) << dynamic_cast<cofmsg const&>( msg );
113  os << indent(2) << "<cofmsg_echo_request >" << std::endl;
114  os << indent(2) << msg.body;
115  return os;
116  };
117 
118  std::string
119  str() const {
120  std::stringstream ss;
121  ss << "-Echo-Request- " << cofmsg::str() << " ";
122  return ss.str();
123  };
124 };
125 
126 
127 
132  public cofmsg
133 {
134 private:
135 
136  cmemory body;
137 
138 public:
139 
140 
145  uint8_t of_version = 0,
146  uint32_t xid = 0,
147  uint8_t* data = 0,
148  size_t datalen = 0);
149 
150 
155  cofmsg_echo_reply const& echo);
156 
157 
162  operator= (
163  cofmsg_echo_reply const& echo);
164 
165 
169  virtual
171 
172 
176  cofmsg_echo_reply(cmemory *memarea);
177 
178 
182  virtual void
183  reset();
184 
185 
189  virtual size_t
190  length() const;
191 
192 
196  virtual void
197  pack(uint8_t *buf = (uint8_t*)0, size_t buflen = 0);
198 
199 
203  virtual void
204  unpack(uint8_t *buf, size_t buflen);
205 
206 
209  virtual void
210  validate();
211 
212 public:
213 
217  cmemory&
218  get_body();
219 
220 public:
221 
222  friend std::ostream&
223  operator<< (std::ostream& os, cofmsg_echo_reply const& msg) {
224  os << indent(0) << dynamic_cast<cofmsg const&>( msg );
225  os << indent(2) << "<cofmsg_echo_reply >" << std::endl;
226  os << indent(2) << msg.body;
227  return os;
228  };
229 
230  std::string
231  str() const {
232  std::stringstream ss;
233  ss << "-Echo-Reply- " << cofmsg::str() << " ";
234  return ss.str();
235  };
236 };
237 
238 } // end of namespace openflow
239 } // end of namespace rofl
240 
241 #endif /* COFMSG_ECHO_H_ */
virtual void pack(uint8_t *buf=(uint8_t *) 0, size_t buflen=0)
Definition: cofmsg_echo.cc:95
cofmsg_echo_reply(uint8_t of_version=0, uint32_t xid=0, uint8_t *data=0, size_t datalen=0)
Definition: cofmsg_echo.cc:153
cofmsg_echo_request(uint8_t of_version=0, uint32_t xid=0, uint8_t *data=0, size_t datalen=0)
Definition: cofmsg_echo.cc:5
Definition: cofmsg_echo.h:19
virtual void reset()
Definition: cofmsg_echo.cc:78
virtual void pack(uint8_t *buf=(uint8_t *) 0, size_t buflen=0)
Definition: cofmsg_echo.cc:243
virtual void validate()
Definition: cofmsg_echo.cc:271
virtual void unpack(uint8_t *buf, size_t buflen)
Definition: cofmsg_echo.cc:261
Definition: cofmsg_echo.h:131
C++ abstraction for malloc'ed memory areas.
Definition: cmemory.h:44
virtual ~cofmsg_echo_reply()
Definition: cofmsg_echo.cc:218
virtual ~cofmsg_echo_request()
Definition: cofmsg_echo.cc:70
virtual size_t length() const
Definition: cofmsg_echo.cc:235
Definition: logging.h:76
virtual void unpack(uint8_t *buf, size_t buflen)
Definition: cofmsg_echo.cc:113
virtual void reset()
Definition: cofmsg_echo.cc:226
virtual void validate()
Definition: cofmsg_echo.cc:123
virtual size_t length() const
Definition: cofmsg_echo.cc:87
Definition: cofmsg.h:62