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

  1. /*
  2. * Peer.h
  3. *
  4. * Created on: 17.01.2017
  5. * Author: piotrek
  6. */
  7. #ifndef PEER_H_
  8. #define PEER_H_
  9. #include "common.h"
  10. #include "Node.h"
  11. #include "Simulation.h"
  12. class Peer : public Node
  13. {
  14. bool sender;
  15. int srcPort;
  16. string remoteIp;
  17. int remotePort;
  18. int partId;
  19. Simulation *sim;
  20. public:
  21. Peer();
  22. Peer(string hostname, string ip, string mask, string gatewayIp);
  23. virtual ~Peer() {};
  24. virtual void onRecv();
  25. void connectToServer(string serverIp, int serverPort);
  26. bool isSender() const;
  27. void setSender(bool sender);
  28. const Simulation* getSim();
  29. void setSim(Simulation* sim);
  30. protected:
  31. void sendData();
  32. void sendAck(string dstIp, int dstPort);
  33. };
  34. #endif /* PEER_H_ */