diff --git a/Makefile b/Makefile index 0f799b1..bdaf719 100644 --- a/Makefile +++ b/Makefile @@ -1,7 +1,7 @@ CXX = g++ CXXFLAGS = -Wall LDFLAGS = -pthread -OBJ = Packet.o NATItem.o Node.o +OBJ = Packet.o Node.o NATItem.o NATRouter.o all: +@make simulation diff --git a/NATRouter.cpp b/NATRouter.cpp new file mode 100644 index 0000000..e7f8488 --- /dev/null +++ b/NATRouter.cpp @@ -0,0 +1,28 @@ +/* + * NATItem.cpp + * + * Created on: 10-01-2017 + * Author: Piotr Dergun + */ + +#include "NATRouter.h" + +NATRouter::NATRouter() +{ + try + { + natTable = new NATItem[65536]; + } + catch(bad_alloc &ba) + { + cerr << "Nie mozna zaalokowac pamieci dla tablicy NAT!" << endl; + exit(1); + } + +} + +NATRouter::~NATRouter() +{ + if (natTable) + delete [] natTable; +} diff --git a/NATRouter.h b/NATRouter.h new file mode 100644 index 0000000..c336204 --- /dev/null +++ b/NATRouter.h @@ -0,0 +1,29 @@ +/* + * NATRouter.h + * + * Created on: 11-01-2017 + * Author: Piotr Dergun + */ + +#ifndef NATROUTER_H_ +#define NATROUTER_H_ + +#include "common.h" +#include "Node.h" +#include "NATItem.h" +/* +typedef struct +{ + string ip; // IP wewn. do którego ma trafić odpowiedź / z którego przyszło żądanie + int port; // port komputera wewn. do którego ma trafić odpowiedź + int timeout; // czas (w sekundach) zajętości portu (0 - port wolny) +} NATItem; +*/ +class NATRouter : public Node +{ + NATItem *natTable; +public: + NATRouter(); + ~NATRouter(); +}; +#endif /* NATROUTER_H_ */