MKCommModel
|
Represents a node in the MESH. More...
#include <MKNode.h>
Classes | |
struct | MKNeighbor |
struct | MKRoute |
Public Member Functions | |
MKNode (mac_t mac_addr, ip4_t ip_addr) | |
Constructs a new MKNode with with a mac address and ip address. | |
operator std::string () const | |
Returns a string containing the mac address and ip address of this node. | |
node * | asCommNode () const |
Returns a new node that represents this node. | |
void | addNeighbor (const MKNode *node, NeighborInfo *link) |
Adds a neighbor node along with the link info between this node and the neighbor node. | |
MKNeighbor * | nbr (mac_t target) |
get neighbor information | |
MKRoute * | route (mac_t target) |
Get route information. | |
MKRoute * | addRoute (MKNode *target) |
add a new route | |
void | clearRoutes () |
Clears the route cache. | |
void | clearNeighbors () |
Clears this node's neighbors. | |
ip4_t | getIP4 () const |
Returns this node's IP address. | |
mac_t | getMAC () const |
std::vector< const MKNode * > | getNeighbors () const |
Returns a copy of this node's list of neighbors. | |
void | setIP (ip4_t ip) |
Sets this node's ip address. | |
Protected Attributes | |
const mac_t | mac |
ip4_t | ip4 |
std::map< MacAddr, MKNeighbor * > | neighbors |
std::map< MacAddr, MKRoute * > | routes |
Friends | |
class | MKNodeTests |
Represents a node in the MESH.
MKNode::MKNode | ( | mac_t | mac_addr, |
ip4_t | ip_addr | ||
) |
Constructs a new MKNode with with a mac address and ip address.
mac_addr | The mac address for this node. |
ip_addr | The ip address for this node. |
void MKNode::addNeighbor | ( | const MKNode * | node, |
NeighborInfo * | link | ||
) |
Adds a neighbor node along with the link info between this node and the neighbor node.
The link info represents this node's connection with the neighbor node.
node | The neighbor node to add. |
link | The link info between this node and the neighbor nodde. |
node * MKNode::asCommNode | ( | ) | const |
Returns a new node that represents this node.
A new node will be allocated; it is the caller's responsibility to free this memory.
ip4_t MKNode::getIP4 | ( | ) | const [inline] |
Returns this node's IP address.
vector< const MKNode * > MKNode::getNeighbors | ( | ) | const |
Returns a copy of this node's list of neighbors.
The nodes shall be ordered in the returned vector in the same order that they where added.
MKNode::operator std::string | ( | ) | const |
Returns a string containing the mac address and ip address of this node.
void MKNode::setIP | ( | ip4_t | ip | ) | [inline] |
Sets this node's ip address.
ip | The new ip address for this node. |
ip4_t MKNode::ip4 [protected] |
This node's ip address
const mac_t MKNode::mac [protected] |
This node's mac address.
std::map<MacAddr, MKNeighbor *> MKNode::neighbors [protected] |
This node's list of neighbors
std::map<MacAddr, MKRoute *> MKNode::routes [protected] |
Known route information