#include <I3Trigger.h>
Implementation of an Internet Indirection Infrastructure trigger. An I3Trigger is composed of an I3Identifier and a I3IdentifierStack (a stack of I3SubIdentifier). In the most basic case, the subidentifier stack contains a single I3IPAddress. When a packet is matched to a trigger, it is sent to the first valid subidentifier found - the rest is passed to the application. If none is found, the packet is dropped.
Public Member Functions | |
I3Trigger () | |
Constructor. | |
int | compareTo (const I3Trigger &t) const |
Comparison function. | |
bool | operator< (const I3Trigger &t) const |
"Less than" comparison function | |
bool | operator> (const I3Trigger &t) const |
"Greater than" comparison function | |
bool | operator== (const I3Trigger &t) const |
"Equals" comparison function | |
void | setIdentifier (const I3Identifier &id) |
Sets the identifier. | |
void | setInsertionTime (simtime_t time) |
Sets the insertion time. | |
void | setIdentifierStack (I3IdentifierStack &stack) |
Sets the identifier stack. | |
I3Identifier & | getIdentifier () |
Returns the identifier. | |
const I3Identifier & | getIdentifier () const |
Returns the identifier. | |
simtime_t | getInsertionTime () const |
Returns the insertion time. | |
void | clear () |
I3IdentifierStack & | getIdentifierStack () |
Returns the insertion time. | |
const I3IdentifierStack & | getIdentifierStack () const |
Returns the identifier stack. | |
int | length () const |
Protected Attributes | |
I3Identifier | identifier |
Identifier to be matched. | |
I3IdentifierStack | identifierStack |
Identifier stack. | |
simtime_t | insertionTime |
Time in which the trigger was inserted into I3. | |
Friends | |
std::ostream & | operator<< (std::ostream &os, const I3Trigger &t) |
String stream operator <<. |
I3Trigger::I3Trigger | ( | ) |
int I3Trigger::compareTo | ( | const I3Trigger & | t | ) | const |
Comparison function.
t | Trigger to compare to |
00028 { 00029 int cmp = identifier.compareTo(t.identifier); 00030 return (cmp != 0) ? cmp : identifierStack.compareTo(t.identifierStack); 00031 }
bool I3Trigger::operator< | ( | const I3Trigger & | t | ) | const |
"Less than" comparison function
t | Trigger to compare to |
00034 { 00035 return compareTo(t) < 0; 00036 }
bool I3Trigger::operator> | ( | const I3Trigger & | t | ) | const |
"Greater than" comparison function
t | Trigger to compare to |
00039 { 00040 return compareTo(t) > 0; 00041 }
bool I3Trigger::operator== | ( | const I3Trigger & | t | ) | const |
"Equals" comparison function
t | Trigger to compare to |
00044 { 00045 return compareTo(t) == 0; 00046 }
void I3Trigger::setIdentifier | ( | const I3Identifier & | id | ) |
void I3Trigger::setInsertionTime | ( | simtime_t | time | ) |
Sets the insertion time.
time | Insertion time |
00055 { 00056 insertionTime = time; 00057 }
void I3Trigger::setIdentifierStack | ( | I3IdentifierStack & | stack | ) |
Sets the identifier stack.
stack | Insertion time |
00060 { 00061 identifierStack = stack; 00062 }
I3Identifier & I3Trigger::getIdentifier | ( | ) |
const I3Identifier & I3Trigger::getIdentifier | ( | ) | const |
Returns the identifier.
00070 { 00071 return identifier; 00072 }
simtime_t I3Trigger::getInsertionTime | ( | ) | const |
void I3Trigger::clear | ( | ) |
I3IdentifierStack & I3Trigger::getIdentifierStack | ( | ) |
const I3IdentifierStack & I3Trigger::getIdentifierStack | ( | ) | const |
Returns the identifier stack.
00091 { 00092 return identifierStack; 00093 }
int I3Trigger::length | ( | ) | const |
00095 { 00096 /* insertionTime is an internal variable and doesn't count as part of the message */ 00097 return identifier.length() + identifierStack.length(); 00098 }
std::ostream& operator<< | ( | std::ostream & | os, | |
const I3Trigger & | t | |||
) | [friend] |
String stream operator <<.
os | Output string stream | |
t | Trigger to be output |
00101 { 00102 os << "(" << t.identifier << ", {" << t.identifierStack << "})"; 00103 return os; 00104 }
I3Identifier I3Trigger::identifier [protected] |
Identifier to be matched.
I3IdentifierStack I3Trigger::identifierStack [protected] |
Identifier stack.
simtime_t I3Trigger::insertionTime [protected] |
Time in which the trigger was inserted into I3.