13#if defined STANDALONE_RTI
21#include <openssl/rand.h>
22#include <openssl/hmac.h>
27#include "net_abstraction.h"
33#define MAX_TIME_FOR_REPLY_TO_STOP_REQUEST SEC(30)
57 net_abstraction_t
net;
355void send_reject(net_abstraction_t net_abs,
unsigned char error_code);
406void usage(
int argc,
const char* argv[]);
pqueue_t pqueue_tag_t
Type of a priority queue sorted by tags.
Definition pqueue_tag.h:89
void handle_address_query(uint16_t fed_id)
Handle address query messages.
void handle_timestamp(federate_info_t *my_fed)
A function to handle timestamp messages.
void initialize_RTI(rti_remote_t *rti)
Initialize the _RTI instance.
void lf_connect_to_federates(net_abstraction_t rti_net)
Wait for one incoming connection request from each federate, and, upon receiving it,...
void handle_latest_tag_confirmed(federate_info_t *fed)
Handle a latest tag confirmed (LTC) message.
void * clock_synchronization_thread(void *noargs)
A (quasi-)periodic thread that performs clock synchronization with each federate.
void handle_port_absent_message(federate_info_t *sending_federate, unsigned char *buffer)
Handle a port absent message being received rom a federate via the RIT.
void handle_address_ad(uint16_t federate_id)
Handle address advertisement messages (.
void handle_stop_request_message(federate_info_t *fed)
Handle a MSG_TYPE_STOP_REQUEST message.
void wait_for_federates()
Start the runtime infrastructure (RTI) interaction with the federates and wait for the federates to e...
void send_physical_clock(unsigned char message_type, federate_info_t *fed, socket_type_t socket_type)
Take a snapshot of the physical clock time and send it to federate fed_id.
void send_reject(net_abstraction_t net_abs, unsigned char error_code)
Send a MSG_TYPE_REJECT message to the specified channel and close the channel.
void update_federate_next_event_tag_locked(uint16_t federate_id, tag_t next_event_tag)
Update the next event tag of federate federate_id.
int process_args(int argc, const char *argv[])
Process the command-line arguments.
clock_sync_stat
The status of clock synchronization.
Definition rti_remote.h:71
void handle_timed_message(federate_info_t *sending_federate, unsigned char *buffer)
Handle a timed message being received from a federate by the RTI to relay to another federate.
void initialize_federate(federate_info_t *fed, uint16_t id)
Initialize the federate with the specified ID.
void handle_stop_request_reply(federate_info_t *fed)
Handle a MSG_TYPE_STOP_REQUEST_REPLY message.
void * respond_to_erroneous_connections(void *nothing)
Thread to respond to new connections, which could be federates of other federations who are attemptin...
void handle_next_event_tag(federate_info_t *fed)
Handle a next event tag (NET) message.
void handle_physical_clock_sync_message(federate_info_t *my_fed, socket_type_t socket_type)
Handle clock synchronization T3 messages from federates.
int process_clock_sync_args(int argc, const char *argv[])
Process command-line arguments related to clock synchronization.
int start_rti_server()
Start the socket server for the runtime infrastructure (RTI).
void * federate_info_thread_TCP(void *fed)
Thread handling TCP communication with a federate.
@ clock_sync_on
Definition rti_remote.h:71
@ clock_sync_init
Definition rti_remote.h:71
@ clock_sync_off
Definition rti_remote.h:71
void usage()
Print a usage message.
Type definitions that are widely used across different parts of the runtime.
Priority queue that uses tags for sorting.
Common declarations for runtime infrastructure (RTI) for scheduling enclaves and distributed Lingua F...
bool _lf_federate_reports_error
int lf_critical_section_enter(environment_t *env)
int lf_critical_section_exit(environment_t *env)
Execution environment.
Definition environment.h:52
Information about a federate known to the RTI, including its runtime state, mode of execution,...
Definition rti_remote.h:48
struct sockaddr_in UDP_addr
The UDP address for the federate.
Definition rti_remote.h:59
bool clock_synchronization_enabled
Indicates the status of clock synchronization for this federate.
Definition rti_remote.h:61
net_abstraction_t net
The network abstraction for communicating with this federate.
Definition rti_remote.h:57
pqueue_tag_t * in_transit_message_tags
Record of in-transit messages to this federate that are not yet processed.
Definition rti_remote.h:64
scheduling_node_t enclave
The base scheduling node information for this federate.
Definition rti_remote.h:50
lf_thread_t thread_id
The ID of the thread handling communication with this federate.
Definition rti_remote.h:55
bool requested_stop
Indicates that the federate has requested stop or has replied to a request for stop from the RTI.
Definition rti_remote.h:53
Common RTI data structure for both remote standalone RTI and local RTI used in enclaved execution.
Definition rti_common.h:103
Structure that an RTI instance uses to keep track of its own and its corresponding federates' state.
Definition rti_remote.h:86
int num_feds_proposed_start
Number of federates that have proposed start times.
Definition rti_remote.h:94
uint16_t user_specified_port
The desired port specified by the user on the command line.
Definition rti_remote.h:118
uint16_t final_port_UDP
The final port number that the UDP socket server ends up using.
Definition rti_remote.h:121
rti_common_t base
The base RTI common data structure.
Definition rti_remote.h:88
clock_sync_stat clock_sync_global_status
Indicates whether clock sync is globally on for the federation.
Definition rti_remote.h:139
bool stop_in_progress
Boolean indicating that a stop request is already in progress.
Definition rti_remote.h:151
uint64_t clock_sync_period_ns
Frequency (period in nanoseconds) between clock sync attempts.
Definition rti_remote.h:142
volatile bool all_federates_exited
Boolean indicating that all federates have exited.
Definition rti_remote.h:105
bool authentication_enabled
Boolean indicating that authentication is enabled.
Definition rti_remote.h:148
const char * federation_id
The ID of the federation that this RTI will supervise.
Definition rti_remote.h:113
int32_t clock_sync_exchanges_per_interval
Number of messages exchanged for each clock sync attempt.
Definition rti_remote.h:145
net_abstraction_t rti_net
The rti's network abstraction.
Definition rti_remote.h:129
int socket_descriptor_UDP
The UDP socket descriptor for the socket server.
Definition rti_remote.h:124
lf_thread_t clock_thread
Thread performing PTP clock sync sessions periodically.
Definition rti_remote.h:132
int64_t max_start_time
Maximum start time seen so far from the federates.
Definition rti_remote.h:91
Information about the scheduling nodes coordinated by the RTI.
Definition rti_common.h:64
A tag is a time, microstep pair.
Definition tag.h:119