Protocol++® (Protocolpp®)  v5.6.2
ProtocolPP::jicmpsa Class Reference
Inheritance diagram for ProtocolPP::jicmpsa:
Collaboration diagram for ProtocolPP::jicmpsa:

Public Member Functions

 jicmpsa ()
 
 jicmpsa (direction_t dir, iana_t ver, icmpmsg_t msg, icmpcode_t code, uint8_t dsecn, uint8_t ttl, uint8_t flags, uint16_t fragoff, uint16_t id, uint32_t label, jarray< uint8_t > src, jarray< uint8_t > dst)
 
 jicmpsa (jicmpsa &security)
 
 jicmpsa (std::shared_ptr< jicmpsa > &security)
 
virtual ~jicmpsa ()=default
 Standard deconstructor.
 
template<typename T >
void set_field (field_t field, T fieldval)
 
template<typename T >
get_field (field_t field)
 
void to_xml (tinyxml2::XMLPrinter &myxml, direction_t direction)
 
void to_json (std::ofstream &myjson, direction_t direction, std::string &indent)
 
 jicmpsa (const jicmpsa &rhs)=delete
 
- Public Member Functions inherited from ProtocolPP::jsecass
 jsecass ()
 
virtual ~jsecass ()=default
 Standard deconstructor.
 
 jsecass (jsecass &jsecass)=delete
 
 jsecass (const jsecass &jsecass)=delete
 

Constructor & Destructor Documentation

◆ jicmpsa() [1/4]

ProtocolPP::jicmpsa::jicmpsa ( )

Standard Constructor with defaults

ICMP SA Defaults
fieldDefault Value
dirdirection_t::DECAP
veriana_t::ICMP
msgicmpmsg_t::TIMEXCEED
codeicmpcode_t::TTLEXPIRE
dsecn0
ttl0xFF
flags0
fragoff0
id0xFFFF
label0xFFFFFFFF
src0xBBBBBBBB
dst0xEEEEEEEE

Generate the security association for ENCAP and new source and destination addresses do the following:

jicmpsa snd;
snd.set_field<direction_t>(field_t::DIRECTION, direction_t::ENCAP);
snd.set_field<jarray<uint8_t>>(field_t::SOURCE, jarray<uint8_t>("00112233"));
snd.set_field<jarray<uint8_t>>(field_t::DESTINATION, jarray<uint8_t>("33221100"));
direction_t
Definition: jenum.h:1688

◆ jicmpsa() [2/4]

ProtocolPP::jicmpsa::jicmpsa ( direction_t  dir,
iana_t  ver,
icmpmsg_t  msg,
icmpcode_t  code,
uint8_t  dsecn,
uint8_t  ttl,
uint8_t  flags,
uint16_t  fragoff,
uint16_t  id,
uint32_t  label,
jarray< uint8_t >  src,
jarray< uint8_t >  dst 
)

ICMP security association

Parameters
dir- Direction of data flow (usually opposite the IP/IPsec flow)
ver- Version of ICMP (ICMP or ICMPv6)
msg- Message to be sent to SENDER
code- Code to be sent to SENDER
dsecn- DS/ECN from sender
ttl- Time-to-Live/HOP Limit
flags- IPv4 flags from sender
fragoff- IPv4 fragmentation offset from sender
id- IPv4 identification field from sender
label- IPv6 label from the sender
src- Address of RECEIVER
dst- Address of SENDER

◆ jicmpsa() [3/4]

ProtocolPP::jicmpsa::jicmpsa ( jicmpsa security)

constructor for ICMP and ICMPv6

Parameters
security- Parameters necessary to setup ICMP flow such as DIRECTION, VERSION, MSG, CODE, SRC, DST

◆ jicmpsa() [4/4]

ProtocolPP::jicmpsa::jicmpsa ( std::shared_ptr< jicmpsa > &  security)
explicit

constructor for ICMP and ICMPv6

Parameters
security- Parameters necessary to setup ICMP flow such as DIRECTION, VERSION, MSG, CODE, SRC, DST

Member Function Documentation

◆ get_field()

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

Returns the field in ICMPSA

ICMP SA Get Fields
field typefield nameExample
direction_tDIRECTIONdirection_t mydir = get_field<direction_t>(field_t::DIRECTION)
iana_tVERSIONiana_t myver = get_field<iana_t>(field_t::VERSION)
icmpmsg_tMESSAGEicmpmsg_t mymsg = get_field<icmpmsg_t>(field_t::MESSAGE)
icmpcode_tCODEicmpcode_t mycode = get_field<icmpcode_t>(field_t::CODE)
uint8_tDSECNuint8_t mydsecn = get_field<uint8_t>(field_t::DSECN)
TTLHOPuint8_t myttl = get_field<uint8_t>(field_t::TTLHOP)
FLAGSuint8_t myflags = get_field<uint8_t>(field_t::FLAGS)
uint16_tFRAGOFFSETuint16_t myfragoff = get_field<uint16_t>(field_t::FRAGOFFSET)
IDuint16_t myid = get_field<uint16_t>(field_t::ID)
LABELuint32_t mylabel = get_field<uint32_t>(field_t::LABEL)
jarray<uint8_t>SOURCEjarray<uint8_t> mysrc = get_field<jarray<uint8_t>>(field_t::SOURCE)
DESTINATIONjarray<uint8_t> mydst = get_field<jarray<uint8_t>>(field_t::DESTINATION)

Some fields may only be available in the jicmp protocol due to their dynamic nature as fields in the ICMP header or packet and are not stored in the security association. For ICMP they include

  • CHECKSUM
  • POINTER
  • TYPE
  • SEQNUM
  • GATEWAY
  • ORIGTIMESTAMP
  • RXTIMESTAMP
  • TXTIMESTAMP
Parameters
field- field to retrieve from the IP header
Returns
value of the field in the security association

◆ set_field()

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

Allows the user to update the field of the IP header

ICMP SA Set Fields
field typefield nameExample
direction_tDIRECTIONset_field<direction_t>(field_t::DIRECTION, direction_t::ENCAP)
iana_tVERSIONset_field<iana_t>(field_t::VERSION, iana_t::ICMPV6)
icmpmsg_tMESSAGEset_field<icmpmsg_t>(field_t::MESSAGE, icmpmsg_t::TIMEXCEED)
icmpcode_tCODEset_field<icmpcode_t>(field_t::CODE, icmpcode_t::TTLEXPIRE)
uint8_tDSECNset_field<uint8_t>(field_t::DSECN, 0xFF)
TTLHOPset_field<uint8_t>(field_t::TTLHOP, 0xAA)
FLAGSset_field<uint8_t>(field_t::FLAGS, 0xCC)
uint16_tFRAGOFFSETset_field<uint16_t>(field_t::FRAGOFFSET, 0x001E)
IDset_field<uint16_t>(field_t::ID, 0x01CC)
LABELset_field<uint32_t>(field_t::LABEL, 0xA1CC)
jarray<uint8_t>SOURCEset_field<jarray<uint8_t>>(field_t::SOURCE, jarray<uint8_t>("0xAABBCCDD"))
DESTINATIONset_field<jarray<uint8_t>>(field_t::DESTINATION, jarray<uint8_t>("0xEE11AABB"))

Some fields may only be available in the jicmp protocol due to their dynamic nature as fields in the ICMP header or packet and are not stored in the security association. For ICMP they include

  • CHECKSUM
  • POINTER
  • TYPE
  • SEQNUM
  • GATEWAY
  • ORIGTIMESTAMP
  • RXTIMESTAMP
  • TXTIMESTAMP
Parameters
field- field to update the IP header with
fieldval- value to update the IP header with

◆ to_json()

void ProtocolPP::jicmpsa::to_json ( std::ofstream &  myjson,
direction_t  direction,
std::string &  indent 
)
virtual

Prints the protocol as an JSON object

Parameters
myjson- JSON object to print with
direction- randomization
indent- indentation for JSON output

Implements ProtocolPP::jsecass.

◆ to_xml()

void ProtocolPP::jicmpsa::to_xml ( tinyxml2::XMLPrinter myxml,
direction_t  direction 
)
virtual

Prints the protocol as an XML object

Parameters
myxml- XMLPrinter object to print with
direction- randomization

Implements ProtocolPP::jsecass.


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