forward_open_request.h
Go to the documentation of this file.
1 
26 #ifndef ODVA_ETHERNETIP_FORWARD_OPEN_REQUEST_H
27 #define ODVA_ETHERNETIP_FORWARD_OPEN_REQUEST_H
28 
29 #include <string>
30 #include <boost/shared_ptr.hpp>
31 
36 #include "odva_ethernetip/path.h"
37 
38 using boost::shared_ptr;
39 
40 namespace eip {
41 
42 using serialization::Serializable;
43 using serialization::Reader;
44 using serialization::Writer;
45 
46 typedef enum
47 {
53 
54 typedef enum
55 {
60 } CONN_TYPE_T;
61 
67 {
68 public:
69 
83 
92  static EIP_DWORD calcConnectionParams(EIP_UINT size, bool variable, EIP_BYTE priority,
93  EIP_BYTE type, bool shared)
94  {
95  return (size & 0x7FFF) | (variable ? 0x2000000 : 0) | (priority & 0x03) << 26
96  | (type & 0x03) << 29 | (shared ? 0x80000000 : 0);
97  }
98 
102  EIP_DWORD setOriginToTargetParams(EIP_UINT size, bool variable, EIP_BYTE priority,
103  EIP_BYTE type, bool shared)
104  {
105  o_to_t_conn_params = calcConnectionParams(size, variable, priority, type, shared);
106  return 0;
107  }
108 
112  EIP_DWORD setTargetToOriginParams(EIP_UINT size, bool variable, EIP_BYTE priority,
113  EIP_BYTE type, bool shared)
114  {
115  t_to_o_conn_params = calcConnectionParams(size, variable, priority, type, shared);
116  return 0;
117  }
118 
124  {
125  return path_;
126  }
127 
132  virtual size_t getLength() const
133  {
134  return sizeof(timeout_tick_size)
135  + sizeof(timeout_ticks)
136  + sizeof(o_to_t_connection_id)
137  + sizeof(t_to_o_connection_id)
138  + sizeof(connection_sn)
139  + sizeof(originator_vendor_id)
140  + sizeof(originator_sn)
141  + sizeof(timeout_multiplyer)
142  + sizeof(o_to_t_rpi)
143  + sizeof(o_to_t_conn_params)
144  + sizeof(t_to_o_rpi)
145  + sizeof(t_to_o_conn_params)
146  + sizeof(conn_type)
147  + 3 // reserved bytes
148  + path_.getLength();
149  }
150 
157  virtual Writer& serialize(Writer& writer) const
158  {
159  EIP_BYTE reserved = 0;
160  writer.write(timeout_tick_size);
161  writer.write(timeout_ticks);
162  writer.write(o_to_t_connection_id);
163  writer.write(t_to_o_connection_id);
164  writer.write(connection_sn);
165  writer.write(originator_vendor_id);
166  writer.write(originator_sn);
167  writer.write(timeout_multiplyer);
168  writer.write(reserved);
169  writer.write(reserved);
170  writer.write(reserved);
171  writer.write(o_to_t_rpi);
172  writer.write(o_to_t_conn_params);
173  writer.write(t_to_o_rpi);
174  writer.write(t_to_o_conn_params);
175  writer.write(conn_type);
176  path_.serialize(writer);
177  return writer;
178  }
179 
183  virtual Reader& deserialize(Reader& reader, size_t length)
184  {
185  throw std::logic_error("Not implemented");
186  }
187 
191  virtual Reader& deserialize(Reader& reader)
192  {
193  throw std::logic_error("Not implemented");
194  }
195 
196 private:
198 };
199 
200 } // namespace eip
201 
202 #endif // ODVA_ETHERNETIP_FORWARD_OPEN_REQUEST_H
path.h
eip::serialization::Writer
Definition: writer.h:41
eip_types.h
eip::ForwardOpenRequest::deserialize
virtual Reader & deserialize(Reader &reader)
Definition: forward_open_request.h:191
eip::CONN_TYPE_RESERVED
@ CONN_TYPE_RESERVED
Definition: forward_open_request.h:59
eip::ForwardOpenRequest::serialize
virtual Writer & serialize(Writer &writer) const
Definition: forward_open_request.h:157
eip::serialization::Reader
Definition: reader.h:42
eip
Definition: connection.h:41
eip::CONN_TYPE_T
CONN_TYPE_T
Definition: forward_open_request.h:54
EIP_BYTE
uint8_t EIP_BYTE
Definition: eip_types.h:35
eip::ForwardOpenRequest::originator_sn
EIP_UDINT originator_sn
Definition: forward_open_request.h:76
EIP_DWORD
uint32_t EIP_DWORD
Definition: eip_types.h:41
eip::ForwardOpenRequest::originator_vendor_id
EIP_UINT originator_vendor_id
Definition: forward_open_request.h:75
eip::serialization::Writer::write
void write(const T &v)
Definition: writer.h:50
EIP_UINT
uint16_t EIP_UINT
Definition: eip_types.h:39
eip::ForwardOpenRequest::timeout_tick_size
EIP_BYTE timeout_tick_size
Definition: forward_open_request.h:70
eip::ForwardOpenRequest::getPath
Path & getPath()
Definition: forward_open_request.h:123
eip::ForwardOpenRequest::o_to_t_conn_params
EIP_DWORD o_to_t_conn_params
Definition: forward_open_request.h:79
eip::ForwardOpenRequest::setTargetToOriginParams
EIP_DWORD setTargetToOriginParams(EIP_UINT size, bool variable, EIP_BYTE priority, EIP_BYTE type, bool shared)
Definition: forward_open_request.h:112
eip::CONN_TYPE_MULTICAST
@ CONN_TYPE_MULTICAST
Definition: forward_open_request.h:57
EIP_USINT
uint8_t EIP_USINT
Definition: eip_types.h:36
eip::ForwardOpenRequest::calcConnectionParams
static EIP_DWORD calcConnectionParams(EIP_UINT size, bool variable, EIP_BYTE priority, EIP_BYTE type, bool shared)
Definition: forward_open_request.h:92
eip::ForwardOpenRequest::path_
Path path_
Definition: forward_open_request.h:197
eip::CONN_PRIORITY_LOW
@ CONN_PRIORITY_LOW
Definition: forward_open_request.h:48
eip::serialization::Serializable
Definition: serializable.h:38
eip::CONN_TYPE_P2P
@ CONN_TYPE_P2P
Definition: forward_open_request.h:58
eip::ForwardOpenRequest::timeout_ticks
EIP_USINT timeout_ticks
Definition: forward_open_request.h:71
eip::CONN_PRIORITY_URGENT
@ CONN_PRIORITY_URGENT
Definition: forward_open_request.h:51
reader.h
eip::ForwardOpenRequest
Definition: forward_open_request.h:66
eip::CONN_TYPE_NULL
@ CONN_TYPE_NULL
Definition: forward_open_request.h:56
eip::CONN_PRIORITY_T
CONN_PRIORITY_T
Definition: forward_open_request.h:46
eip::ForwardOpenRequest::connection_sn
EIP_UINT connection_sn
Definition: forward_open_request.h:74
eip::ForwardOpenRequest::o_to_t_rpi
EIP_UDINT o_to_t_rpi
Definition: forward_open_request.h:78
eip::ForwardOpenRequest::timeout_multiplyer
EIP_USINT timeout_multiplyer
Definition: forward_open_request.h:77
eip::ForwardOpenRequest::t_to_o_connection_id
EIP_UDINT t_to_o_connection_id
Definition: forward_open_request.h:73
eip::Path::getLength
virtual size_t getLength() const
Definition: path.cpp:79
eip::ForwardOpenRequest::o_to_t_connection_id
EIP_UDINT o_to_t_connection_id
Definition: forward_open_request.h:72
eip::Path::serialize
virtual Writer & serialize(Writer &writer) const
Definition: path.h:137
eip::CONN_PRIORITY_SCHEDULED
@ CONN_PRIORITY_SCHEDULED
Definition: forward_open_request.h:50
eip::ForwardOpenRequest::deserialize
virtual Reader & deserialize(Reader &reader, size_t length)
Definition: forward_open_request.h:183
eip::ForwardOpenRequest::getLength
virtual size_t getLength() const
Definition: forward_open_request.h:132
eip::CONN_PRIORITY_HIGH
@ CONN_PRIORITY_HIGH
Definition: forward_open_request.h:49
EIP_UDINT
uint32_t EIP_UDINT
Definition: eip_types.h:42
eip::ForwardOpenRequest::t_to_o_conn_params
EIP_DWORD t_to_o_conn_params
Definition: forward_open_request.h:81
serializable.h
eip::ForwardOpenRequest::setOriginToTargetParams
EIP_DWORD setOriginToTargetParams(EIP_UINT size, bool variable, EIP_BYTE priority, EIP_BYTE type, bool shared)
Definition: forward_open_request.h:102
eip::ForwardOpenRequest::conn_type
EIP_BYTE conn_type
Definition: forward_open_request.h:82
eip::ForwardOpenRequest::t_to_o_rpi
EIP_UDINT t_to_o_rpi
Definition: forward_open_request.h:80
writer.h
eip::Path
Definition: path.h:50


odva_ethernetip
Author(s): Kareem Shehata
autogenerated on Wed Mar 2 2022 00:38:56