Public Member Functions | Private Attributes | List of all members
eip::EncapPacket Class Reference

#include <encap_packet.h>

Inheritance diagram for eip::EncapPacket:
Inheritance graph
[legend]

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)
 
EncapHeadergetHeader ()
 
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_
 

Detailed Description

Representation of an EtherNet/IP Encapsulation Packet

Definition at line 50 of file encap_packet.h.

Constructor & Destructor Documentation

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

Parameters
commandCommand ID for the header
session_handleSession handle to use in the header
bufData for the payload

Definition at line 66 of file encap_packet.h.

Member Function Documentation

Reader & eip::EncapPacket::deserialize ( Reader &  reader,
size_t  length 
)

Deserialize packet from the given reader with the max length given

Parameters
readerReader to use for deserialization
lengthLength expected for the packet
Returns
the reader again
Exceptions
std::length_errorif 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

Parameters
readerReader to use for deserialization
Returns
the reader again
Exceptions
std::length_errorif 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

Returns
Header data

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

Returns
total length of the header and the payload combined

Definition at line 112 of file encap_packet.h.

shared_ptr<Serializable> eip::EncapPacket::getPayload ( ) const
inline

Get the data payload from this packet

Returns
the data payload of the packet

Definition at line 87 of file encap_packet.h.

void eip::EncapPacket::getPayloadAs ( Serializable &  result)

Get the payload as a particular serializable instance

Parameters
resultSerializable 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

Parameters
writerThe Writer into which to serialize
Returns
the writer again

Definition at line 49 of file encap_packet.cpp.

void eip::EncapPacket::setPayload ( shared_ptr< Serializable >  payload)
inline

Set the payload for this packet

Parameters
payloadPayload 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.

Member Data Documentation

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.


The documentation for this class was generated from the following files:


odva_ethernetip
Author(s): Kareem Shehata
autogenerated on Mon Jun 10 2019 14:00:16