Paul Zinselmeyer
ba8e969470
All checks were successful
Latex Build / build-latex (Assignment 4 - Protokollsicherheit (Praxis)) (push) Successful in 1m2s
Latex Build / build-latex (Assignment 5 - Software Security - Teil 1) (push) Successful in 1m3s
Latex Build / build-latex (Assignment 6 - Software Security - Teil 2) (push) Successful in 1m0s
Latex Build / build-latex (Assignment 4 - Protokollsicherheit (Praxis)) (pull_request) Successful in 30s
Latex Build / build-latex (Assignment 5 - Software Security - Teil 1) (pull_request) Successful in 10s
Latex Build / build-latex (Assignment 6 - Software Security - Teil 2) (pull_request) Successful in 8s
61 lines
978 B
C++
61 lines
978 B
C++
#ifndef NETWORKMANAGER_H
|
|
#define NETWORKMANAGER_H
|
|
|
|
#include "Server.h"
|
|
#include "Client.h"
|
|
#include "LogBase.h"
|
|
#include "Network_def.h"
|
|
|
|
#include <string>
|
|
#include <stdio.h>
|
|
#include <limits.h>
|
|
#include <unistd.h>
|
|
#include <functional>
|
|
#include <iostream>
|
|
#include <algorithm>
|
|
|
|
using namespace std;
|
|
using namespace util;
|
|
|
|
class NetworkManager {
|
|
|
|
typedef boost::asio::ssl::stream<boost::asio::ip::tcp::socket> ssl_socket;
|
|
|
|
public:
|
|
NetworkManager();
|
|
virtual ~NetworkManager();
|
|
void sendMsg();
|
|
void Init();
|
|
void setPort(int port);
|
|
void printMsg(bool send, const char* msg);
|
|
|
|
template <typename T>
|
|
string serialize(T msg) {
|
|
string s;
|
|
if (msg.SerializeToString(&s)) {
|
|
Log("Serialization successful");
|
|
return s;
|
|
} else {
|
|
Log("Serialization failed", log::error);
|
|
return "";
|
|
}
|
|
}
|
|
|
|
public:
|
|
boost::asio::io_service io_service;
|
|
int port;
|
|
};
|
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|