Information Elements

Collaboration diagram for Information Elements:

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 Documentation

#define catch_bad_alloc (  )     try { x; } catch(bad_alloc) { throw_nomem_error(); }


Function Documentation

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().

void protlib::IE::check_ser_args ( coding_t  cod,
uint32 wbytes 
) const [protected, inherited]

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]

clear all pointer fields

Set all pointers to external data to NULL. By default this does nothing because there are no pointers.

Definition at line 143 of file ie.cpp.

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]

protlib::IE::IE ( const IE n  )  [protected, inherited]

copy constructor

Definition at line 61 of file ie.cpp.

protlib::IE::IE ( uint16  category  )  [protected, inherited]

contructor

Constructor. Sets category of IE.

Definition at line 59 of file ie.cpp.

protlib::IEError::IEError ( std::string  msg  )  throw () [protected, inherited]

Definition at line 184 of file ie.cpp.

protlib::IEError::IEError ( error_t  error  )  [inherited]

Constructor.

Initialize an IEError object by setting the error code.

Warning:
Don't instantiate IEError. Use a child class instead!
Parameters:
error the kind of error this exception represents

Definition at line 179 of file ie.cpp.

protlib::IEManager::IEManager (  )  [protected, inherited]

Constructor.

Definition at line 518 of file ie.cpp.

protlib::IEMsgTooShort::IEMsgTooShort ( IE::coding_t  coding,
uint16  category,
uint32  pos 
) [inherited]

Constructor.

Parameters:
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.

Parameters:
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.

Parameters:
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.

Parameters:
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.

Parameters:
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.

Deprecated:
This constructor should not be used for new code.
Parameters:
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.

Parameters:
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.

Deprecated:
This constructor should not be used for new code.
Parameters:
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.

Parameters:
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.

Parameters:
category category of the IE
type IE type
subtype IE subtype
Returns:
a registered instance, or NULL if no matching IE is found

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().

Parameters:
category category of the IE
type IE type
subtype IE subtype
Returns:
a new instance, or NULL if no matching IE is found

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 
)

input operator

Definition at line 689 of file ie.cpp.

References protlib::IE::input().

protlib::PDUSyntaxError::PDUSyntaxError ( IE::coding_t  coding,
uint16  category,
uint16  type,
uint16  subtype,
uint32  pos,
const char *  msg = "" 
) [inherited]

Constructor.

Parameters:
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.

Deprecated:
This constructor shouldn't be used for new code.
Parameters:
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.

Parameters:
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.

Parameters:
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]

round uint32 up

Adds up the given uint32 to fit a 32-bit or 4-byte border.

Definition at line 491 of file ie.h.

void protlib::IEManager::serialize ( IE ie,
NetMsg msg,
IE::coding_t  coding,
uint32 wbytes 
) const [inline, virtual, inherited]

This mainly calls the serialize member function of the given IE.

Parameters:
ie pointer to an IE
msg NetMsg object that will hold the serialized IE.
coding IE coding sheme
wbytes number of output bytes

Definition at line 478 of file ie.h.

References protlib::IE::serialize().

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]

get a string representing the IE content

Print the IE to a string using print() and stringstream.

Definition at line 126 of file ie.cpp.

References protlib::IE::print().

protlib::IEError::~IEError (  )  throw () [virtual, inherited]

Destructor.

This has only been defined to prevent compiler warnings.

Definition at line 196 of file ie.cpp.

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.


Variable Documentation

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"
}
IEError strings.

Definition at line 192 of file ie.h.

Referenced by protlib::IEError::getstr().


Generated on Fri Aug 14 23:38:35 2009 for Ariba by  doxygen 1.5.8