QSC Post Quantum Cryptographic Library 1.0.0.6c (A6)
A post quantum secure library written in Ansi C
 
Loading...
Searching...
No Matches
socket.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_SOCKET_H
41#define QSC_SOCKET_H
42
43#include "common.h"
44#include "socketflags.h"
45
46QSC_CPLUSPLUS_ENABLED_START
47
52
57#define QSC_SOCKET_ADDRESS_MAX_SIZE 65ULL
58
63#define QSC_SOCKET_MAX_CONN 0x7FFFFFFFL
64
69#define QSC_SOCKET_RET_ERROR -1LL
70
75#define QSC_SOCKET_RET_SUCCESS 0LL
76
81#define QSC_SOCKET_TERMINATOR_SIZE 1ULL
82
87#define QSC_SOCKET_TIMEOUT_MSEC 10000ULL
88
89#if defined(QSC_SYSTEM_OS_WINDOWS)
94typedef int32_t socklen_t;
95#endif
96
101#if defined(QSC_SYSTEM_OS_WINDOWS)
102typedef uintptr_t socket_t;
103#else
104typedef int32_t socket_t;
105#endif
106
111#if defined(QSC_SYSTEM_OS_WINDOWS)
112 static const socket_t QSC_UNINITIALIZED_SOCKET = (uintptr_t)~0;
113#else
114 static const int32_t QSC_UNINITIALIZED_SOCKET = -1;
115#endif
116
131
132QSC_CPLUSPLUS_ENABLED_END
133
134#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_SOCKET_ADDRESS_MAX_SIZE
Definition socket.h:57
int32_t socket_t
Definition socket.h:104
The socket flags enumerations.
qsc_socket_transports
The socket transmission type.
Definition socketflags.h:165
qsc_socket_states
The socket instance current connection state.
Definition socketflags.h:79
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
The socket instance structure.
Definition socket.h:121
int8_t address[QSC_SOCKET_ADDRESS_MAX_SIZE]
Definition socket.h:123
qsc_socket_address_families address_family
Definition socket.h:126
uint16_t port
Definition socket.h:125
uint32_t instance
Definition socket.h:124
qsc_socket_states connection_status
Definition socket.h:127
qsc_socket_protocols socket_protocol
Definition socket.h:128
qsc_socket_transports socket_transport
Definition socket.h:129
socket_t connection
Definition socket.h:122