Protocol++® (Protocolpp®)  v5.6.2
ProtocolPP::jpacket Class Reference

Public Member Functions

 jpacket (std::string stream, std::string name, std::string prev, std::shared_ptr< jarray< uint8_t >> &input, uint32_t status=0)
 
 jpacket (std::string stream, std::string name, std::string prev, std::shared_ptr< jarray< uint8_t >> &input, std::shared_ptr< jarray< uint8_t >> &expect, uint32_t outlen=0, uint32_t status=0)
 
 jpacket (std::string stream, std::string name, std::string prev, std::shared_ptr< jarray< uint8_t >> &input, std::shared_ptr< jarray< uint8_t >> &expect, uint64_t outaddr, uint32_t outlen=0, uint32_t status=0)
 
 jpacket (jpacket &rhs)
 
 jpacket (const jpacket &rhs)
 
virtual ~jpacket ()=default
 Standard deconstructor.
 
template<typename T >
void set_field (field_t field, T fieldval)
 
void set_data (field_t field, std::shared_ptr< jarray< uint8_t >> &data)
 
template<typename T >
get_field (field_t field)
 
void get_data (field_t field, std::shared_ptr< jarray< uint8_t >> &data)
 

Constructor & Destructor Documentation

◆ jpacket() [1/5]

ProtocolPP::jpacket::jpacket ( std::string  stream,
std::string  name,
std::string  prev,
std::shared_ptr< jarray< uint8_t >> &  input,
uint32_t  status = 0 
)

Constructor for jpacket

Parameters
stream- name of the stream this packet belongs to
name- unique name of the packet
prev- name of the previous packet (may be 'start')
input- shared pointer to input data
status- expected status of the packet

◆ jpacket() [2/5]

ProtocolPP::jpacket::jpacket ( std::string  stream,
std::string  name,
std::string  prev,
std::shared_ptr< jarray< uint8_t >> &  input,
std::shared_ptr< jarray< uint8_t >> &  expect,
uint32_t  outlen = 0,
uint32_t  status = 0 
)

Constructor for jpacket

Parameters
stream- name of the stream this packet belongs to
name- unique name of the packet
prev- name of the previous packet (may be 'start')
input- shared pointer to input data
expect- shared pointer to expected data
outlen- length of the output data
status- expected status of the packet

◆ jpacket() [3/5]

ProtocolPP::jpacket::jpacket ( std::string  stream,
std::string  name,
std::string  prev,
std::shared_ptr< jarray< uint8_t >> &  input,
std::shared_ptr< jarray< uint8_t >> &  expect,
uint64_t  outaddr,
uint32_t  outlen = 0,
uint32_t  status = 0 
)

Constructor for jpacket

Parameters
stream- name of the stream this packet belongs to
name- unique name of the packet
prev- name of the previous packet (may be 'start')
input- shared pointer to input data
expect- shared pointer to expected data
outaddr- Address of the output memory location
outlen- length of the output data
status- expected status of the packet

◆ jpacket() [4/5]

ProtocolPP::jpacket::jpacket ( jpacket rhs)

Copy constructor for jpacket

Parameters
rhs- jpacket to copy

◆ jpacket() [5/5]

ProtocolPP::jpacket::jpacket ( const jpacket rhs)

Copy constructor for jpacket

Parameters
rhs- jpacket to copy

Member Function Documentation

◆ get_data()

void ProtocolPP::jpacket::get_data ( field_t  field,
std::shared_ptr< jarray< uint8_t >> &  data 
)

Get the data for this packet

std::shared_ptr<jarray<uint8_t>> mydata = std::shared_ptr<jarray<uint8_t>>(50,0);
get_data(field_t::INPUT, mydata);
get_data(field_t::OUTPUT, mydata);
get_data(field_t::EXPECT, mydata);
void get_data(field_t field, std::shared_ptr< jarray< uint8_t >> &data)
Parameters
field- Data field to set
data- Array to place the data in

◆ get_field()

template<typename T >
T ProtocolPP::jpacket::get_field ( field_t  field)

Returns the field in JPACKET

JPACKET Get Fields
field typefield nameExample
std::string STREAMstd::string myname = get_field<std::string>(field_t::STREAM)
std::string NAMEstd::string myname = get_field<std::string>(field_t::NAME)
std::string PREVIOUSstd::string myname = get_field<std::string>(field_t::PREVIOUS)
uint64_t OUTADDRuint64_t myoutaddr = get_field<uint64_t>(field_t::OUTADDR)
uint32_t OUTLENuint32_t myinlen = get_field<uint32_t>(field_t::OUTLEN)
uint32_t INLENuint32_t myinlen = get_field<uint32_t>(field_t::INLEN)
uint32_t OUTPUTLENuint32_t myinlen = get_field<uint32_t>(field_t::OUTPUTLEN)
uint32_t EXPLENuint32_t myinlen = get_field<uint32_t>(field_t::EXPLEN)
uint32_t STATUSuint32_t mystatus = get_field<uint32_t>(field_t::STATUS)
Parameters
field- field to retrieve from the IP header
Returns
value of the field in the security association

◆ set_data()

void ProtocolPP::jpacket::set_data ( field_t  field,
std::shared_ptr< jarray< uint8_t >> &  data 
)

Set the input data for this packet

std::shared_ptr<jarray<uint8_t>> mydata = std::make_shared<jarray<uint8_t>>(50, 0xAA);
set_data(field_t::INPUT, mydata);
set_data(field_t::OUTPUT, mydata);
set_data(field_t::EXPECT, mydata);
void set_data(field_t field, std::shared_ptr< jarray< uint8_t >> &data)
Parameters
field- Data field to set
data- Array to place the data in

◆ set_field()

template<typename T >
void ProtocolPP::jpacket::set_field ( field_t  field,
fieldval 
)

Allows the user to update the field in JPACKET

JPACKET Set Fields
field typefield nameExample
std::string STREAMset_field<std::string>(field_t::STREAM, std::string("ALIBABA"))
std::string NAMEset_field<std::string>(field_t::NAME, std::string("ALIBABA"))
std::string PREVIOUSset_field<std::string>(field_t::PREVIOUS, std::string("ALIBABA"))
uint64_t OUTADDRset_field<uint64_t>(field_t::OUTADDR, 0xAAFFDDEEFF112233)
uint32_t OUTLENset_field<uint32_t>(field_t::OUTLEN, 1500)
uint32_t STATUSset_field<uint32_t>(field_t::STATUS, 0x03100123)
Parameters
field- field to update
fieldval- value to update the field with

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