SharkSSL C/C++ Reference
TLS, cryptography, certificates, and PSA integration

Detailed Description

The SeCtx library makes it possible to use sequential functions in an event driven system such as a bare metal (non RTOS) system.

It does so by implementing a method for saving and restoring the stack by using the standard C library functions setjmp/longjmp.

See Bare Metal Systems for an introduction.

Data Structures

struct  SeCtx
 SeCtx structure: See Context Manager and Bare Metal Systems for details. More...
 

Macros

#define SeCtx_setStackTop(o, stackMark)    (*(stackMark)=1,(o)->stackTop=stackMark,setjmp((o)->startContext))
 
#define SeCtx_destructor(o)
 

Typedefs

typedef void(* SeCtxTask) (struct SeCtx *ctx)
 The task/thread entry point. More...
 
typedef struct SeCtx SeCtx
 SeCtx structure: See Context Manager and Bare Metal Systems for details. More...
 

Functions

void SeCtx_constructor (SeCtx *o, SeCtxTask t, void *buf, int bufLen)
 Create a Context Manager instance. More...
 
void SeCtx_save (SeCtx *o)
 
void SeCtx_restore (SeCtx *o)
 
void SeCtx_panic (SeCtx *o, U32 size)
 Function you must implement. More...
 

Macro Definition Documentation

◆ SeCtx_destructor

#define SeCtx_destructor (   o)

◆ SeCtx_setStackTop

#define SeCtx_setStackTop (   o,
  stackMark 
)     (*(stackMark)=1,(o)->stackTop=stackMark,setjmp((o)->startContext))

Typedef Documentation

◆ SeCtx

typedef struct SeCtx SeCtx

SeCtx structure: See Context Manager and Bare Metal Systems for details.

◆ SeCtxTask

typedef void(* SeCtxTask) (struct SeCtx *ctx)

The task/thread entry point.

Function Documentation

◆ SeCtx_constructor()

void SeCtx_constructor ( SeCtx *  o,
SeCtxTask  t,
void *  buf,
int  bufLen 
)

Create a Context Manager instance.

Parameters
ouninitialized data of size sizeof(SeCtx).
tthe task/thread to call
bufbuffer used for storing the stack when switching from sequential mode to event driven mode.
bufLenbuffer length.
See also
SeCtx_panic

◆ SeCtx_panic()

void SeCtx_panic ( SeCtx *  o,
U32  size 
)

Function you must implement.

This function is called if the buffer provided in SeCtx_constructor is too small.

Parameters
oContext whose stack buffer could not be allocated or is too small; NULL for a dynamic stack request exceeding 40 KiB.
sizeRequired stack-save size in bytes.

◆ SeCtx_restore()

void SeCtx_restore ( SeCtx *  o)

◆ SeCtx_save()

void SeCtx_save ( SeCtx *  o)