Template class for flowkey. More...
#include <flowkey.h>
Public Member Functions | |
| FlowKey () | |
| Void constructor. More... | |
| FlowKey (const int8_t *key) | |
| Construct by copying from a pointer. More... | |
| FlowKey (int32_t ipaddr) | |
| Construct by a 1-tuple. More... | |
| FlowKey (int32_t srcip, int32_t dstip) | |
| Construct by a 2-tuple. More... | |
| FlowKey (int32_t srcip, int32_t dstip, int16_t srcport, int16_t dstport, int8_t protocol) | |
| Construct by a 5-tuple. More... | |
| bool | operator== (const FlowKey &otherkey) const |
| See if two flowkeys are identical. More... | |
| bool | operator< (const FlowKey &otherkey) const |
| See if the first flowkey is less than the second key in lexicographic order. More... | |
| FlowKey< key_len > & | operator^= (const FlowKey &otherkey) |
| XOR two flowkeys in place. More... | |
| template<int32_t other_len> | |
| FlowKey< key_len > & | copy (int32_t pos, const FlowKey< other_len > &other_key, int32_t o_pos, int32_t len) |
| Copy from another flowkey (probably of different length) More... | |
| FlowKey< key_len > & | copy (int32_t pos, const int8_t *key, int32_t len) |
| Copy from a given pointer. More... | |
| FlowKey< key_len > & | swap (FlowKey< key_len > &the_other_key) |
| Swap the content of two flowkey. More... | |
| int8_t | getBit (int32_t pos) const |
| Get a single bit in flowkey. More... | |
| void | setBit (int32_t pos, bool one) |
| Set a single bit in flowkey. More... | |
| const int8_t * | cKey () const |
| Get the flowkey as a char array. More... | |
| int32_t | getIp () const |
| Get the IP address. More... | |
| int32_t | getSrcIp () const |
| Get the src IP address. More... | |
| int32_t | getDstIp () const |
| Get the dst IP address. More... | |
| int16_t | getSrcPort () const |
| Get the src port. More... | |
| int16_t | getDstPort () const |
| Get the dst port. More... | |
| int8_t | getProtocol () const |
| Get the protocol code. More... | |
Friends | |
| template<int32_t other_len> | |
| class | FlowKey |
Template class for flowkey.
| key_len | length of flowkey |
| OmniSketch::FlowKey< key_len >::FlowKey |
Void constructor.
Initialized to an all-zero flowkey
| OmniSketch::FlowKey< key_len >::FlowKey | ( | const int8_t * | key | ) |
Construct by copying from a pointer.
| key | the pointer to be copied from |
| OmniSketch::FlowKey< key_len >::FlowKey | ( | int32_t | ipaddr | ) |
Construct by a 1-tuple.
| ipaddr | IP address of the flow |
key_len=4 when invoking. Otherwise an exception would be thrown. | OmniSketch::FlowKey< key_len >::FlowKey | ( | int32_t | srcip, |
| int32_t | dstip | ||
| ) |
Construct by a 2-tuple.
| srcip | source IP address |
| dstip | destination IP address |
key_len=8 when invoking. Otherwise an exception would be thrown. | OmniSketch::FlowKey< key_len >::FlowKey | ( | int32_t | srcip, |
| int32_t | dstip, | ||
| int16_t | srcport, | ||
| int16_t | dstport, | ||
| int8_t | protocol | ||
| ) |
Construct by a 5-tuple.
| srcip | source IP address |
| dstip | destination IP address |
| srcport | source port |
| dstport | destination port |
| protocol | code of network protocol in use |
key_len=13 when invoking. Otherwise an exception would be thrown.
|
inline |
Get the flowkey as a char array.
| FlowKey< key_len > & OmniSketch::FlowKey< key_len >::copy | ( | int32_t | pos, |
| const FlowKey< other_len > & | other_key, | ||
| int32_t | o_pos, | ||
| int32_t | len | ||
| ) |
Copy from another flowkey (probably of different length)
| other_len | Length of the other flowkey |
| pos | destination offset (into the current flowkey) |
| other_key | the other flowkey to be copied from |
| o_pos | source offset (into the other flowkey) |
| len | length of the copied interval (in bytes) |
| FlowKey< key_len > & OmniSketch::FlowKey< key_len >::copy | ( | int32_t | pos, |
| const int8_t * | key, | ||
| int32_t | len | ||
| ) |
Copy from a given pointer.
| pos | destination offset (into the current flowkey) |
| key | the pointer to be copied from |
| len | length of the copied interval (in bytes) |
| int8_t OmniSketch::FlowKey< key_len >::getBit | ( | int32_t | pos | ) | const |
Get a single bit in flowkey.
| pos | Offset into the flowkey |
1 if the bit is on; 0 otherwise.
|
inline |
Get the dst IP address.
key_len=8 or key_len=13 when invoking
|
inline |
Get the dst port.
key_len=13 when invoking
|
inline |
Get the IP address.
key_len=4 when invoking
|
inline |
Get the protocol code.
key_len=13 when invoking
|
inline |
Get the src IP address.
key_len=8 or key_len=13 when invoking
|
inline |
Get the src port.
key_len=13 when invoking | bool OmniSketch::FlowKey< key_len >::operator< | ( | const FlowKey< key_len > & | otherkey | ) | const |
See if the first flowkey is less than the second key in lexicographic order.
| otherkey | the second flowkey to compare with (of the same length) |
false if is smaller; true if equal or is greater | bool OmniSketch::FlowKey< key_len >::operator== | ( | const FlowKey< key_len > & | otherkey | ) | const |
See if two flowkeys are identical.
| otherkey | the second flowkey to compare with (of the same length) |
true if equal; false otherwise. | FlowKey< key_len > & OmniSketch::FlowKey< key_len >::operator^= | ( | const FlowKey< key_len > & | otherkey | ) |
XOR two flowkeys in place.
| void OmniSketch::FlowKey< key_len >::setBit | ( | int32_t | pos, |
| bool | one | ||
| ) |
Set a single bit in flowkey.
| pos | Offset into the flowkey |
| one | 1 if set to be on; 0 otherwise. |
| FlowKey< key_len > & OmniSketch::FlowKey< key_len >::swap | ( | FlowKey< key_len > & | the_other_key | ) |
Swap the content of two flowkey.
No effect if one flowkey swaps with itself