INET Framework for OMNeT++/OMNEST
SDESItem Class Reference

#include <sdes.h>

List of all members.

Public Types

enum  SDES_ITEM_TYPE {
  SDES_UNDEF = 0, SDES_CNAME = 1, SDES_NAME = 2, SDES_EMAIL = 3,
  SDES_PHONE = 4, SDES_LOC = 5, SDES_TOOL = 6, SDES_NOTE = 7,
  SDES_PRIV = 8
}

Public Member Functions

 SDESItem ()
 SDESItem (SDES_ITEM_TYPE type, const char *content)
 SDESItem (const SDESItem &sdesItem)
virtual ~SDESItem ()
SDESItemoperator= (const SDESItem &sdesItem)
virtual SDESItemdup () const
virtual std::string info ()
virtual void dump (std::ostream &os)
virtual SDES_ITEM_TYPE getType ()
virtual const char * getContent ()
virtual int getLength ()

Protected Attributes

SDES_ITEM_TYPE _type
int _length
const char * _content

Detailed Description

The class SDESItem is used for storing a source description item (type of description, description string) for an rtp end system.


Member Enumeration Documentation

This enumeration holds the types of source description items as defined in the rfc. In this implementation only SDES_UNDEF and SDES_CNAME are usable.

Enumerator:
SDES_UNDEF 
SDES_CNAME 
SDES_NAME 
SDES_EMAIL 
SDES_PHONE 
SDES_LOC 
SDES_TOOL 
SDES_NOTE 
SDES_PRIV 
                            {
            SDES_UNDEF = 0,
            SDES_CNAME = 1,
            SDES_NAME = 2,
            SDES_EMAIL = 3,
            SDES_PHONE = 4,
            SDES_LOC = 5,
            SDES_TOOL = 6,
            SDES_NOTE = 7,
            SDES_PRIV = 8
        };

Constructor & Destructor Documentation

SDESItem::SDESItem ( )

Default constructor.

Referenced by dup().

                   : cObject() {
    _type = SDES_UNDEF;
    _length = 2;
    _content = "";
};
SDESItem::SDESItem ( SDES_ITEM_TYPE  type,
const char *  content 
)

Constructor which sets the entry.

                                                           : cObject() {
    _type = type;
    _content = content;
    // an sdes item requires one byte for the type field,
    // one byte for the length field and bytes for
    // the content string
    _length = 2 + strlen(_content);
};
SDESItem::SDESItem ( const SDESItem sdesItem)

Copy constructor.

                                           : cObject() {
    operator=(sdesItem);
};
SDESItem::~SDESItem ( ) [virtual]

Destructor.

                    {
};

Member Function Documentation

void SDESItem::dump ( std::ostream &  os) [virtual]

Writes an info about this SDESItem into the give output stream.

                                  {
    os << "SDESItem:" << endl;
    os << "  type = " << _type << endl;
    os << "  content = " << _content << endl;
};
SDESItem * SDESItem::dup ( ) const [virtual]

Duplicates theis SDESItem by calling the copy constructor.

                              {
    return new SDESItem(*this);
};
const char * SDESItem::getContent ( ) [virtual]

Returns the stored sdes string.

                                 {
    return opp_strdup(_content);
};
int SDESItem::getLength ( ) [virtual]

This method returns the size of this SDESItem in bytes as it would be in the real world.

Referenced by SDESChunk::addSDESItem().

                        {
    // bytes needed for this sdes item are
    // one byte for type, one for length
    // and the string
    return _length + 2;
};
SDESItem::SDES_ITEM_TYPE SDESItem::getType ( ) [virtual]

Returns the type of this sdes item.

Referenced by SDESChunk::addSDESItem().

                                         {
    return _type;
};
std::string SDESItem::info ( ) [virtual]

Writes a short info about this SDESItem into the given string.

                         {
    std::stringstream out;
    out << "SDESItem=" << _content;
    return out.str();
};
SDESItem & SDESItem::operator= ( const SDESItem sdesItem)

Assignment operator.

Referenced by SDESItem().

                                                      {
    cObject::operator=(sdesItem);
    _type = sdesItem._type;
    _length = sdesItem._length;
    _content = opp_strdup(sdesItem._content);
    return *this;
};

Member Data Documentation

const char* SDESItem::_content [protected]

The sdes string.

Referenced by dump(), getContent(), info(), operator=(), and SDESItem().

int SDESItem::_length [protected]

The length of this SDESItem.

Referenced by getLength(), operator=(), and SDESItem().

The type of this SDESItem.

Referenced by dump(), getType(), operator=(), and SDESItem().


The documentation for this class was generated from the following files: