Browse Source

C++11 + poprawki

master
Piotr Dergun 7 years ago
parent
commit
68b679fa70
6 changed files with 22 additions and 35 deletions
  1. +1
    -1
      Makefile
  2. +12
    -17
      NATItem.cpp
  3. +8
    -3
      NATItem.h
  4. +1
    -8
      NATRouter.h
  5. +0
    -5
      Packet.cpp
  6. +0
    -1
      Packet.h

+ 1
- 1
Makefile View File

@ -1,5 +1,5 @@
CXX = g++
CXXFLAGS = -Wall
CXXFLAGS = -Wall -std=c++11
LDFLAGS = -pthread
OBJ = Packet.o Node.o NATItem.o NATRouter.o

+ 12
- 17
NATItem.cpp View File

@ -14,37 +14,32 @@ NATItem::NATItem()
this->timeout = 0;
}
NATItem::~NATItem()
const string& NATItem::getIp() const
{
// TODO Auto-generated destructor stub
return ip;
}
void NATItem::setIp(string ip)
void NATItem::setIp(const string& ip)
{
this->ip = ip;
}
void NATItem::setPort(int port)
int NATItem::getPort() const
{
return port;
}
void NATItem::setTimeout(int timeout)
{
}
string NATItem::getIp()
void NATItem::setPort(int port)
{
this->port = port;
}
int NATItem::getPort()
int NATItem::getTimeout() const
{
return timeout;
}
int NATItem::getTimeout()
void NATItem::setTimeout(int timeout)
{
this->timeout = timeout;
}

+ 8
- 3
NATItem.h View File

@ -18,8 +18,7 @@ class NATItem
public:
NATItem();
virtual ~NATItem();
/*
// settery
void setIp(string ip);
void setPort(int port);
@ -28,7 +27,13 @@ public:
// gettery
string getIp();
int getPort();
int getTimeout();
int getTimeout();*/
const string& getIp() const;
void setIp(const string& ip);
int getPort() const;
void setPort(int port);
int getTimeout() const;
void setTimeout(int timeout);
};
#endif /* NATITEM_H_ */

+ 1
- 8
NATRouter.h View File

@ -11,14 +11,7 @@
#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;

+ 0
- 5
Packet.cpp View File

@ -12,11 +12,6 @@ Packet::Packet(string msg) : Packet()
this->setMsg(msg);
}
Packet::~Packet()
{
// TODO Auto-generated destructor stub
}
//settery
void Packet::setSrcIp(string srcIp)
{

+ 0
- 1
Packet.h View File

@ -20,7 +20,6 @@ class Packet
public:
Packet() : srcIp("0.0.0.0"), dstIp("0.0.0.0"), srcPort(0), dstPort(0), msg("") {}
Packet(string msg);
virtual ~Packet();
// settery
void setSrcIp(string srcIp);

Loading…
Cancel
Save