20#ifdef PLATFORM_ARDUINO
21#error To be implemented. No support for federation on Arduino yet.
23#include <sys/socket.h>
37#define HOST_LITTLE_ENDIAN 1
38#define HOST_BIG_ENDIAN 2
167void extract_header(
unsigned char* buffer, uint16_t* port_id, uint16_t* federate_id,
size_t* length);
267bool extract_match_group(
const char* rti_addr,
char* dest, regmatch_t group,
size_t max_len,
size_t min_len,
268 const char* err_msg);
284bool extract_match_groups(
const char* rti_addr,
char** rti_addr_strs,
bool** rti_addr_flags, regmatch_t* group_array,
285 int* gids,
size_t* max_lens,
size_t* min_lens,
const char** err_msgs);
void extract_rti_addr_info(const char *rti_addr, rti_addr_info_t *rti_addr_info)
Extract the host, port and user from rti_addr.
bool validate_host(const char *host)
Check whether host is valid.
bool validate_user(const char *user)
Check whether user is valid.
uint16_t extract_uint16(unsigned char *bytes)
Extract an uint16_t from the specified byte sequence.
uint16_t swap_bytes_if_big_endian_uint16(uint16_t src)
If this host is little endian, then reverse the order of the bytes of the argument.
bool extract_match_groups(const char *rti_addr, char **rti_addr_strs, bool **rti_addr_flags, regmatch_t *group_array, int *gids, size_t *max_lens, size_t *min_lens, const char **err_msgs)
Extract match groups from the rti_addr regex.
bool match_regex(const char *str, char *regex)
Check whether str matches regex.
void encode_tag(unsigned char *buffer, tag_t tag)
Encode tag information into buffer.
void extract_header(unsigned char *buffer, uint16_t *port_id, uint16_t *federate_id, size_t *length)
Extract the core header information that all messages between federates share.
bool validate_port(char *port)
Check whether port is valid.
int64_t extract_int64(unsigned char *bytes)
This will swap the order of the bytes if this machine is big endian.
void extract_timed_header(unsigned char *buffer, uint16_t *port_id, uint16_t *federate_id, size_t *length, tag_t *tag)
Extract the timed header information for timed messages between federates.
bool extract_match_group(const char *rti_addr, char *dest, regmatch_t group, size_t max_len, size_t min_len, const char *err_msg)
Extract one match group from the rti_addr regex .
int32_t extract_int32(unsigned char *bytes)
This will swap the order of the bytes if this machine is big endian.
void encode_uint32(uint32_t data, unsigned char *buffer)
Write the specified data as a sequence of bytes starting at the specified address.
tag_t extract_tag(unsigned char *buffer)
Extract tag information from buffer.
int64_t swap_bytes_if_big_endian_int64(int64_t src)
If this host is little endian, then reverse the order of the bytes of the argument.
int host_is_big_endian(void)
Return true (1) if the host is big endian.
void encode_int64(int64_t data, unsigned char *buffer)
Write the specified data as a sequence of bytes starting at the specified address.
int32_t swap_bytes_if_big_endian_int32(int32_t src)
If this host is little endian, then reverse the order of the bytes of the argument.
void encode_uint16(uint16_t data, unsigned char *buffer)
Write the specified data as a sequence of bytes starting at the specified address.
void encode_int32(int32_t data, unsigned char *buffer)
Write the specified data as a sequence of bytes starting at the specified address.
Common socket operations and utilities for federated Lingua Franca programs.
A helper struct for passing rti_addr information between lf_parse_rti_addr and extract_rti_addr_info.
Definition net_util.h:209
char rti_port_str[6]
Definition net_util.h:211
char rti_user_str[256]
Definition net_util.h:212
bool has_user
Definition net_util.h:215
bool has_host
Definition net_util.h:213
bool has_port
Definition net_util.h:214
char rti_host_str[256]
Definition net_util.h:210
A tag is a time, microstep pair.
Definition tag.h:119
Time and tag definitions and functions for Lingua Franca.