|
OpenLcbCLib 1.0 Alpha
OpenSource C Library to create OpenLcb/Lcc Nodes
|
Fixed-size buffer mapping 12-bit CAN aliases to 48-bit OpenLCB Node IDs. More...
Go to the source code of this file.
Functions | |
| void | AliasMappings_initialize (void) |
| Initializes the alias mapping buffer, clearing all entries and flags. | |
| alias_mapping_info_t * | AliasMappings_get_alias_mapping_info (void) |
| Returns a pointer to the internal alias mapping info structure. | |
| void | AliasMappings_set_has_duplicate_alias_flag (void) |
| Signals the main loop that an incoming message used one of our reserved aliases. | |
| void | AliasMappings_clear_has_duplicate_alias_flag (void) |
| Clears the duplicate alias flag after the conflict has been resolved. | |
| alias_mapping_t * | AliasMappings_register (uint16_t alias, node_id_t node_id) |
| Registers a CAN alias / Node ID pair in the buffer. | |
| void | AliasMappings_unregister (uint16_t alias) |
| Removes the entry matching the given alias from the buffer. | |
| alias_mapping_t * | AliasMappings_find_mapping_by_alias (uint16_t alias) |
| Finds the mapping entry for the given alias. | |
| alias_mapping_t * | AliasMappings_find_mapping_by_node_id (node_id_t node_id) |
| Finds the mapping entry for the given Node ID. | |
| void | AliasMappings_flush (void) |
| Clears all alias mappings and resets all flags. | |
Fixed-size buffer mapping 12-bit CAN aliases to 48-bit OpenLCB Node IDs.
Supports bidirectional lookup (by alias or by Node ID), duplicate alias detection, and permission tracking. Used during node login, message routing, and alias conflict resolution. Must be initialized before any node operations.
|
extern |
Initializes the alias mapping buffer, clearing all entries and flags.
|
extern |
Returns a pointer to the internal alias mapping info structure.
Intended for diagnostics and testing. Prefer the specific API functions for normal use — direct modification can break internal consistency.
|
extern |
Signals the main loop that an incoming message used one of our reserved aliases.
Sets the has_duplicate_alias flag. The main state machine must detect this flag and restart alias allocation with a new alias. Setting this flag does NOT automatically trigger reallocation.
Signals the main loop that an incoming message used one of our reserved aliases.
|
extern |
Clears the duplicate alias flag after the conflict has been resolved.
Clears the duplicate alias flag after the conflict has been resolved.
|
extern |
Registers a CAN alias / Node ID pair in the buffer.
Searches for an empty slot or an existing entry with the same Node ID. If the Node ID already exists its alias is updated (correct behavior during conflict recovery). Returns NULL if the buffer is full or either parameter is outside its valid range.
Use cases:
| alias | 12-bit CAN alias (valid range: 0x001–0xFFF). |
| node_id | 48-bit OpenLCB node_id_t (valid range: 0x000000000001–0xFFFFFFFFFFFF). |
Algorithm:
Use cases:
* @param alias 12-bit CAN alias (valid range: 0x001–0xFFF). * @param node_id 48-bit OpenLCB Node ID (valid range: 0x000000000001–0xFFFFFFFFFFFF). *
|
extern |
Removes the entry matching the given alias from the buffer.
Safe to call with an alias that does not exist — no error is raised. All fields in the matching slot are cleared so it can be reused.
| alias | 12-bit CAN alias to remove. |
Algorithm:
* @param alias 12-bit CAN alias to remove. *
|
extern |
Finds the mapping entry for the given alias.
| alias | 12-bit CAN alias to search for. |
Algorithm:
* @param alias 12-bit CAN alias to search for. *
|
extern |
Finds the mapping entry for the given Node ID.
| node_id | 48-bit OpenLCB node_id_t to search for. |
Algorithm:
* @param node_id 48-bit OpenLCB Node ID to search for. *
|
extern |
Clears all alias mappings and resets all flags.
Functionally identical to AliasMappings_initialize() but intended for runtime use (system reset, test teardown). Use initialize() at startup.
Clears all alias mappings and resets all flags.
Copyright (c) 2026 Jim Kueneman all rights reserved. See the License