QSC Post Quantum Cryptographic Library 1.0.0.6c (A6)
A post quantum secure library written in Ansi C
 
Loading...
Searching...
No Matches
socketbase.h
Go to the documentation of this file.
1/* 2025 Quantum Resistant Cryptographic Solutions Corporation
2 * All Rights Reserved.
3 *
4 * NOTICE: This software and all accompanying materials are the exclusive
5 * property of Quantum Resistant Cryptographic Solutions Corporation (QRCS).
6 * The intellectual and technical concepts contained within this implementation
7 * are proprietary to QRCS and its authorized licensors and are protected under
8 * applicable U.S. and international copyright, patent, and trade secret laws.
9 *
10 * CRYPTOGRAPHIC STANDARDS:
11 * - This software includes implementations of cryptographic algorithms such as
12 * SHA3, AES, and others. These algorithms are public domain or standardized
13 * by organizations such as NIST and are NOT the property of QRCS.
14 * - However, all source code, optimizations, and implementations in this library
15 * are original works of QRCS and are protected under this license.
16 *
17 * RESTRICTIONS:
18 * - Redistribution, modification, or unauthorized distribution of this software,
19 * in whole or in part, is strictly prohibited.
20 * - This software is provided for non-commercial, educational, and research
21 * purposes only. Commercial use in any form is expressly forbidden.
22 * - Licensing and authorized distribution are solely at the discretion of QRCS.
23 * - Any use of this software implies acceptance of these restrictions.
24 *
25 * DISCLAIMER:
26 * This software is provided "as is," without warranty of any kind, express or
27 * implied, including but not limited to warranties of merchantability or fitness
28 * for a particular purpose. QRCS disclaims all liability for any direct, indirect,
29 * incidental, or consequential damages resulting from the use or misuse of this software.
30 *
31 * FULL LICENSE:
32 * This software is subject to the **Quantum Resistant Cryptographic Solutions
33 * Proprietary License (QRCS-PL)**. The complete license terms are included
34 * in the LICENSE.txt file distributed with this software.
35 *
36 * Written by: John G. Underhill
37 * Contact: john.underhill@protonmail.com
38 */
39
40#ifndef QSC_SOCKETBASE_H
41#define QSC_SOCKETBASE_H
42
43#include "common.h"
44#include "intutils.h"
45#include "ipinfo.h"
46#include "memutils.h"
47#include "socket.h"
48
49QSC_CPLUSPLUS_ENABLED_START
50
67
68/* bogus winbase.h error */
70
71#if defined(QSC_SYSTEM_OS_WINDOWS)
72# include <WinSock2.h>
73# include <WS2tcpip.h>
74# include <ws2def.h>
75# include <objbase.h>
76# include <inaddr.h>
77# include <iphlpapi.h>
78# if defined(QSC_SYSTEM_COMPILER_MSC) && defined(QSC_SYSTEM_MAX_PATH)
79# pragma comment(lib, "iphlpapi.lib")
80# pragma comment(lib, "ws2_32.lib")
81# endif
82#elif defined(QSC_SYSTEM_OS_POSIX)
83# include <errno.h>
84# include <netdb.h>
85# include <ifaddrs.h>
86# include <netinet/in.h>
87# include <arpa/inet.h>
88# include <sys/select.h>
89# include <sys/socket.h>
90# include <string.h>
91# include <sys/types.h>
92# include <sys/un.h>
93# include <unistd.h>
94# if defined(QSC_SYSTEM_OS_LINUX)
95# include <netpacket/packet.h>
96# elif defined(QSC_SYSTEM_OS_APPLE)
97# include <net/if_dl.h>
98# include <netinet/in.h>
99//# include <netinet/in6.h>
100# if !defined(AF_PACKET)
101# define AF_PACKET PF_INET
102# endif
103# elif defined(QSC_SYSTEM_OS_UNIX)
104
105# endif
106//#else
107//# error "The operating system is not supported!"
108#endif
109
111//\def QSC_SOCKET_DUAL_IPV6_STACK
112//* \brief Enables a dual stack ipv4 and ipv6 listener.
113//*/
114//#if !defined(QSC_SOCKET_DUAL_IPV6_STACK)
115//# define QSC_SOCKET_DUAL_IPV6_STACK
116//#endif
117
118/*** Function State ***/
119
124#define QSC_SOCKET_RECEIVE_BUFFER_SIZE 1600ULL
125
129typedef enum
130{
134#if defined(QSC_SYSTEM_OS_WINDOWS)
136 qsc_socket_exception_address_required = WSAEDESTADDRREQ,
143 qsc_socket_exception_circuit_reset = WSAECONNRESET,
151 qsc_socket_exception_host_is_down = WSAEHOSTDOWN,
152 qsc_socket_exception_host_unreachable = WSAEHOSTUNREACH,
154 qsc_socket_exception_invalid_address = WSAEADDRNOTAVAIL,
155 qsc_socket_exception_invalid_parameter = WSA_INVALID_PARAMETER,
158 qsc_socket_exception_invalid_provider = WSAEINVALIDPROVIDER,
161 qsc_socket_exception_name_too_long = WSAENAMETOOLONG,
166 qsc_socket_exception_no_memory = WSA_NOT_ENOUGH_MEMORY,
169 qsc_socket_exception_not_initialized = WSANOTINITIALISED,
171 qsc_socket_exception_protocol_unsupported = WSAEPROTONOSUPPORT,
172 qsc_socket_exception_shut_down = WSAESHUTDOWN,
173 qsc_socket_exception_socket_unsupported = WSAESOCKTNOSUPPORT,
175 qsc_socket_exception_too_many_processes = WSAEPROCLIM,
178 qsc_socket_exception_would_block = WSAEWOULDBLOCK,
179#else
200 //qsc_socket_exception_invalid_parameter = EOTHER, /*!< One or more parameters are invalid */
203 //qsc_socket_exception_invalid_provider = EINVALIDPROVIDER, /*!< The service provider is invalid */
218 //qsc_socket_exception_too_many_processes = EPROCLIM, /*!< The host is using too many processes */
222
223#endif
225
229static const char QSC_SOCKET_ERROR_STRINGS[48][128] =
230{
231 "SUCCESS: The operation completed successfully.",
232 "ERROR: The operation has failed.",
233 "INVALID: The input parameters are incorrect.",
234 "EADDRINUSE: The socket's local address is in use and the socket was not marked to allow address reuse with SO_REUSEADDR.",
235 "EDESTADDRREQ: A destination address is required.",
236 "EAFNOSUPPORT: The address family is not supported.",
237 "EISCONN: The socket is already connected.",
238 "EINTR: A blocking sockets call was canceled.",
239 "EINPROGRESS: A blocking sockets call is in progress, or the service provider is still processing a callback function.",
240 "EACCES: The requested address is a broadcast address, but the appropriate flag was not set.",
241 "EFAULT: The buffer parameter is not completely contained in a valid part of the user address space.",
242 "ECONNRESET: The virtual circuit was reset by the remote side executing a hard or abortive close.",
243 "ECONNABORTED: The virtual circuit was terminated due to a time-out or other failure.",
244 "ETIMEDOUT: The connection has been dropped, because of a network failure.",
245 "ECONNREFUSED: The connection was refused.",
246 "ENOTSOCK: The descriptor is not a socket.",
247 "EDQUOT: The disk quota is exceeded.",
248 "ENETRESET: The connection has been broken due to the keep-alive activity detecting a failure.",
249 "EPFNOSUPPORT: The protocol family is not supported.",
250 "EHOSTDOWN: The destination host is down.",
251 "EHOSTUNREACH: The remote host cannot be reached from this host at this time.",
252 "EALREADY: Operation in progress.",
253 "EADDRNOTAVAIL: The address is not available.",
254 "INVALID_PARAMETER: One or more parameters are invalid.",
255 "EPROTOTYPE: The protocol type is invalid for the socket.",
256 "ENOPROTOOPT: The protocol option is invalid.",
257 "EINVALIDPROVIDER: The service provider is invalid.",
258 "EREMOTE: The item is not available locally.",
259 "EMSGSIZE: The message size is too long.",
260 "ENAMETOOLONG: The name is too long.",
261 "ENETDOWN: The network subsystem has failed.",
262 "ENETUNREACH: The network is unreachable.",
263 "ENOBUFS: No buffer space is available.",
264 "EMFILE: No more socket descriptors are available.",
265 "_NOT_ENOUGH_MEMORY: The system does not have enough memory available.",
266 "EINVAL: The socket has not been bound with bind, or MSG_OOB was specified for a socket with SO_OOBINLINE enabled.",
267 "ENOTCONN: The socket is not connected.",
268 "NOTINITIALISED: A successful Startup call must occur before using this function.",
269 "EOPNOTSUPP: The socket operation is not supported.",
270 "EPROTONOSUPPORT: The protocol is not supported.",
271 "ESHUTDOWN: The socket has been shut down.",
272 "ESOCKTNOSUPPORT: The socket type is not supported.",
273 "SYSNOTREADY: The subsystem is unavailable.",
274 "EPROCLIM: The host is using too many processes.",
275 "EUSERS: The user quota is exceeded.",
276 "ELOOP: Can not translate name.",
277 "EWOULDBLOCK: The socket is marked as nonblocking and the requested operation would block.",
278 "",
279};
280
286typedef struct
287{
288 void (*callback)(qsc_socket* sock, const uint8_t* message, size_t* msglen);
289 void (*error)(const qsc_socket* sock, qsc_socket_exceptions exception);
293
299typedef struct
300{
302 void (*callback)(qsc_socket* sock, size_t id);
303 void (*error)(qsc_socket* sock, qsc_socket_exceptions exception);
304 uint32_t count;
306
307/*** Function Prototypes ***/
308
310//* \brief The socket exception callback prototype
311//*
312//* \param source: [qsc_socket*] The socket source
313//* \param error: [qsc_socket_exceptions] The socket exception
314//*/
315//QSC_EXPORT_API void qsc_socket_exception_callback(qsc_socket* source, qsc_socket_exceptions error);
316
318//* \brief The socket receive asynchronous callback prototype
319//*
320//* \param source: [qsc_socket*] The socket source
321//* \param message: [const uint8_t*] The socket message buffer
322//* \param msglen: [size_t*] A pointer to the size of the message
323//*/
324//QSC_EXPORT_API void qsc_socket_receive_async_callback(qsc_socket* source, const uint8_t* message, size_t* msglen);
325
327//* \brief The receive polling callback prototype
328//*
329//* \param source: [const qsc_socket*] The socket source
330//* \param error: [size_t] The socket exception
331//*/
332//QSC_EXPORT_API void qsc_socket_receive_poll_callback(const qsc_socket* source, size_t error);
333
334/*** Accessors ***/
335
342QSC_EXPORT_API bool qsc_socket_ipv4_valid_address(const char* address);
343
350QSC_EXPORT_API bool qsc_socket_ipv6_valid_address(const char* address);
351
360
369
379
387
397QSC_EXPORT_API qsc_socket_exceptions qsc_socket_bind(qsc_socket* sock, const char* address, uint16_t port);
398
409
420
427
436
446QSC_EXPORT_API qsc_socket_exceptions qsc_socket_connect(qsc_socket* sock, const char* address, uint16_t port);
447
458
469
481
491
500
510QSC_EXPORT_API size_t qsc_socket_peek(const qsc_socket* sock, uint8_t* output, size_t otplen);
511
524QSC_EXPORT_API size_t qsc_socket_receive(const qsc_socket* sock, uint8_t* output, size_t otplen, qsc_socket_receive_flags flag);
525
534
545QSC_EXPORT_API size_t qsc_socket_receive_all(const qsc_socket* sock, uint8_t* output, size_t otplen, qsc_socket_receive_flags flag);
546
559QSC_EXPORT_API size_t qsc_socket_receive_from(qsc_socket* sock, char* dest, uint16_t port, uint8_t* output, size_t otplen, qsc_socket_receive_flags flag);
560
570
583QSC_EXPORT_API size_t qsc_socket_send(const qsc_socket* sock, const uint8_t* input, size_t inplen, qsc_socket_send_flags flag);
584
595QSC_EXPORT_API size_t qsc_socket_send_to(const qsc_socket* sock, const uint8_t* input, size_t inplen, qsc_socket_send_flags flag);
596
607QSC_EXPORT_API size_t qsc_socket_send_all(const qsc_socket* sock, const uint8_t* input, size_t inplen, qsc_socket_send_flags flag);
608
618
619/*~~~ Helper Functions ~~~*/
620
628
635
645QSC_EXPORT_API qsc_socket_exceptions qsc_socket_ioctl(const qsc_socket* sock, int32_t command, uint32_t* arguments);
646
655QSC_EXPORT_API bool qsc_socket_receive_ready(const qsc_socket* sock, const struct timeval* timeout);
656
665QSC_EXPORT_API bool qsc_socket_send_ready(const qsc_socket* sock, const struct timeval* timeout);
666
673
680
693
700
701QSC_CPLUSPLUS_ENABLED_END
702
703#endif
Contains common definitions for the Quantum Secure Cryptographic (QSC) library.
#define QSC_EXPORT_API
API export macro for Microsoft compilers when importing from a DLL.
Definition common.h:520
#define QSC_SYSTEM_CONDITION_IGNORE(x)
MSVC-specific macro to disable a specific warning condition.
Definition common.h:784
This file contains common integer manipulation and conversion functions.
IP information function definitions.
Contains common memory-related functions implemented using SIMD instructions.
TCP/IP function constants and structures.
QSC_EXPORT_API size_t qsc_socket_receive(const qsc_socket *sock, uint8_t *output, size_t otplen, qsc_socket_receive_flags flag)
Receive data from a synchronous connected socket or a bound connection-less socket....
Definition socketbase.c:564
QSC_EXPORT_API qsc_socket_exceptions qsc_socket_ioctl(const qsc_socket *sock, int32_t command, uint32_t *arguments)
Sets the IO mode of the socket.
Definition socketbase.c:1098
QSC_EXPORT_API bool qsc_socket_start_sockets(void)
Start the sockets library.
Definition socketbase.c:1227
QSC_EXPORT_API qsc_socket_exceptions qsc_socket_accept(const qsc_socket *source, qsc_socket *target)
The Accept function handles an incoming connection attempt on the socket.
Definition socketbase.c:173
QSC_EXPORT_API qsc_socket_exceptions qsc_socket_connect_ipv4(qsc_socket *sock, const qsc_ipinfo_ipv4_address *address, uint16_t port)
The Connect function establishes a connection to a remote host using IPv4 addressing.
Definition socketbase.c:391
QSC_EXPORT_API void qsc_socket_clear_socket(qsc_socket *sock)
Erases the socket struture.
Definition socketbase.c:321
QSC_EXPORT_API bool qsc_socket_send_ready(const qsc_socket *sock, const struct timeval *timeout)
Tests the socket to see if it is ready to send data.
Definition socketbase.c:1153
qsc_socket_exceptions
Socket code enumeration names.
Definition socketbase.h:130
@ qsc_socket_exception_would_block
Definition socketbase.h:221
@ qsc_socket_exception_broadcast_address
Definition socketbase.h:186
@ qsc_socket_exception_socket_unsupported
Definition socketbase.h:215
@ qsc_socket_exception_circuit_terminated
Definition socketbase.h:188
@ qsc_socket_exception_buffer_fault
Definition socketbase.h:187
@ qsc_socket_exception_message_too_long
Definition socketbase.h:205
@ qsc_socket_exception_address_unsupported
Definition socketbase.h:182
@ qsc_socket_exception_invalid_protocol_option
Definition socketbase.h:202
@ qsc_socket_exception_address_required
Definition socketbase.h:181
@ qsc_socket_exception_already_in_use
Definition socketbase.h:183
@ qsc_socket_exception_blocking_in_progress
Definition socketbase.h:185
@ qsc_socket_exception_no_descriptors
Definition socketbase.h:210
@ qsc_socket_exception_host_is_down
Definition socketbase.h:196
@ qsc_socket_exception_connection_refused
Definition socketbase.h:191
@ qsc_socket_exception_operation_unsupported
Definition socketbase.h:213
@ qsc_socket_exception_shut_down
Definition socketbase.h:216
@ qsc_socket_exception_disk_quota_exceeded
Definition socketbase.h:193
@ qsc_socket_exception_item_is_remote
Definition socketbase.h:204
@ qsc_socket_exception_circuit_timeout
Definition socketbase.h:190
@ qsc_socket_invalid_input
Definition socketbase.h:133
@ qsc_socket_exception_name_too_long
Definition socketbase.h:206
@ qsc_socket_exception_host_unreachable
Definition socketbase.h:197
@ qsc_socket_exception_dropped_connection
Definition socketbase.h:194
@ qsc_socket_exception_invalid_address
Definition socketbase.h:199
@ qsc_socket_exception_system_not_ready
Definition socketbase.h:217
@ qsc_socket_exception_not_connected
Definition socketbase.h:212
@ qsc_socket_exception_error
Definition socketbase.h:132
@ qsc_socket_exception_not_bound
Definition socketbase.h:211
@ qsc_socket_exception_success
Definition socketbase.h:131
@ qsc_socket_exception_too_many_users
Definition socketbase.h:219
@ qsc_socket_exception_family_unsupported
Definition socketbase.h:195
@ qsc_socket_exception_blocking_cancelled
Definition socketbase.h:184
@ qsc_socket_exception_circuit_reset
Definition socketbase.h:189
@ qsc_socket_exception_protocol_unsupported
Definition socketbase.h:214
@ qsc_socket_exception_invalid_protocol
Definition socketbase.h:201
@ qsc_socket_exception_descriptor_not_socket
Definition socketbase.h:192
@ qsc_socket_exception_address_in_use
Definition socketbase.h:180
@ qsc_socket_exception_network_failure
Definition socketbase.h:207
@ qsc_socket_exception_no_buffer_space
Definition socketbase.h:209
@ qsc_socket_exception_in_progress
Definition socketbase.h:198
@ qsc_socket_exception_translation_failed
Definition socketbase.h:220
@ qsc_socket_exception_network_unreachable
Definition socketbase.h:208
QSC_EXPORT_API qsc_socket_exceptions qsc_socket_bind_ipv6(qsc_socket *sock, const qsc_ipinfo_ipv6_address *address, uint16_t port)
The Bind function associates an IPv6 address with a socket.
Definition socketbase.c:279
#define QSC_SOCKET_RECEIVE_BUFFER_SIZE
The socket receive buffer size.
Definition socketbase.h:124
QSC_EXPORT_API qsc_socket_exceptions qsc_socket_bind_ipv4(qsc_socket *sock, const qsc_ipinfo_ipv4_address *address, uint16_t port)
The Bind function associates an IPv4 address with a socket.
Definition socketbase.c:238
QSC_EXPORT_API void qsc_socket_attach(qsc_socket *source, qsc_socket *target)
Copy a socket to the target socket.
Definition socketbase.c:202
QSC_EXPORT_API qsc_socket_exceptions qsc_socket_create(qsc_socket *sock, qsc_socket_address_families family, qsc_socket_transports transport, qsc_socket_protocols protocol)
The Create function creates a socket that is bound to a specific transport provider.
Definition socketbase.c:467
QSC_EXPORT_API size_t qsc_socket_receive_all(const qsc_socket *sock, uint8_t *output, size_t otplen, qsc_socket_receive_flags flag)
Receive a block of data from a synchronous connected socket or a bound connection-less socket,...
Definition socketbase.c:657
QSC_EXPORT_API void qsc_socket_set_last_error(qsc_socket_exceptions error)
Set the last error generated by the socket library.
Definition socketbase.c:1184
QSC_EXPORT_API qsc_socket_exceptions qsc_socket_listen(const qsc_socket *sock, int32_t backlog)
Places the socket in the listening state, waiting for a connection.
Definition socketbase.c:498
QSC_EXPORT_API size_t qsc_socket_receive_from(qsc_socket *sock, char *dest, uint16_t port, uint8_t *output, size_t otplen, qsc_socket_receive_flags flag)
Receive data from a synchronous connected socket or a bound connection-less socket.
Definition socketbase.c:687
QSC_EXPORT_API uint32_t qsc_socket_receive_poll(const qsc_socket_receive_poll_state *state)
Polls an array of sockets. Fires a callback if a socket is ready to receive data, or an error if sock...
Definition socketbase.c:622
QSC_EXPORT_API qsc_socket_exceptions qsc_socket_connect(qsc_socket *sock, const char *address, uint16_t port)
The Connect function establishes a connection to a remote host.
Definition socketbase.c:363
QSC_EXPORT_API bool qsc_socket_is_blocking(const qsc_socket *sock)
Determines if the socket is in blocking mode.
Definition socketbase.c:136
QSC_EXPORT_API qsc_socket_exceptions qsc_socket_connect_ipv6(qsc_socket *sock, const qsc_ipinfo_ipv6_address *address, uint16_t port)
The Connect function establishes a connection to a remote host using IPv6 addressing.
Definition socketbase.c:429
QSC_EXPORT_API size_t qsc_socket_max_send_buffer_size(const qsc_socket *sock)
Get the maximum send buffer size for a socket.
Definition socketbase.c:519
QSC_EXPORT_API qsc_socket_exceptions qsc_socket_close_socket(qsc_socket *sock)
Closes and disposes of the socket.
Definition socketbase.c:335
QSC_EXPORT_API size_t qsc_socket_send_all(const qsc_socket *sock, const uint8_t *input, size_t inplen, qsc_socket_send_flags flag)
Sends a block of data larger than a single packet size, on a TCP socket and returns when sent.
Definition socketbase.c:804
QSC_EXPORT_API qsc_socket_exceptions qsc_socket_bind(qsc_socket *sock, const char *address, uint16_t port)
The Bind function associates an IP address with a socket.
Definition socketbase.c:212
QSC_EXPORT_API qsc_socket_exceptions qsc_socket_shut_down(qsc_socket *sock, qsc_socket_shut_down_flags params)
Shuts down a socket.
Definition socketbase.c:834
QSC_EXPORT_API bool qsc_socket_receive_ready(const qsc_socket *sock, const struct timeval *timeout)
Tests the socket to see if it is ready to receive data.
Definition socketbase.c:1124
QSC_EXPORT_API size_t qsc_socket_peek(const qsc_socket *sock, uint8_t *output, size_t otplen)
Receive data from a synchronous connected socket or a bound connection-less socket without downloadin...
Definition socketbase.c:546
QSC_EXPORT_API qsc_socket_exceptions qsc_socket_shut_down_sockets(void)
Shut down the sockets library.
Definition socketbase.c:1193
QSC_EXPORT_API bool qsc_socket_ipv4_valid_address(const char *address)
The socket exception callback prototype.
Definition socketbase.c:98
QSC_EXPORT_API const char * qsc_socket_error_to_string(qsc_socket_exceptions code)
Returns the error string associated with the exception code.
Definition socketbase.c:860
QSC_EXPORT_API qsc_socket_exceptions qsc_socket_receive_async(qsc_socket_receive_async_state *state)
Receive data from a connected socket asynchronously.
Definition socketbase.c:606
QSC_EXPORT_API bool qsc_socket_is_connected(const qsc_socket *sock)
Determines if the socket is connected.
Definition socketbase.c:153
QSC_EXPORT_API size_t qsc_socket_send(const qsc_socket *sock, const uint8_t *input, size_t inplen, qsc_socket_send_flags flag)
Sends data on a TCP connected socket. Note: The input buffer must be at least 1 byte longer than the ...
Definition socketbase.c:750
QSC_EXPORT_API size_t qsc_socket_send_to(const qsc_socket *sock, const uint8_t *input, size_t inplen, qsc_socket_send_flags flag)
Sends data on a UDP socket.
Definition socketbase.c:768
QSC_EXPORT_API qsc_socket_exceptions qsc_socket_get_last_error(void)
The last error generated by the internal socket library.
Definition socketbase.c:1085
QSC_EXPORT_API qsc_socket_exceptions qsc_socket_set_option(const qsc_socket *sock, qsc_socket_protocols level, qsc_socket_options option, int32_t optval)
Send an option command to the socket. Options that use a boolean are format: 0=false,...
Definition socketbase.c:1206
QSC_EXPORT_API bool qsc_socket_ipv6_valid_address(const char *address)
Detects if the string contains a valid IPV6 address.
Definition socketbase.c:117
qsc_socket_options
TCP socket options.
Definition socketflags.h:90
qsc_socket_transports
The socket transmission type.
Definition socketflags.h:165
qsc_socket_shut_down_flags
The socket shutdown api flags.
Definition socketflags.h:155
qsc_socket_address_families
The socket address family type.
Definition socketflags.h:68
qsc_socket_receive_flags
The socket receive api flags.
Definition socketflags.h:127
qsc_socket_send_flags
The socket send api flags.
Definition socketflags.h:144
qsc_socket_protocols
The socket IP protocol type.
Definition socketflags.h:108
The IPv4 address structure.
Definition ipinfo.h:150
The IPv6 address structure.
Definition ipinfo.h:309
The socket async receive state structure. The structure contains pointers to the originating socket,...
Definition socketbase.h:287
void(* callback)(qsc_socket *sock, const uint8_t *message, size_t *msglen)
Definition socketbase.h:288
void(* error)(const qsc_socket *sock, qsc_socket_exceptions exception)
Definition socketbase.h:289
uint8_t buffer[QSC_SOCKET_RECEIVE_BUFFER_SIZE]
Definition socketbase.h:291
qsc_socket * source
Definition socketbase.h:290
The socket polling state structure. The structure contains an array of client sockets,...
Definition socketbase.h:300
uint32_t count
Definition socketbase.h:304
void(* error)(qsc_socket *sock, qsc_socket_exceptions exception)
Definition socketbase.h:303
qsc_socket ** sockarr
Definition socketbase.h:301
void(* callback)(qsc_socket *sock, size_t id)
Definition socketbase.h:302
The socket instance structure.
Definition socket.h:121