Main Page
Namespaces
Classes
Files
File List
File Members
include
odva_ethernetip
encap_header.h
Go to the documentation of this file.
1
26
#ifndef ODVA_ETHERNETIP_ENCAP_HEADER_H
27
#define ODVA_ETHERNETIP_ENCAP_HEADER_H
28
29
#include <iostream>
30
#include "
odva_ethernetip/eip_types.h
"
31
#include "
odva_ethernetip/serialization/reader.h
"
32
#include "
odva_ethernetip/serialization/writer.h
"
33
#include "
odva_ethernetip/serialization/serializable.h
"
34
35
namespace
eip
{
36
37
using
serialization::Serializable;
38
using
serialization::Reader;
39
using
serialization::Writer;
40
44
class
EncapHeader
:
public
Serializable
45
{
46
public
:
47
EIP_UINT
command
;
48
EIP_UINT
length
;
49
EIP_UDINT
session_handle
;
50
EIP_DWORD
status
;
51
EIP_DWORD
context
[2];
52
EIP_DWORD
options
;
53
57
EncapHeader
(
EIP_UINT
cmd = 0,
EIP_UDINT
handle = 0)
58
: command(cmd), length(0), session_handle(handle), status(0), options(0)
59
{
60
context[0] = 0;
61
context[1] = 0;
62
}
63
68
virtual
size_t
getLength
()
const
69
{
70
return
24;
71
}
72
79
virtual
Writer&
serialize
(Writer& writer)
const
;
80
89
virtual
Reader&
deserialize
(Reader& reader,
size_t
length)
90
{
91
if
(
getLength
() != length)
92
{
93
throw
std::length_error(
"Invalid length given for encapsulation packet header"
);
94
}
95
deserialize
(reader);
96
return
reader;
97
}
98
105
virtual
Reader&
deserialize
(Reader& reader);
106
};
107
108
}
// namespace eip
109
110
#endif // ODVA_ETHERNETIP_ENCAP_HEADER_H
EIP_DWORD
uint32_t EIP_DWORD
Definition:
eip_types.h:41
reader.h
eip::EncapHeader::serialize
virtual Writer & serialize(Writer &writer) const
Definition:
encap_header.cpp:35
eip::EncapHeader::getLength
virtual size_t getLength() const
Definition:
encap_header.h:68
eip::EncapHeader::command
EIP_UINT command
Definition:
encap_header.h:47
eip::EncapHeader::context
EIP_DWORD context[2]
Definition:
encap_header.h:51
eip_types.h
eip::EncapHeader::session_handle
EIP_UDINT session_handle
Definition:
encap_header.h:49
eip::EncapHeader
Definition:
encap_header.h:44
eip
Definition:
connection.h:41
EIP_UINT
uint16_t EIP_UINT
Definition:
eip_types.h:39
writer.h
eip::EncapHeader::length
EIP_UINT length
Definition:
encap_header.h:48
eip::EncapHeader::options
EIP_DWORD options
Definition:
encap_header.h:52
EIP_UDINT
uint32_t EIP_UDINT
Definition:
eip_types.h:42
serializable.h
eip::EncapHeader::status
EIP_DWORD status
Definition:
encap_header.h:50
eip::EncapHeader::deserialize
virtual Reader & deserialize(Reader &reader, size_t length)
Definition:
encap_header.h:89
eip::EncapHeader::EncapHeader
EncapHeader(EIP_UINT cmd=0, EIP_UDINT handle=0)
Definition:
encap_header.h:57
odva_ethernetip
Author(s): Kareem Shehata
autogenerated on Mon Jun 10 2019 14:00:16