MPDC: Multi Party Domain Cryptosystem 1.0.0.0b (A0)
MPDC Interior protocol
server.h File Reference

The common MPDC server functions. More...

#include "common.h"
#include "certificate.h"
#include "commands.h"
#include "logger.h"
#include "mpdc.h"
#include "topology.h"
#include "../../QSC/QSC/collection.h"

Go to the source code of this file.

Data Structures

struct  mpdc_server_application_state
 The MPDC server state. More...
 

Macros

#define MPDC_SERVER_MINIMUM_COMMAND_LENGTH   4
 The minimum valid length for a server command.
 
#define MPDC_SERVER_APPLICATION_STATE_SIZE
 Calculates the size of the MPDC server application state.
 

Typedefs

typedef MPDC_EXPORT_API enum mpdc_server_server_loop_status mpdc_server_server_loop_status
 
typedef MPDC_EXPORT_API struct mpdc_server_application_state mpdc_server_application_state
 

Enumerations

enum  mpdc_server_server_loop_status { mpdc_server_loop_status_stopped = 0x00 , mpdc_server_loop_status_started = 0x01 , mpdc_server_loop_status_paused = 0x02 }
 The MPDC server loop status. More...
 

Functions

MPDC_EXPORT_API void mpdc_server_certificate_directory (const mpdc_server_application_state *state, char *dpath, size_t pathlen)
 Get the full delimited path to the certificate storage directory.
 
MPDC_EXPORT_API void mpdc_server_certificate_path (const mpdc_server_application_state *state, char *fpath, size_t pathlen, const char *issuer)
 Get the full path to a certificate.
 
MPDC_EXPORT_API bool mpdc_server_child_certificate_export (const mpdc_server_application_state *state, const char *dpath)
 Export the local certificate to a file.
 
MPDC_EXPORT_API bool mpdc_server_child_certificate_from_issuer (mpdc_child_certificate *ccert, const mpdc_server_application_state *state, const char *issuer)
 Get the certificate instance from file using the issuer string.
 
MPDC_EXPORT_API bool mpdc_server_child_certificate_from_serial (mpdc_child_certificate *ccert, const mpdc_server_application_state *state, const uint8_t *serial)
 Get the certificate instance from file using the serial number.
 
MPDC_EXPORT_API void mpdc_server_child_certificate_generate (mpdc_server_application_state *state, mpdc_child_certificate *ccert, uint64_t period)
 Generate a new child certificate.
 
MPDC_EXPORT_API bool mpdc_server_child_certificate_import (mpdc_child_certificate *lcert, mpdc_server_application_state *state, const char *fpath)
 Import the local certificate signed by the root.
 
MPDC_EXPORT_API void mpdc_server_child_certificate_path (const mpdc_server_application_state *state, char *fpath, size_t pathlen)
 Get the full path to the child certificate.
 
MPDC_EXPORT_API void mpdc_server_child_certificate_path_from_issuer (const mpdc_server_application_state *state, char *fpath, size_t pathlen, const char *issuer)
 Get the certificate file path from the certificate issuer name.
 
MPDC_EXPORT_API bool mpdc_server_child_certificate_print (const char *fpath, size_t pathlen)
 Print the local child certificate to console.
 
MPDC_EXPORT_API void mpdc_server_local_certificate_store (mpdc_server_application_state *state, const mpdc_child_certificate *ccert, const char *address)
 Store a child certificate.
 
MPDC_EXPORT_API void mpdc_server_clear_config (mpdc_server_application_state *state)
 Erase and reset the configuration file.
 
MPDC_EXPORT_API void mpdc_server_clear_log (mpdc_server_application_state *state)
 Erase the log file.
 
MPDC_EXPORT_API void mpdc_server_erase_all (mpdc_server_application_state *state)
 Erase all state, including log files, and reset configuration.
 
MPDC_EXPORT_API void mpdc_server_log_host (mpdc_server_application_state *state)
 Enable logging on the server.
 
MPDC_EXPORT_API void mpdc_server_log_print (mpdc_server_application_state *state)
 Print the log file to the console.
 
MPDC_EXPORT_API bool mpdc_server_log_write_message (mpdc_server_application_state *state, mpdc_application_messages msgtype, const char *message, size_t msglen)
 Write a message to the log.
 
MPDC_EXPORT_API void mpdc_server_mfkcol_path (const mpdc_server_application_state *state, char *fpath, size_t pathlen)
 Get the path to the mfk collection file.
 
MPDC_EXPORT_API bool mpdc_server_mfkcol_from_file (qsc_collection_state *mfkcol, const mpdc_server_application_state *state)
 Convert an encrypted mfk collection file to a collection state.
 
MPDC_EXPORT_API void mpdc_server_mfkcol_to_file (const qsc_collection_state *mfkcol, const mpdc_server_application_state *state)
 Convert an mfk collection to an encrypted file.
 
MPDC_EXPORT_API void mpdc_server_print_banner (const mpdc_server_application_state *state)
 Print the server banner.
 
MPDC_EXPORT_API void mpdc_server_print_error (const mpdc_server_application_state *state, mpdc_application_messages appmsg, const char *message, mpdc_protocol_errors error)
 Print a network error to the console.
 
MPDC_EXPORT_API void mpdc_server_print_configuration (const mpdc_server_application_state *state)
 Print the server configuration.
 
MPDC_EXPORT_API bool mpdc_server_root_certificate_export (const mpdc_server_application_state *state, const char *dpath)
 Export the root certificate to a directory.
 
MPDC_EXPORT_API bool mpdc_server_root_import_dialogue (mpdc_server_application_state *state)
 Import the root certificate.
 
MPDC_EXPORT_API void mpdc_server_root_certificate_generate (mpdc_server_application_state *state, mpdc_root_certificate *rcert, uint64_t period)
 Generate a new root certificate.
 
MPDC_EXPORT_API bool mpdc_server_root_certificate_load (const mpdc_server_application_state *state, mpdc_root_certificate *root, const mpdc_topology_list_state *tlist)
 Load a root certificate using the issuer name.
 
MPDC_EXPORT_API bool mpdc_server_root_certificate_print (const char *fpath, size_t pathlen)
 Print a formatted root certificate to console.
 
MPDC_EXPORT_API void mpdc_server_root_certificate_store (mpdc_server_application_state *state, const mpdc_root_certificate *rcert)
 Store a root certificate to a file.
 
MPDC_EXPORT_API void mpdc_server_set_command_prompt (mpdc_server_application_state *state)
 Set the command prompt to the current state mode.
 
MPDC_EXPORT_API bool mpdc_server_set_console_timeout (mpdc_server_application_state *state, const char *snum, size_t numlen)
 Set the number of idle minutes before the user is logged out.
 
MPDC_EXPORT_API bool mpdc_server_set_domain_name (mpdc_server_application_state *state, const char *name, size_t namelen)
 Rename the network domain.
 
MPDC_EXPORT_API bool mpdc_server_set_host_name (mpdc_server_application_state *state, const char *name, size_t namelen)
 Rename the server host.
 
MPDC_EXPORT_API bool mpdc_server_set_ip_address (mpdc_server_application_state *state, const char *address, size_t addlen)
 Set the IP address of the server.
 
MPDC_EXPORT_API bool mpdc_server_set_password_retries (mpdc_server_application_state *state, const char *snum, size_t numlen)
 Set the number of failed password retries.
 
MPDC_EXPORT_API void mpdc_server_erase_signature_key (mpdc_server_application_state *state)
 Erase the signature-scheme signing key.
 
MPDC_EXPORT_API void mpdc_server_state_backup_restore (const mpdc_server_application_state *state)
 Restore the state from backup.
 
MPDC_EXPORT_API void mpdc_server_state_backup_save (const mpdc_server_application_state *state)
 Backup the state.
 
MPDC_EXPORT_API void mpdc_server_state_initialize (mpdc_server_application_state *state, mpdc_network_designations srvtype)
 Initialize the internal state.
 
MPDC_EXPORT_API bool mpdc_server_state_store (mpdc_server_application_state *state)
 Write the server state to file.
 
MPDC_EXPORT_API void mpdc_server_state_unload (mpdc_server_application_state *state)
 Unload the server state from memory.
 
MPDC_EXPORT_API bool mpdc_server_topology_dla_fetch (const mpdc_server_application_state *state, mpdc_child_certificate *dcert)
 Load the DLA certificate from state.
 
MPDC_EXPORT_API bool mpdc_server_topology_load (mpdc_server_application_state *state)
 Load the topology from an encrypted file to state.
 
MPDC_EXPORT_API void mpdc_server_topology_print_list (mpdc_server_application_state *state)
 Print the topological list to the console.
 
MPDC_EXPORT_API void mpdc_server_topology_purge_externals (mpdc_server_application_state *state)
 Clear the topology list except for the root and local nodes.
 
MPDC_EXPORT_API void mpdc_server_topology_remove_certificate (mpdc_server_application_state *state, const char *issuer)
 Delete the certificate.
 
MPDC_EXPORT_API void mpdc_server_topology_remove_node (mpdc_server_application_state *state, const char *issuer)
 Remove a node from the topology.
 
MPDC_EXPORT_API void mpdc_server_topology_reset (mpdc_server_application_state *state)
 Delete all nodes and certificates except for the root.
 
MPDC_EXPORT_API bool mpdc_server_topology_local_fetch (const mpdc_server_application_state *state, mpdc_child_certificate *ccert)
 Load the local certificate from state.
 
MPDC_EXPORT_API bool mpdc_server_topology_root_exists (const mpdc_server_application_state *state)
 Check if the root certificate exists on file.
 
MPDC_EXPORT_API bool mpdc_server_topology_root_fetch (const mpdc_server_application_state *state, mpdc_root_certificate *rcert)
 Load the root certificate from state.
 
MPDC_EXPORT_API void mpdc_server_topology_to_file (mpdc_server_application_state *state)
 Copy the topology to an encrypted file.
 
MPDC_EXPORT_API bool mpdc_server_user_login (mpdc_server_application_state *state)
 Start the user login dialogue.
 
MPDC_EXPORT_API void mpdc_server_user_logout (mpdc_server_application_state *state)
 Log out of the server.
 

Detailed Description

The common MPDC server functions.

Detailed File Description: This header file defines the common functions, macros, enumerations, and data structures used by the MPDC server. The functions in this file cover certificate management, logging, topology management, configuration, state backup and restore, and user login functionalities. Every public function, macro, struct, and enumeration is documented in detail below.

Macro Definition Documentation

◆ MPDC_SERVER_APPLICATION_STATE_SIZE

#define MPDC_SERVER_APPLICATION_STATE_SIZE
Value:
(MPDC_STORAGE_DOMAINNAME_MAX + MPDC_STORAGE_HOSTNAME_MAX + \
MPDC_STORAGE_ADDRESS_MAX + MPDC_STORAGE_PATH_MAX + MPDC_STORAGE_USERNAME_MAX + MPDC_CERTIFICATE_ISSUER_SIZE + \
sizeof(uint16_t) + sizeof(uint8_t) + sizeof(uint8_t) + sizeof(uint16_t) + sizeof(bool) + sizeof(bool) + \
#define MPDC_CERTIFICATE_ISSUER_SIZE
The maximum certificate issuer string length. The last character must be a string terminator.
Definition mpdc.h:795
#define MPDC_ASYMMETRIC_SIGNING_KEY_SIZE
The byte size of the asymmetric signature signing-key array.
Definition mpdc.h:239

Calculates the size of the MPDC server application state.

This macro sums the sizes of various maximum string lengths and fixed?size fields used in the server state structure.

Enumeration Type Documentation

◆ mpdc_server_server_loop_status

The MPDC server loop status.

This enumeration represents the current state of the server's main loop.

Enumerator
mpdc_server_loop_status_stopped 

The server is stopped.

mpdc_server_loop_status_started 

The server is running.

mpdc_server_loop_status_paused 

The server is paused.

Function Documentation

◆ mpdc_server_certificate_directory()

MPDC_EXPORT_API void mpdc_server_certificate_directory ( const mpdc_server_application_state * state,
char * dpath,
size_t pathlen )

Get the full delimited path to the certificate storage directory.

This function builds the full directory path where certificates are stored, based on the server's configuration in the application state.

Parameters
state[const] The server application state.
dpathThe output buffer that receives the certificate storage directory path.
pathlenThe length of the dpath buffer.

◆ mpdc_server_certificate_path()

MPDC_EXPORT_API void mpdc_server_certificate_path ( const mpdc_server_application_state * state,
char * fpath,
size_t pathlen,
const char * issuer )

Get the full path to a certificate.

This function constructs the full file path to a certificate based on the certificate issuer.

Parameters
state[const] The server application state.
fpathThe output buffer that receives the certificate file path.
pathlenThe length of the fpath buffer.
issuer[const] The issuer name of the certificate.

◆ mpdc_server_child_certificate_export()

MPDC_EXPORT_API bool mpdc_server_child_certificate_export ( const mpdc_server_application_state * state,
const char * dpath )

Export the local certificate to a file.

This function exports the local child certificate to the specified destination directory.

Parameters
state[const] The server application state.
dpathThe destination directory path.
Returns
Returns true if the certificate is successfully exported.

◆ mpdc_server_child_certificate_from_issuer()

MPDC_EXPORT_API bool mpdc_server_child_certificate_from_issuer ( mpdc_child_certificate * ccert,
const mpdc_server_application_state * state,
const char * issuer )

Get the certificate instance from file using the issuer string.

This function loads a child certificate from file using the issuer string.

Parameters
ccertThe output child certificate.
state[const] The server application state.
issuer[const] The certificate issuer string.
Returns
Returns true if the certificate is successfully loaded.

◆ mpdc_server_child_certificate_from_serial()

MPDC_EXPORT_API bool mpdc_server_child_certificate_from_serial ( mpdc_child_certificate * ccert,
const mpdc_server_application_state * state,
const uint8_t * serial )

Get the certificate instance from file using the serial number.

This function loads a child certificate from file using its serial number.

Parameters
ccertThe output child certificate.
state[const] The server application state.
serial[const] The certificate serial number.
Returns
Returns true if the certificate is successfully loaded.

◆ mpdc_server_child_certificate_generate()

MPDC_EXPORT_API void mpdc_server_child_certificate_generate ( mpdc_server_application_state * state,
mpdc_child_certificate * ccert,
uint64_t period )

Generate a new child certificate.

This function generates a new child certificate, writes the signature private key to the server state, and populates the child certificate structure.

Parameters
stateThe server application state. The private key is written to state->sigkey.
ccertThe output child certificate.
periodThe number of seconds the certificate is valid.

◆ mpdc_server_child_certificate_import()

MPDC_EXPORT_API bool mpdc_server_child_certificate_import ( mpdc_child_certificate * lcert,
mpdc_server_application_state * state,
const char * fpath )

Import the local certificate signed by the root.

This function imports the local certificate that has been signed by the root certificate.

Parameters
lcertThe local certificate structure to populate.
stateThe server application state.
fpathThe full file path to the certificate file.
Returns
Returns true if the certificate is successfully imported.

◆ mpdc_server_child_certificate_path()

MPDC_EXPORT_API void mpdc_server_child_certificate_path ( const mpdc_server_application_state * state,
char * fpath,
size_t pathlen )

Get the full path to the child certificate.

This function retrieves the full file path of the child certificate based on the server state.

Parameters
state[const] The server application state.
fpathThe output buffer that receives the certificate file path.
pathlenThe length of the fpath buffer.

◆ mpdc_server_child_certificate_path_from_issuer()

MPDC_EXPORT_API void mpdc_server_child_certificate_path_from_issuer ( const mpdc_server_application_state * state,
char * fpath,
size_t pathlen,
const char * issuer )

Get the certificate file path from the certificate issuer name.

This function constructs the file path to a certificate using the issuer name.

Parameters
state[const] The server application state.
fpathThe output buffer that receives the file path.
pathlenThe length of the file path buffer.
issuerThe certificate's issuer name.

◆ mpdc_server_child_certificate_print()

MPDC_EXPORT_API bool mpdc_server_child_certificate_print ( const char * fpath,
size_t pathlen )

Print the local child certificate to console.

This function prints the local child certificate (read from file) to the console.

Parameters
fpathThe file path to the certificate.
pathlenThe length of the file path buffer.
Returns
Returns true if the certificate is successfully printed.

◆ mpdc_server_clear_config()

MPDC_EXPORT_API void mpdc_server_clear_config ( mpdc_server_application_state * state)

Erase and reset the configuration file.

This function erases the current configuration file and resets it.

Parameters
stateThe server application state.

◆ mpdc_server_clear_log()

MPDC_EXPORT_API void mpdc_server_clear_log ( mpdc_server_application_state * state)

Erase the log file.

This function erases the server log file.

Parameters
stateThe server application state.

◆ mpdc_server_erase_all()

MPDC_EXPORT_API void mpdc_server_erase_all ( mpdc_server_application_state * state)

Erase all state, including log files, and reset configuration.

This function erases all persistent state and log files, effectively resetting the server.

Parameters
stateThe server application state.

◆ mpdc_server_erase_signature_key()

MPDC_EXPORT_API void mpdc_server_erase_signature_key ( mpdc_server_application_state * state)

Erase the signature-scheme signing key.

This function erases the signing key stored in the server state.

Parameters
stateThe server application state.

◆ mpdc_server_local_certificate_store()

MPDC_EXPORT_API void mpdc_server_local_certificate_store ( mpdc_server_application_state * state,
const mpdc_child_certificate * ccert,
const char * address )

Store a child certificate.

This function stores the local child certificate to file using the server state information.

Parameters
stateThe server application state.
ccertThe child certificate to store.
addressThe network address associated with the certificate.

◆ mpdc_server_log_host()

MPDC_EXPORT_API void mpdc_server_log_host ( mpdc_server_application_state * state)

Enable logging on the server.

This function enables host logging for the server.

Parameters
stateThe server application state.

◆ mpdc_server_log_print()

MPDC_EXPORT_API void mpdc_server_log_print ( mpdc_server_application_state * state)

Print the log file to the console.

This function outputs the contents of the server log file to the console.

Parameters
stateThe server application state.

◆ mpdc_server_log_write_message()

MPDC_EXPORT_API bool mpdc_server_log_write_message ( mpdc_server_application_state * state,
mpdc_application_messages msgtype,
const char * message,
size_t msglen )

Write a message to the log.

This function writes a log message with an optional predefined message header.

Parameters
stateThe server application state.
msgtypeThe predefined message enumerator.
message[const] The optional text message.
msglenThe length of the text message.
Returns
Returns true if the log message was successfully written.

◆ mpdc_server_mfkcol_from_file()

MPDC_EXPORT_API bool mpdc_server_mfkcol_from_file ( qsc_collection_state * mfkcol,
const mpdc_server_application_state * state )

Convert an encrypted mfk collection file to a collection state.

This function reads the encrypted mfk collection from file and converts it into the internal collection state.

Parameters
mfkcolThe empty collection state that will be populated.
state[const] The server application state.
Returns
Returns true if the mfk collection is successfully loaded.

◆ mpdc_server_mfkcol_path()

MPDC_EXPORT_API void mpdc_server_mfkcol_path ( const mpdc_server_application_state * state,
char * fpath,
size_t pathlen )

Get the path to the mfk collection file.

This function constructs the full file path for the master fragmentation key (mfk) collection.

Parameters
state[const] The server application state.
fpathThe output buffer that receives the file path.
pathlenThe length of the fpath buffer.

◆ mpdc_server_mfkcol_to_file()

MPDC_EXPORT_API void mpdc_server_mfkcol_to_file ( const qsc_collection_state * mfkcol,
const mpdc_server_application_state * state )

Convert an mfk collection to an encrypted file.

This function writes the current mfk collection state to an encrypted file.

Parameters
mfkcol[const] The mfk collection state.
state[const] The server application state.

◆ mpdc_server_print_banner()

MPDC_EXPORT_API void mpdc_server_print_banner ( const mpdc_server_application_state * state)

Print the server banner.

This function prints the server banner to the console.

Parameters
state[const] The server application state.

◆ mpdc_server_print_configuration()

MPDC_EXPORT_API void mpdc_server_print_configuration ( const mpdc_server_application_state * state)

Print the server configuration.

This function prints the current server configuration to the console.

Parameters
state[const] The server application state.

◆ mpdc_server_print_error()

MPDC_EXPORT_API void mpdc_server_print_error ( const mpdc_server_application_state * state,
mpdc_application_messages appmsg,
const char * message,
mpdc_protocol_errors error )

Print a network error to the console.

This function prints a formatted error message for network errors.

Parameters
state[const] The server application state.
appmsgThe predefined application message enumerator.
messageThe error message text.
errorThe protocol error code.

◆ mpdc_server_root_certificate_export()

MPDC_EXPORT_API bool mpdc_server_root_certificate_export ( const mpdc_server_application_state * state,
const char * dpath )

Export the root certificate to a directory.

This function exports the server's root certificate to the specified destination directory.

Parameters
state[const] The server application state.
dpathThe destination directory path.
Returns
Returns true if the export is successful.

◆ mpdc_server_root_certificate_generate()

MPDC_EXPORT_API void mpdc_server_root_certificate_generate ( mpdc_server_application_state * state,
mpdc_root_certificate * rcert,
uint64_t period )

Generate a new root certificate.

This function generates a new root certificate, writes the signature private key to the server state, and populates the root certificate structure.

Parameters
stateThe server application state; the private key is written to state->sigkey.
rcertThe output root certificate.
periodThe validity period (in seconds) for the certificate.

◆ mpdc_server_root_certificate_load()

MPDC_EXPORT_API bool mpdc_server_root_certificate_load ( const mpdc_server_application_state * state,
mpdc_root_certificate * root,
const mpdc_topology_list_state * tlist )

Load a root certificate using the issuer name.

This function loads the root certificate from file using the issuer name.

Parameters
state[const] The server application state.
rootThe output root certificate.
tlist[const] A pointer to the topology list.
Returns
Returns true if the root certificate is successfully loaded.

◆ mpdc_server_root_certificate_print()

MPDC_EXPORT_API bool mpdc_server_root_certificate_print ( const char * fpath,
size_t pathlen )

Print a formatted root certificate to console.

This function prints a formatted version of the root certificate to the console.

Parameters
fpathThe file path to the root certificate.
pathlenThe length of the file path buffer.
Returns
Returns true if the certificate is successfully printed.

◆ mpdc_server_root_certificate_store()

MPDC_EXPORT_API void mpdc_server_root_certificate_store ( mpdc_server_application_state * state,
const mpdc_root_certificate * rcert )

Store a root certificate to a file.

This function stores the root certificate to file.

Parameters
stateThe server application state.
rcertThe root certificate to store.
addressThe root certificate's address.

◆ mpdc_server_root_import_dialogue()

MPDC_EXPORT_API bool mpdc_server_root_import_dialogue ( mpdc_server_application_state * state)

Import the root certificate.

This function prompts the user to import the root certificate through a dialogue.

Parameters
stateThe server application state.
Returns
Returns true if the root certificate is successfully imported.

◆ mpdc_server_set_command_prompt()

MPDC_EXPORT_API void mpdc_server_set_command_prompt ( mpdc_server_application_state * state)

Set the command prompt to the current state mode.

This function sets the command prompt based on the current console mode in the server state.

Parameters
stateThe server application state.

◆ mpdc_server_set_console_timeout()

MPDC_EXPORT_API bool mpdc_server_set_console_timeout ( mpdc_server_application_state * state,
const char * snum,
size_t numlen )

Set the number of idle minutes before the user is logged out.

This function configures the console timeout period (in minutes) for automatic user logout.

Parameters
stateThe server application state.
snumThe number string representing the timeout period in minutes.
numlenThe length of the number string.
Returns
Returns true if the timeout is successfully set.

◆ mpdc_server_set_domain_name()

MPDC_EXPORT_API bool mpdc_server_set_domain_name ( mpdc_server_application_state * state,
const char * name,
size_t namelen )

Rename the network domain.

This function renames the network domain in the server configuration.

Parameters
stateThe server application state.
nameThe new domain name.
namelenThe length of the domain name string.
Returns
Returns true if the domain name is successfully changed.

◆ mpdc_server_set_host_name()

MPDC_EXPORT_API bool mpdc_server_set_host_name ( mpdc_server_application_state * state,
const char * name,
size_t namelen )

Rename the server host.

This function renames the server host in the configuration.

Parameters
stateThe server application state.
nameThe new host name.
namelenThe length of the host name string.
Returns
Returns true if the host name is successfully changed.

◆ mpdc_server_set_ip_address()

MPDC_EXPORT_API bool mpdc_server_set_ip_address ( mpdc_server_application_state * state,
const char * address,
size_t addlen )

Set the IP address of the server.

This function sets the server's IP address.

Parameters
stateThe server application state.
addressThe IP address string.
addlenThe length of the address string.
Returns
Returns true if the IP address is successfully set.

◆ mpdc_server_set_password_retries()

MPDC_EXPORT_API bool mpdc_server_set_password_retries ( mpdc_server_application_state * state,
const char * snum,
size_t numlen )

Set the number of failed password retries.

This function sets the maximum number of failed password attempts allowed.

Parameters
stateThe server application state.
snumThe number string representing the number of retries.
numlenThe length of the number string.
Returns
Returns true if the number of retries is successfully set.

◆ mpdc_server_state_backup_restore()

MPDC_EXPORT_API void mpdc_server_state_backup_restore ( const mpdc_server_application_state * state)

Restore the state from backup.

This function restores the server state from a previously saved backup.

Parameters
stateThe server application state.

◆ mpdc_server_state_backup_save()

MPDC_EXPORT_API void mpdc_server_state_backup_save ( const mpdc_server_application_state * state)

Backup the state.

This function saves the current server state to a backup file.

Parameters
stateThe server application state.

◆ mpdc_server_state_initialize()

MPDC_EXPORT_API void mpdc_server_state_initialize ( mpdc_server_application_state * state,
mpdc_network_designations srvtype )

Initialize the internal state.

This function initializes the MPDC server state for a given server type.

Parameters
stateThe server application state.
srvtypeThe server type designation.

◆ mpdc_server_state_store()

MPDC_EXPORT_API bool mpdc_server_state_store ( mpdc_server_application_state * state)

Write the server state to file.

This function writes the current server state to an encrypted file.

Parameters
stateThe server application state.
Returns
Returns true if the state is successfully stored.

◆ mpdc_server_state_unload()

MPDC_EXPORT_API void mpdc_server_state_unload ( mpdc_server_application_state * state)

Unload the server state from memory.

This function unloads and clears the current server state from memory.

Parameters
stateThe server application state.

◆ mpdc_server_topology_dla_fetch()

MPDC_EXPORT_API bool mpdc_server_topology_dla_fetch ( const mpdc_server_application_state * state,
mpdc_child_certificate * dcert )

Load the DLA certificate from state.

This function loads the DLA certificate from the server state.

Parameters
state[const] The server application state.
dcertThe output DLA certificate.
Returns
Returns true if the DLA certificate is successfully loaded.

◆ mpdc_server_topology_load()

MPDC_EXPORT_API bool mpdc_server_topology_load ( mpdc_server_application_state * state)

Load the topology from an encrypted file to state.

This function loads the network topology from an encrypted file into the server state.

Parameters
stateThe server application state.
Returns
Returns true if the topology is successfully loaded.

◆ mpdc_server_topology_local_fetch()

MPDC_EXPORT_API bool mpdc_server_topology_local_fetch ( const mpdc_server_application_state * state,
mpdc_child_certificate * ccert )

Load the local certificate from state.

This function loads the local child certificate from the server state.

Parameters
state[const] The server application state.
ccertThe output local certificate.
Returns
Returns true if the certificate is successfully loaded.

◆ mpdc_server_topology_print_list()

MPDC_EXPORT_API void mpdc_server_topology_print_list ( mpdc_server_application_state * state)

Print the topological list to the console.

This function prints the network topology list to the console.

Parameters
state[const] The server application state.

◆ mpdc_server_topology_purge_externals()

MPDC_EXPORT_API void mpdc_server_topology_purge_externals ( mpdc_server_application_state * state)

Clear the topology list except for the root and local nodes.

This function purges the topology list by deleting all nodes except for the root and local nodes.

Parameters
stateThe server application state.

◆ mpdc_server_topology_remove_certificate()

MPDC_EXPORT_API void mpdc_server_topology_remove_certificate ( mpdc_server_application_state * state,
const char * issuer )

Delete the certificate.

This function deletes a certificate from the topology based on its issuer.

Parameters
stateThe server application state.
issuerThe target node's issuer string.

◆ mpdc_server_topology_remove_node()

MPDC_EXPORT_API void mpdc_server_topology_remove_node ( mpdc_server_application_state * state,
const char * issuer )

Remove a node from the topology.

This function removes a node from the topology list based on its issuer.

Parameters
stateThe server application state.
issuerThe target node's issuer string.

◆ mpdc_server_topology_reset()

MPDC_EXPORT_API void mpdc_server_topology_reset ( mpdc_server_application_state * state)

Delete all nodes and certificates except for the root.

This function resets the topology list by deleting all nodes and certificates except the root.

Parameters
stateThe server application state.

◆ mpdc_server_topology_root_exists()

MPDC_EXPORT_API bool mpdc_server_topology_root_exists ( const mpdc_server_application_state * state)

Check if the root certificate exists on file.

This function checks whether the root certificate file exists.

Parameters
state[const] The server application state.
Returns
Returns true if the root certificate exists.

◆ mpdc_server_topology_root_fetch()

MPDC_EXPORT_API bool mpdc_server_topology_root_fetch ( const mpdc_server_application_state * state,
mpdc_root_certificate * rcert )

Load the root certificate from state.

This function loads the root certificate from the server state.

Parameters
state[const] The server application state.
rcertThe output root certificate.
Returns
Returns true if the root certificate is successfully loaded.

◆ mpdc_server_topology_to_file()

MPDC_EXPORT_API void mpdc_server_topology_to_file ( mpdc_server_application_state * state)

Copy the topology to an encrypted file.

This function writes the current network topology from the server state to an encrypted file.

Parameters
stateThe server application state.

◆ mpdc_server_user_login()

MPDC_EXPORT_API bool mpdc_server_user_login ( mpdc_server_application_state * state)

Start the user login dialogue.

This function initiates the user login process and prompts for credentials.

Parameters
stateThe server application state.
Returns
Returns true if the user logged in successfully.

◆ mpdc_server_user_logout()

MPDC_EXPORT_API void mpdc_server_user_logout ( mpdc_server_application_state * state)

Log out of the server.

This function logs out the current user and resets the session.

Parameters
stateThe server application state.