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++ CXX = g++
CXXFLAGS = -Wall
CXXFLAGS = -Wall -std=c++11
LDFLAGS = -pthread LDFLAGS = -pthread
OBJ = Packet.o Node.o NATItem.o NATRouter.o OBJ = Packet.o Node.o NATItem.o NATRouter.o

+ 12
- 17
NATItem.cpp View File

@ -14,37 +14,32 @@ NATItem::NATItem()
this->timeout = 0; 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: public:
NATItem(); NATItem();
virtual ~NATItem();
/*
// settery // settery
void setIp(string ip); void setIp(string ip);
void setPort(int port); void setPort(int port);
@ -28,7 +27,13 @@ public:
// gettery // gettery
string getIp(); string getIp();
int getPort(); 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_ */ #endif /* NATITEM_H_ */

+ 1
- 8
NATRouter.h View File

@ -11,14 +11,7 @@
#include "common.h" #include "common.h"
#include "Node.h" #include "Node.h"
#include "NATItem.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 class NATRouter : public Node
{ {
NATItem *natTable; NATItem *natTable;

+ 0
- 5
Packet.cpp View File

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

+ 0
- 1
Packet.h View File

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

Loading…
Cancel
Save