73#define INFINITE_TMO (~((U32)0))
107#ifndef INVALID_SOCKET
108#define INVALID_SOCKET ((SOCKET)-1)
111#ifndef SOCKET_constructor
113#define SOCKET_constructor(o, ctx) ((void)(ctx), memset((o), 0, sizeof(SOCKET)))
115#define SOCKET_constructor(o, ctx) ((void)(ctx), (*(o) = INVALID_SOCKET))
129#define se_disableTrace(disable)
135#if XPRINTF && SHARKSSL_ENABLE_INFO_API
138#define printCiphersuite(notused)
170#if (SHARKSSL_TLS_1_3 && SHARKSSL_ENABLE_KEY_UPDATE)
284#ifndef se_getSockName
285#define se_getSockName(sock, buf, status) do { \
286 struct sockaddr_in in; int size=sizeof(struct sockaddr_in); \
287 *(status) = getsockname(*(sock), (struct sockaddr *)&in, &size); \
288 memcpy((buf), &in.sin_addr.s_addr, 4); \
289 if(*(status) == 0) *(status) = 4; \
299#define xprintf(data) _xprintf data
TLS objects, certificate/session operations, and public-key interfaces.
struct SharkSslCon SharkSslCon
SharkSslCon is an opaque handle returned by function SharkSsl_createCon.
Definition: SharkSSL.h:495
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)
Tests whether the local socket handle is valid.
int seSec_read(SharkSslCon *s, SOCKET *sock, U8 **buf, U32 timeout)
Read data from socket stream and decode the encrypted data.
int seSec_close(SharkSslCon *s, SOCKET *sock)
Sends the complete close_notify alert.
int seSec_write(SharkSslCon *s, SOCKET *sock, U8 *buf, int maxLen)
Encrypts and sends plaintext to the connected peer.
void printCiphersuite(U16 cipherSuite)
Print the selected ciphersuite.
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.
int se_sendAll(SOCKET *sock, const void *buf, int len)
Sends all bytes on a blocking transport, continuing partial sends.
int seSec_handshake(SharkSslCon *s, SOCKET *sock, U32 timeout, const char *commonName)
Performs the initial SSL handshaking using an asymmetric cipher in order to establish cipher settings...
int seSec_keyUpdate(SharkSslCon *s, SOCKET *sock, U8 requestUpdate)
Sends a TLS 1.3 KeyUpdate handshake message.
void se_disableTrace(int disable)
Disable/enable the trace when XPRINTF is defined.
void _xprintf(const char *fmt,...)
The example code and macro xprintf requires this function when the code is compiled with macro XPRINT...
#define SOCKET
Infinite wait time option for socket read functions.
Definition: selib.h:103
SeCtx structure: See Context Manager and Bare Metal Systems for details.
Definition: SeCtx.h:75