SharkSSL C/C++ Reference
TLS, cryptography, certificates, and PSA integration
SeCtx.h
Go to the documentation of this file.
1/*
2 * ____ _________ __ _
3 * / __ \___ ____ _/ /_ __(_)___ ___ ___ / / ____ ____ _(_)____
4 * / /_/ / _ \/ __ `/ / / / / / __ `__ \/ _ \/ / / __ \/ __ `/ / ___/
5 * / _, _/ __/ /_/ / / / / / / / / / / / __/ /___/ /_/ / /_/ / / /__
6 * /_/ |_|\___/\__,_/_/ /_/ /_/_/ /_/ /_/\___/_____/\____/\__, /_/\___/
7 * /____/
8 *
9 ****************************************************************************
10 * HEADER
11 *
12 * $Id: SeCtx.h 6657 2026-10-28 18:19:39Z wini $
13 *
14 * COPYRIGHT: Real Time Logic LLC, 2014 - 2026
15 *
16 * This software is copyrighted by and is the sole property of Real
17 * Time Logic LLC. All rights, title, ownership, or other interests in
18 * the software remain the property of Real Time Logic LLC. This
19 * software may only be used in accordance with the terms and
20 * conditions stipulated in the corresponding license agreement under
21 * which the software has been supplied. Any unauthorized use,
22 * duplication, transmission, distribution, or disclosure of this
23 * software is expressly forbidden.
24 *
25 * This Copyright notice may not be removed or modified without prior
26 * written consent of Real Time Logic LLC.
27 *
28 * Real Time Logic LLC. reserves the right to modify this software
29 * without notice.
30 *
31 * http://sharkssl.com
32 ****************************************************************************
33 *
34 */
35
36#define SE_CTX
37
38
59#include <setjmp.h>
60#include <TargConfig.h>
61
62struct SeCtx;
63
65typedef void (*SeCtxTask)(struct SeCtx* ctx);
66
70typedef struct SeCtx
71{
72 jmp_buf savedContext;
73#ifndef NDEBUG
74 U32 magic1;
75#endif
76 jmp_buf startContext;
77#ifndef NDEBUG
78 U32 magic2;
79#endif
82 void* stackBuf;
83#ifndef NDEBUG
85#endif
91#ifdef SECTX_EX
92 SECTX_EX;
93#endif
95
96#define SeCtx_setStackTop(o, stackMark) \
97 (*(stackMark)=1,(o)->stackTop=stackMark,setjmp((o)->startContext))
98
99#ifdef DYNAMIC_SE_CTX
101void SeCtx_destructor(SeCtx* o);
102#else
103
104
113void SeCtx_constructor(SeCtx* o, SeCtxTask t, void* buf, int bufLen);
114#define SeCtx_destructor(o)
115#endif
116
118
120
126void SeCtx_panic(SeCtx* o, U32 size);
127 /* end group SeCtx */
void SeCtx_save(SeCtx *o)
void SeCtx_panic(SeCtx *o, U32 size)
Function you must implement.
#define SeCtx_destructor(o)
Definition: SeCtx.h:114
void SeCtx_constructor(SeCtx *o, SeCtxTask t, void *buf, int bufLen)
Create a Context Manager instance.
void(* SeCtxTask)(struct SeCtx *ctx)
The task/thread entry point.
Definition: SeCtx.h:65
void SeCtx_restore(SeCtx *o)
struct SeCtx SeCtx
SeCtx structure: See Context Manager and Bare Metal Systems for details.
SeCtx structure: See Context Manager and Bare Metal Systems for details.
Definition: SeCtx.h:71
jmp_buf startContext
Definition: SeCtx.h:76
SeCtxTask task
Definition: SeCtx.h:80
U32 magic1
Definition: SeCtx.h:74
void * stackBuf
Definition: SeCtx.h:82
U32 timeout
Definition: SeCtx.h:86
U8 * currentStack
Definition: SeCtx.h:84
U32 magic2
Definition: SeCtx.h:78
U8 ready
Definition: SeCtx.h:90
U16 stackBufLen
Definition: SeCtx.h:88
U8 hasContext
Definition: SeCtx.h:89
U32 startTime
Definition: SeCtx.h:87
U8 * stackTop
Definition: SeCtx.h:81
jmp_buf savedContext
Definition: SeCtx.h:72