Browse Source

klasa NATRouter - dziedziczy po Node

master
Piotr Dergun 7 years ago
parent
commit
2afad50929
3 changed files with 58 additions and 1 deletions
  1. +1
    -1
      Makefile
  2. +28
    -0
      NATRouter.cpp
  3. +29
    -0
      NATRouter.h

+ 1
- 1
Makefile View File

@ -1,7 +1,7 @@
CXX = g++ CXX = g++
CXXFLAGS = -Wall CXXFLAGS = -Wall
LDFLAGS = -pthread LDFLAGS = -pthread
OBJ = Packet.o NATItem.o Node.o
OBJ = Packet.o Node.o NATItem.o NATRouter.o
all: all:
+@make simulation +@make simulation

+ 28
- 0
NATRouter.cpp View File

@ -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;
}

+ 29
- 0
NATRouter.h View File

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

Loading…
Cancel
Save