![]() |
Classes | |
class | protlib::IE |
class | protlib::IEError |
class | protlib::PDUSyntaxError |
class | protlib::IEMsgTooShort |
class | protlib::IEWrongVersion |
class | protlib::IEWrongType |
class | protlib::IEWrongSubtype |
class | protlib::IEWrongLength |
class | protlib::IETooBigForImpl |
class | protlib::IEProtocolSpecific |
class | protlib::IEErrorList |
IE error list. More... | |
class | protlib::IE_Key |
struct | protlib::hash_IE_Key |
class | protlib::IEManager |
Namespaces | |
namespace | protlib |
Defines | |
#define | catch_bad_alloc(x) try { x; } catch(bad_alloc) { throw_nomem_error(); } |
Catch bad_alloc and call throw_nomem_error. | |
Functions | |
ostream & | protlib::operator<< (ostream &os, const IE &ie) |
print an IE to an ostream | |
istream & | protlib::operator>> (istream &is, IE &ie) |
input operator | |
uint32 | protlib::round_up4 (uint32 i) |
round uint32 up | |
protlib::IE::IE (uint16 category) | |
contructor | |
protlib::IE::IE (const IE &n) | |
copy constructor | |
uint16 | protlib::IE::get_category () const |
get category | |
bool | protlib::IE::check_deser_args (coding_t cod, IEErrorList &errorlist, uint32 &bread) const |
check arguments for deserialization | |
void | protlib::IE::check_ser_args (coding_t cod, uint32 &wbytes) const |
check arguments for serialization | |
virtual ostream & | protlib::IE::print (ostream &os, uint32 level, const uint32 indent, const char *name=NULL) const |
print to a ostream | |
virtual istream & | protlib::IE::input (istream &is, bool istty, uint32 level, const uint32 indent, const char *name=NULL) |
input from an istream | |
string | protlib::IE::to_string (const char *name=0) const |
get a string representing the IE content | |
void | protlib::IE::throw_nomem_error () const |
throw a NO_MEM exception | |
virtual void | protlib::IE::clear_pointers () |
clear all pointer fields | |
protlib::IEError::IEError (error_t e) | |
protlib::IEError::IEError (std::string msg) throw () | |
virtual | protlib::IEError::~IEError () throw () |
virtual const char * | protlib::IEError::getstr () const |
protlib::PDUSyntaxError::PDUSyntaxError (const char *msg) | |
protlib::PDUSyntaxError::PDUSyntaxError (IE::coding_t coding, uint16 category, uint16 type, uint16 subtype, uint32 pos, const char *msg="") | |
protlib::IEMsgTooShort::IEMsgTooShort (IE::coding_t coding, uint16 category, uint32 pos) | |
protlib::IEWrongVersion::IEWrongVersion (IE::coding_t coding, uint16 category, uint32 pos) | |
protlib::IEWrongType::IEWrongType (IE::coding_t coding, uint16 category, uint32 pos) | |
protlib::IEWrongType::IEWrongType (IE::coding_t coding, uint16 category, uint16 type, uint32 pos) | |
protlib::IEWrongSubtype::IEWrongSubtype (IE::coding_t coding, uint16 category, uint16 type, uint32 pos) | |
protlib::IEWrongSubtype::IEWrongSubtype (IE::coding_t coding, uint16 category, uint16 type, uint16 subtype, uint32 pos) | |
protlib::IEWrongLength::IEWrongLength (IE::coding_t coding, uint16 category, uint16 type, uint16 subtype, uint32 pos) | |
protlib::IETooBigForImpl::IETooBigForImpl (IE::coding_t coding, uint16 category, uint32 pos) | |
protlib::IEProtocolSpecific::IEProtocolSpecific (IE::coding_t coding, uint16 category, uint32 pos) | |
void | protlib::IEErrorList::put (IEError *iee) |
put an IEError on the list | |
IEError * | protlib::IEErrorList::get () |
get and remove next IEError | |
bool | protlib::IEErrorList::is_empty () const |
is list empty | |
void | protlib::IEErrorList::clear () |
clear list | |
protlib::IEErrorList::~IEErrorList () | |
destructor | |
protlib::IEManager::IEManager () | |
virtual | protlib::IEManager::~IEManager () |
virtual void | protlib::IEManager::register_ie (const IE *ie) |
virtual void | protlib::IEManager::register_ie (uint16 category, uint16 type, uint16 subtype, const IE *ie) |
virtual IE * | protlib::IEManager::new_instance (uint16 category, uint16 type, uint16 subtype) |
virtual IE * | protlib::IEManager::lookup_ie (uint16 category, uint16 type, uint16 subtype) |
virtual void | protlib::IEManager::throw_nomem_error () const |
virtual void | protlib::IEManager::serialize (IE &ie, NetMsg &msg, IE::coding_t coding, uint32 &bytes_written) const |
Variables | |
static const char * | protlib::IEError::err_str [] |
IEError strings. |
#define catch_bad_alloc | ( | x | ) | try { x; } catch(bad_alloc) { throw_nomem_error(); } |
Catch bad_alloc and call throw_nomem_error.
Definition at line 65 of file ie.h.
Referenced by protlib::IE::check_deser_args(), protlib::udsaddress::copy(), protlib::netaddress::copy(), protlib::appladdress::copy(), protlib::hostaddress::copy(), protlib::udsaddress::new_instance(), protlib::netaddress::new_instance(), protlib::appladdress::new_instance(), and protlib::hostaddress::new_instance().
bool protlib::IE::check_deser_args | ( | coding_t | cod, | |
IEErrorList & | errorlist, | |||
uint32 & | bread | |||
) | const [protected, inherited] |
check arguments for deserialization
Check arguments of IE deserialization member functions. Additionally, bread is set to 0.
Definition at line 71 of file ie.cpp.
References catch_bad_alloc, protlib::IEError::ERROR_CODING, protlib::log::ERROR_LOG, protlib::IE::get_ie_name(), Log, protlib::log::LOG_NORMAL, protlib::IEErrorList::put(), and protlib::IE::supports_coding().
check arguments for serialization
Check arguments of IE serialization member functions. Additionally, wbytes is set to 0.
Definition at line 85 of file ie.cpp.
References protlib::IE::check(), protlib::IEError::ERROR_CODING, protlib::IEError::ERROR_INVALID_STATE, protlib::log::ERROR_LOG, protlib::IE::get_ie_name(), protlib::IEError::getstr(), Log, protlib::log::LOG_NORMAL, and protlib::IE::supports_coding().
void protlib::IEErrorList::clear | ( | ) | [inherited] |
clear list
clear IE error list and destroy all stored IE error objects.
Definition at line 494 of file ie.cpp.
References protlib::IEErrorList::queue.
Referenced by protlib::IEErrorList::~IEErrorList().
void protlib::IE::clear_pointers | ( | ) | [virtual, inherited] |
IEError * protlib::IEErrorList::get | ( | ) | [inherited] |
get and remove next IEError
Get and remove IE Error from the list. Returns NULL if list is empty.
Definition at line 478 of file ie.cpp.
References protlib::IEErrorList::queue.
uint16 protlib::IE::get_category | ( | ) | const [inherited] |
get category
Get the category of the IE.
Definition at line 64 of file ie.cpp.
References protlib::IE::category.
const char * protlib::IEError::getstr | ( | ) | const [virtual, inherited] |
Returns an error message.
Note: what() returns more useful messages.
Reimplemented from protlib::ProtLibException.
Definition at line 208 of file ie.cpp.
References protlib::IEError::err, and protlib::IEError::err_str.
Referenced by protlib::IE::check_ser_args(), protlib::IEMsgTooShort::IEMsgTooShort(), protlib::IEProtocolSpecific::IEProtocolSpecific(), protlib::IETooBigForImpl::IETooBigForImpl(), protlib::IEWrongLength::IEWrongLength(), protlib::IEWrongSubtype::IEWrongSubtype(), protlib::IEWrongType::IEWrongType(), and protlib::IEWrongVersion::IEWrongVersion().
protlib::IE::IE | ( | const IE & | n | ) | [protected, inherited] |
protlib::IE::IE | ( | uint16 | category | ) | [protected, inherited] |
protlib::IEError::IEError | ( | std::string | msg | ) | throw () [protected, inherited] |
protlib::IEError::IEError | ( | error_t | error | ) | [inherited] |
protlib::IEManager::IEManager | ( | ) | [protected, inherited] |
protlib::IEMsgTooShort::IEMsgTooShort | ( | IE::coding_t | coding, | |
uint16 | category, | |||
uint32 | pos | |||
) | [inherited] |
Constructor.
coding | the protocol version | |
category | the IE's category | |
pos | the position in the NetMsg at which the problem was discovered |
Definition at line 268 of file ie.cpp.
References protlib::ProtLibException::error_msg, protlib::IEMsgTooShort::errorpos, and protlib::IEError::getstr().
protlib::IEProtocolSpecific::IEProtocolSpecific | ( | IE::coding_t | coding, | |
uint16 | category, | |||
uint32 | pos | |||
) | [inherited] |
Constructor.
coding | the protocol version | |
category | the IE's category | |
pos | the position in the NetMsg at which the problem was discovered |
Definition at line 455 of file ie.cpp.
References protlib::ProtLibException::error_msg, protlib::IEProtocolSpecific::errorpos, and protlib::IEError::getstr().
protlib::IETooBigForImpl::IETooBigForImpl | ( | IE::coding_t | coding, | |
uint16 | category, | |||
uint32 | pos | |||
) | [inherited] |
Constructor.
coding | the protocol version | |
category | the IE's category | |
pos | the position in the NetMsg at which the problem was discovered |
Definition at line 433 of file ie.cpp.
References protlib::ProtLibException::error_msg, protlib::IETooBigForImpl::errorpos, and protlib::IEError::getstr().
protlib::IEWrongLength::IEWrongLength | ( | IE::coding_t | coding, | |
uint16 | category, | |||
uint16 | type, | |||
uint16 | subtype, | |||
uint32 | pos | |||
) | [inherited] |
Constructor.
The category, type and subtype parameters refer to the IE throwing the exception.
coding | the protocol version | |
category | the IE's category | |
type | the IE's type | |
subtype | the IE's subtype | |
pos | the position in the NetMsg at which the problem was discovered |
Definition at line 409 of file ie.cpp.
References protlib::ProtLibException::error_msg, protlib::IEWrongLength::errorpos, and protlib::IEError::getstr().
protlib::IEWrongSubtype::IEWrongSubtype | ( | IE::coding_t | coding, | |
uint16 | category, | |||
uint16 | type, | |||
uint16 | subtype, | |||
uint32 | pos | |||
) | [inherited] |
Constructor.
coding | the protocol version | |
category | the IE's category | |
type | the IE's type | |
subtype | the IE's subtype | |
pos | the position in the NetMsg at which the problem was discovered |
Definition at line 380 of file ie.cpp.
References protlib::ProtLibException::error_msg, protlib::IEWrongSubtype::errorpos, and protlib::IEError::getstr().
protlib::IEWrongSubtype::IEWrongSubtype | ( | IE::coding_t | coding, | |
uint16 | category, | |||
uint16 | type, | |||
uint32 | pos | |||
) | [inherited] |
Constructor.
coding | the protocol version | |
category | the IE's category | |
type | the IE's type | |
pos | the position in the NetMsg at which the problem was discovered |
Definition at line 357 of file ie.cpp.
References protlib::ProtLibException::error_msg, protlib::IEWrongSubtype::errorpos, protlib::IEError::getstr(), and protlib::IEWrongSubtype::subtype.
protlib::IEWrongType::IEWrongType | ( | IE::coding_t | coding, | |
uint16 | category, | |||
uint16 | type, | |||
uint32 | pos | |||
) | [inherited] |
Constructor.
coding | the protocol version | |
category | the IE's category | |
type | the IE's type | |
pos | the position in the NetMsg at which the problem was discovered |
Definition at line 332 of file ie.cpp.
References protlib::ProtLibException::error_msg, protlib::IEWrongType::errorpos, and protlib::IEError::getstr().
protlib::IEWrongType::IEWrongType | ( | IE::coding_t | coding, | |
uint16 | category, | |||
uint32 | pos | |||
) | [inherited] |
Constructor.
coding | the protocol version | |
category | the IE's category | |
pos | the position in the NetMsg at which the problem was discovered |
Definition at line 312 of file ie.cpp.
References protlib::ProtLibException::error_msg, protlib::IEWrongType::errorpos, protlib::IEError::getstr(), and protlib::IEWrongType::type.
protlib::IEWrongVersion::IEWrongVersion | ( | IE::coding_t | coding, | |
uint16 | category, | |||
uint32 | pos | |||
) | [inherited] |
Constructor.
coding | the protocol version | |
category | the IE's category | |
pos | the position in the NetMsg at which the problem was discovered |
Definition at line 289 of file ie.cpp.
References protlib::ProtLibException::error_msg, protlib::IEWrongVersion::errorpos, and protlib::IEError::getstr().
istream & protlib::IE::input | ( | istream & | is, | |
bool | istty, | |||
uint32 | level, | |||
const uint32 | indent, | |||
const char * | name = NULL | |||
) | [virtual, inherited] |
input from an istream
Attention: No checking, no warnings. This is ONLY for testing.
Definition at line 115 of file ie.cpp.
References protlib::log::ERROR_LOG, protlib::IE::get_ie_name(), Log, and protlib::log::LOG_NORMAL.
Referenced by protlib::operator>>().
bool protlib::IEErrorList::is_empty | ( | ) | const [inherited] |
is list empty
Is the IE error list empty?
Definition at line 489 of file ie.cpp.
References protlib::IEErrorList::queue.
IE * protlib::IEManager::lookup_ie | ( | uint16 | category, | |
uint16 | type, | |||
uint16 | subtype | |||
) | [protected, virtual, inherited] |
Return a registered IE.
Returns a registered IE instance. It does not create a new instance, it is really an instance you registered earlier. Use new_instance() if you need new instances!
This method is an extension point that can be used, for example, to return "default" IEs if no matching IE is found in the registry.
Definition at line 661 of file ie.cpp.
References protlib::IEManager::registry.
Referenced by protlib::IEManager::new_instance().
IE * protlib::IEManager::new_instance | ( | uint16 | category, | |
uint16 | type, | |||
uint16 | subtype | |||
) | [virtual, inherited] |
Create a new instance.
Creates a new instance using the appropriate registered IE. The definition of appropriate depends on lookup_ie().
Note that some old IEManager child classes called this method lookup(). This old lookup() method should not be confused with lookup_ie().
Definition at line 636 of file ie.cpp.
References protlib::IE::copy(), and protlib::IEManager::lookup_ie().
ostream & protlib::operator<< | ( | ostream & | os, | |
const IE & | ie | |||
) |
print an IE to an ostream
Print the given IE to the ostream using level=0 and indent=3.
Definition at line 684 of file ie.cpp.
References protlib::IE::print().
istream & protlib::operator>> | ( | istream & | is, | |
IE & | ie | |||
) |
protlib::PDUSyntaxError::PDUSyntaxError | ( | IE::coding_t | coding, | |
uint16 | category, | |||
uint16 | type, | |||
uint16 | subtype, | |||
uint32 | pos, | |||
const char * | msg = "" | |||
) | [inherited] |
Constructor.
coding | the protocol version | |
category | the IE's category | |
type | the IE's type | |
subtype | the IE's subtype | |
pos | the position in the NetMsg at which the problem was discovered | |
msg | a message describing the problem |
Definition at line 245 of file ie.cpp.
References protlib::ProtLibException::error_msg.
protlib::PDUSyntaxError::PDUSyntaxError | ( | const char * | msg | ) | [inherited] |
Constructor.
msg | an error message describing the problem |
Definition at line 222 of file ie.cpp.
References protlib::PDUSyntaxError::category, protlib::PDUSyntaxError::coding, protlib::ProtLibException::error_msg, protlib::PDUSyntaxError::subtype, and protlib::PDUSyntaxError::type.
ostream & protlib::IE::print | ( | ostream & | os, | |
uint32 | level, | |||
const uint32 | indent, | |||
const char * | name = NULL | |||
) | const [virtual, inherited] |
print to a ostream
Print the content of the IE, default behaviour is to print its name. Level and indent control how much space is inserted after a newline. If name points to a string, this string is printed before the get_ie_name().
Definition at line 108 of file ie.cpp.
References protlib::IE::get_ie_name().
Referenced by protlib::operator<<(), and protlib::IE::to_string().
void protlib::IEErrorList::put | ( | IEError * | iee | ) | [inherited] |
put an IEError on the list
Insert IE Error into list.
Definition at line 471 of file ie.cpp.
References protlib::IEErrorList::queue.
Referenced by protlib::IE::check_deser_args().
void protlib::IEManager::register_ie | ( | uint16 | category, | |
uint16 | type, | |||
uint16 | subtype, | |||
const IE * | ie | |||
) | [virtual, inherited] |
Register an Information Element.
Register an IE for the given category, type and subtype. It is not allowed to register more than one IE for a (category, type, subtype) triple.
It is very important that each IE instance is registered only once. If a class can handle multiple (category, type, subtype) triples, one instance per triple has to be registered.
There is no way to unregister an IE. All registered IEs will be deleted by IEManager's destructor.
category | category of the IE | |
type | IE type | |
subtype | IE subtype | |
ie | the IE to register (NULL is not allowed) |
Definition at line 587 of file ie.cpp.
References DLog, ERRLog, protlib::IEError::ERROR_REGISTER, protlib::IE::get_ie_name(), and protlib::IEManager::registry.
void protlib::IEManager::register_ie | ( | const IE * | ie | ) | [virtual, inherited] |
Register an Information Element.
Make the IE object passed as the argument register itself with this IEManager. See IE's register_ie() method for the rules.
This method exists for convenience only, please see the other register_ie() method for details.
ie | pointer to IE (NULL is not allowed) |
Definition at line 561 of file ie.cpp.
References protlib::IEError::ERROR_REGISTER, and protlib::IE::register_ie().
uint32 protlib::round_up4 | ( | uint32 | i | ) | [inline] |
void protlib::IEManager::serialize | ( | IE & | ie, | |
NetMsg & | msg, | |||
IE::coding_t | coding, | |||
uint32 & | wbytes | |||
) | const [inline, virtual, inherited] |
void protlib::IEManager::throw_nomem_error | ( | ) | const [protected, virtual, inherited] |
Throw an exception and log it.
Definition at line 669 of file ie.cpp.
References ERRLog, and protlib::IEError::ERROR_NO_MEM.
void protlib::IE::throw_nomem_error | ( | ) | const [protected, inherited] |
throw a NO_MEM exception
Log and throw a nomem_error
Definition at line 133 of file ie.cpp.
References protlib::log::ERROR_LOG, protlib::IEError::ERROR_NO_MEM, protlib::IE::get_ie_name(), Log, and protlib::log::LOG_CRIT.
string protlib::IE::to_string | ( | const char * | name = 0 |
) | const [inherited] |
protlib::IEError::~IEError | ( | ) | throw () [virtual, inherited] |
protlib::IEErrorList::~IEErrorList | ( | ) | [inherited] |
destructor
Destroy IEError list and all IEError objects in it.
Definition at line 504 of file ie.cpp.
References protlib::IEErrorList::clear(), protlib::log::DEBUG_LOG, Log, protlib::log::LOG_CRIT, and protlib::IEErrorList::queue.
protlib::IEManager::~IEManager | ( | ) | [virtual, inherited] |
Destructor.
All registered IEs are deleted.
Definition at line 528 of file ie.cpp.
References DLog, and protlib::IEManager::registry.
const char * protlib::IEError::err_str [static, private, inherited] |
Initial value:
{ "Error while registering IE. Either pointer to IE is NULL or registered IE already.", "IE coding scheme is not supported by this function.", "IE category is not supported by this function or in the applied coding scheme.", "IE Manager instance does not exist (possible mem alloc problem?)", "NetMsg too short for (de)serialization.", "IE is in invalid state.", "Wrong/unexpected IE type.", "Wrong/unexpected IE subtype.", "Wrong IE length.", "Not enough memory to allocate IE.", "Too big for this protocol implementation.", "Unknown error code for this error class.", "Wrong or unknown protocol version.", "Unexpected object", "PDU syntax error", "PDU Object set failed (wrong index)", "Protocol Specific Error" }
Definition at line 192 of file ie.h.
Referenced by protlib::IEError::getstr().