SNMP++
3.3.11
|
#include <octet.h>
Public Types | |
enum | OutputType { OutputHexAndClear, OutputHex, OutputClear } |
Enum for setting the hex output format. More... | |
Public Member Functions | |
OctetStr () | |
Constructs a valid OctetStr with zero length. More... | |
OctetStr (const char *str) | |
Constructs a OctetStr with the given value. More... | |
OctetStr (const unsigned char *str, unsigned long len) | |
Constructs a OctetStr with the given value. More... | |
OctetStr (const OctetStr &octet) | |
Construct a OctetStr from another OctetStr. More... | |
~OctetStr () | |
Destructor, frees allocated space. More... | |
OctetStr & | operator= (const char *str) |
Assign a char string to a OctetStr. More... | |
OctetStr & | operator= (const OctetStr &octet) |
Assign a OctetStr to a OctetStr. More... | |
OctetStr & | operator+= (const char *a) |
Append a char string to this OctetStr. More... | |
OctetStr & | operator+= (const unsigned char c) |
Append a single char to this OctetStr. More... | |
OctetStr & | operator+= (const OctetStr &octet) |
Append another OctetStr to this OctetStr. More... | |
unsigned char & | operator[] (int i) |
Allow access as if it was an array. More... | |
unsigned char | operator[] (int i) const |
Allow access as if it was an array for const OctetStr objects. More... | |
SmiUINT32 | get_syntax () const |
Return the syntax. More... | |
int | get_asn1_length () const |
Return the space needed for serialization. More... | |
bool | valid () const |
Return validity of the object. More... | |
SnmpSyntax * | clone () const |
Clone this object. More... | |
SnmpSyntax & | operator= (const SnmpSyntax &val) |
Map other SnmpSyntax objects to OctetStr. More... | |
const char * | get_printable () const |
Get a printable ASCII value of the string. More... | |
const char * | get_printable_hex (const enum OutputType output_type=hex_output_type) const |
Get an ASCII formatted hex dump of the contents. More... | |
const char * | get_printable_clear () const |
Get the contents with all non printable characters replaced. More... | |
void | set_data (const unsigned char *str, unsigned long len) |
Set the data on an already constructed OctetStr. More... | |
unsigned long | len () const |
Get the length of the string. More... | |
unsigned char * | data () const |
Get a pointer to internal data. More... | |
int | nCompare (const unsigned long n, const OctetStr &o) const |
void | clear () |
Null out the contents of the string. More... | |
bool | set_len (const unsigned long new_len) |
Append or shorten the internal data buffer. More... | |
Public Member Functions inherited from SnmpSyntax | |
virtual | ~SnmpSyntax () |
Virtual destructor to ensure deletion of derived classes... More... | |
Static Public Member Functions | |
static void | set_hex_output_type (const enum OutputType ot) |
Set the output format for get_pritable_hex(). More... | |
static void | set_np_char (const char np) |
Set the char get_printable_hex() and get_printable_clear() will use for non printable characters. More... | |
static OctetStr | from_hex_string (const OctetStr &hex_string) |
Build an OctetStr from a hex string. More... | |
static bool | set_linefeed_chars (const char *lf_chars) |
Set the character for linefeeds in get_printable() functions. More... | |
Protected Types | |
enum | OutputFunction { OutputFunctionDefault, OutputFunctionHex, OutputFunctionClear } |
Protected Attributes | |
SNMP_PP_MUTABLE char * | output_buffer |
SNMP_PP_MUTABLE unsigned int | output_buffer_len |
SNMP_PP_MUTABLE bool | m_changed |
SNMP_PP_MUTABLE enum OutputType | output_last_type |
SNMP_PP_MUTABLE char | output_last_np_char |
SNMP_PP_MUTABLE enum OutputFunction | output_last_function |
bool | validity |
Protected Attributes inherited from SnmpSyntax | |
SmiVALUE | smival |
Static Protected Attributes | |
static enum OutputType | hex_output_type |
static char | nonprintable_char |
static char | linefeed_chars [3] |
Friends | |
DLLOPT friend int | operator== (const OctetStr &lhs, const OctetStr &rhs) |
Equal operator for two OctetStr. More... | |
DLLOPT friend int | operator!= (const OctetStr &lhs, const OctetStr &rhs) |
Not equal operator for two OctetStr. More... | |
DLLOPT friend int | operator< (const OctetStr &lhs, const OctetStr &rhs) |
Not equal operator for two OctetStr. More... | |
DLLOPT friend int | operator<= (const OctetStr &lhs, const OctetStr &rhs) |
Less than operator for two OctetStr. More... | |
DLLOPT friend int | operator> (const OctetStr &lhs, const OctetStr &rhs) |
Greater than operator for two OctetStr. More... | |
DLLOPT friend int | operator>= (const OctetStr &lhs, const OctetStr &rhs) |
Greater than or equal operator for two OctetStr. More... | |
DLLOPT friend int | operator== (const OctetStr &lhs, const char *rhs) |
Equal operator for OctetStr and char string. More... | |
DLLOPT friend int | operator!= (const OctetStr &lhs, const char *rhs) |
Not equal operator for OctetStr and char string. More... | |
DLLOPT friend int | operator< (const OctetStr &lhs, const char *rhs) |
Less than operator for OctetStr and char string. More... | |
DLLOPT friend int | operator<= (const OctetStr &lhs, const char *rhs) |
Less than or equal operator for OctetStr and char string. More... | |
DLLOPT friend int | operator> (const OctetStr &lhs, const char *rhs) |
Greater than operator for OctetStr and char string. More... | |
DLLOPT friend int | operator>= (const OctetStr &lhs, const char *rhs) |
Greater than or equal operator for OctetStr and char string. More... | |
Additional Inherited Members | |
Protected Member Functions inherited from SnmpSyntax | |
SnmpSyntax () | |
|
protected |
enum OctetStr::OutputType |
OctetStr::OctetStr | ( | ) |
Constructs a valid OctetStr with zero length.
OctetStr::OctetStr | ( | const char * | str | ) |
OctetStr::OctetStr | ( | const unsigned char * | str, |
unsigned long | len | ||
) |
OctetStr::OctetStr | ( | const OctetStr & | octet | ) |
OctetStr::~OctetStr | ( | ) |
Destructor, frees allocated space.
|
virtual |
Null out the contents of the string.
The string will be empty after calling this method
Implements SnmpSyntax.
|
inlinevirtual |
Clone this object.
Implements SnmpSyntax.
Reimplemented in OpaqueStr.
|
inline |
Build an OctetStr from a hex string.
Called with "5465 737469 6e672074686973206D657468 6f 64 21" the returned value will be "Testing this method!"
hex_string | - The hex string (may contain spaces) |
|
virtual |
Return the space needed for serialization.
Implements SnmpSyntax.
|
virtual |
Get a printable ASCII value of the string.
Implements SnmpSyntax.
const char* OctetStr::get_printable_clear | ( | ) | const |
Get the contents with all non printable characters replaced.
const char* OctetStr::get_printable_hex | ( | const enum OutputType | output_type = hex_output_type | ) | const |
Get an ASCII formatted hex dump of the contents.
If the output format was set to OctetStr::OutputHexAndClear, the produced string of this method will look like this:
09 4F 63 74 65 74 53 74 72 3A 3A 67 65 74 5F 70 .OctetStr::get_p 72 69 6E 74 61 62 6C 65 5F 68 65 78 28 29 rintable_hex()
If the output format was set to OctetStr::OutputHex the produced string will look like this:
09 4F 63 74 65 74 53 74 72 3A 3A 67 65 74 5F 70 72 69 6E 74 61 62 6C 65 5F 68 65 78 28 29
|
inlinevirtual |
Return the syntax.
Implements SnmpSyntax.
Reimplemented in OpaqueStr.
Definition at line 225 of file octet.h.
References sNMP_SYNTAX_OCTETS.
|
inline |
int OctetStr::nCompare | ( | const unsigned long | n, |
const OctetStr & | o | ||
) | const |
OctetStr& OctetStr::operator= | ( | const char * | str | ) |
Assign a char string to a OctetStr.
Referenced by OpaqueStr::operator=().
|
virtual |
|
inline |
|
inline |
void OctetStr::set_data | ( | const unsigned char * | str, |
unsigned long | len | ||
) |
Set the data on an already constructed OctetStr.
The given string is copied to an internal member var, so the params can be destroyed afterwards.
str | - The new string value |
len | - Length of the given string |
|
inlinestatic |
bool OctetStr::set_len | ( | const unsigned long | new_len | ) |
Append or shorten the internal data buffer.
The buffer will either be shortened or extended. In the second case zeroes are added to the end of the string.
new_len | - The new length for the string |
|
static |
Set the character for linefeeds in get_printable() functions.
The default linefeeds are \n for Unix and \r\n on other systems.
lf_chars | - string less than 3 bytes |
|
inlinestatic |
Set the char get_printable_hex() and get_printable_clear() will use for non printable characters.
|
inlinevirtual |
Return validity of the object.
Implements SnmpSyntax.
Definition at line 235 of file octet.h.
Referenced by Pdu::get_context_name(), and Pdu::set_context_name().
Not equal operator for two OctetStr.
Not equal operator for OctetStr and char string.
Not equal operator for two OctetStr.
Less than operator for OctetStr and char string.
Less than operator for two OctetStr.
Less than or equal operator for OctetStr and char string.
Equal operator for two OctetStr.
Equal operator for OctetStr and char string.
Greater than operator for two OctetStr.
Greater than operator for OctetStr and char string.
Greater than or equal operator for two OctetStr.
Greater than or equal operator for OctetStr and char string.
|
staticprotected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |