My Project
 All Classes Files Functions Variables Typedefs Enumerations Enumerator Macros
runtime_communication.h
Go to the documentation of this file.
1 /*
2 START OF LICENSE STUB
3  DeDOS: Declarative Dispersion-Oriented Software
4  Copyright (C) 2017 University of Pennsylvania, Georgetown University
5 
6  This program is free software: you can redistribute it and/or modify
7  it under the terms of the GNU General Public License as published by
8  the Free Software Foundation, either version 3 of the License, or
9  (at your option) any later version.
10 
11  This program is distributed in the hope that it will be useful,
12  but WITHOUT ANY WARRANTY; without even the implied warranty of
13  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14  GNU General Public License for more details.
15 
16  You should have received a copy of the GNU General Public License
17  along with this program. If not, see <http://www.gnu.org/licenses/>.
18 END OF LICENSE STUB
19 */
25 #ifndef RUNTIME_COMMUNICATION_H_
26 #define RUNTIME_COMMUNICATION_H_
27 #include "inter_runtime_messages.h"
28 
29 #include <unistd.h>
30 #include <stdbool.h>
31 #include <netinet/ip.h>
32 
40 int send_to_peer(unsigned int runtime_id, struct inter_runtime_msg_hdr *hdr, void *payload);
41 
47 int connect_to_runtime_peer(unsigned int id, struct sockaddr_in *addr);
48 
52 int add_runtime_peer(unsigned int runtime_id, int fd);
53 
57 int init_runtime_socket(int listen_port);
58 
63 
64 #endif
int init_runtime_socket(int listen_port)
Initializes the socket listening for incoming connections.
int add_runtime_peer(unsigned int runtime_id, int fd)
Adds the file descriptor to the list of current runtime peers.
Header for messages to runtime from another runtime.
Definitions of the message types that can be passed between runtimes.
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.
static int runtime_id(int runtime_fd)
int handle_runtime_communication(int fd)
Reads a message off of the provided file descriptor as if it is coming from a runtime peer...
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. ...