/*
|
|
* Peer.h
|
|
*
|
|
* Created on: 17.01.2017
|
|
* Author: piotrek
|
|
*/
|
|
|
|
#ifndef PEER_H_
|
|
#define PEER_H_
|
|
|
|
#include "common.h"
|
|
#include "Node.h"
|
|
#include "Simulation.h"
|
|
|
|
class Peer : public Node
|
|
{
|
|
bool sender;
|
|
int srcPort;
|
|
string remoteIp;
|
|
int remotePort;
|
|
int partId;
|
|
Simulation *sim;
|
|
|
|
public:
|
|
Peer();
|
|
Peer(string hostname, string ip, string mask, string gatewayIp);
|
|
virtual ~Peer() {};
|
|
|
|
virtual void onRecv();
|
|
void connectToServer(string serverIp, int serverPort);
|
|
bool isSender() const;
|
|
void setSender(bool sender);
|
|
const Simulation* getSim();
|
|
void setSim(Simulation* sim);
|
|
|
|
protected:
|
|
void sendData();
|
|
void sendAck(string dstIp, int dstPort);
|
|
};
|
|
|
|
#endif /* PEER_H_ */
|