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

Public Member Functions

 jmacsecsa ()
 
 jmacsecsa (direction_t dir, macsecmode_t mode, bool fcs, bool usext, bool enreceive, bool entransmit, bool protectframes, uint8_t tcian, uint8_t sl, uint16_t ethtype, uint32_t vlantag1, uint32_t vlantag2, uint32_t pn, uint32_t xpn, uint32_t ssci, uint32_t arlen, uint32_t icvlen, uint32_t keylen, uint64_t src, uint64_t dst, uint64_t sci, jarray< uint8_t > arwin, std::shared_ptr< jarray< uint8_t >> sakey, std::shared_ptr< jarray< uint8_t >> salt)
 
 jmacsecsa (jmacsecsa &rhs)
 
 jmacsecsa (std::shared_ptr< jmacsecsa > &rhs)
 
 ~jmacsecsa ()
 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)
 
 jmacsecsa (const jmacsecsa &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

◆ jmacsecsa() [1/4]

ProtocolPP::jmacsecsa::jmacsecsa ( )

Standard Constructor with defaults

MACSEC Defaults
fieldDefault Value
dirdirection_t::ENCAP
modemacsecmode_t::AES_GCM_128
fcsfalse
usextfalse
enreceivefalse
entransmitfalse
protectframestrue
tcian0
sl0
ethtype0x88E5
vlantag10
vlantag20
pn0
xpn0
ssci0
icvlen16
keylen16
src0
dst0
sci0
arlen0
arwin0
std::shared_ptr<jmacsecsa> snd = std::make_shared<jmacsecsa>();
snd->set_field<uint32_t>(field_t::PN, 0x00000001);
snd->set_field<uint8_t>(field_t::TCIAN, 0xEE);
snd->set_field<std::shared_ptr<jarray<uint8_t>>>(field_t::CIPHERKEY, std::make_shared<jarray<uint8_t>>>(m_rand->getbyte(16)));

◆ jmacsecsa() [2/4]

ProtocolPP::jmacsecsa::jmacsecsa ( direction_t  dir,
macsecmode_t  mode,
bool  fcs,
bool  usext,
bool  enreceive,
bool  entransmit,
bool  protectframes,
uint8_t  tcian,
uint8_t  sl,
uint16_t  ethtype,
uint32_t  vlantag1,
uint32_t  vlantag2,
uint32_t  pn,
uint32_t  xpn,
uint32_t  ssci,
uint32_t  arlen,
uint32_t  icvlen,
uint32_t  keylen,
uint64_t  src,
uint64_t  dst,
uint64_t  sci,
jarray< uint8_t >  arwin,
std::shared_ptr< jarray< uint8_t >>  sakey,
std::shared_ptr< jarray< uint8_t >>  salt 
)

Security Association for MacSec

Parameters
dir- Direction for processing (ENCAP or DECAP)
mode- Mode for MACSEC (AES-GCM with 128-bit or 256-bit key with or without extended packet number)
fcs- Calculate the CRC-IEEE over the packet and add to packet (ENCAP) or verify (DECAP)
usext- use extended sequence number
enreceive- SA receiving frames
entransmit- SA transmitting frames
protectframes- SA protecting frames
tcian- TAG control information
sl- short length parameter
ethtype- ethernet type
vlantag1- customer virtual LAN tag (CVLAN), service virtual LAN tag (SVLAN), or service instance virtual LAN tag (IVLAN)
vlantag2- customer virtual LAN tag (CVLAN), service virtual LAN tag (SVLAN), or service instance virtual LAN tag (IVLAN)
pn- packet number this Phy is generating/receiving
xpn- if extended packet numbers are used, upper half of the PN
ssci- short security control index (for extended packet number)
arlen- Number of packets to track in the replay window
icvlen- length of the ICV. Default is 16
keylen- length of the key (either 16 or 32 bytes)
src- source address for the stream
dst- destination address for the stream
sci- security control index (64-bits)
arwin- Anti-replay window to track packets
sakey- AES-GCM key for integrity of user data
salt- salt to XOR with SSCI, XPN, and PN when using extended packet numbers

◆ jmacsecsa() [3/4]

ProtocolPP::jmacsecsa::jmacsecsa ( jmacsecsa rhs)

Create an instance of the macsec protocol. Use update_sec to create the security association

Parameters
rhs- security association for this flow

◆ jmacsecsa() [4/4]

ProtocolPP::jmacsecsa::jmacsecsa ( std::shared_ptr< jmacsecsa > &  rhs)
explicit

Create an instance of the macsec protocol. Use update_sec to create the security association

Parameters
rhs- security association for this flow

Member Function Documentation

◆ get_field()

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

Return the macsec field

MACSEC Get Fields
field typefield nameExample
direction_tDIRECTIONdirection_t mydir = get_field<direction_t>(field_t::DIRECTION)
macsecmode_tMODEmacsecmode_t mymode = get_field<macsecmode_t>(field_t::MODE)
boolFCSbool myfcs = get_field<bool>(field_t::FCS)
boolUSEXTbool myusext = get_field<bool>(field_t::USEXT)
uint8_tTCIANuint8_t mytcian = get_field<uint8_t>(field_t::TCIAN)
SLuint8_t mysl = get_field<uint8_t>(field_t::SL)
uint16_tETHERTYPEuint16_t myethtype = get_field<uint16_t>(field_t::ETHERTYPE)
uint32_tVLANTAG1uint32_t cvlantag = get_field<uint32_t>(field_t::VLANTAG1)
uint32_tVLANTAG2uint32_t svlantag = get_field<uint32_t>(field_t::VLANTAG2)
uint32_tPNuint32_t mypn = get_field<uint32_t>(field_t::PN)
XPNuint32_t myxpn = get_field<uint32_t>(field_t::XPN)
SSCIuint32_t myssci = get_field<uint32_t>(field_t::SSCI)
ARLENuint32_t myarlen = get_field<uint32_t>(field_t::ARLEN)
ICVLENuint32_t myicvlen = get_field<uint32_t>(field_t::ICVLEN)
KEYLENuint32_t mykeylen = get_field<uint32_t>(field_t::KEYLEN)
uint64_tSOURCEuint64_t mysrc = get_field<uint64_t>(field_t::SOURCE)
DESTINATIONuint64_t mydst = get_field<uint64_t>(field_t::DESTINATION)
jarray<uint8_tARWINjarray<uint8_t> myarwin = get_field<jarray<uint8_t>>(field_t::ARWIN)
std::shared_ptr<jarray<uint8_t>>SAKEYstd::shared_ptr<jarray<uint8_t>> mysakey = get_field<std::shared_ptr<jarray<uint8_t>>>(field_t::SAKEY)
SALTstd::shared_ptr<jarray<uint8_t>> mysalt = get_field<std::shared_ptr<jarray<uint8_t>>>(field_t::SALT)
Parameters
field- MACSEC field to retrieve
Returns
MACSEC field value

◆ set_field()

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

Update MACSEC field

MACSEC Set Fields
field typefield nameExample
direction_tDIRECTIONset_field<direction_t>(field_t::DIRECTION, direction_t::ENCAP)
macsecmode_tMODEset_field<macsecmode_t>(field_t::MODE, macsecmode_t::AES_256_GCM)
boolFCSset_field<bool>(field_t::FCS, true)
boolUSEXTset_field<bool>(field_t::USEXT, true)
uint8_tTCIANset_field<uint8_t>(field_t::TCIAN, 0x88)
SLset_field<uint8_t>(field_t::SL, 0x88)
uint16_tETHERTYPEset_field<uint16_t>(field_t::ETHERTYPE, 0x88FF)
uint32_tVLANTAG1set_field<uint32_t>(field_t::VLANTAG1, 0x810000FE)
uint32_tVLANTAG2set_field<uint32_t>(field_t::VLANTAG2, 0x88A800FE)
uint32_tPNset_field<uint32_t>(field_t::PN, 0x000088FF)
XPNset_field<uint32_t>(field_t::XPN, 0x088FF0AA)
SSCIset_field<uint32_t>(field_t::SSCI, 0x8FF0AACC)
ARLENset_field<uint32_t>(field_t::ARLEN, 128)
ICVLENset_field<uint32_t>(field_t::ICVLEN, 8)
KEYLENset_field<uint32_t>(field_t::KEYLEN, 32)
uint64_tSOURCEset_field<uint64_t>(field_t::SOURCE, 0xAABBCCDD11223344)
DESTINATIONset_field<uint64_t>(field_t::DESTINATION, 0x1122334455667788)
jarray<uint8_t>ARWINset_field<jarray<uint8_t>>(field_t::ARWIN, jarray<uint8_t>("00000000000000000000000000000001")
std::shared_ptr<jarray<uint8_t>>SAKEYset_field<std::shared_ptr<jarray<uint8_t>>>(field_t::SAKEY, std::make_shared<jarray<uint8_t>("AAAABBECEDEDEDED"))
SALTset_field<std::shared_ptr<jarray<uint8_t>>>(field_t::SALT, std::make_shared<jarray<uint8_t>("AAAABBEC"))
Parameters
field- MACSEC field to update
fieldval- new value for the MACSEC field

◆ to_json()

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

Write the protocol and security objects as JSON

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

Implements ProtocolPP::jsecass.

◆ to_xml()

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

Write the protocol and security objects as XML

Parameters
myxml- XMLPrinter object to print with
direction- randomization

Implements ProtocolPP::jsecass.


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