Socket-handling between runtimes. More...
#include "inter_runtime_messages.h"
#include <unistd.h>
#include <stdbool.h>
#include <netinet/ip.h>
Go to the source code of this file.
Functions | |
int | send_to_peer (unsigned int runtime_id, struct inter_runtime_msg_hdr *hdr, void *payload) |
Sends a message to the peer runtime with the provided id. More... | |
int | connect_to_runtime_peer (unsigned int id, struct sockaddr_in *addr) |
Innitiates a connection to a runtime peer with the given ID at the given address. More... | |
int | add_runtime_peer (unsigned int runtime_id, int fd) |
Adds the file descriptor to the list of current runtime peers. More... | |
int | init_runtime_socket (int listen_port) |
Initializes the socket listening for incoming connections. More... | |
int | handle_runtime_communication (int fd) |
Reads a message off of the provided file descriptor as if it is coming from a runtime peer. More... | |
Socket-handling between runtimes.
Definition in file runtime_communication.h.
int add_runtime_peer | ( | unsigned int | runtime_id, |
int | fd | ||
) |
Adds the file descriptor to the list of current runtime peers.
Definition at line 97 of file runtime_communication.c.
int connect_to_runtime_peer | ( | unsigned int | id, |
struct sockaddr_in * | addr | ||
) |
Innitiates a connection to a runtime peer with the given ID at the given address.
Only to be called from the output thread
Definition at line 150 of file runtime_communication.c.
int handle_runtime_communication | ( | int | fd | ) |
Reads a message off of the provided file descriptor as if it is coming from a runtime peer.
Definition at line 286 of file runtime_communication.c.
int init_runtime_socket | ( | int | listen_port | ) |
Initializes the socket listening for incoming connections.
Definition at line 177 of file runtime_communication.c.
int send_to_peer | ( | unsigned int | runtime_id, |
struct inter_runtime_msg_hdr * | hdr, | ||
void * | payload | ||
) |
Sends a message to the peer runtime with the provided id.
runtime_id | The ID of the runtime to which the message is to be sent |
hdr | The header of the inter-runtime message |
payload | The message to be sent |
Definition at line 64 of file runtime_communication.c.