#include <encap_packet.h>
Public Member Functions | |
Reader & | deserialize (Reader &reader, size_t length) |
Reader & | deserialize (Reader &reader) |
EncapPacket (EIP_UINT command=0, EIP_UDINT session_handle=0) | |
EncapPacket (EIP_UINT command, EIP_UDINT session_handle, shared_ptr< Serializable > payload) | |
EncapHeader & | getHeader () |
size_t | getLength () const |
shared_ptr< Serializable > | getPayload () const |
void | getPayloadAs (Serializable &result) |
Writer & | serialize (Writer &writer) const |
void | setPayload (shared_ptr< Serializable > payload) |
void | updateLength () |
Private Attributes | |
EncapHeader | header_ |
shared_ptr< Serializable > | payload_ |
Representation of an EtherNet/IP Encapsulation Packet
Definition at line 50 of file encap_packet.h.
eip::EncapPacket::EncapPacket | ( | EIP_UINT | command = 0 , |
EIP_UDINT | session_handle = 0 |
||
) | [inline] |
Construct an encapsulation packet
Definition at line 57 of file encap_packet.h.
eip::EncapPacket::EncapPacket | ( | EIP_UINT | command, |
EIP_UDINT | session_handle, | ||
shared_ptr< Serializable > | payload | ||
) | [inline] |
Construct an encapsulation packet with a data payload
command | Command ID for the header |
session_handle | Session handle to use in the header |
buf | Data for the payload |
Definition at line 66 of file encap_packet.h.
Reader & eip::EncapPacket::deserialize | ( | Reader & | reader, |
size_t | length | ||
) |
Deserialize packet from the given reader with the max length given
reader | Reader to use for deserialization |
length | Length expected for the packet |
std::length_error | if the buffer is overrun while deserializing |
Definition at line 77 of file encap_packet.cpp.
Reader & eip::EncapPacket::deserialize | ( | Reader & | reader | ) |
Deserialize data from the given reader without length information
reader | Reader to use for deserialization |
std::length_error | if the buffer is overrun while deserializing |
Definition at line 61 of file encap_packet.cpp.
EncapHeader& eip::EncapPacket::getHeader | ( | ) | [inline] |
Get the header portion of this packet
Definition at line 78 of file encap_packet.h.
size_t eip::EncapPacket::getLength | ( | ) | const [inline] |
Get the length of the entire packet, not just the payload
Definition at line 112 of file encap_packet.h.
shared_ptr<Serializable> eip::EncapPacket::getPayload | ( | ) | const [inline] |
Get the data payload from this packet
Definition at line 87 of file encap_packet.h.
void eip::EncapPacket::getPayloadAs | ( | Serializable & | result | ) |
Get the payload as a particular serializable instance
result | Serializable class to get data into |
Definition at line 44 of file encap_packet.cpp.
Writer & eip::EncapPacket::serialize | ( | Writer & | writer | ) | const |
Serialize the packet to the given writer
writer | The Writer into which to serialize |
Definition at line 49 of file encap_packet.cpp.
void eip::EncapPacket::setPayload | ( | shared_ptr< Serializable > | payload | ) | [inline] |
Set the payload for this packet
payload | Payload to use |
Definition at line 96 of file encap_packet.h.
void eip::EncapPacket::updateLength | ( | ) | [inline] |
Update the length field of the header. Note that this must be called if the payload size is modified after setting the payload reference.
Definition at line 126 of file encap_packet.h.
EncapHeader eip::EncapPacket::header_ [private] |
Definition at line 156 of file encap_packet.h.
shared_ptr<Serializable> eip::EncapPacket::payload_ [private] |
Definition at line 157 of file encap_packet.h.