My Project
 All Classes Files Functions Variables Typedefs Enumerations Enumerator Macros
Functions
runtime_communication.h File Reference

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...
 

Detailed Description

Socket-handling between runtimes.

Definition in file runtime_communication.h.

Function Documentation

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

Returns
0 on success, -1 on error

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.

Parameters
runtime_idThe ID of the runtime to which the message is to be sent
hdrThe header of the inter-runtime message
payloadThe message to be sent
Returns
0 on success, -1 on error

Definition at line 64 of file runtime_communication.c.