|
OpenLcbCLib 1.0 Alpha
OpenSource C Library to create OpenLcb/Lcc Nodes
|
Random-access list of OpenLCB message pointers. More...
Macros | |
| #define | BUFFER_LIST_INPROCESS_TIMEOUT_TICKS 30 |
| Multi-frame assembly timeout in 100ms ticks (3 seconds). | |
Functions | |
| void | OpenLcbBufferList_initialize (void) |
| Initializes the buffer list. | |
| 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, or NULL if empty or out of range. | |
| 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.
Fixed-size array with linear search. NULL slots are free. Supports indexed access and attribute-based search (alias + MTI).
| #define BUFFER_LIST_INPROCESS_TIMEOUT_TICKS 30 |
Multi-frame assembly timeout in 100ms ticks (3 seconds).
| void OpenLcbBufferList_initialize | ( | void | ) |
Initializes the buffer list.
Initializes the buffer list to an empty state.
Algorithm:
| openlcb_msg_t * OpenLcbBufferList_add | ( | openlcb_msg_t * | new_msg | ) |
Inserts a message pointer into the first available slot.
Algorithm:
* @param new_msg Pointer to @ref openlcb_msg_t from the buffer store *
| 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.
Algorithm:
* @param source_alias CAN alias of sending node * @param dest_alias CAN alias of receiving node * @param mti Message Type Indicator code *
| openlcb_msg_t * OpenLcbBufferList_release | ( | openlcb_msg_t * | msg | ) |
Removes a message from the list without freeing it.
Algorithm:
* @param msg Pointer to @ref openlcb_msg_t to remove (NULL is safe) *
| openlcb_msg_t * OpenLcbBufferList_index_of | ( | uint16_t | index | ) |
Returns the message pointer at the given index, or NULL if empty or out of range.
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.
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