DKTP: Dual Key Tunneling Protocol 1.0.0.0a (A1)
A quantum secure dual-key encrypted tunneling protocol
|
DKTP Server functions. More...
Go to the source code of this file.
Macros | |
#define | DKTP_SERVER_PAUSE_INTERVAL 100U |
The pause interval used by the server pause function. |
Functions | |
DKTP_EXPORT_API void | dktp_server_broadcast (const uint8_t *message, size_t msglen) |
Broadcast a message to all connected hosts. | |
DKTP_EXPORT_API void | dktp_server_pause (void) |
Pause the server. | |
DKTP_EXPORT_API void | dktp_server_quit (void) |
Quit the server. | |
DKTP_EXPORT_API void | dktp_server_resume (void) |
Resume the server listener. | |
DKTP_EXPORT_API dktp_errors | dktp_server_start_ipv4 (qsc_socket *source, const dktp_local_peer_key *lpk, void(*receive_callback)(dktp_connection_state *, const uint8_t *, size_t), void(*disconnect_callback)(dktp_connection_state *)) |
Start the IPv4 multi-threaded server. | |
DKTP_EXPORT_API dktp_errors | dktp_server_start_ipv6 (qsc_socket *source, const dktp_local_peer_key *lpk, void(*receive_callback)(dktp_connection_state *, const uint8_t *, size_t), void(*disconnect_callback)(dktp_connection_state *)) |
Start the IPv6 multi-threaded server. |
DKTP Server functions.
This header declares the functions used to implement the server component of the Dual Key Tunneling Protocol (DKTP). The server functions manage client connections, broadcast messages, and control the server lifecycle through operations such as pausing, resuming, and quitting. DKTP employs a multi-threaded server design that supports both IPv4 and IPv6 connections.
The functions provided in this header include:
#define DKTP_SERVER_PAUSE_INTERVAL 100U |
The pause interval used by the server pause function.
This macro defines the time interval (in milliseconds) that the server will pause before resuming operations or processing new connection requests.
DKTP_EXPORT_API void dktp_server_broadcast | ( | const uint8_t * | message, |
size_t | msglen ) |
Broadcast a message to all connected hosts.
This function iterates over all active connections managed by the server and transmits the specified message to each connected host. It is useful for disseminating announcements or control messages across the network.
message | [const] A pointer to the message data to be broadcast. |
msglen | The length (in bytes) of the message. |
DKTP_EXPORT_API void dktp_server_pause | ( | void | ) |
Pause the server.
This function temporarily suspends the acceptance of new client connections. While paused, the server continues to service existing connections but does not allow any new joins until it is resumed.
DKTP_EXPORT_API void dktp_server_quit | ( | void | ) |
Quit the server.
This function gracefully shuts down the server by closing all active client connections and terminating the server's listener. It is used to perform a complete shutdown of the server operations.
DKTP_EXPORT_API void dktp_server_resume | ( | void | ) |
Resume the server listener.
This function resumes the server's listener functionality after it has been paused. Once resumed, the server will once again accept new incoming client connections.
DKTP_EXPORT_API dktp_errors dktp_server_start_ipv4 | ( | qsc_socket * | source, |
const dktp_local_peer_key * | lpk, | ||
void(* | receive_callback )(dktp_connection_state *, const uint8_t *, size_t), | ||
void(* | disconnect_callback )(dktp_connection_state *) ) |
Start the IPv4 multi-threaded server.
This function initializes and starts the DKTP server for IPv4 connections using a multi-threaded architecture. It listens on the provided socket and uses the specified DKTP private key for secure key exchange and authentication. Two callback functions are provided:
source | A pointer to the listener socket used by the server. |
lpk | [const] A pointer to the DKTP server private signature key used for key exchange. |
receive_callback | A pointer to the function that processes incoming client data. |
disconnect_callback | A pointer to the function that handles client disconnect events. |
DKTP_EXPORT_API dktp_errors dktp_server_start_ipv6 | ( | qsc_socket * | source, |
const dktp_local_peer_key * | lpk, | ||
void(* | receive_callback )(dktp_connection_state *, const uint8_t *, size_t), | ||
void(* | disconnect_callback )(dktp_connection_state *) ) |
Start the IPv6 multi-threaded server.
This function initializes and starts the DKTP server for IPv6 connections using a multi-threaded design. It listens on the provided IPv6 socket and employs the specified DKTP private key for secure communications. The server uses two callback functions to process incoming client data and handle disconnect events.
source | A pointer to the listener socket used by the server. |
lpk | [const] A pointer to the DKTP server private signature key used for key exchange and authentication. |
receive_callback | A pointer to the function that processes incoming client data. |
disconnect_callback | A pointer to the function that handles client disconnect events. |