44#ifndef SHARKSSL_COMPAT
45#define SHARKSSL_COMPAT 1
73typedef unsigned char U8;
74typedef signed char S8;
75typedef unsigned short U16;
76typedef signed short S16;
77typedef unsigned long U32;
78typedef signed long S32;
79typedef unsigned long long U64;
80typedef signed long long S64;
91#define INFINITE_TMO (~((U32)0))
116#define baAssert(x) if(x) xprintf(("failed assertion %s %d\n",__FILE__, __LINE__))
119#define baAssert assert
130#include <umm_malloc.h>
131#define baMalloc(s) umm_malloc(s)
132#define baRealloc(m, s) umm_realloc(m, s)
133#define baFree(m) umm_free(m)
149#ifndef SOCKET_constructor
150#define SOCKET_constructor(o, ctx) (void)ctx,memset(o,0,sizeof(SOCKET))
217#ifndef se_getSockName
218#define se_getSockName(sock, buf, status) do { \
219 struct sockaddr_in in; int size=sizeof(struct sockaddr_in); \
220 *(status) = getsockname(*(sock), (struct sockaddr *)&in, &size); \
221 memcpy((buf), &in.sin_addr.s_addr, 4); \
222 if(*(status) == 0) *(status) = 4; \
233#define xprintf(data) _xprintf data
240void _xprintf(
const char* fmt, ...);
257typedef struct {
void* x; } SharkSsl;
258#define SharkSsl_constructor(sharkSsl, type, cache, inSize,outSize)
259#define SharkSsl_setCAList(sharkSsl, sharkSslCAList)
260#define sharkssl_entropy(entropy)
261#define SharkSsl_createCon(sharkSsl) ((void*)~0)
262#define SharkSsl_terminateCon(sharkSsl, scon)
263#define SharkSsl_destructor(sharkSsl)
264#define SharkSsl_addCertificate(sharkSsl, cert)
266#define SharkSslCon void
269#define SHARKSSL_SHA1_HASH_LEN 20
270typedef struct SharkSslSha1Ctx
276void SharkSslSha1Ctx_constructor(SharkSslSha1Ctx* ctx);
277void SharkSslSha1Ctx_append(SharkSslSha1Ctx* ctx,
const U8* data, U32 len);
278void SharkSslSha1Ctx_finish(SharkSslSha1Ctx*,U8 digest[SHARKSSL_SHA1_HASH_LEN]);
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)
Returns TRUE if socket is valid (connected).
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:142
SeCtx structure: See Context Manager and Bare Metal Systems for details.
Definition: SeCtx.h:71