QSC Post Quantum Cryptographic Library 1.0.0.6c (A6)
A post quantum secure library written in Ansi C
 
Loading...
Searching...
No Matches
socketserver.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_SOCKETSERVER_H
41#define QSC_SOCKETSERVER_H
42
43#include "common.h"
44#include "socketbase.h"
45
46QSC_CPLUSPLUS_ENABLED_START
47
85
90#define QSC_SOCKET_SERVER_LISTEN_BACKLOG 128ULL
91
96#define QSC_SOCKET_SERVER_MAX_THREADS 1024ULL
97
98/*** Structures ***/
99
107
121
122/*** Function Prototypes ***/
123
130
138
139/*** Accessors ***/
140
149
158
167
174
181
194QSC_EXPORT_API qsc_socket_exceptions qsc_socket_server_listen(qsc_socket* source, qsc_socket* target, const char* address, uint16_t port, qsc_socket_address_families family);
195
208
221
233
244
255
266
273
274QSC_CPLUSPLUS_ENABLED_END
275
276#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
Socket function definitions.
qsc_socket_exceptions
Socket code enumeration names.
Definition socketbase.h:130
qsc_socket_options
TCP socket options.
Definition socketflags.h:90
qsc_socket_transports
The socket transmission type.
Definition socketflags.h:165
qsc_socket_address_families
The socket address family type.
Definition socketflags.h:68
qsc_socket_protocols
The socket IP protocol type.
Definition socketflags.h:108
QSC_EXPORT_API qsc_socket_exceptions qsc_socket_server_listen_async(qsc_socket_server_async_accept_state *state, const char *address, uint16_t port, qsc_socket_address_families family)
Places the socket in an asynchronous listening state.
Definition socketserver.c:230
QSC_EXPORT_API qsc_socket_protocols qsc_socket_server_socket_protocol(const qsc_socket *sock)
Get the socket protocol type.
Definition socketserver.c:22
QSC_EXPORT_API qsc_socket_exceptions qsc_socket_server_listen_ipv4(qsc_socket *source, qsc_socket *target, const qsc_ipinfo_ipv4_address *address, uint16_t port)
Places the source IPv4 socket in a blocking listening state, and waits for a connection....
Definition socketserver.c:118
QSC_EXPORT_API void qsc_socket_server_set_options(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 socketserver.c:341
QSC_EXPORT_API qsc_socket_exceptions qsc_socket_server_listen_async_ipv6(qsc_socket_server_async_accept_state *state, const qsc_ipinfo_ipv6_address *address, uint16_t port)
Places the IPv6 socket in an asynchronous listening state.
Definition socketserver.c:299
QSC_EXPORT_API void qsc_socket_server_accept_callback(qsc_socket_server_accept_result *ares)
The socket server accept callback prototype.
QSC_EXPORT_API qsc_socket_exceptions qsc_socket_server_listen_ipv6(qsc_socket *source, qsc_socket *target, const qsc_ipinfo_ipv6_address *address, uint16_t port)
Places the source IPv6 socket in a blocking listening state, and waits for a connection....
Definition socketserver.c:151
QSC_EXPORT_API qsc_socket_exceptions qsc_socket_server_listen(qsc_socket *source, qsc_socket *target, const char *address, uint16_t port, qsc_socket_address_families family)
Places the source socket in a blocking listening state, and waits for a connection....
Definition socketserver.c:81
QSC_EXPORT_API qsc_socket_transports qsc_socket_server_socket_transport(const qsc_socket *sock)
Get the socket transport type.
Definition socketserver.c:38
QSC_EXPORT_API void qsc_socket_server_shut_down(qsc_socket *sock)
Shut down the server.
Definition socketserver.c:351
QSC_EXPORT_API void qsc_socket_server_initialize(qsc_socket *sock)
Initialize the server socket.
Definition socketserver.c:65
QSC_EXPORT_API void qsc_socket_server_close_socket(qsc_socket *sock)
Shut down channels and close the socket.
Definition socketserver.c:54
QSC_EXPORT_API qsc_socket_exceptions qsc_socket_server_listen_async_ipv4(qsc_socket_server_async_accept_state *state, const qsc_ipinfo_ipv4_address *address, uint16_t port)
Places the IPv4 socket in an asynchronous listening state.
Definition socketserver.c:266
QSC_EXPORT_API void qsc_socket_server_error_callback(const qsc_socket *source, qsc_socket_exceptions error)
The socket server error callback prototype.
QSC_EXPORT_API qsc_socket_address_families qsc_socket_server_address_family(const qsc_socket *sock)
Get the sockets address family, IPv4 or IPv6.
Definition socketserver.c:6
The IPv4 address structure.
Definition ipinfo.h:150
The IPv6 address structure.
Definition ipinfo.h:309
The async socket result structure.
Definition socketserver.h:104
qsc_socket target
Definition socketserver.h:105
The async listener-accept state structure. The structure contains a pointer to the listener socket,...
Definition socketserver.h:116
void(* callback)(qsc_socket_server_accept_result *result)
Definition socketserver.h:118
void(* error)(qsc_socket *sock, qsc_socket_exceptions exception)
Definition socketserver.h:119
qsc_socket * source
Definition socketserver.h:117
The socket instance structure.
Definition socket.h:121