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

Public Types

enum  audit_t {
  AUDIT_INVALIDSA , AUDIT_FRAGMENT , AUDIT_ROLLOVER , AUDIT_REPLAY ,
  AUDIT_ICV , AUDIT_FORMAT , AUDIT_DUMMY
}
 

Public Member Functions

 jipsec (std::shared_ptr< jrand > &rand, std::shared_ptr< jipsecsa > &security, std::string &replay)
 
 ~jipsec ()
 
void encap_packet (std::shared_ptr< jarray< uint8_t >> &input, std::shared_ptr< jarray< uint8_t >> &output)
 
void decap_packet (std::shared_ptr< jarray< uint8_t >> &input, std::shared_ptr< jarray< uint8_t >> &output)
 
void set_hdr (jarray< uint8_t > &hdr)
 
void set_field (field_t field, uint64_t value)
 
jarray< uint8_t > get_exthdr (iana_t extension, iana_t nh, jarray< uint8_t > &data, uint16_t type_offset=0, uint8_t segments=0)
 
jarray< uint8_t > get_hdr ()
 
uint64_t get_field (field_t field)
 
uint64_t get_field (field_t field, jarray< uint8_t > &header)
 
void get_security (std::shared_ptr< jipsecsa > &sec)
 
void to_xml (tinyxml2::XMLPrinter &myxml, direction_t direction)
 
void to_json (std::ofstream &myjson, direction_t direction, std::string &indent)
 
void audit (audit_t type, jarray< uint8_t > &header)
 
 jipsec (jipsec &jipsec)=delete
 
 jipsec (const jipsec &jipsec)=delete
 
- Public Member Functions inherited from ProtocolPP::jprotocol
 jprotocol (direction_t dir)
 
 jprotocol (direction_t dir, std::string &file)
 
 jprotocol (direction_t dir, std::shared_ptr< jrand > &rand)
 
 jprotocol (direction_t dir, std::shared_ptr< jrand > &rand, std::string &file)
 
virtual ~jprotocol ()
 Standard deconstructor.
 
virtual void encap_packet (std::shared_ptr< jarray< uint8_t >> &output)
 
virtual void decap_packet (std::shared_ptr< jarray< uint8_t >> &input)
 
bool hasfile ()
 
uint32_t get_status ()
 
jarray< uint8_t > checksum (iana_t prot, direction_t dir, jarray< uint8_t > &check, uint32_t offset=0)
 
jarray< uint8_t > pad (pad_t padtype, uint32_t len)
 
 jprotocol (jprotocol &jprotocol)=delete
 
 jprotocol (const jprotocol &jprotocol)=delete
 

Additional Inherited Members

- Static Public Member Functions inherited from ProtocolPP::jprotocol
const static std::string currentDateTime ()
 
static std::string str_status (uint32_t status)
 
static jarray< uint8_t > to_array (uint8_t input)
 
static jarray< uint8_t > to_array (uint16_t input)
 
static jarray< uint8_t > to_array (uint32_t input)
 
static jarray< uint8_t > to_array (uint64_t input)
 
static uint8_t to_u8 (jarray< uint8_t > src_array)
 
static uint16_t to_u16 (jarray< uint8_t > src_array)
 
static uint32_t to_u32 (jarray< uint8_t > src_array)
 
static uint64_t to_u64 (jarray< uint8_t > src_array)
 
static uint32_t fnv_hash (std::shared_ptr< jarray< uint8_t >> &header, jarray< uint8_t > &mask, uint32_t hdrlen)
 
- Protected Member Functions inherited from ProtocolPP::jprotocol
template<typename T , typename TE >
std::shared_ptr< jreplay< T, TE > > update_replay (protocol_t prot, T &seqnum, TE &extseq, bool usext, uint32_t size)
 
template<typename T , typename TE >
std::shared_ptr< jreplay< T, TE > > update_replay (protocol_t prot, T &seqnum, TE &extseq, bool usext, uint32_t size, jarray< uint8_t > &window)
 
void update_status (uint32_t stat)
 
void get_data (std::shared_ptr< jarray< uint8_t >> &data)
 
void put_data (std::shared_ptr< jarray< uint8_t >> &wdata)
 
void encryptdat (std::shared_ptr< jarray< uint8_t >> &red, std::shared_ptr< jarray< uint8_t >> &black)
 
void decryptdat (std::shared_ptr< jarray< uint8_t >> &black, std::shared_ptr< jarray< uint8_t >> &red)
 
uint32_t roundup (uint32_t value, uint32_t mult)
 
- Protected Attributes inherited from ProtocolPP::jprotocol
direction_t m_dir
 direction of processing
 
uint32_t m_status
 
std::shared_ptr< jrandm_rand
 random data generator passed into constructor
 
std::string m_filename
 file input string for this protocol
 
std::fstream m_file
 input file stream object for this protocol
 
endian_t m_endian
 endianess string for this protocol
 

Member Enumeration Documentation

◆ audit_t

Audit types for IPsec

AUDIT_INVALIDSA - Invalid Security Association AUDIT_FRAGMENT - Fragment received when not allowed AUDIT_ROLLOVER - Sequence number rolled over AUDIT_REPLAY - Anti-Replay error AUDIT_ICV - Received ICV was incorrect AUDIT_FORMAT - IPv6 JUMBOGRAM formatting errors AUDIT_DUMMY - Dummy packet received

Enumerator
AUDIT_INVALIDSA 

Audit for invalid security association.

AUDIT_FRAGMENT 

Audit for received fragment when no fragments allowed.

AUDIT_ROLLOVER 

Audit for sequence number overflow.

AUDIT_REPLAY 

Audit for anti-replay error.

AUDIT_ICV 

Audit for incorrect received ICV.

AUDIT_FORMAT 

Audit for IPv6 JUMBOGRAM formatting errors.

AUDIT_DUMMY 

Audit for received DUMMY packets.

Constructor & Destructor Documentation

◆ jipsec()

ProtocolPP::jipsec::jipsec ( std::shared_ptr< jrand > &  rand,
std::shared_ptr< jipsecsa > &  security,
std::string &  replay 
)

Constructor for IPsec

Parameters
rand- Random data generation for IVs and padding
security- Security association (SA) for this IPsec flow
replay- Type of replay packets to generate if requested

◆ ~jipsec()

ProtocolPP::jipsec::~jipsec ( )

Standard deconstructor flush and close the auditlog if present

Member Function Documentation

◆ audit()

void ProtocolPP::jipsec::audit ( audit_t  type,
jarray< uint8_t > &  header 
)

Audit function

Parameters
type- Type of Audit
header- IPsec header to extract audit information

◆ decap_packet()

void ProtocolPP::jipsec::decap_packet ( std::shared_ptr< jarray< uint8_t >> &  input,
std::shared_ptr< jarray< uint8_t >> &  output 
)
virtual

Decap will produce a payload from the packet passed

Parameters
input- packet to decapsulate with IPsec
output- packet encapsulated with IPsec

Implements ProtocolPP::jprotocol.

◆ encap_packet()

void ProtocolPP::jipsec::encap_packet ( std::shared_ptr< jarray< uint8_t >> &  input,
std::shared_ptr< jarray< uint8_t >> &  output 
)
virtual

Encap will produce a packet from the payload passed

Parameters
input- payload to protect with IPsec
output- packet encapsulated with IPsec

Implements ProtocolPP::jprotocol.

◆ get_exthdr()

jarray<uint8_t> ProtocolPP::jipsec::get_exthdr ( iana_t  extension,
iana_t  nh,
jarray< uint8_t > &  data,
uint16_t  type_offset = 0,
uint8_t  segments = 0 
)

Add the extension header

Parameters
extension- extension to add to the IPsec header
nh- Next header after the current one
data- Data necessary for the extension header (32-bit length for JUMBOGRAM, Route header, Identifcation for Fragment, etc.)
type_offset- Type (8-bits) for Routing header, offset (13-bits) for Fragment header
segments- Number of segments left for Routing header (8-bits), "More" bit for Fragment header (1-bit)
Returns
extension header(s)

◆ get_field() [1/2]

uint64_t ProtocolPP::jipsec::get_field ( field_t  field)
virtual

Retrieve the field from the IP header

Parameters
field- field to return from the header
Returns
field

Reimplemented from ProtocolPP::jprotocol.

◆ get_field() [2/2]

uint64_t ProtocolPP::jipsec::get_field ( field_t  field,
jarray< uint8_t > &  header 
)
virtual

Retrieve the field from the IP header

Parameters
field- field to return from the header
header- header to retrieve the field from
Returns
field

Implements ProtocolPP::jprotocol.

◆ get_hdr()

jarray<uint8_t> ProtocolPP::jipsec::get_hdr ( )
virtual

Retrieve the IP header

Returns
current IP header

Implements ProtocolPP::jprotocol.

◆ get_security()

void ProtocolPP::jipsec::get_security ( std::shared_ptr< jipsecsa > &  sec)

get_security

Parameters
sec- Shared pointer to hold the security association

◆ set_field()

void ProtocolPP::jipsec::set_field ( field_t  field,
uint64_t  value 
)
virtual

Update IP field with the new value

Parameters
field- field to update
value- new value for the field

Implements ProtocolPP::jprotocol.

◆ set_hdr()

void ProtocolPP::jipsec::set_hdr ( jarray< uint8_t > &  hdr)
virtual

Update the current IP header with a new header

Parameters
hdr- new IP header for this flow

Implements ProtocolPP::jprotocol.

◆ to_json()

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

Return the protocol and security fields as JSON

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

Implements ProtocolPP::jprotocol.

◆ to_xml()

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

Return the protocol and security fields as XML

Parameters
myxml- XMLPrinter object
direction- randomization

Implements ProtocolPP::jprotocol.


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