Am5os
 All Classes Functions Pages
protoagent.h
1 //
2 // protobuf_broker.h
3 // Projectname: amos-ss16-proj5
4 //
5 // Created on 14.06.2016.
6 // Copyright (c) 2016 de.fau.cs.osr.amos2016.gruppe5
7 //
8 // This file is part of the AMOS Project 2016 @ FAU
9 // (Friedrich-Alexander University Erlangen-Nürnberg)
10 //
11 // This program is free software: you can redistribute it and/or modify
12 // it under the terms of the GNU Affero General Public License as
13 // published by the Free Software Foundation, either version 3 of the
14 // License, or (at your option) any later version.
15 //
16 // This program is distributed in the hope that it will be useful,
17 // but WITHOUT ANY WARRANTY; without even the implied warranty of
18 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 // GNU Affero General Public License for more details.
20 //
21 // You should have received a copy of the GNU Affero General Public
22 // License along with this program. If not, see
23 // <http://www.gnu.org/licenses/>.
24 //
25 
26 
27 #ifndef PROTOBUF_BROKER_H
28 #define PROTOBUF_BROKER_H
29 
30 #include <vector>
31 #include <string>
32 #include <limits>
33 #include <memory>
34 #include <iostream>
35 
36 #include <arpa/inet.h>
37 
38 #include "caf/all.hpp"
39 #include "caf/io/all.hpp"
40 
41 
42 CAF_PUSH_WARNINGS
43 #include "message.pb.h"
44 CAF_POP_WARNINGS
45 
46 using namespace std;
47 using namespace caf;
48 using namespace caf::io;
49 
50 
51 class ProtoAgent {
52 
53 public:
60  static void startClient (uint16_t port, const string& host);
61 
67  static void startServer (uint16_t port);
68 
76  static void print_on_exit(const actor& hdl, const std::string& name);
77 
78 
84  static behavior sendWarning(event_based_actor* self);
85 
86 
91  static behavior ackMessage();
92 
93 
101  static void protobuf_io(broker* self, connection_handle hdl, const actor& buddy);
102 
109  static behavior server(broker* self, actor buddy);
110 };
111 
112 #endif // PROTOBUF_BROKER_H
Definition: protoagent.h:51