43#include "aerncommon.h"
49#include "collection.h"
70#define AERN_SERVER_MINIMUM_COMMAND_LENGTH 4U
79#define AERN_SERVER_APPLICATION_STATE_SIZE (AERN_STORAGE_DOMAINNAME_MAX + AERN_STORAGE_HOSTNAME_MAX + \
80 AERN_STORAGE_ADDRESS_MAX + AERN_STORAGE_PATH_MAX + AERN_STORAGE_USERNAME_MAX + AERN_CERTIFICATE_ISSUER_SIZE + \
81 sizeof(uint16_t) + sizeof(uint8_t) + sizeof(uint8_t) + sizeof(uint16_t) + sizeof(bool) + sizeof(bool) + \
82 AERN_ASYMMETRIC_SIGNING_KEY_SIZE)
118 char domain[AERN_STORAGE_DOMAINNAME_MAX];
AERN Common Definitions and Protocol Configuration.
#define AERN_CERTIFICATE_ISSUER_SIZE
The maximum certificate issuer string length. The last character must be a string terminator.
Definition aern.h:813
aern_protocol_errors
The AERN protocol error values.
Definition aern.h:1244
aern_network_designations
The AERN device designation.
Definition aern.h:1140
AERN Certificate Handling Functions.
The AERN command enumerations.
aern_application_messages
The ARS application messages.
Definition commands.h:73
aern_console_modes
The ARS console modes.
Definition commands.h:331
aern_command_actions
The ARS command actions.
Definition commands.h:248
aern_server_server_loop_status
The AERN server loop status.
Definition server.h:95
@ aern_server_loop_status_stopped
Definition server.h:96
@ aern_server_loop_status_started
Definition server.h:97
@ aern_server_loop_status_paused
Definition server.h:98
AERN_EXPORT_API bool aern_server_topology_local_fetch(const aern_server_application_state *state, aern_child_certificate *ccert)
Load the local certificate from state.
Definition server.c:2173
AERN_EXPORT_API void aern_server_topology_remove_certificate(aern_server_application_state *state, const char *issuer)
Delete the certificate.
Definition server.c:2260
AERN_EXPORT_API void aern_server_erase_all(aern_server_application_state *state)
Erase all state, including log files, and reset configuration.
Definition server.c:931
AERN_EXPORT_API bool aern_server_mfkcol_from_file(qsc_collection_state *mfkcol, const aern_server_application_state *state)
Convert an encrypted mfk collection file to a collection state.
Definition server.c:1059
AERN_EXPORT_API bool aern_server_set_host_name(aern_server_application_state *state, const char *name, size_t namelen)
Rename the server host.
Definition server.c:1676
AERN_EXPORT_API bool aern_server_child_certificate_export(const aern_server_application_state *state, const char *dpath)
Export the local certificate to a file.
Definition server.c:652
AERN_EXPORT_API void aern_server_print_banner(const aern_server_application_state *state)
Print the server banner.
Definition server.c:1169
AERN_EXPORT_API void aern_server_topology_remove_node(aern_server_application_state *state, const char *issuer)
Remove a node from the topology.
Definition server.c:2284
AERN_EXPORT_API void aern_server_child_certificate_path(const aern_server_application_state *state, char *fpath, size_t pathlen)
Get the full path to the child certificate.
Definition server.c:812
AERN_EXPORT_API void aern_server_topology_reset(aern_server_application_state *state)
Delete all nodes and certificates except for the root.
Definition server.c:2301
AERN_EXPORT_API void aern_server_mfkcol_path(const aern_server_application_state *state, char *fpath, size_t pathlen)
Get the path to the mfk collection file.
Definition server.c:1045
AERN_EXPORT_API bool aern_server_topology_adc_fetch(const aern_server_application_state *state, aern_child_certificate *dcert)
Load the ADC certificate from state.
Definition server.c:2078
AERN_EXPORT_API bool aern_server_child_certificate_from_serial(aern_child_certificate *ccert, const aern_server_application_state *state, const uint8_t *serial)
Get the certificate instance from file using the serial number.
Definition server.c:707
AERN_EXPORT_API void aern_server_log_print(aern_server_application_state *state)
Print the log file to the console.
Definition server.c:971
AERN_EXPORT_API void aern_server_state_backup_save(const aern_server_application_state *state)
Backup the state.
Definition server.c:1878
AERN_EXPORT_API bool aern_server_user_login(aern_server_application_state *state)
Start the user login dialogue.
Definition server.c:2417
AERN_EXPORT_API bool aern_server_topology_root_exists(const aern_server_application_state *state)
Check if the root certificate exists on file.
Definition server.c:2319
AERN_EXPORT_API bool aern_server_state_store(aern_server_application_state *state)
Write the server state to file.
Definition server.c:2034
AERN_EXPORT_API void aern_server_topology_to_file(aern_server_application_state *state)
Copy the topology to an encrypted file.
Definition server.c:2367
AERN_EXPORT_API bool aern_server_set_password_retries(aern_server_application_state *state, const char *snum, size_t numlen)
Set the number of failed password retries.
Definition server.c:1774
AERN_EXPORT_API bool aern_server_root_certificate_export(const aern_server_application_state *state, const char *dpath)
Export the root certificate to a directory.
Definition server.c:1263
AERN_EXPORT_API bool aern_server_child_certificate_import(aern_child_certificate *lcert, aern_server_application_state *state, const char *fpath)
Import the local certificate signed by the root.
Definition server.c:756
AERN_EXPORT_API void aern_server_state_unload(aern_server_application_state *state)
Unload the server state from memory.
Definition server.c:2066
AERN_EXPORT_API void aern_server_print_configuration(const aern_server_application_state *state)
Print the server configuration.
Definition server.c:1195
AERN_EXPORT_API bool aern_server_root_certificate_load(const aern_server_application_state *state, aern_root_certificate *root, const aern_topology_list_state *tlist)
Load a root certificate using the issuer name.
Definition server.c:1374
AERN_EXPORT_API void aern_server_child_certificate_generate(aern_server_application_state *state, aern_child_certificate *ccert, uint64_t period)
Generate a new child certificate.
Definition server.c:729
AERN_EXPORT_API void aern_server_certificate_path(const aern_server_application_state *state, char *fpath, size_t pathlen, const char *issuer)
Get the full path to a certificate.
Definition server.c:638
AERN_EXPORT_API void aern_server_log_host(aern_server_application_state *state)
Enable logging on the server.
Definition server.c:943
AERN_EXPORT_API bool aern_server_log_write_message(aern_server_application_state *state, aern_application_messages msgtype, const char *message, size_t msglen)
Write a message to the log.
Definition server.c:1015
AERN_EXPORT_API bool aern_server_child_certificate_from_issuer(aern_child_certificate *ccert, const aern_server_application_state *state, const char *issuer)
Get the certificate instance from file using the issuer string.
Definition server.c:690
AERN_EXPORT_API void aern_server_child_certificate_path_from_issuer(const aern_server_application_state *state, char *fpath, size_t pathlen, const char *issuer)
Get the certificate file path from the certificate issuer name.
Definition server.c:825
AERN_EXPORT_API bool aern_server_child_certificate_print(const char *fpath, size_t pathlen)
Print the local child certificate to console.
Definition server.c:839
AERN_EXPORT_API bool aern_server_topology_root_fetch(const aern_server_application_state *state, aern_root_certificate *rcert)
Load the root certificate from state.
Definition server.c:2337
AERN_EXPORT_API void aern_server_root_certificate_store(aern_server_application_state *state, const aern_root_certificate *rcert)
Store a root certificate to a file.
Definition server.c:1467
AERN_EXPORT_API void aern_server_print_error(const aern_server_application_state *state, aern_application_messages appmsg, const char *message, aern_protocol_errors error)
Print a network error to the console.
Definition server.c:1180
AERN_EXPORT_API void aern_server_mfkcol_to_file(const qsc_collection_state *mfkcol, const aern_server_application_state *state)
Convert an mfk collection to an encrypted file.
Definition server.c:1125
AERN_EXPORT_API void aern_server_state_backup_restore(const aern_server_application_state *state)
Restore the state from backup.
Definition server.c:1820
AERN_EXPORT_API void aern_server_clear_config(aern_server_application_state *state)
Erase and reset the configuration file.
Definition server.c:906
AERN_EXPORT_API void aern_server_user_logout(aern_server_application_state *state)
Log out of the server.
Definition server.c:2701
AERN_EXPORT_API void aern_server_certificate_directory(const aern_server_application_state *state, char *dpath, size_t pathlen)
Get the full delimited path to the certificate storage directory.
Definition server.c:618
AERN_EXPORT_API void aern_server_set_command_prompt(aern_server_application_state *state)
Set the command prompt to the current state mode.
Definition server.c:1529
AERN_EXPORT_API void aern_server_local_certificate_store(aern_server_application_state *state, const aern_child_certificate *ccert, const char *address)
Store a child certificate.
Definition server.c:874
AERN_EXPORT_API bool aern_server_set_ip_address(aern_server_application_state *state, const char *address, size_t addlen)
Set the IP address of the server.
Definition server.c:1733
AERN_EXPORT_API bool aern_server_topology_load(aern_server_application_state *state)
Load the topology from an encrypted file to state.
Definition server.c:2108
AERN_EXPORT_API void aern_server_topology_purge_externals(aern_server_application_state *state)
Clear the topology list except for the root and local nodes.
Definition server.c:2235
AERN_EXPORT_API void aern_server_erase_signature_key(aern_server_application_state *state)
Erase the signature-scheme signing key.
Definition server.c:1810
AERN_EXPORT_API bool aern_server_root_certificate_print(const char *fpath, size_t pathlen)
Print a formatted root certificate to console.
Definition server.c:1432
AERN_EXPORT_API bool aern_server_root_import_dialogue(aern_server_application_state *state)
Import the root certificate.
Definition server.c:1301
AERN_EXPORT_API bool aern_server_set_console_timeout(aern_server_application_state *state, const char *snum, size_t numlen)
Set the number of idle minutes before the user is logged out.
Definition server.c:1581
AERN_EXPORT_API void aern_server_clear_log(aern_server_application_state *state)
Erase the log file.
Definition server.c:917
AERN_EXPORT_API void aern_server_root_certificate_generate(aern_server_application_state *state, aern_root_certificate *rcert, uint64_t period)
Generate a new root certificate.
Definition server.c:1347
AERN_EXPORT_API bool aern_server_set_domain_name(aern_server_application_state *state, const char *name, size_t namelen)
Rename the network domain.
Definition server.c:1618
AERN_EXPORT_API void aern_server_state_initialize(aern_server_application_state *state, aern_network_designations srvtype)
Initialize the internal state.
Definition server.c:1924
AERN_EXPORT_API void aern_server_topology_print_list(aern_server_application_state *state)
Print the topological list to the console.
Definition server.c:2203
The child certificate structure.
Definition aern.h:1318
The root certificate structure.
Definition aern.h:1436
The AERN server state.
Definition server.h:116
uint8_t * kchain
Definition server.h:124
aern_child_certificate ads
Definition server.h:135
const char * aplpath
Definition server.h:126
aern_network_designations srvtype
Definition server.h:141
const char * pubkeyname
Definition server.h:131
const char * srvname
Definition server.h:132
char issuer[AERN_CERTIFICATE_ISSUER_SIZE]
Definition server.h:120
char username[AERN_STORAGE_USERNAME_MAX]
Definition server.h:123
const char * promptdef
Definition server.h:130
uint8_t retries
Definition server.h:143
aern_console_modes mode
Definition server.h:139
char localip[AERN_STORAGE_ADDRESS_MAX]
Definition server.h:121
aern_topology_list_state tlist
Definition server.h:137
const char * prikeyname
Definition server.h:129
char logpath[AERN_STORAGE_PATH_MAX]
Definition server.h:122
char cmdprompt[AERN_STORAGE_PROMPT_MAX]
Definition server.h:117
bool loghost
Definition server.h:145
uint16_t timeout
Definition server.h:142
const char * banner
Definition server.h:127
uint8_t * sigkey
Definition server.h:125
uint16_t port
Definition server.h:140
const char * topname
Definition server.h:133
bool joined
Definition server.h:144
aern_command_actions action
Definition server.h:138
char domain[AERN_STORAGE_DOMAINNAME_MAX]
Definition server.h:118
aern_root_certificate root
Definition server.h:136
const char * wtitle
Definition server.h:134
char hostname[AERN_STORAGE_HOSTNAME_MAX]
Definition server.h:119
const char * cfgname
Definition server.h:128
The AERN topology list structure.
Definition topology.h:185
The AERN topology functions.