PQS: Post Quantum Shell 1.0.0.0a (A1)
A quantum safe shell application
client.h File Reference

PQS Client functions. More...

#include "pqs.h"
#include "../../QSC/QSC/rcs.h"
#include "../../QSC/QSC/socketclient.h"

Go to the source code of this file.

Functions

PQS_EXPORT_API pqs_errors pqs_client_connect_ipv4 (const pqs_client_verification_key *pubk, const qsc_ipinfo_ipv4_address *address, uint16_t port, void(*send_func)(pqs_connection_state *), void(*receive_callback)(pqs_connection_state *, const uint8_t *, size_t))
 Connect to the remote server using IPv4 and perform the key exchange.
 
PQS_EXPORT_API pqs_errors pqs_client_connect_ipv6 (const pqs_client_verification_key *pubk, const qsc_ipinfo_ipv6_address *address, uint16_t port, void(*send_func)(pqs_connection_state *), void(*receive_callback)(pqs_connection_state *, const uint8_t *, size_t))
 Connect to the remote server using IPv6 and perform the key exchange.
 

Detailed Description

PQS Client functions.

This header defines the functions used to implement the Post Quantum Shell (PQS) client. The client is responsible for connecting to a remote PQS server using either an IPv4 or IPv6 address, performing the simplex key exchange, and managing the send and receive operations through callback functions.

The public API includes the following functions:

  • pqs_client_connect_ipv4: Establishes a connection to a remote server using an IPv4 address.
  • pqs_client_connect_ipv6: Establishes a connection to a remote server using an IPv6 address.

Both functions initialize the PQS client state, perform the key exchange, and then invoke callback functions to run the send loop (on the main thread) and the receive loop (on a new thread). In case of errors during connection, key exchange, or data transmission, appropriate error logging is performed and the connection is terminated.

Function Documentation

◆ pqs_client_connect_ipv4()

PQS_EXPORT_API pqs_errors pqs_client_connect_ipv4 ( const pqs_client_verification_key * pubk,
const qsc_ipinfo_ipv4_address * address,
uint16_t port,
void(* send_func )(pqs_connection_state *),
void(* receive_callback )(pqs_connection_state *, const uint8_t *, size_t) )

Connect to the remote server using IPv4 and perform the key exchange.

This function attempts to establish a connection to the remote PQS server using the provided IPv4 address and port number. After a successful connection, it performs the client key exchange, and returns the connected socket and PQS client state via callback functions. On success, the function returns pqs_error_none; otherwise, it returns the appropriate error code.

Parameters
pubk[const] Pointer to the client's public signature verification key.
address[const] Pointer to the server's IPv4 address.
portThe PQS application port number (typically PQS_SERVER_PORT).
send_funcPointer to the send callback function which contains the message send loop.
receive_callbackPointer to the receive callback function used to process the incoming server data stream.
Returns
A pqs_errors value indicating the outcome of the connection and key exchange process.

DOXYGEN_IGNORE DOXYGEN_IGNORE

◆ pqs_client_connect_ipv6()

PQS_EXPORT_API pqs_errors pqs_client_connect_ipv6 ( const pqs_client_verification_key * pubk,
const qsc_ipinfo_ipv6_address * address,
uint16_t port,
void(* send_func )(pqs_connection_state *),
void(* receive_callback )(pqs_connection_state *, const uint8_t *, size_t) )

Connect to the remote server using IPv6 and perform the key exchange.

This function attempts to establish a connection to the remote PQS server using the provided IPv6 address and port number. Following a successful connection, it carries out the client key exchange, and returns the connected socket and PQS client state via callback functions. On success, the function returns pqs_error_none; if any error occurs during the process, an appropriate error code is returned.

Parameters
pubk[const] Pointer to the client's public signature verification key.
address[const] Pointer to the server's IPv6 address.
portThe PQS application port number (typically PQS_SERVER_PORT).
send_funcPointer to the send callback function which contains the message send loop.
receive_callbackPointer to the receive callback function used to process the incoming server data stream.
Returns
A pqs_errors value indicating the outcome of the connection and key exchange process.