OpenLcbCLib 1.0 Alpha
OpenSource C Library to create OpenLcb/Lcc Nodes
Loading...
Searching...
No Matches
protocol_message_network.c File Reference

Core message network protocol implementation. More...

Functions

void ProtocolMessageNetwork_initialize (const interface_openlcb_protocol_message_network_t *interface_openlcb_protocol_message_network)
 Stores the callback interface. Call once at startup.
 
void ProtocolMessageNetwork_handle_initialization_complete (openlcb_statemachine_info_t *statemachine_info)
 Handle Initialization Complete (full node). Check for duplicate Node ID.
 
void ProtocolMessageNetwork_handle_initialization_complete_simple (openlcb_statemachine_info_t *statemachine_info)
 Handle Initialization Complete Simple. Check for duplicate Node ID.
 
void ProtocolMessageNetwork_handle_protocol_support_inquiry (openlcb_statemachine_info_t *statemachine_info)
 Reply to Protocol Support Inquiry with this node’s PSI flags.
 
void ProtocolMessageNetwork_handle_protocol_support_reply (openlcb_statemachine_info_t *statemachine_info)
 Handle Protocol Support Reply. No automatic response.
 
void ProtocolMessageNetwork_handle_verify_node_id_global (openlcb_statemachine_info_t *statemachine_info)
 Handle global Verify Node ID — replies if payload matches or is empty.
 
void ProtocolMessageNetwork_handle_verify_node_id_addressed (openlcb_statemachine_info_t *statemachine_info)
 Handle addressed Verify Node ID — always replies (unaddressed per §3.4.2).
 
void ProtocolMessageNetwork_handle_verified_node_id (openlcb_statemachine_info_t *statemachine_info)
 Handle Verified Node ID — fires duplicate-ID event if IDs match.
 
void ProtocolMessageNetwork_handle_optional_interaction_rejected (openlcb_statemachine_info_t *statemachine_info)
 Handle Optional Interaction Rejected (MessageNetworkS Section 3.5.2).
 
void ProtocolMessageNetwork_handle_terminate_due_to_error (openlcb_statemachine_info_t *statemachine_info)
 Handle Terminate Due To Error (MessageNetworkS Section 3.5.2).
 

Detailed Description

Core message network protocol implementation.

Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:

  • Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
  • Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.

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.

Implements Verify Node ID (addressed and global), Protocol Support Inquiry/Reply, Initialization Complete, Optional Interaction Rejected, and Terminate Due To Error. Also detects duplicate Node IDs on the network.

Author
Jim Kueneman
Date
4 Mar 2026
See also
protocol_message_network.h
MessageNetworkS.pdf

Function Documentation

◆ ProtocolMessageNetwork_initialize()

void ProtocolMessageNetwork_initialize ( const interface_openlcb_protocol_message_network_t * interface_openlcb_protocol_message_network)

Stores the callback interface. Call once at startup.

* @param interface_openlcb_protocol_message_network  Populated table.
* 

◆ ProtocolMessageNetwork_handle_initialization_complete()

void ProtocolMessageNetwork_handle_initialization_complete ( openlcb_statemachine_info_t * statemachine_info)

Handle Initialization Complete (full node). Check for duplicate Node ID.

Handle Initialization Complete (full node). No automatic response.

◆ ProtocolMessageNetwork_handle_initialization_complete_simple()

void ProtocolMessageNetwork_handle_initialization_complete_simple ( openlcb_statemachine_info_t * statemachine_info)

Handle Initialization Complete Simple. Check for duplicate Node ID.

Handle Initialization Complete Simple. No automatic response.

◆ ProtocolMessageNetwork_handle_protocol_support_inquiry()

void ProtocolMessageNetwork_handle_protocol_support_inquiry ( openlcb_statemachine_info_t * statemachine_info)

Reply to Protocol Support Inquiry with this node’s PSI flags.

Handle Protocol Support Inquiry — replies with this node’s PSI flags.

Swaps PSI_FIRMWARE_UPGRADE → PSI_FIRMWARE_UPGRADE_ACTIVE when a firmware upgrade is in progress.

◆ ProtocolMessageNetwork_handle_protocol_support_reply()

void ProtocolMessageNetwork_handle_protocol_support_reply ( openlcb_statemachine_info_t * statemachine_info)

Handle Protocol Support Reply. No automatic response.

Parameters
statemachine_infoPointer to openlcb_statemachine_info_t context.

◆ ProtocolMessageNetwork_handle_verify_node_id_global()

void ProtocolMessageNetwork_handle_verify_node_id_global ( openlcb_statemachine_info_t * statemachine_info)

Handle global Verify Node ID — replies if payload matches or is empty.

Parameters
statemachine_infoPointer to openlcb_statemachine_info_t context.

◆ ProtocolMessageNetwork_handle_verify_node_id_addressed()

void ProtocolMessageNetwork_handle_verify_node_id_addressed ( openlcb_statemachine_info_t * statemachine_info)

Handle addressed Verify Node ID — always replies (unaddressed per §3.4.2).

Handle addressed Verify Node ID — always replies.

◆ ProtocolMessageNetwork_handle_verified_node_id()

void ProtocolMessageNetwork_handle_verified_node_id ( openlcb_statemachine_info_t * statemachine_info)

Handle Verified Node ID — fires duplicate-ID event if IDs match.

Handle Verified Node ID — checks for duplicate Node ID.

◆ ProtocolMessageNetwork_handle_optional_interaction_rejected()

void ProtocolMessageNetwork_handle_optional_interaction_rejected ( openlcb_statemachine_info_t * statemachine_info)

Handle Optional Interaction Rejected (MessageNetworkS Section 3.5.2).

Handle Optional Interaction Rejected. No automatic response.

Parses error code (bytes 0-1) and rejected MTI (bytes 2-3). Invokes the application callback if non-NULL. No automatic response.

◆ ProtocolMessageNetwork_handle_terminate_due_to_error()

void ProtocolMessageNetwork_handle_terminate_due_to_error ( openlcb_statemachine_info_t * statemachine_info)

Handle Terminate Due To Error (MessageNetworkS Section 3.5.2).

Handle Terminate Due To Error. No automatic response.

Parses error code (bytes 0-1) and rejected MTI (bytes 2-3). Invokes the application callback if non-NULL. No automatic response.


Copyright (c) 2026 Jim Kueneman all rights reserved. See the License