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

Public Member Functions

 jtcpsa ()
 
 jtcpsa (direction_t dir, uint32_t mtu, uint16_t src, uint16_t dst, uint32_t seqnum, uint32_t acknum, uint8_t doffset, uint8_t flags, uint16_t window, uint16_t urgpointer, uint32_t timeout)
 
 jtcpsa (jtcpsa &rhs)
 Standard copy constructor.
 
virtual ~jtcpsa ()=default
 Standard deconstructor.
 
 jtcpsa (std::shared_ptr< jtcpsa > &rhs)
 Standard copy constructor from shared pointer.
 
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)
 
 jtcpsa (const jtcpsa &jtcpsa)=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

◆ jtcpsa() [1/2]

ProtocolPP::jtcpsa::jtcpsa ( )

Standard constructor using default values

TCP Defaults
fieldDefault Value
dirdirection_t::ENCAP
mtu1500
src0xDEAD
dst0xBEEF
seqnum0x00000001
acknum0x00000001
doffset0
flags0
window1500
urgpointer0
timeout0

◆ jtcpsa() [2/2]

ProtocolPP::jtcpsa::jtcpsa ( direction_t  dir,
uint32_t  mtu,
uint16_t  src,
uint16_t  dst,
uint32_t  seqnum,
uint32_t  acknum,
uint8_t  doffset,
uint8_t  flags,
uint16_t  window,
uint16_t  urgpointer,
uint32_t  timeout 
)

TCP security association needed to setup a flow

Parameters
dir- direction. Because TCP is bi-directional in all cases, this parameter is mainly used to decide if a file is being read from or written to (ENCAP or DECAP) and it keeps the interface consistent with other protocols
mtu- Maximum Transmission Unit
src- Source Port
dst- Destination Port
seqnum- Sequence Number
acknum- Acknowledgement Number
doffset- offset to where data begins
flags- header flags in following order (RSVD, RSVD, URG, ACK, PSH, RST, SYN, FIN)
window- size of the receive window
urgpointer- points to the octet following urgent data
timeout- Time to wait before closing idle socket

Member Function Documentation

◆ get_field()

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

Retrieves a boolean value from the field requested. If the function is called with a field that is not a boolean, this function prints an error to the screen

TCP Get Fields
field typefield nameExample
direction_tDIRECTIONdirection_t mydir = get_field<direction_t>(field_t::DIRECTION)
uint32_tMTUuint32_t mymtu = get_field<uint32_t>(field_t::MTU)
SEQNUMuint32_t myseqnum = get_field<uint32_t>(field_t::SEQNUM)
ACKNUMuint32_t myacknum = get_field<uint32_t>(field_t::ACKNUM)
TIMEOUTuint32_t mytimeout = get_field<uint32_t>(field_t::TIMEOUT)
uint16_tSOURCEuint16_t mysrc = get_field<uint16_t>(field_t::SOURCE)
DESTINATIONuint16_t mydst = get_field<uint16_t>(field_t::DESTINATION)
WINDOWuint16_t mywin = get_field<uint16_t>(field_t::WINDOW)
URGPOINTERuint16_t myptr = get_field<uint16_t>(field_t::URGPOINTER)
uint8_tDOFFSETuint8_t myoff = get_field<uint8_t>(field_t::DOFFSET)
FLAGSuint8_t myflags = get_field<uint8_t>(field_t::FLAGS)

Due to their dynamic nature, some fields are only available in jtcp which include the following fields

  • LENGTH
  • CHECKSUM
  • STATE
    • LISTEN
    • SYN_SENT
    • SYN_RCVD
    • FIN_WAIT_1
    • FIN_WAIT_2
    • CLOSE_WAIT
    • LAST_ACK
    • TIME_WAIT
    • CLOSED
  • SNDUNA
  • SNDNXT
  • SNDWND
  • SNDUP
  • SNDW1
  • SNDW2
  • ISS
  • RCVNXT
  • RCVWND
  • RCVUP
  • IRS
Parameters
field- field to set
Returns
- boolean value from the field

◆ set_field()

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

Sets a boolean field in the security association. If the function is called with a field that is not boolean, this function prints an error to the screen

TCP Set Fields
field typefield nameExample
direction_tDIRECTIONset_field<direction_t>(field_t::DIRECTION, direction_t::ENCAP)
uint32_tMTUset_field<uint32_t>(field_t::MTU, 1500)
SEQNUMset_field<uint32_t>(field_t::SEQNUM, 0x00000001)
ACKNUMset_field<uint32_t>(field_t::ACKNUM, 0x00000001)
TIMEOUTset_field<uint32_t>(field_t::TIMEOUT, 0x00000001)
uint16_tSOURCEset_field<uint16_t>(field_t::SOURCE, 0xDEAD)
DESTINATIONset_field<uint16_t>(field_t::DESTINATION, 0xBEEF)
WINDOWset_field<uint16_t>(field_t::WINDOW, 0x1000)
URGPOINTERset_field<uint16_t>(field_t::URGPOINTER, 0x1000)
uint8_tDOFFSETset_field<uint8_t>(field_t::DOFFSET, 0x10)
FLAGSset_field<uint8_t>(field_t::FLAGS, 0x10)

Due to their dynamic nature, some fields are only available in jtcp which include the following fields

  • LENGTH
  • CHECKSUM
  • STATE
    • LISTEN
    • SYN_SENT
    • SYN_RCVD
    • FIN_WAIT_1
    • FIN_WAIT_2
    • CLOSE_WAIT
    • LAST_ACK
    • TIME_WAIT
    • CLOSED
  • SNDUNA
  • SNDNXT
  • SNDWND
  • SNDUP
  • SNDW1
  • SNDW2
  • ISS
  • RCVNXT
  • RCVWND
  • RCVUP
  • IRS
Parameters
field- field to set
fieldval- boolean value for the field

◆ to_json()

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

print the protocol and security objects as JSON

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

Implements ProtocolPP::jsecass.

◆ to_xml()

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

print the protocol and security objects as XML

Parameters
myxml- object to print to XML
direction- randomization

Implements ProtocolPP::jsecass.


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