44#ifndef SHARKSSL_COMPAT
45#define SHARKSSL_COMPAT 1
83#define INFINITE_TMO (~((U32)0))
108#define baAssert(x) if(x) xprintf(("failed assertion %s %d\n",__FILE__, __LINE__))
111#define baAssert assert
122#include <umm_malloc.h>
123#define baMalloc(s) umm_malloc(s)
124#define baRealloc(m, s) umm_realloc(m, s)
125#define baFree(m) umm_free(m)
144#ifndef INVALID_SOCKET
145#define INVALID_SOCKET ((SOCKET)-1)
148#ifndef SOCKET_constructor
150#define SOCKET_constructor(o, ctx) ((void)(ctx), memset((o), 0, sizeof(SOCKET)))
152#define SOCKET_constructor(o, ctx) ((void)(ctx), (*(o) = INVALID_SOCKET))
236#ifndef se_getSockName
237#define se_getSockName(sock, buf, status) do { \
238 struct sockaddr_in in; int size=sizeof(struct sockaddr_in); \
239 *(status) = getsockname(*(sock), (struct sockaddr *)&in, &size); \
240 memcpy((buf), &in.sin_addr.s_addr, 4); \
241 if(*(status) == 0) *(status) = 4; \
252#define xprintf(data) _xprintf data
259void _xprintf(
const char* fmt, ...);
278typedef struct {
void* x; } SharkSsl;
279#define SharkSsl_constructor(sharkSsl, type, cache, inSize,outSize)
280#define SharkSsl_setCAList(sharkSsl, sharkSslCAList)
281#define SharkSsl_setCAListEx(sharkSsl, sharkSslCAList, caListLen) 1
282#define sharkssl_entropy(entropy)
283#define SharkSsl_createCon(sharkSsl) ((void*)~0)
284#define SharkSsl_terminateCon(sharkSsl, scon)
285#define SharkSsl_destructor(sharkSsl)
286#define SharkSsl_addCertificate(sharkSsl, cert)
288#define SharkSslCon void
292#define SHARKSSL_SHA256_HASH_LEN 32
293typedef struct SharkSslSha256Ctx
302int seSha256Ctx_constructor(SharkSslSha256Ctx* ctx);
303int seSha256Ctx_append(SharkSslSha256Ctx* ctx,
const U8* data,
U32 len);
304int seSha256Ctx_finish(SharkSslSha256Ctx* ctx,
U8 digest[SHARKSSL_SHA256_HASH_LEN]);
305#define SharkSslSha256Ctx_constructor seSha256Ctx_constructor
306#define SharkSslSha256Ctx_append seSha256Ctx_append
307#define SharkSslSha256Ctx_finish seSha256Ctx_finish
314#define SHARKSSL_SHA1_HASH_LEN 20
315typedef struct SharkSslSha1Ctx
321void SharkSslSha1Ctx_constructor(SharkSslSha1Ctx* ctx);
322void SharkSslSha1Ctx_append(SharkSslSha1Ctx* ctx,
const U8* data,
U32 len);
323void SharkSslSha1Ctx_finish(SharkSslSha1Ctx*,
U8 digest[SHARKSSL_SHA1_HASH_LEN]);
uint16_t U16
Unsigned 16-bit integer.
Definition: GenPrimT.h:94
int64_t S64
Signed 64-bit integer.
Definition: GenPrimT.h:90
uint64_t U64
Unsigned 64-bit integer.
Definition: GenPrimT.h:98
int32_t S32
Signed 32-bit integer.
Definition: GenPrimT.h:88
uint32_t U32
Unsigned 32-bit integer.
Definition: GenPrimT.h:96
int16_t S16
Signed 16-bit integer.
Definition: GenPrimT.h:86
uint8_t U8
Unsigned 8-bit integer.
Definition: GenPrimT.h:92
int8_t S8
Signed 8-bit integer.
Definition: GenPrimT.h:84
void se_close(SOCKET *sock)
Close a connected socket connection.
int se_accept(SOCKET **listenSock, U32 timeout, SOCKET **outSock)
Waits for remote connections on the server SOCKET object 'listenSock', initialized by function se_bin...
S32 se_send(SOCKET *sock, const void *buf, U32 len)
Sends data to the connected peer.
int se_connect(SOCKET *sock, const char *address, U16 port)
Initializes a SOCKET object connected to a remote host/address at a given port.
int se_sockValid(SOCKET *sock)
Check the socket representation using the selected port.
void mainTask(SeCtx *ctx)
Main entry for all example programs.
int se_bind(SOCKET *sock, U16 port)
Initializes a SOCKET object bound to a local port, ready to accept client connections.
S32 se_recv(SOCKET *sock, void *buf, U32 len, U32 timeout)
Waits for data sent by peer.
#define SOCKET
The SOCKET object/handle is an 'int' when using a BSD compatible TCP/IP stack.
Definition: selib.h:135
SeCtx structure: See Context Manager and Bare Metal Systems for details.
Definition: SeCtx.h:75