|
OpenLcbCLib 1.0 Alpha
OpenSource C Library to create OpenLcb/Lcc Nodes
|
Random-access list of OpenLCB message pointers. More...
Go to the source code of this file.
Functions | |
| void | OpenLcbBufferList_initialize (void) |
| Initializes the buffer list to an empty state. | |
| openlcb_msg_t * | OpenLcbBufferList_add (openlcb_msg_t *new_msg) |
| Inserts a message pointer into the first available slot. | |
| openlcb_msg_t * | OpenLcbBufferList_find (uint16_t source_alias, uint16_t dest_alias, uint16_t mti) |
| Finds a message matching source alias, dest alias, and MTI. | |
| openlcb_msg_t * | OpenLcbBufferList_release (openlcb_msg_t *msg) |
| Removes a message from the list without freeing it. | |
| openlcb_msg_t * | OpenLcbBufferList_index_of (uint16_t index) |
| Returns the message pointer at the given index. | |
| bool | OpenLcbBufferList_is_empty (void) |
| Returns true if the list contains no messages. | |
| void | OpenLcbBufferList_check_timeouts (uint8_t current_tick) |
| Scans for stale in-progress buffers and frees them. | |
Random-access list of OpenLCB message pointers.
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
Provides a fixed-size array of openlcb_msg_t pointers that supports both indexed access and attribute-based search (source alias, destination alias, and MTI). Primarily used for multi-frame message assembly where frames must be matched to an in-progress message by sender and type. Must be initialized after OpenLcbBufferStore_initialize().
|
extern |
Initializes the buffer list to an empty state.
Clears all slots to NULL. Must be called once during startup after OpenLcbBufferStore_initialize().
Initializes the buffer list to an empty state.
Algorithm:
|
extern |
Inserts a message pointer into the first available slot.
| new_msg | Pointer to an openlcb_msg_t allocated from OpenLcbBufferStore. |
Algorithm:
* @param new_msg Pointer to @ref openlcb_msg_t from the buffer store *
|
extern |
Finds a message matching source alias, dest alias, and MTI.
| source_alias | 12-bit CAN alias of the originating node. |
| dest_alias | 12-bit CAN alias of the destination node. |
| mti | Message Type Indicator to match. |
Algorithm:
* @param source_alias CAN alias of sending node * @param dest_alias CAN alias of receiving node * @param mti Message Type Indicator code *
|
extern |
Removes a message from the list without freeing it.
| msg | Pointer to the openlcb_msg_t to remove (NULL is safe). |
Algorithm:
* @param msg Pointer to @ref openlcb_msg_t to remove (NULL is safe) *
|
extern |
Returns the message pointer at the given index.
| index | Zero-based slot index (0 to LEN_MESSAGE_BUFFER - 1). |
Returns the message pointer at the given index.
|
extern |
Returns true if the list contains no messages.
|
extern |
Scans for stale in-progress buffers and frees them.
Caller MUST hold the shared resource lock before calling. Frees any in-progress message whose elapsed time (computed from the global 100ms tick) has reached the timeout threshold.
| current_tick | Current value of the global 100ms tick counter, passed as a parameter from the main loop. |
Copyright (c) 2026 Jim Kueneman all rights reserved. See the License