Symulacja NAT na przedmiot Symulacje Komputerowe
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 

41 lines
686 B

/*
* 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_ */