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.
 
 

46 lines
864 B

/*
* Node.h
*
* Created on: 10.01.2017
* Author: piotrek
*/
#ifndef NODE_H_
#define NODE_H_
#include "common.h"
#include "Packet.h"
typedef struct {
string ip;
string mask;
} NetConf;
class Node
{
queue<Packet>rcvPackets; // kolejka z pakietami do przetworzenia
vector<Node*> connectedNodes; // referencje do węzłów, z którymi jest podłączony
NetConf netConf; // konfiguracja sieciowa
string hostname; // nazwa węzła
public:
Node();
virtual ~Node();
bool connectNode(Node *node, bool firstConnected = false);
void send(Packet packet);
Packet recv();
// settery
void setHostname(string hostname);
void setIp(string ip);
void setMask(string mask);
// gettery
string getHostname();
string getIp();
string getMask();
virtual void onRecv(); // wirtualna metoda na odbiór i dalszą akcję
};
#endif /* NODE_H_ */