dtlsClient.hpp File Reference
#include <array>
#include <cstdint>
#include <iostream>
#include <openssl/bio.h>
#include <openssl/conf.h>
#include <openssl/dh.h>
#include <openssl/engine.h>
#include <openssl/err.h>
#include <openssl/ssl.h>
#include "IPv4_5TupleL2Ident.hpp"
#include "mbuf.hpp"
#include "stateMachine.hpp"
Include dependency graph for dtlsClient.hpp:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  DTLS_Client::dtlsClient
 
struct  DTLS_Client::States
 The state of the DTLS client. More...
 

Namespaces

 DTLS_Client
 

Functions

SSL_CTX * DTLS_Client::createCTX ()
 Use this to create the SSL context for creaeteStateData() More...
 
void DTLS_Client::configStateMachine (StateMachine< IPv4_5TupleL2Ident< mbuf >, mbuf > &sm)
 Configure the state machine. More...
 
StateMachine< IPv4_5TupleL2Ident< mbuf >, mbuf >::State DTLS_Client::createStateData (SSL_CTX *ctx, uint32_t localIP, uint32_t remoteIP, uint16_t localPort, uint16_t remotePort, std::array< uint8_t, 6 > localMac, std::array< uint8_t, 6 > remoteMac)
 Create the state of the client. More...
 
void DTLS_Client::initHandshake (StateMachine< IPv4_5TupleL2Ident< mbuf >, mbuf >::State &state, mbuf *, StateMachine< IPv4_5TupleL2Ident< mbuf >, mbuf >::FunIface &funIface)
 
void DTLS_Client::runHandshake (StateMachine< IPv4_5TupleL2Ident< mbuf >, mbuf >::State &state, mbuf *, StateMachine< IPv4_5TupleL2Ident< mbuf >, mbuf >::FunIface &funIface)
 
void DTLS_Client::sendData (StateMachine< IPv4_5TupleL2Ident< mbuf >, mbuf >::State &state, mbuf *, StateMachine< IPv4_5TupleL2Ident< mbuf >, mbuf >::FunIface &funIface)
 
void DTLS_Client::runTeardown (StateMachine< IPv4_5TupleL2Ident< mbuf >, mbuf >::State &state, mbuf *, StateMachine< IPv4_5TupleL2Ident< mbuf >, mbuf >::FunIface &funIface)
 
void * DtlsClient_init (uint32_t dstIP, uint16_t dstPort, uint8_t srcMac[6], uint8_t dstMac[6])
 Initialize a DTLS client. More...
 
void * DtlsClient_connect (void *obj, struct rte_mbuf **inPkts, unsigned int inCount, unsigned int *sendCount, unsigned int *freeCount, uint32_t srcIP, uint16_t srcPort)
 Add one connection to the State Machine. More...
 
void DtlsClient_getPkts (void *obj, struct rte_mbuf **sendPkts, struct rte_mbuf **freePkts)
 Get the packets from an opaque structure. More...
 
void * DtlsClient_process (void *obj, struct rte_mbuf **inPkts, unsigned int inCount, unsigned int *sendCount, unsigned int *freeCount)
 Process incoming packets. More...
 
void DtlsClient_free (void *obj)
 Free recources used by the state machine. More...
 

Function Documentation

◆ DtlsClient_connect()

void* DtlsClient_connect ( void *  obj,
struct rte_mbuf **  inPkts,
unsigned int  inCount,
unsigned int *  sendCount,
unsigned int *  freeCount,
uint32_t  srcIP,
uint16_t  srcPort 
)

Add one connection to the State Machine.

Parameters
objThe void* returned from DtlsClient_init()
inPktsmbufs from MoonGen
inCountNumber of buffers in inPkts (should be 1)
sendCountThis will be set to the number of packets to be sent
freeCountThis will be set to the number of packets to be freed
srcIPIP which should be used as the source
srcPortPort which should be used as the source
Returns
Opaque object to be fed into DtlsClient_getPkts

Definition at line 320 of file dtlsClient.cpp.

Here is the call graph for this function:

◆ DtlsClient_free()

void DtlsClient_free ( void *  obj)

Free recources used by the state machine.

Parameters
objobject returned by DtlsClient_init()

Definition at line 369 of file dtlsClient.cpp.

◆ DtlsClient_getPkts()

void DtlsClient_getPkts ( void *  obj,
struct rte_mbuf **  sendPkts,
struct rte_mbuf **  freePkts 
)

Get the packets from an opaque structure.

Parameters
objReturn value of DtlsClient_connect() or DtlsClient_process()
sendPktsArray of packet buffers to be sent
freePktsArray of packet buffers to be freed

Definition at line 346 of file dtlsClient.cpp.

Here is the call graph for this function:

◆ DtlsClient_init()

void* DtlsClient_init ( uint32_t  dstIP,
uint16_t  dstPort,
uint8_t  srcMac[6],
uint8_t  dstMac[6] 
)

Initialize a DTLS client.

Parameters
dstIPIP of the DTLS test server
dstPortPort of the DTLS test server
srcMacMAC address of the local NIC
dstMacMAC address of the remote NIC
Returns
An opaque object which should be fed into DtlsClient_connect

Definition at line 303 of file dtlsClient.cpp.

Here is the call graph for this function:

◆ DtlsClient_process()

void* DtlsClient_process ( void *  obj,
struct rte_mbuf **  inPkts,
unsigned int  inCount,
unsigned int *  sendCount,
unsigned int *  freeCount 
)

Process incoming packets.

Parameters
objStructure returned from DtlsClient_init()
inPktsThe newly arrived packets
inCountNumber of incoming packets
sendCountWill be set to the number of packets to be sent
freeCountWill be set to the number of packets to be freed

Definition at line 355 of file dtlsClient.cpp.

Here is the call graph for this function: