reactor-c
C Runtime for Lingua Franca
Loading...
Searching...
No Matches
federate_instance_t Struct Reference

#include <federate.h>

Data Fields

int socket_TCP_RTI
 
lf_thread_t RTI_socket_listener
 
size_t number_of_inbound_p2p_connections
 
lf_thread_tinbound_socket_listeners
 
size_t number_of_outbound_p2p_connections
 
int sockets_for_inbound_p2p_connections [NUMBER_OF_FEDERATES]
 
int sockets_for_outbound_p2p_connections [NUMBER_OF_FEDERATES]
 
lf_thread_t inbound_p2p_handling_thread_id
 
int server_socket
 
int server_port
 
tag_t last_TAG
 
bool is_last_TAG_provisional
 
bool has_upstream
 
bool has_downstream
 
bool received_stop_request_from_rti
 
tag_t last_sent_LTC
 
tag_t last_sent_NET
 
instant_t min_delay_from_physical_action_to_federate_output
 

Detailed Description

Structure that a federate instance uses to keep track of its own state.

Field Documentation

◆ has_downstream

bool federate_instance_t::has_downstream

Indicator of whether this federate has downstream federates. The default value of false may be overridden in _lf_initialize_trigger_objects.

◆ has_upstream

bool federate_instance_t::has_upstream

Indicator of whether this federate has upstream federates. The default value of false may be overridden in _lf_initialize_trigger_objects.

◆ inbound_p2p_handling_thread_id

lf_thread_t federate_instance_t::inbound_p2p_handling_thread_id

Thread ID for a thread that accepts sockets and then supervises listening to those sockets for incoming P2P (physical) connections.

◆ inbound_socket_listeners

lf_thread_t* federate_instance_t::inbound_socket_listeners

Array of thread IDs for threads that listen for incoming messages. This is NULL if there are none and otherwise has size given by number_of_inbound_p2p_connections.

◆ is_last_TAG_provisional

bool federate_instance_t::is_last_TAG_provisional

Indicates whether the last TAG received is provisional or an ordinary TAG. If the last TAG has been provisional, network port absent reactions must be inserted. This variable should only be accessed while holding the mutex lock.

◆ last_sent_LTC

tag_t federate_instance_t::last_sent_LTC

A record of the most recently sent LTC (latest tag confirmed) message. In some situations, federates can send logical_tag_complete for the same tag twice or more in-a-row to the RTI. For example, when _lf_next() returns without advancing tag. To prevent overwhelming the RTI with extra messages, record the last sent logical tag complete message and check against it in lf_latest_tag_confirmed().

Note
Here, the underlying assumption is that the TCP stack will deliver the Logical TAG Complete message to the RTI eventually if it is deliverable

◆ last_sent_NET

tag_t federate_instance_t::last_sent_NET

A record of the most recently sent NET (next event tag) message.

◆ last_TAG

tag_t federate_instance_t::last_TAG

Most recent tag advance grant (TAG) received from the RTI, or NEVER if none has been received. This variable should only be accessed while holding the mutex lock on the top-level environment.

◆ min_delay_from_physical_action_to_federate_output

instant_t federate_instance_t::min_delay_from_physical_action_to_federate_output

For use in federates with centralized coordination, the minimum time delay between a physical action within this federate and an output from this federate. This is NEVER if there is causal path from a physical action to any output.

◆ number_of_inbound_p2p_connections

size_t federate_instance_t::number_of_inbound_p2p_connections

Number of inbound physical connections to the federate. This can be either physical connections, or logical connections in the decentralized coordination, or both.

◆ number_of_outbound_p2p_connections

size_t federate_instance_t::number_of_outbound_p2p_connections

Number of outbound peer-to-peer connections from the federate. This can be either physical connections, or logical connections in the decentralized coordination, or both.

◆ received_stop_request_from_rti

bool federate_instance_t::received_stop_request_from_rti

Used to prevent the federate from sending a REQUEST_STOP message if it has already received a stop request from the RTI. This variable should only be accessed while holding a mutex lock.

◆ RTI_socket_listener

lf_thread_t federate_instance_t::RTI_socket_listener

Thread listening for incoming TCP messages from the RTI.

◆ server_port

int federate_instance_t::server_port

The port used for the server socket to listen for messages from other federates. The federate informs the RTI of this port once it has created its socket server by sending an ADDRESS_AD message (

See also
rti.h).

◆ server_socket

int federate_instance_t::server_socket

A socket descriptor for the socket server of the federate. This is assigned in lf_create_server(). This socket is used to listen to incoming physical connections from remote federates. Once an incoming connection is accepted, the opened socket will be stored in federate_sockets_for_inbound_p2p_connections.

◆ socket_TCP_RTI

int federate_instance_t::socket_TCP_RTI

The TCP socket descriptor for this federate to communicate with the RTI. This is set by lf_connect_to_rti(), which must be called before other functions that communicate with the rti are called.

◆ sockets_for_inbound_p2p_connections

int federate_instance_t::sockets_for_inbound_p2p_connections[NUMBER_OF_FEDERATES]

An array that holds the socket descriptors for inbound connections from each federate. The index will be the federate ID of the remote sending federate. This is initialized at startup to -1 and is set to a socket ID by lf_handle_p2p_connections_from_federates() when the socket is opened.

Note
There will not be an inbound socket unless a physical connection or a p2p logical connection (by setting the coordination target property to "distributed") is specified in the Lingua Franca program where this federate is the destination. Multiple incoming p2p connections from the same remote federate will use the same socket.

◆ sockets_for_outbound_p2p_connections

int federate_instance_t::sockets_for_outbound_p2p_connections[NUMBER_OF_FEDERATES]

An array that holds the socket descriptors for outbound direct connections to each remote federate. The index will be the federate ID of the remote receiving federate. This is initialized at startup to -1 and is set to a socket ID by lf_connect_to_federate() when the socket is opened.

Note
This federate will not open an outbound socket unless a physical connection or a p2p logical connection (by setting the coordination target property to "distributed") is specified in the Lingua Franca program where this federate acts as the source. Multiple outgoing p2p connections to the same remote federate will use the same socket.

The documentation for this struct was generated from the following file: