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.

45 lines
1001 B

  1. /*
  2. * NATRouter.h
  3. *
  4. * Created on: 11-01-2017
  5. * Author: Piotr Dergun
  6. */
  7. #ifndef NATROUTER_H_
  8. #define NATROUTER_H_
  9. #include "common.h"
  10. #include "Node.h"
  11. #include "NATItem.h"
  12. class NATRouter : public Node
  13. {
  14. NATItem *natTable = NULL; // tablica z zaalokowanymi portami na zewnątrz
  15. NetConf netWanConf; // konfiguracja sieciowa na zewnątrz
  16. void initalizeNatTable();
  17. int getFreePort();
  18. int getAllocatedPort(string srcIp, int srcPort);
  19. void sNAT(Packet *packet);
  20. void dNAT(Packet *packet);
  21. void setWanNetwork();
  22. public:
  23. NATRouter();
  24. NATRouter(string hostname);
  25. NATRouter(string hostname, string ip, string mask);
  26. NATRouter(string hostname, string ip, string mask, string gatewayIp);
  27. ~NATRouter();
  28. virtual void onRecv();
  29. // settery
  30. void setWanIp(string wanIp);
  31. void setWanMask(string wanMask);
  32. void setWanGatewayIp(string wanGatewayIp);
  33. // gettery
  34. string getWanIp();
  35. string getWanMask();
  36. string getWanNetwork();
  37. string getWanGatewayIp();
  38. };
  39. #endif /* NATROUTER_H_ */