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

The MPDC topology functions. More...

#include "mpdc.h"
#include "certificate.h"
#include "../../QSC/QSC/ipinfo.h"
#include "../../QSC/QSC/list.h"
#include "../../QSC/QSC/timestamp.h"

Go to the source code of this file.

Data Structures

struct  mpdc_topology_node_state
 The MPDC topology node structure. More...
 
struct  mpdc_topology_list_state
 The MPDC topology list structure. More...
 

Macros

#define MPDC_TOPOLOGY_NODE_ENCODED_SIZE
 The size of an encoded node string.
 
#define MPDC_TOPOLOGY_NODE_MINIMUM_ISSUER_SIZE   3
 The minimum size of an issuer string.
 
#define MPDC_TOPOLOGY_NODE_NOT_FOUND   -1
 The value returned when a node is not found.
 
#define MPDC_NETWORK_TOPOLOGY_MAX_SIZE   1024
 The maximum size of the topology.
 
#define MPDC_NETWORK_TOPOLOGY_NODE_SIZE
 The size in bytes of a serialized topological node.
 

Typedefs

typedef MPDC_EXPORT_API struct mpdc_topology_node_state mpdc_topology_node_state
 
typedef MPDC_EXPORT_API struct mpdc_topology_list_state mpdc_topology_list_state
 

Functions

MPDC_EXPORT_API void mpdc_topology_address_from_issuer (char *address, const char *issuer, const mpdc_topology_list_state *list)
 Returns an IP address from an issuer string.
 
MPDC_EXPORT_API void mpdc_topology_node_add_alias (mpdc_topology_node_state *node, const char *alias)
 Add an alias string to an issuer path.
 
MPDC_EXPORT_API bool mpdc_topology_nodes_are_equal (const mpdc_topology_node_state *a, const mpdc_topology_node_state *b)
 Compare two topological nodes for equality.
 
MPDC_EXPORT_API uint8_t * mpdc_topology_child_add_empty_node (mpdc_topology_list_state *list)
 Get an empty node pointer from the topology list.
 
MPDC_EXPORT_API void mpdc_topology_child_add_item (mpdc_topology_list_state *list, const mpdc_topology_node_state *node)
 Add a node to the topology list.
 
MPDC_EXPORT_API bool mpdc_topology_canonical_to_issuer_name (char *issuer, size_t isslen, const char *domain, const char *cname)
 Translate a canonical name to an issuer name.
 
MPDC_EXPORT_API bool mpdc_topology_issuer_to_canonical_name (char *cname, size_t namelen, const char *issuer)
 Translate an issuer name to a canonical name.
 
MPDC_EXPORT_API void mpdc_topology_child_register (mpdc_topology_list_state *list, const mpdc_child_certificate *ccert, const char *address)
 Register a child to a topology list.
 
MPDC_EXPORT_API void mpdc_topology_list_clone (const mpdc_topology_list_state *tlist, mpdc_topology_list_state *tcopy)
 Clone a topology list.
 
MPDC_EXPORT_API void mpdc_topology_list_deserialize (mpdc_topology_list_state *list, const uint8_t *input, size_t inplen)
 Deserialize a topology list.
 
MPDC_EXPORT_API void mpdc_topology_list_dispose (mpdc_topology_list_state *list)
 Dispose of the topology list and release memory.
 
MPDC_EXPORT_API void mpdc_topology_list_initialize (mpdc_topology_list_state *list)
 Initialize the topology list.
 
MPDC_EXPORT_API bool mpdc_topology_list_item (const mpdc_topology_list_state *list, mpdc_topology_node_state *node, size_t index)
 Get a node from the index.
 
MPDC_EXPORT_API size_t mpdc_topology_list_remove_duplicates (mpdc_topology_list_state *list)
 Remove duplicate nodes from the topology.
 
MPDC_EXPORT_API size_t mpdc_topology_list_server_count (const mpdc_topology_list_state *list, mpdc_network_designations ntype)
 Get the count of a type of node in the database.
 
MPDC_EXPORT_API size_t mpdc_topology_list_serialize (uint8_t *output, const mpdc_topology_list_state *list)
 Serialize a topology list.
 
MPDC_EXPORT_API size_t mpdc_topology_list_size (const mpdc_topology_list_state *list)
 Get the byte size of the serialized list.
 
MPDC_EXPORT_API size_t mpdc_topology_list_to_string (const mpdc_topology_list_state *list, char *output, size_t outlen)
 Convert the topology list to a printable string.
 
MPDC_EXPORT_API size_t mpdc_topology_list_update_pack (uint8_t *output, const mpdc_topology_list_state *list, mpdc_network_designations ntype)
 Pack a node update set to an array.
 
MPDC_EXPORT_API size_t mpdc_topology_list_update_unpack (mpdc_topology_list_state *list, const uint8_t *input, size_t inplen)
 Unpack a node update set to the topology list.
 
MPDC_EXPORT_API size_t mpdc_topology_ordered_server_list (mpdc_topology_list_state *olist, const mpdc_topology_list_state *tlist, mpdc_network_designations ntype)
 Return a list of nodes of a type, sorted by serial number.
 
MPDC_EXPORT_API void mpdc_topology_node_clear (mpdc_topology_node_state *node)
 Erase a node structure.
 
MPDC_EXPORT_API void mpdc_topology_node_copy (const mpdc_topology_node_state *source, mpdc_topology_node_state *destination)
 Copy a source node to a destination node structure.
 
MPDC_EXPORT_API void mpdc_topology_node_deserialize (mpdc_topology_node_state *node, const uint8_t *input)
 Deserialize a topological node.
 
MPDC_EXPORT_API size_t mpdc_topology_node_encode (const mpdc_topology_node_state *node, char output[MPDC_TOPOLOGY_NODE_ENCODED_SIZE])
 Encode a topological node into a printable string.
 
MPDC_EXPORT_API bool mpdc_topology_node_exists (const mpdc_topology_list_state *list, const uint8_t *serial)
 Queries on the serial number if the node is in the database.
 
MPDC_EXPORT_API int32_t mpdc_topology_node_get_index (const mpdc_topology_list_state *list, const uint8_t *serial)
 Find the index number of a node in an array.
 
MPDC_EXPORT_API bool mpdc_topology_node_find (const mpdc_topology_list_state *list, mpdc_topology_node_state *node, const uint8_t *serial)
 Return the node pointer in the list matching the serial number.
 
MPDC_EXPORT_API bool mpdc_topology_node_find_address (const mpdc_topology_list_state *list, mpdc_topology_node_state *node, const char *address)
 Return the node pointer in the list matching the address string.
 
MPDC_EXPORT_API bool mpdc_topology_node_find_alias (const mpdc_topology_list_state *list, mpdc_topology_node_state *node, const char *alias)
 Return the node pointer in the list matching the alias string.
 
MPDC_EXPORT_API bool mpdc_topology_node_find_dla (const mpdc_topology_list_state *list, mpdc_topology_node_state *node)
 Return the DLA node from the list.
 
MPDC_EXPORT_API bool mpdc_topology_node_find_issuer (const mpdc_topology_list_state *list, mpdc_topology_node_state *node, const char *issuer)
 Return the node pointer in the list matching the name string.
 
MPDC_EXPORT_API bool mpdc_topology_node_find_root (const mpdc_topology_list_state *list, mpdc_topology_node_state *node)
 Return the RDS server node from the list.
 
MPDC_EXPORT_API void mpdc_topology_node_remove (mpdc_topology_list_state *list, const uint8_t *serial)
 Find and remove a node from the topology.
 
MPDC_EXPORT_API void mpdc_topology_node_remove_duplicate (mpdc_topology_list_state *list, const char *issuer)
 Remove a node from the topology with the same issuer name.
 
MPDC_EXPORT_API bool mpdc_topology_node_verify_dla (const mpdc_topology_list_state *list, const mpdc_child_certificate *ccert)
 Verify that the DLA certificate matches the hash stored in the topology.
 
MPDC_EXPORT_API bool mpdc_topology_node_verify_issuer (const mpdc_topology_list_state *list, const mpdc_child_certificate *ccert, const char *issuer)
 Verify that an issuing node's certificate matches the hash stored in the topology.
 
MPDC_EXPORT_API bool mpdc_topology_node_verify_root (const mpdc_topology_list_state *list, const mpdc_root_certificate *rcert)
 Verify that the root certificate matches the hash stored in the topology.
 
MPDC_EXPORT_API size_t mpdc_topology_node_serialize (uint8_t *output, const mpdc_topology_node_state *node)
 Serialize a topological node structure, including the mfk.
 
MPDC_EXPORT_API void mpdc_topology_root_register (mpdc_topology_list_state *list, const mpdc_root_certificate *rcert, const char *address)
 Register a root to a topology list.
 
MPDC_EXPORT_API void mpdc_topology_from_file (const char *fpath, mpdc_topology_list_state *list)
 Copy a topology list from a file.
 
MPDC_EXPORT_API void mpdc_topology_to_file (const mpdc_topology_list_state *list, const char *fpath)
 Copy a topology list to a file.
 

Detailed Description

The MPDC topology functions.

Detailed File Description: This header file defines the functions, macros, structures, and enumerations used by MPDC 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 MPDC device types of [root server], [dla, agent, 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 DLA 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:\MPDC\xyz\mas), enabling file system certificate retrieval based on the issuer's topological path.

Macro Definition Documentation

◆ MPDC_NETWORK_TOPOLOGY_NODE_SIZE

#define MPDC_NETWORK_TOPOLOGY_NODE_SIZE
Value:
#define MPDC_CERTIFICATE_EXPIRATION_SIZE
The certificate expiration date length.
Definition mpdc.h:782
#define MPDC_CERTIFICATE_ADDRESS_SIZE
The maximum IP address length.
Definition mpdc.h:758
#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_CERTIFICATE_DESIGNATION_SIZE
The size of the child certificate designation field.
Definition mpdc.h:776
#define MPDC_CERTIFICATE_HASH_SIZE
The size of the certificate hash in bytes.
Definition mpdc.h:788
#define MPDC_CERTIFICATE_SERIAL_SIZE
The certificate serial number field length.
Definition mpdc.h:819

The size in bytes of a serialized topological node.

◆ MPDC_TOPOLOGY_NODE_ENCODED_SIZE

#define MPDC_TOPOLOGY_NODE_ENCODED_SIZE
Value:
(MPDC_CHILD_CERTIFICATE_ISSUER_PREFIX_SIZE + MPDC_CERTIFICATE_ISSUER_SIZE + MPDC_CERTIFICATE_SEPERATOR_SIZE + \
MPDC_CHILD_CERTIFICATE_ADDRESS_PREFIX_SIZE + QSC_IPINFO_IPV4_STRNLEN + MPDC_CERTIFICATE_SEPERATOR_SIZE + \
MPDC_ROOT_CERTIFICATE_HASH_PREFIX_SIZE + (MPDC_CERTIFICATE_HASH_SIZE * 2) + MPDC_CERTIFICATE_SEPERATOR_SIZE + \
MPDC_CHILD_CERTIFICATE_SERIAL_PREFIX_SIZE + (MPDC_CERTIFICATE_SERIAL_SIZE * 2) + MPDC_CERTIFICATE_SEPERATOR_SIZE + \
MPDC_CHILD_CERTIFICATE_DESIGNATION_PREFIX_SIZE + MPDC_NETWORK_DESIGNATION_SIZE + MPDC_CERTIFICATE_SEPERATOR_SIZE + \
MPDC_CHILD_CERTIFICATE_VALID_FROM_PREFIX_SIZE + QSC_TIMESTAMP_STRING_SIZE + MPDC_CERTIFICATE_SEPERATOR_SIZE + \
MPDC_CHILD_CERTIFICATE_EXPIRATION_TO_PREFIX_SIZE + QSC_TIMESTAMP_STRING_SIZE + MPDC_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

◆ mpdc_topology_address_from_issuer()

MPDC_EXPORT_API void mpdc_topology_address_from_issuer ( char * address,
const char * issuer,
const mpdc_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 MPDC_CERTIFICATE_ADDRESS_SIZE).
issuer[const] The issuer string.
list[const] A pointer to the topology list.

◆ mpdc_topology_canonical_to_issuer_name()

MPDC_EXPORT_API bool mpdc_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.

◆ mpdc_topology_child_add_empty_node()

MPDC_EXPORT_API uint8_t * mpdc_topology_child_add_empty_node ( mpdc_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.

◆ mpdc_topology_child_add_item()

MPDC_EXPORT_API void mpdc_topology_child_add_item ( mpdc_topology_list_state * list,
const mpdc_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.

◆ mpdc_topology_child_register()

MPDC_EXPORT_API void mpdc_topology_child_register ( mpdc_topology_list_state * list,
const mpdc_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 MPDC_CERTIFICATE_ADDRESS_SIZE).

◆ mpdc_topology_from_file()

MPDC_EXPORT_API void mpdc_topology_from_file ( const char * fpath,
mpdc_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.

◆ mpdc_topology_issuer_to_canonical_name()

MPDC_EXPORT_API bool mpdc_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.

◆ mpdc_topology_list_clone()

MPDC_EXPORT_API void mpdc_topology_list_clone ( const mpdc_topology_list_state * tlist,
mpdc_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.

◆ mpdc_topology_list_deserialize()

MPDC_EXPORT_API void mpdc_topology_list_deserialize ( mpdc_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.

◆ mpdc_topology_list_dispose()

MPDC_EXPORT_API void mpdc_topology_list_dispose ( mpdc_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.

◆ mpdc_topology_list_initialize()

MPDC_EXPORT_API void mpdc_topology_list_initialize ( mpdc_topology_list_state * list)

Initialize the topology list.

This function initializes the topology list state.

Parameters
listThe topology list state to initialize.

◆ mpdc_topology_list_item()

MPDC_EXPORT_API bool mpdc_topology_list_item ( const mpdc_topology_list_state * list,
mpdc_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.

◆ mpdc_topology_list_remove_duplicates()

MPDC_EXPORT_API size_t mpdc_topology_list_remove_duplicates ( mpdc_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.

◆ mpdc_topology_list_serialize()

MPDC_EXPORT_API size_t mpdc_topology_list_serialize ( uint8_t * output,
const mpdc_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.

◆ mpdc_topology_list_server_count()

MPDC_EXPORT_API size_t mpdc_topology_list_server_count ( const mpdc_topology_list_state * list,
mpdc_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.

◆ mpdc_topology_list_size()

MPDC_EXPORT_API size_t mpdc_topology_list_size ( const mpdc_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.

◆ mpdc_topology_list_to_string()

MPDC_EXPORT_API size_t mpdc_topology_list_to_string ( const mpdc_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.

◆ mpdc_topology_list_update_pack()

MPDC_EXPORT_API size_t mpdc_topology_list_update_pack ( uint8_t * output,
const mpdc_topology_list_state * list,
mpdc_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.

◆ mpdc_topology_list_update_unpack()

MPDC_EXPORT_API size_t mpdc_topology_list_update_unpack ( mpdc_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.

◆ mpdc_topology_node_add_alias()

MPDC_EXPORT_API void mpdc_topology_node_add_alias ( mpdc_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.

◆ mpdc_topology_node_clear()

MPDC_EXPORT_API void mpdc_topology_node_clear ( mpdc_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.

◆ mpdc_topology_node_copy()

MPDC_EXPORT_API void mpdc_topology_node_copy ( const mpdc_topology_node_state * source,
mpdc_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.

◆ mpdc_topology_node_deserialize()

MPDC_EXPORT_API void mpdc_topology_node_deserialize ( mpdc_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.

◆ mpdc_topology_node_encode()

MPDC_EXPORT_API size_t mpdc_topology_node_encode ( const mpdc_topology_node_state * node,
char output[MPDC_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.

◆ mpdc_topology_node_exists()

MPDC_EXPORT_API bool mpdc_topology_node_exists ( const mpdc_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.

◆ mpdc_topology_node_find()

MPDC_EXPORT_API bool mpdc_topology_node_find ( const mpdc_topology_list_state * list,
mpdc_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.

◆ mpdc_topology_node_find_address()

MPDC_EXPORT_API bool mpdc_topology_node_find_address ( const mpdc_topology_list_state * list,
mpdc_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.

◆ mpdc_topology_node_find_alias()

MPDC_EXPORT_API bool mpdc_topology_node_find_alias ( const mpdc_topology_list_state * list,
mpdc_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.

◆ mpdc_topology_node_find_dla()

MPDC_EXPORT_API bool mpdc_topology_node_find_dla ( const mpdc_topology_list_state * list,
mpdc_topology_node_state * node )

Return the DLA node from the list.

This function finds the DLA node in the topology list.

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

◆ mpdc_topology_node_find_issuer()

MPDC_EXPORT_API bool mpdc_topology_node_find_issuer ( const mpdc_topology_list_state * list,
mpdc_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.

◆ mpdc_topology_node_find_root()

MPDC_EXPORT_API bool mpdc_topology_node_find_root ( const mpdc_topology_list_state * list,
mpdc_topology_node_state * node )

Return the RDS server node from the list.

This function retrieves the RDS 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 RDS server node was found; false otherwise.

◆ mpdc_topology_node_get_index()

MPDC_EXPORT_API int32_t mpdc_topology_node_get_index ( const mpdc_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 MPDC_TOPOLOGY_NODE_NOT_FOUND if not found.

◆ mpdc_topology_node_remove()

MPDC_EXPORT_API void mpdc_topology_node_remove ( mpdc_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 (MPDC_CERTIFICATE_SERIAL_SIZE bytes).

◆ mpdc_topology_node_remove_duplicate()

MPDC_EXPORT_API void mpdc_topology_node_remove_duplicate ( mpdc_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.

◆ mpdc_topology_node_serialize()

MPDC_EXPORT_API size_t mpdc_topology_node_serialize ( uint8_t * output,
const mpdc_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.

◆ mpdc_topology_node_verify_dla()

MPDC_EXPORT_API bool mpdc_topology_node_verify_dla ( const mpdc_topology_list_state * list,
const mpdc_child_certificate * ccert )

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

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

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

◆ mpdc_topology_node_verify_issuer()

MPDC_EXPORT_API bool mpdc_topology_node_verify_issuer ( const mpdc_topology_list_state * list,
const mpdc_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.

◆ mpdc_topology_node_verify_root()

MPDC_EXPORT_API bool mpdc_topology_node_verify_root ( const mpdc_topology_list_state * list,
const mpdc_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.

◆ mpdc_topology_nodes_are_equal()

MPDC_EXPORT_API bool mpdc_topology_nodes_are_equal ( const mpdc_topology_node_state * a,
const mpdc_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.

◆ mpdc_topology_ordered_server_list()

MPDC_EXPORT_API size_t mpdc_topology_ordered_server_list ( mpdc_topology_list_state * olist,
const mpdc_topology_list_state * tlist,
mpdc_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.

◆ mpdc_topology_root_register()

MPDC_EXPORT_API void mpdc_topology_root_register ( mpdc_topology_list_state * list,
const mpdc_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.

◆ mpdc_topology_to_file()

MPDC_EXPORT_API void mpdc_topology_to_file ( const mpdc_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.