|
X-TraceC++Library
|
Represents an X-Trace metadata option. More...
#include <XtrOption.h>
Public Types | |
| enum | { NOP = 0, CHAIN_ID = 0xC1, LAMPORT = 0xC0, SEVERITY = 0xCE } |
Public Member Functions | |
| Option () | |
| virtual | ~Option () |
| virtual Option * | clone () const =0 |
| Returns a pointer to a newly allocated Option, of the same subtype as the cloned object. | |
| virtual u_int8_t | getType () const =0 |
| Returns the type of this option. | |
| virtual u_int8_t | getLength () const =0 |
| Returns the length of the payload for this option. | |
| virtual u_int8_t | getSize () const =0 |
| Returns the size of the options when packed. | |
| virtual xtr_result | pack (u_int8_t *dest, size_t *size) const =0 |
| Writes the binary packed form of this option to the destination. | |
| bool | isEqual (const Option &other) const |
| Two Options are equal if their packed representation are the same. | |
Static Public Member Functions | |
| static Option * | createFromBytes (const u_int8_t *b, size_t *size) |
| Create a new Option from bytes. | |
Represents an X-Trace metadata option.
| xtr::Option::Option | ( | ) | [inline] |
| virtual xtr::Option::~Option | ( | ) | [inline, virtual] |
| virtual Option* xtr::Option::clone | ( | ) | const [pure virtual] |
Returns a pointer to a newly allocated Option, of the same subtype as the cloned object.
Implemented in xtr::OptionSeverity, xtr::OptionChainId, xtr::OptionAny, and xtr::OptionNop.
| static Option* xtr::Option::createFromBytes | ( | const u_int8_t * | b, |
| size_t * | size | ||
| ) | [static] |
Create a new Option from bytes.
This is a factory method that returns Options of different derived types, if they are known.
| b | buffer to read the option from |
| size | INPUT: maximum safe size to read from b OUTPUT: number of bytes read from b OR 0 in case of an error parsing the option. |
| virtual u_int8_t xtr::Option::getLength | ( | ) | const [pure virtual] |
Returns the length of the payload for this option.
Implemented in xtr::OptionSeverity, xtr::OptionChainId, xtr::OptionAny, and xtr::OptionNop.
| virtual u_int8_t xtr::Option::getSize | ( | ) | const [pure virtual] |
Returns the size of the options when packed.
Implemented in xtr::OptionSeverity, xtr::OptionChainId, xtr::OptionAny, and xtr::OptionNop.
| virtual u_int8_t xtr::Option::getType | ( | ) | const [pure virtual] |
Returns the type of this option.
Implemented in xtr::OptionSeverity, xtr::OptionChainId, xtr::OptionAny, and xtr::OptionNop.
| bool xtr::Option::isEqual | ( | const Option & | other | ) | const |
Two Options are equal if their packed representation are the same.
| virtual xtr_result xtr::Option::pack | ( | u_int8_t * | dest, |
| size_t * | size | ||
| ) | const [pure virtual] |
Writes the binary packed form of this option to the destination.
| dest | buffer to write option to |
| size | INPUT: maximum safe size to write to dest OUTPUT: actual number of bytes written |
Implemented in xtr::OptionSeverity, xtr::OptionChainId, xtr::OptionAny, and xtr::OptionNop.
1.7.5.1