AERN: Authenticated Encrypted Relay Network 1.0.0.0a (A1)
A post quantum authenticated and encrypted proxy chain network
topology.h File Reference

The AERN topology functions. More...

#include "aern.h"
#include "certificate.h"
#include "ipinfo.h"
#include "list.h"
#include "timestamp.h"

Go to the source code of this file.

Data Structures

struct  aern_topology_node_state
 The AERN topology node structure. More...
struct  aern_topology_list_state
 The AERN topology list structure. More...

Macros

#define AERN_TOPOLOGY_NODE_ENCODED_SIZE
 The size of an encoded node string.
#define AERN_TOPOLOGY_NODE_MINIMUM_ISSUER_SIZE   3U
 The minimum size of an issuer string.
#define AERN_TOPOLOGY_NODE_NOT_FOUND   -1
 The value returned when a node is not found.
#define AERN_NETWORK_TOPOLOGY_MAX_SIZE   1024U
 The maximum size of the topology.
#define AERN_NETWORK_TOPOLOGY_NODE_SIZE
 The size in bytes of a serialized topological node.

Typedefs

typedef AERN_EXPORT_API struct aern_topology_node_state aern_topology_node_state
typedef AERN_EXPORT_API struct aern_topology_list_state aern_topology_list_state

Functions

AERN_EXPORT_API void aern_topology_address_from_issuer (char *address, const char *issuer, const aern_topology_list_state *list)
 Returns an IP address from an issuer string.
AERN_EXPORT_API void aern_topology_node_add_alias (aern_topology_node_state *node, const char *alias)
 Add an alias string to an issuer path.
AERN_EXPORT_API bool aern_topology_nodes_are_equal (const aern_topology_node_state *a, const aern_topology_node_state *b)
 Compare two topological nodes for equality.
AERN_EXPORT_API uint8_t * aern_topology_child_add_empty_node (aern_topology_list_state *list)
 Get an empty node pointer from the topology list.
AERN_EXPORT_API void aern_topology_child_add_item (aern_topology_list_state *list, const aern_topology_node_state *node)
 Add a node to the topology list.
AERN_EXPORT_API bool aern_topology_canonical_to_issuer_name (char *issuer, size_t isslen, const char *domain, const char *cname)
 Translate a canonical name to an issuer name.
AERN_EXPORT_API bool aern_topology_issuer_to_canonical_name (char *cname, size_t namelen, const char *issuer)
 Translate an issuer name to a canonical name.
AERN_EXPORT_API void aern_topology_child_register (aern_topology_list_state *list, const aern_child_certificate *ccert, const char *address)
 Register a child to a topology list.
AERN_EXPORT_API void aern_topology_list_clone (const aern_topology_list_state *tlist, aern_topology_list_state *tcopy)
 Clone a topology list.
AERN_EXPORT_API void aern_topology_list_deserialize (aern_topology_list_state *list, const uint8_t *input, size_t inplen)
 Deserialize a topology list.
AERN_EXPORT_API void aern_topology_list_dispose (aern_topology_list_state *list)
 Dispose of the topology list and release memory.
AERN_EXPORT_API void aern_topology_list_initialize (aern_topology_list_state *list)
 Initialize the topology list.
AERN_EXPORT_API bool aern_topology_list_item (const aern_topology_list_state *list, aern_topology_node_state *node, size_t index)
 Get a node from the index.
AERN_EXPORT_API size_t aern_topology_list_remove_duplicates (aern_topology_list_state *list)
 Remove duplicate nodes from the topology.
AERN_EXPORT_API size_t aern_topology_list_server_count (const aern_topology_list_state *list, aern_network_designations ntype)
 Get the count of a type of node in the database.
AERN_EXPORT_API size_t aern_topology_list_serialize (uint8_t *output, const aern_topology_list_state *list)
 Serialize a topology list.
AERN_EXPORT_API size_t aern_topology_list_size (const aern_topology_list_state *list)
 Get the byte size of the serialized list.
AERN_EXPORT_API size_t aern_topology_list_to_string (const aern_topology_list_state *list, char *output, size_t outlen)
 Convert the topology list to a printable string.
AERN_EXPORT_API size_t aern_topology_list_update_pack (uint8_t *output, const aern_topology_list_state *list, aern_network_designations ntype)
 Pack a node update set to an array.
AERN_EXPORT_API size_t aern_topology_list_update_unpack (aern_topology_list_state *list, const uint8_t *input, size_t inplen)
 Unpack a node update set to the topology list.
AERN_EXPORT_API size_t aern_topology_ordered_server_list (aern_topology_list_state *olist, const aern_topology_list_state *tlist, aern_network_designations ntype)
 Return a list of nodes of a type, sorted by serial number.
AERN_EXPORT_API void aern_topology_node_clear (aern_topology_node_state *node)
 Erase a node structure.
AERN_EXPORT_API void aern_topology_node_copy (const aern_topology_node_state *source, aern_topology_node_state *destination)
 Copy a source node to a destination node structure.
AERN_EXPORT_API void aern_topology_node_deserialize (aern_topology_node_state *node, const uint8_t *input)
 Deserialize a topological node.
AERN_EXPORT_API size_t aern_topology_node_encode (const aern_topology_node_state *node, char output[AERN_TOPOLOGY_NODE_ENCODED_SIZE])
 Encode a topological node into a printable string.
AERN_EXPORT_API bool aern_topology_node_exists (const aern_topology_list_state *list, const uint8_t *serial)
 Queries on the serial number if the node is in the database.
AERN_EXPORT_API int32_t aern_topology_node_get_index (const aern_topology_list_state *list, const uint8_t *serial)
 Find the index number of a node in an array.
AERN_EXPORT_API bool aern_topology_node_find (const aern_topology_list_state *list, aern_topology_node_state *node, const uint8_t *serial)
 Return the node pointer in the list matching the serial number.
AERN_EXPORT_API bool aern_topology_node_find_address (const aern_topology_list_state *list, aern_topology_node_state *node, const char *address)
 Return the node pointer in the list matching the address string.
AERN_EXPORT_API bool aern_topology_node_find_alias (const aern_topology_list_state *list, aern_topology_node_state *node, const char *alias)
 Return the node pointer in the list matching the alias string.
AERN_EXPORT_API bool aern_topology_node_find_ads (const aern_topology_list_state *list, aern_topology_node_state *node)
 Return the ADC node from the list.
AERN_EXPORT_API bool aern_topology_node_find_issuer (const aern_topology_list_state *list, aern_topology_node_state *node, const char *issuer)
 Return the node pointer in the list matching the name string.
AERN_EXPORT_API bool aern_topology_node_find_root (const aern_topology_list_state *list, aern_topology_node_state *node)
 Return the ARS server node from the list.
AERN_EXPORT_API void aern_topology_node_remove (aern_topology_list_state *list, const uint8_t *serial)
 Find and remove a node from the topology.
AERN_EXPORT_API void aern_topology_node_remove_duplicate (aern_topology_list_state *list, const char *issuer)
 Remove a node from the topology with the same issuer name.
AERN_EXPORT_API bool aern_topology_node_verify_ads (const aern_topology_list_state *list, const aern_child_certificate *ccert)
 Verify that the ADC certificate matches the hash stored in the topology.
AERN_EXPORT_API bool aern_topology_node_verify_issuer (const aern_topology_list_state *list, const aern_child_certificate *ccert, const char *issuer)
 Verify that an issuing node's certificate matches the hash stored in the topology.
AERN_EXPORT_API bool aern_topology_node_verify_root (const aern_topology_list_state *list, const aern_root_certificate *rcert)
 Verify that the root certificate matches the hash stored in the topology.
AERN_EXPORT_API size_t aern_topology_node_serialize (uint8_t *output, const aern_topology_node_state *node)
 Serialize a topological node structure, including the mfk.
AERN_EXPORT_API void aern_topology_root_register (aern_topology_list_state *list, const aern_root_certificate *rcert, const char *address)
 Register a root to a topology list.
AERN_EXPORT_API void aern_topology_from_file (const char *fpath, aern_topology_list_state *list)
 Copy a topology list from a file.
AERN_EXPORT_API void aern_topology_to_file (const aern_topology_list_state *list, const char *fpath)
 Copy a topology list to a file.

Detailed Description

The AERN topology functions.

Detailed File Description: This header file defines the functions, macros, structures, and enumerations used by AERN for managing the network topology. The topology functions handle the serialization and deserialization of network node information, conversion between canonical and issuer names, registration and removal of nodes from the topology list, and various lookup and verification operations.

Notes: The issuer parameter composition; network/host.ctype:alias The first segment of an issuer string consists of the network path, which is the network name, appended with a forward slash (network/host). A network name can contain subdomains, each ending in a forward slash, ex. domain/subdomain/host. The network portion of the issuer string represents the network and host names as a path string. The second segment is the host name, and an optional extension preceded by a period (host.type), ex. xyz/mas.ctype. There are three types of devices; root, intra-domain, and inter-domain, which correspond to AERN device types of [root server], [ads, aps, mas, client], and [idg] inter-domain gateways. The third segment of the issuer string is the alias (path:alias), a readable domain alias name, always preceded by a colon. The network name and any subdomains are always preceded by a single forward slash (domain/subdomain). ex. network/sub-network/host. The host name is the network device name, and it is terminated with a colon (path:alias). The alias is a name that represents a compact path or string representation of the network\node path. Example: xyz/mas-1:www.xyz.com The entire issuer string cannot exceed 256 bytes. Periods, dashes, and most other symbols are legal with the exception of the reserved symbols: period, forward slash, and colon (. / :), as well as illegal symbols such as ! @ $ % ^ & * ( ) { } | ; " '. Name to address lookups can be performed by the ADC that can translate a network\node path, or an alias name, to an IP address (IPv4 or IPv6). Inverse lookups can also be performed, which return the issuer string from an IP address. Issuer network paths are mirrored in the storage subsystem and used as storage path substrings (e.g., C:\AERN\xyz\mas), enabling file system certificate retrieval based on the issuer's topological path.

Macro Definition Documentation

◆ AERN_NETWORK_TOPOLOGY_NODE_SIZE

#define AERN_NETWORK_TOPOLOGY_NODE_SIZE
Value:
#define AERN_CERTIFICATE_EXPIRATION_SIZE
The certificate expiration date length.
Definition aern.h:800
#define AERN_CERTIFICATE_ISSUER_SIZE
The maximum certificate issuer string length. The last character must be a string terminator.
Definition aern.h:813
#define AERN_CERTIFICATE_ADDRESS_SIZE
The maximum IP address length.
Definition aern.h:776
#define AERN_CERTIFICATE_DESIGNATION_SIZE
The size of the child certificate designation field.
Definition aern.h:794
#define AERN_CERTIFICATE_HASH_SIZE
The size of the certificate hash in bytes.
Definition aern.h:806
#define AERN_CERTIFICATE_SERIAL_SIZE
The certificate serial number field length.
Definition aern.h:837

The size in bytes of a serialized topological node.

◆ AERN_TOPOLOGY_NODE_ENCODED_SIZE

#define AERN_TOPOLOGY_NODE_ENCODED_SIZE
Value:
(AERN_CHILD_CERTIFICATE_ISSUER_PREFIX_SIZE + AERN_CERTIFICATE_ISSUER_SIZE + AERN_CERTIFICATE_SEPERATOR_SIZE + \
AERN_CHILD_CERTIFICATE_ADDRESS_PREFIX_SIZE + QSC_IPINFO_IPV4_STRNLEN + AERN_CERTIFICATE_SEPERATOR_SIZE + \
AERN_ROOT_CERTIFICATE_HASH_PREFIX_SIZE + (AERN_CERTIFICATE_HASH_SIZE * 2U) + AERN_CERTIFICATE_SEPERATOR_SIZE + \
AERN_CHILD_CERTIFICATE_SERIAL_PREFIX_SIZE + (AERN_CERTIFICATE_SERIAL_SIZE * 2U) + AERN_CERTIFICATE_SEPERATOR_SIZE + \
AERN_CHILD_CERTIFICATE_DESIGNATION_PREFIX_SIZE + AERN_NETWORK_DESIGNATION_SIZE + AERN_CERTIFICATE_SEPERATOR_SIZE + \
AERN_CHILD_CERTIFICATE_VALID_FROM_PREFIX_SIZE + QSC_TIMESTAMP_STRING_SIZE + AERN_CERTIFICATE_SEPERATOR_SIZE + \
AERN_CHILD_CERTIFICATE_EXPIRATION_TO_PREFIX_SIZE + QSC_TIMESTAMP_STRING_SIZE + AERN_CERTIFICATE_SEPERATOR_SIZE)

The size of an encoded node string.

This macro defines the size of a printable, encoded node string. Its value depends on whether the network is IPv6 or IPv4.

Function Documentation

◆ aern_topology_address_from_issuer()

AERN_EXPORT_API void aern_topology_address_from_issuer ( char * address,
const char * issuer,
const aern_topology_list_state * list )

Returns an IP address from an issuer string.

This function extracts and returns the network address associated with a given issuer string, using the topology list to resolve the address.

Parameters
addressThe output buffer to receive the node's network address (max AERN_CERTIFICATE_ADDRESS_SIZE).
issuer[const] The issuer string.
list[const] A pointer to the topology list.

◆ aern_topology_canonical_to_issuer_name()

AERN_EXPORT_API bool aern_topology_canonical_to_issuer_name ( char * issuer,
size_t isslen,
const char * domain,
const char * cname )

Translate a canonical name to an issuer name.

This function converts a device canonical name into its corresponding issuer name based on the domain.

Parameters
issuerThe output issuer string.
isslenThe length of the issuer buffer.
domainThe domain name.
cnameThe input device canonical name.
Returns
Returns false if the conversion fails.

◆ aern_topology_child_add_empty_node()

AERN_EXPORT_API uint8_t * aern_topology_child_add_empty_node ( aern_topology_list_state * list)

Get an empty node pointer from the topology list.

This function returns a pointer to an empty node entry in the topology list.

Note
This function is not thread safe.
Parameters
listA pointer to the topology list.
Returns
Returns a pointer to the empty node entry or NULL if none is available.

◆ aern_topology_child_add_item()

AERN_EXPORT_API void aern_topology_child_add_item ( aern_topology_list_state * list,
const aern_topology_node_state * node )

Add a node to the topology list.

This function adds a new node item to the topology list.

Parameters
listA pointer to the topology list.
node[const] The node to add.

◆ aern_topology_child_register()

AERN_EXPORT_API void aern_topology_child_register ( aern_topology_list_state * list,
const aern_child_certificate * ccert,
const char * address )

Register a child to a topology list.

This function registers a new child node in the topology list based on its certificate.

Parameters
listA pointer to the topology list.
ccert[const] The node's child certificate.
address[const] The node's network address (max AERN_CERTIFICATE_ADDRESS_SIZE).

◆ aern_topology_from_file()

AERN_EXPORT_API void aern_topology_from_file ( const char * fpath,
aern_topology_list_state * list )

Copy a topology list from a file.

This function loads a topology list from a file.

Parameters
fpath[const] The full path to the topology list file.
listA pointer to the topology list state to populate.

◆ aern_topology_issuer_to_canonical_name()

AERN_EXPORT_API bool aern_topology_issuer_to_canonical_name ( char * cname,
size_t namelen,
const char * issuer )

Translate an issuer name to a canonical name.

This function converts an issuer name back into its canonical form.

Parameters
cnameThe output canonical name.
namelenThe length of the canonical name buffer.
issuerThe input issuer name string.
Returns
Returns false if the conversion fails.

◆ aern_topology_list_clone()

AERN_EXPORT_API void aern_topology_list_clone ( const aern_topology_list_state * tlist,
aern_topology_list_state * tcopy )

Clone a topology list.

This function creates a clone of the given topology list.

Parameters
tlist[const] A pointer to the source topology list.
tcopyA pointer to the destination topology list.

◆ aern_topology_list_deserialize()

AERN_EXPORT_API void aern_topology_list_deserialize ( aern_topology_list_state * list,
const uint8_t * input,
size_t inplen )

Deserialize a topology list.

This function deserializes a topology list from a given input array.

Parameters
listA pointer to the topology list state to populate.
input[const] The serialized topology array.
inplenThe size of the input array.

◆ aern_topology_list_dispose()

AERN_EXPORT_API void aern_topology_list_dispose ( aern_topology_list_state * list)

Dispose of the topology list and release memory.

This function releases all memory allocated for the topology list.

Parameters
listA pointer to the topology list state.

◆ aern_topology_list_initialize()

AERN_EXPORT_API void aern_topology_list_initialize ( aern_topology_list_state * list)

Initialize the topology list.

This function initializes the topology list state.

Parameters
listThe topology list state to initialize.

◆ aern_topology_list_item()

AERN_EXPORT_API bool aern_topology_list_item ( const aern_topology_list_state * list,
aern_topology_node_state * node,
size_t index )

Get a node from the index.

This function retrieves the node at the specified index in the topology list.

Parameters
listThe topology list state.
nodeA pointer to the node structure to populate.
indexThe index of the node.
Returns
Returns false if the node was not found.

◆ aern_topology_list_remove_duplicates()

AERN_EXPORT_API size_t aern_topology_list_remove_duplicates ( aern_topology_list_state * list)

Remove duplicate nodes from the topology.

This function removes duplicate entries from the topology list.

Parameters
listThe topology list state.
Returns
Returns the number of items remaining in the list.

◆ aern_topology_list_serialize()

AERN_EXPORT_API size_t aern_topology_list_serialize ( uint8_t * output,
const aern_topology_list_state * list )

Serialize a topology list.

This function serializes the topology list into a byte array.

Parameters
outputThe output buffer for the serialized topology.
list[const] The topology list state.
Returns
Returns the size of the serialized topology.

◆ aern_topology_list_server_count()

AERN_EXPORT_API size_t aern_topology_list_server_count ( const aern_topology_list_state * list,
aern_network_designations ntype )

Get the count of a type of node in the database.

This function counts the number of nodes of a specific type in the topology list.

Parameters
list[const] The topology list state.
ntypeThe type of node entry to count.
Returns
Returns the number of nodes matching the given type.

◆ aern_topology_list_size()

AERN_EXPORT_API size_t aern_topology_list_size ( const aern_topology_list_state * list)

Get the byte size of the serialized list.

This function returns the size in bytes of the serialized topology list.

Parameters
list[const] The topology list state.
Returns
Returns the byte size of the serialized topology.

◆ aern_topology_list_to_string()

AERN_EXPORT_API size_t aern_topology_list_to_string ( const aern_topology_list_state * list,
char * output,
size_t outlen )

Convert the topology list to a printable string.

This function converts the topology list into a human?readable string.

Parameters
list[const] The topology list state.
outputThe output string buffer.
outlenThe length of the output buffer.
Returns
Returns the size of the resulting string.

◆ aern_topology_list_update_pack()

AERN_EXPORT_API size_t aern_topology_list_update_pack ( uint8_t * output,
const aern_topology_list_state * list,
aern_network_designations ntype )

Pack a node update set to an array.

This function serializes a subset of nodes from the topology list (of a given type) into an array.

Parameters
outputThe output buffer for the serialized node update set.
list[const] The topology list state.
ntypeThe type of node entry to pack.
Returns
Returns the size of the serialized node update set.

◆ aern_topology_list_update_unpack()

AERN_EXPORT_API size_t aern_topology_list_update_unpack ( aern_topology_list_state * list,
const uint8_t * input,
size_t inplen )

Unpack a node update set to the topology list.

This function deserializes an update set and adds the nodes to the topology list.

Parameters
listThe topology list state to update.
inputThe input serialized node update set.
inplenThe length of the input array.
Returns
Returns the number of bytes processed.

◆ aern_topology_node_add_alias()

AERN_EXPORT_API void aern_topology_node_add_alias ( aern_topology_node_state * node,
const char * alias )

Add an alias string to an issuer path.

This function appends an alias to the issuer string of a node.

Parameters
nodeThe network node to update.
alias[const] The host alias to add.

◆ aern_topology_node_clear()

AERN_EXPORT_API void aern_topology_node_clear ( aern_topology_node_state * node)

Erase a node structure.

This function clears all data in a topology node structure.

Parameters
nodeA pointer to the topology node structure to erase.

◆ aern_topology_node_copy()

AERN_EXPORT_API void aern_topology_node_copy ( const aern_topology_node_state * source,
aern_topology_node_state * destination )

Copy a source node to a destination node structure.

This function copies the contents of one topology node structure to another.

Parameters
source[const] A pointer to the source node structure.
destinationA pointer to the destination node structure.

◆ aern_topology_node_deserialize()

AERN_EXPORT_API void aern_topology_node_deserialize ( aern_topology_node_state * node,
const uint8_t * input )

Deserialize a topological node.

This function converts a serialized topology node array into a topology node structure.

Parameters
nodeA pointer to the topology node structure to populate.
input[const] The input serialized topology node data.

◆ aern_topology_node_encode()

AERN_EXPORT_API size_t aern_topology_node_encode ( const aern_topology_node_state * node,
char output[AERN_TOPOLOGY_NODE_ENCODED_SIZE] )

Encode a topological node into a printable string.

This function encodes a topology node into a human?readable string format.

Parameters
nodeA pointer to the topology node structure.
outputThe output buffer for the encoded node string.
Returns
Returns the size of the encoded node string.

◆ aern_topology_node_exists()

AERN_EXPORT_API bool aern_topology_node_exists ( const aern_topology_list_state * list,
const uint8_t * serial )

Queries on the serial number if the node is in the database.

This function checks whether a node with the specified serial number exists in the topology list.

Parameters
list[const] The topology list state.
serialThe serial number to search for.
Returns
Returns true if the node exists; false otherwise.

◆ aern_topology_node_find()

AERN_EXPORT_API bool aern_topology_node_find ( const aern_topology_list_state * list,
aern_topology_node_state * node,
const uint8_t * serial )

Return the node pointer in the list matching the serial number.

This function finds a node in the topology list that matches the given serial number.

Parameters
list[const] The topology list state.
nodeA pointer to the destination node structure to populate.
serial[const] The certificate serial number to search for.
Returns
Returns true if the node was found; false otherwise.

◆ aern_topology_node_find_address()

AERN_EXPORT_API bool aern_topology_node_find_address ( const aern_topology_list_state * list,
aern_topology_node_state * node,
const char * address )

Return the node pointer in the list matching the address string.

This function searches the topology list for a node that matches the given network address.

Parameters
list[const] The topology list state.
nodeA pointer to the destination node structure.
address[const] The network address to search for.
Returns
Returns true if the node was found; false otherwise.

◆ aern_topology_node_find_ads()

AERN_EXPORT_API bool aern_topology_node_find_ads ( const aern_topology_list_state * list,
aern_topology_node_state * node )

Return the ADC node from the list.

This function finds the ADC node in the topology list.

Parameters
list[const] The topology list state.
nodeA pointer to the destination node structure.
Returns
Returns true if the ADC node was found; false otherwise.

◆ aern_topology_node_find_alias()

AERN_EXPORT_API bool aern_topology_node_find_alias ( const aern_topology_list_state * list,
aern_topology_node_state * node,
const char * alias )

Return the node pointer in the list matching the alias string.

This function searches the topology list for a node that matches the given alias.

Parameters
list[const] The topology list state.
nodeA pointer to the destination node structure.
alias[const] The alias to search for.
Returns
Returns true if the node was found; false otherwise.

◆ aern_topology_node_find_issuer()

AERN_EXPORT_API bool aern_topology_node_find_issuer ( const aern_topology_list_state * list,
aern_topology_node_state * node,
const char * issuer )

Return the node pointer in the list matching the name string.

This function finds a node in the topology list that matches the given issuer name.

Parameters
list[const] The topology list state.
nodeA pointer to the destination node structure.
issuer[const] The certificate issuer name.
Returns
Returns true if the node was found; false otherwise.

◆ aern_topology_node_find_root()

AERN_EXPORT_API bool aern_topology_node_find_root ( const aern_topology_list_state * list,
aern_topology_node_state * node )

Return the ARS server node from the list.

This function retrieves the ARS server node from the topology list.

Parameters
list[const] The topology list state.
nodeA pointer to the destination node structure.
Returns
Returns true if the ARS server node was found; false otherwise.

◆ aern_topology_node_get_index()

AERN_EXPORT_API int32_t aern_topology_node_get_index ( const aern_topology_list_state * list,
const uint8_t * serial )

Find the index number of a node in an array.

This function searches for a node by its serial number and returns its index in the topology list.

Parameters
list[const] The topology list state.
serialThe serial number to search for.
Returns
Returns the index of the node, or AERN_TOPOLOGY_NODE_NOT_FOUND if not found.

◆ aern_topology_node_remove()

AERN_EXPORT_API void aern_topology_node_remove ( aern_topology_list_state * list,
const uint8_t * serial )

Find and remove a node from the topology.

This function searches for a node by its serial number and removes it from the topology list.

Parameters
listThe topology list state.
serialThe serial number of the node to remove (AERN_CERTIFICATE_SERIAL_SIZE bytes).

◆ aern_topology_node_remove_duplicate()

AERN_EXPORT_API void aern_topology_node_remove_duplicate ( aern_topology_list_state * list,
const char * issuer )

Remove a node from the topology with the same issuer name.

This function removes duplicate nodes from the topology list that have the same issuer name.

Parameters
listThe topology list state.
issuerThe issuer name to match for removal.

◆ aern_topology_node_serialize()

AERN_EXPORT_API size_t aern_topology_node_serialize ( uint8_t * output,
const aern_topology_node_state * node )

Serialize a topological node structure, including the mfk.

This function serializes the topology node structure into a byte array.

Parameters
outputThe output buffer to receive the serialized node.
node[const] A pointer to the topology node structure.
Returns
Returns the size of the serialized node.

◆ aern_topology_node_verify_ads()

AERN_EXPORT_API bool aern_topology_node_verify_ads ( const aern_topology_list_state * list,
const aern_child_certificate * ccert )

Verify that the ADC certificate matches the hash stored in the topology.

This function verifies that the ADC certificate in the topology list matches the certificate hash.

Parameters
list[const] The topology list state.
ccert[const] The ADC certificate structure.
Returns
Returns true if the certificate matches the stored hash; false otherwise.

◆ aern_topology_node_verify_issuer()

AERN_EXPORT_API bool aern_topology_node_verify_issuer ( const aern_topology_list_state * list,
const aern_child_certificate * ccert,
const char * issuer )

Verify that an issuing node's certificate matches the hash stored in the topology.

This function verifies that the certificate for a given issuer matches the stored hash in the topology list.

Parameters
list[const] The topology list state.
ccert[const] The node's certificate structure.
issuer[const] The certificate issuer name.
Returns
Returns true if the certificate is valid and matches; false otherwise.

◆ aern_topology_node_verify_root()

AERN_EXPORT_API bool aern_topology_node_verify_root ( const aern_topology_list_state * list,
const aern_root_certificate * rcert )

Verify that the root certificate matches the hash stored in the topology.

This function verifies that the root certificate matches the hash stored in the topology list.

Parameters
list[const] The topology list state.
rcert[const] The root certificate structure.
Returns
Returns true if the root certificate is valid; false otherwise.

◆ aern_topology_nodes_are_equal()

AERN_EXPORT_API bool aern_topology_nodes_are_equal ( const aern_topology_node_state * a,
const aern_topology_node_state * b )

Compare two topological nodes for equality.

This function compares two topology node structures and returns true if they are identical.

Parameters
a[const] The first node.
b[const] The second node.
Returns
Returns true if the nodes are identical; false otherwise.

◆ aern_topology_ordered_server_list()

AERN_EXPORT_API size_t aern_topology_ordered_server_list ( aern_topology_list_state * olist,
const aern_topology_list_state * tlist,
aern_network_designations ntype )

Return a list of nodes of a type, sorted by serial number.

This function returns a new topology list containing nodes of a specific type, sorted by their serial number.

Note
The caller is responsible for disposing the output list.
Parameters
olistThe sorted output topology list.
tlistThe unsorted input topology list.
ntypeThe type of node to filter and sort.
Returns
Returns the number of nodes in the sorted list.

◆ aern_topology_root_register()

AERN_EXPORT_API void aern_topology_root_register ( aern_topology_list_state * list,
const aern_root_certificate * rcert,
const char * address )

Register a root to a topology list.

This function registers a root certificate into the topology list.

Parameters
listA pointer to the topology list.
rcert[const] The root certificate.
address[const] The network address of the root.

◆ aern_topology_to_file()

AERN_EXPORT_API void aern_topology_to_file ( const aern_topology_list_state * list,
const char * fpath )

Copy a topology list to a file.

This function writes the current topology list to a file.

Parameters
list[const] The topology list state.
fpath[const] The destination file path for the topology list.