Class defining XIDs that are used by the Graph class.
#include <dagaddr.hpp>
Create a new empty node with type XID_TYPE_DUMMY_SOURCE and id 0. This is commonly used to create the "dummy" source node.
Node::Node |
( |
const Node & |
r | ) |
|
Create a new node that is a copy of the supplied node.
- Parameters
-
Node::Node |
( |
uint32_t |
type, |
|
|
const void * |
id, |
|
|
int |
dummy |
|
) |
| |
Node::Node |
( |
int |
type, |
|
|
const std::string |
id_str |
|
) |
| |
Create a new DAG node from a principal type and an XID (as a string).
- Parameters
-
type | The node's principal type. Must be one of:
Node::XID_TYPE_AD (Administrative Domain)
Node::XID_TYPE_HID (Host)
Node::XID_TYPE_CID (Content)
Node::XID_TYPE_SID (Service)
Node::XID_TYPE_FID (Flood)
Node::XID_TYPE_IP (IPv4 / 4ID) |
id_str | The node's XID as a string. This should be 20 pairs of two characters; each pair of characters is the ASCII representation of one byte of the XID in hex. |
Node::Node |
( |
const std::string |
type_str, |
|
|
const std::string |
id_str |
|
) |
| |
Create a new DAG node from a principal type (as a string) and an XID (as a string).
- Parameters
-
Node::Node |
( |
const std::string |
node_string | ) |
|
Create a new node from a single string with the format <type>:<id>. Examples:
AD:1234567890123456789012345678901234567890
CID:0000011111222223333344444555556666677777
- Parameters
-
bool Node::equal_to |
( |
const Node & |
r | ) |
const |
bool Node::has_valid_xid |
( |
| ) |
const |
- Returns
- true if node has a valid XID, false otherwise
const unsigned char* Node::id |
( |
| ) |
const |
|
inline |
std::string Node::id_string |
( |
| ) |
const |
Get the node's XID as a std::string. This string will be 40 characters long (representing 20 bytes in hex). The string does not include the principal type prefix (e.g., "HID:").
- Returns
- The node's XID as a string
bool Node::operator!= |
( |
const Node & |
r | ) |
const |
|
inline |
Graph Node::operator* |
( |
const Node & |
r | ) |
const |
|
inline |
Make a graph by appending a node to this node. The resulting graph will have one edge from this node to the supplied node.
- Parameters
-
- Returns
- The resulting graph
Make a graph by appending an existing graph to this node. The resulting graph will have an edge from this node to the source node of the supplied one. The edges of the supplied graph will not be affected.
- Parameters
-
- Returns
- The resulting graph
Graph Node::operator+ |
( |
const Node & |
r | ) |
const |
|
inline |
Make a graph by merging this node with another node. If the nodes are equal, the resulting graph will contain one node and no edges. Otherwise, the resulting graph will contain two nodes and no edges. Each node will be both a source and a sink.
- Parameters
-
r | The node with which to merge |
- Returns
- The resulting graph
Make a graph by merging this node with the supplied graph. If the node is already present in this graph, the resulting graph will be the same as the supplied graph. If the node is different, this node will be added to the graph but will not be connected by any edges.
- Parameters
-
r | The graph with which to merge |
- Returns
- The resulting graph
Node & Node::operator= |
( |
const Node & |
r | ) |
|
bool Node::operator== |
( |
const Node & |
r | ) |
const |
|
inline |
std::string Node::to_string |
( |
| ) |
const |
- Returns
- A string of the form <type>:<id>
const uint32_t& Node::type |
( |
| ) |
const |
|
inline |
std::string Node::type_string |
( |
| ) |
const |
const std::size_t Node::ID_LEN = 20 |
|
static |
const std::string Node::XID_TYPE_AD_STRING = "AD" |
|
static |
const std::string Node::XID_TYPE_CID_STRING = "CID" |
|
static |
const std::string Node::XID_TYPE_DUMMY_SOURCE_STRING = "SOURCE" |
|
static |
const std::string Node::XID_TYPE_FID_STRING = "FID" |
|
static |
const std::string Node::XID_TYPE_HID_STRING = "HID" |
|
static |
const std::string Node::XID_TYPE_IP_STRING = "IP" |
|
static |
const std::string Node::XID_TYPE_SID_STRING = "SID" |
|
static |
const std::string Node::XID_TYPE_UNKNOWN_STRING = "UNKNOWN" |
|
static |
The documentation for this class was generated from the following files: