Barracuda Application Server C/C++ Reference
Native APIs, integration guides, and platform interfaces
SeCtx.h
1/*
2 * ____ _________ __ _
3 * / __ \___ ____ _/ /_ __(_)___ ___ ___ / / ____ ____ _(_)____
4 * / /_/ / _ \/ __ `/ / / / / / __ `__ \/ _ \/ / / __ \/ __ `/ / ___/
5 * / _, _/ __/ /_/ / / / / / / / / / / / __/ /___/ /_/ / /_/ / / /__
6 * /_/ |_|\___/\__,_/_/ /_/ /_/_/ /_/ /_/\___/_____/\____/\__, /_/\___/
7 * /____/
8 *
9 ****************************************************************************
10 * HEADER
11 *
12 * $Id: SeCtx.h 6825 2026-11-10 21:17:44Z 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
62#ifdef __cplusplus
63extern "C" {
64#endif
65
66struct SeCtx;
67
69typedef void (*SeCtxTask)(struct SeCtx* ctx);
70
74typedef struct SeCtx
75{
76 jmp_buf savedContext;
77#ifndef NDEBUG
78 U32 magic1;
79#endif
80 jmp_buf startContext;
81#ifndef NDEBUG
82 U32 magic2;
83#endif
84 SeCtxTask task;
85 U8* stackTop;
86 void* stackBuf;
87#ifndef NDEBUG
88 U8* currentStack;
89#endif
90 U32 timeout;
91 U32 startTime;
92 U16 stackBufLen;
93 U8 hasContext;
94 U8 ready;
95#ifdef SECTX_EX
96 SECTX_EX;
97#endif
99
100#define SeCtx_setStackTop(o, stackMark) \
101 (*(stackMark)=1,(o)->stackTop=stackMark,setjmp((o)->startContext))
102
103#ifdef DYNAMIC_SE_CTX
109void SeCtx_destructor(SeCtx* o);
110#else
111
112
121void SeCtx_constructor(SeCtx* o, SeCtxTask t, void* buf, int bufLen);
127#define SeCtx_destructor(o)
128#endif
129
130void SeCtx_save(SeCtx* o);
131
132void SeCtx_restore(SeCtx* o);
133
139void SeCtx_panic(SeCtx* o, U32 size);
140 /* end group SeCtx */
142
143#ifdef __cplusplus
144}
145#endif
void SeCtx_panic(SeCtx *o, U32 size)
Function you must implement.
#define SeCtx_destructor(o)
No operation for a context using a caller-supplied static stack buffer.
Definition: SeCtx.h:127
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:69
struct SeCtx SeCtx
SeCtx structure: See Context Manager and Bare Metal Systems for details.
uint16_t U16
Unsigned 16-bit integer.
Definition: GenPrimT.h:94
uint32_t U32
Unsigned 32-bit integer.
Definition: GenPrimT.h:96
uint8_t U8
Unsigned 8-bit integer.
Definition: GenPrimT.h:92
SeCtx structure: See Context Manager and Bare Metal Systems for details.
Definition: SeCtx.h:75