My Project
 All Classes Files Functions Variables Typedefs Enumerations Enumerator Macros
controller_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 */
24 #ifndef CONTROLLER_COMMUNICATION_H_
25 #define CONTROLLER_COMMUNICATION_H_
26 #include "netinet/ip.h"
27 #include "ctrl_runtime_messages.h"
28 #include "rt_controller_messages.h"
29 #include <stdbool.h>
30 
36 int send_to_controller(struct rt_controller_msg_hdr *msg, void *payload);
37 
41 int init_controller_socket(struct sockaddr_in *addr);
42 
49 
54 int send_ack_message(int ack_id, bool success);
55 
57 bool is_controller_fd(int fd);
58 
61 
62 #endif
int send_to_controller(struct rt_controller_msg_hdr *msg, void *payload)
Sends a message to the global controller.
int send_ack_message(int ack_id, bool success)
WILL Send an acknoweledgement of success for a specific message.
bool is_controller_fd(int fd)
Checks if fd is file descriptor for controller.
int send_stats_to_controller()
Samples the relevant statistics and sends them to the controller.
Header for all messages from controller to runtime.
int handle_controller_communication(int fd)
Reads and processes a controller message off of the provided file descriptor.
Definitions of structures for sending messages from the global controller to runtimes.
int init_controller_socket(struct sockaddr_in *addr)
Initilizes a connection with the global controller located at the provided address.
Definitiions of structures for sending messages from runtimes to controller.