MoonGen
 All Files Functions Variables Pages
esp.lua File Reference

ESP utility. More...

Go to the source code of this file.

Functions

function ipsecIV set (iv)
 Set the IPsec IV. More...
 
function ipsecIV get ()
 Retrieve the IPsec IV. More...
 
function ipsecIV getString (doByteSwap)
 Get the IPsec IV as string. More...
 
function espHeader setSPI (int)
 Set the SPI. More...
 
function espHeader getSPI ()
 Retrieve the SPI. More...
 
function espHeader getSPIString ()
 Retrieve the SPI as string. More...
 
function espHeader setSQN (int)
 Set the SQN. More...
 
function espHeader getSQN ()
 Retrieve the SQN. More...
 
function espHeader getSQNString ()
 Retrieve the SQN as string. More...
 
function espHeader setIV (iv)
 Set the IV. More...
 
function espHeader getIV ()
 Retrieve the IV. More...
 
function espHeader getIVString ()
 Retrieve the IV as string. More...
 
function espHeader fill (args, pre)
 Set all members of the esp header. More...
 
function espHeader get (pre)
 Retrieve the values of all members. More...
 
function espHeader getString ()
 Retrieve the values of all members. More...
 
function espHeader resolveNextHeader ()
 Resolve which header comes after this one (in a packet) For instance: in tcp/udp based on the ports This function must exist and is only used when get/dump is executed on an unknown (mbuf not yet casted to e.g. More...
 
function espHeader setDefaultNamedArgs (pre, namedArgs, nextHeader, accumulatedLength)
 Change the default values for namedArguments (for fill/get) This can be used to for instance calculate a length value based on the total packet length See proto/ip4.setDefaultNamedArgs as an example This function must exist and is only used by packet.fill. More...
 

Detailed Description

ESP utility.

Utility functions for the esp_header structs defined in headers.lua .
Includes:

  • ESP constants
  • IPsec IV
  • ESP header utility
  • Definition of esp packets

Definition in file esp.lua.

Function Documentation

function espHeader fill ( args  ,
pre   
)

Set all members of the esp header.

Per default, all members are set to default values specified in the respective set function. Optional named arguments can be used to set a member to a user-provided value.

Parameters
argsTable of named arguments. Available arguments: espSPI, espSQN
preprefix for namedArgs. Default 'esp'. fill() fill{ espXYZ=1 }
function ipsecIV get ( )

Retrieve the IPsec IV.

Returns
IV in 'union ipsec_iv' format.
function espHeader get ( pre  )

Retrieve the values of all members.

Parameters
preprefix for namedArgs. Default 'esp'.
Returns
Table of named arguments. For a list of arguments see "See also".
See Also
espHeader:fill
function espHeader getIV ( )

Retrieve the IV.

Returns
SPI as 'union ipsec_iv'.
function espHeader getIVString ( )

Retrieve the IV as string.

Returns
IV as string.
function espHeader getSPI ( )

Retrieve the SPI.

Returns
SPI as A bit integer.
function espHeader getSPIString ( )

Retrieve the SPI as string.

Returns
SPI as string.
function espHeader getSQN ( )

Retrieve the SQN.

Returns
SQN as A bit integer.
function espHeader getSQNString ( )

Retrieve the SQN as string.

Returns
SQN as string.
function ipsecIV getString ( doByteSwap  )

Get the IPsec IV as string.

Parameters
ivIPsec IV in string format.
function espHeader getString ( )

Retrieve the values of all members.

Returns
Values in string format.
function espHeader resolveNextHeader ( )

Resolve which header comes after this one (in a packet) For instance: in tcp/udp based on the ports This function must exist and is only used when get/dump is executed on an unknown (mbuf not yet casted to e.g.

tcpv6 packet) packet (mbuf)

Returns
String next header (e.g. 'eth', 'ip4', nil)
function ipsecIV set ( iv  )

Set the IPsec IV.

Parameters
ivIPsec IV in 'union ipsec_iv' format.
function espHeader setDefaultNamedArgs ( pre  ,
namedArgs  ,
nextHeader  ,
accumulatedLength   
)

Change the default values for namedArguments (for fill/get) This can be used to for instance calculate a length value based on the total packet length See proto/ip4.setDefaultNamedArgs as an example This function must exist and is only used by packet.fill.

Parameters
preThe prefix used for the namedArgs, e.g. 'esp'
namedArgsTable of named arguments (see See more)
nextHeaderThe header following after this header in a packet
accumulatedLengthThe so far accumulated length for previous headers in a packet
Returns
Table of namedArgs
See Also
espHeader:fill
function espHeader setIV ( iv  )

Set the IV.

Parameters
intIV of the esp header as 'union ipsec_iv'.
function espHeader setSPI ( int  )

Set the SPI.

Parameters
intSPI of the esp header as A bit integer.
function espHeader setSQN ( int  )

Set the SQN.

Parameters
intSQN of the esp header as A bit integer.