Quantum Secure Tunneling Protocol 1.0.0.0a (A1)
A three-party quantum secure encrypted tunneling protocol
|
QSTP Server functions. More...
Go to the source code of this file.
Macros | |
#define | QSTP_SERVER_PAUSE_INTERVAL 100 |
The pause interval (in milliseconds) used by the server pause function. | |
Functions | |
QSTP_EXPORT_API bool | qstp_server_expiration_check (const qstp_server_signature_key *kset) |
Check the expiration status of a server key. | |
QSTP_EXPORT_API void | qstp_server_key_generate (qstp_server_signature_key *kset, const char issuer[QSTP_CERTIFICATE_ISSUER_SIZE], uint32_t exp) |
Generate a new signature key for the server. | |
QSTP_EXPORT_API void | qstp_server_pause (void) |
Pause the server, suspending new connection joins. | |
QSTP_EXPORT_API void | qstp_server_quit (void) |
Quit the server, closing all active connections. | |
QSTP_EXPORT_API void | qstp_server_resume (void) |
Resume the server listener function from a paused state. | |
QSTP_EXPORT_API qstp_errors | qstp_server_start_ipv4 (qsc_socket *source, const qstp_server_signature_key *kset, void(*receive_callback)(qstp_connection_state *, const char *, size_t), void(*disconnect_callback)(qstp_connection_state *)) |
Start the IPv4 multi-threaded server. | |
QSTP_EXPORT_API qstp_errors | qstp_server_start_ipv6 (qsc_socket *source, const qstp_server_signature_key *kset, void(*receive_callback)(qstp_connection_state *, const char *, size_t), void(*disconnect_callback)(qstp_connection_state *)) |
Start the IPv6 multi-threaded server. | |
QSTP Server functions.
This header declares functions that implement the server-side operations in the Quantum Secure Messaging Protocol (QSTP). The functions defined here manage the server's lifecycle and connection handling, including key expiration checks, key generation, pausing/resuming the server, and starting the multi-threaded server for both IPv4 and IPv6 networks. These operations ensure that the server can properly authenticate itself, manage its connections, and handle client communications according to the protocol requirements.
QSTP_EXPORT_API bool qstp_server_expiration_check | ( | const qstp_server_signature_key * | kset | ) |
Check the expiration status of a server key.
This function examines the expiration time of a given QSTP server signature key to determine if the key is still valid.
kset | A pointer to the QSTP server signature key to be checked. |
QSTP_EXPORT_API void qstp_server_key_generate | ( | qstp_server_signature_key * | kset, |
const char | issuer[QSTP_CERTIFICATE_ISSUER_SIZE], | ||
uint32_t | exp ) |
Generate a new signature key for the server.
This function generates a new QSTP signature key for the server. It fills in the provided server signature key structure using the specified issuer name and expiration period (in days). The generated key will be used for signing operations in the key exchange and authentication processes.
kset | A pointer to the QSTP server signature key structure to be generated. |
issuer | [const] A pointer to the issuer string; its length must match QSTP_CERTIFICATE_ISSUER_SIZE. |
exp | The expiration period (in days) for which the key will be valid. |
QSTP_EXPORT_API void qstp_server_pause | ( | void | ) |
Pause the server, suspending new connection joins.
This function temporarily suspends the server's listener, preventing new clients from joining. Existing connections are maintained while the server is paused.
QSTP_EXPORT_API void qstp_server_quit | ( | void | ) |
Quit the server, closing all active connections.
This function shuts down the server by closing all active connections and terminating the listener. It is used to gracefully exit the server operation.
QSTP_EXPORT_API void qstp_server_resume | ( | void | ) |
Resume the server listener function from a paused state.
This function resumes the server's listener after it has been paused, allowing new client connections to be accepted.
QSTP_EXPORT_API qstp_errors qstp_server_start_ipv4 | ( | qsc_socket * | source, |
const qstp_server_signature_key * | kset, | ||
void(* | receive_callback )(qstp_connection_state *, const char *, size_t), | ||
void(* | disconnect_callback )(qstp_connection_state *) ) |
Start the IPv4 multi-threaded server.
This function starts the QSTP server on an IPv4 network interface using a multi-threaded model. It listens for incoming client connections on the specified listener socket and uses the provided QSTP private key for authentication and key exchange. The function also accepts callback functions to process incoming data and handle disconnect events.
source | A pointer to the listener server socket. |
kset | [const] A pointer to the QSTP server signature key (private key) used for authentication. |
receive_callback | A pointer to the callback function for processing incoming data from clients. |
disconnect_callback | A pointer to the callback function that is invoked when a client disconnects. |
qstp_errors
indicating the outcome of starting the IPv4 server. QSTP_EXPORT_API qstp_errors qstp_server_start_ipv6 | ( | qsc_socket * | source, |
const qstp_server_signature_key * | kset, | ||
void(* | receive_callback )(qstp_connection_state *, const char *, size_t), | ||
void(* | disconnect_callback )(qstp_connection_state *) ) |
Start the IPv6 multi-threaded server.
This function starts the QSTP server on an IPv6 network interface using a multi-threaded model. It listens for incoming client connections on the specified listener socket and uses the provided QSTP private key for authentication and key exchange. The function also accepts callback functions to process incoming data and handle disconnect events.
source | A pointer to the listener server socket. |
kset | [const] A pointer to the QSTP server signature key (private key) used for authentication. |
receive_callback | A pointer to the callback function for processing incoming data from clients. |
disconnect_callback | A pointer to the callback function that is invoked when a client disconnects. |
qstp_errors
indicating the outcome of starting the IPv6 server.