INET Framework for OMNeT++/OMNEST
inet::RawPacket Class Reference

Message that carries raw bytes. More...

#include <RawPacket.h>

Inheritance diagram for inet::RawPacket:
inet::RawPacket_Base

Public Member Functions

 RawPacket (const char *name=nullptr, int kind=0)
 Constructor. More...
 
 RawPacket (const RawPacket &other)
 Copy constructor. More...
 
RawPacketoperator= (const RawPacket &other)
 operator = More...
 
virtual RawPacketdup () const override
 Creates and returns an exact copy of this object. More...
 
virtual void setDataFromBuffer (const void *ptr, unsigned int length)
 Set data from buffer. More...
 
virtual void addDataFromBuffer (const void *ptr, unsigned int length)
 Add data from buffer to the end of existing content. More...
 
virtual unsigned int copyDataToBuffer (void *ptr, unsigned int length) const
 Copy data content to buffer. More...
 
virtual void removePrefix (unsigned int length)
 Truncate data content. More...
 
- Public Member Functions inherited from inet::RawPacket_Base
virtual ~RawPacket_Base ()
 
virtual void parsimPack (omnetpp::cCommBuffer *b) const override
 
virtual void parsimUnpack (omnetpp::cCommBuffer *b) override
 
virtual ByteArraygetByteArray ()
 
virtual const ByteArraygetByteArray () const
 
virtual void setByteArray (const ByteArray &byteArray)
 

Additional Inherited Members

- Protected Member Functions inherited from inet::RawPacket_Base
bool operator== (const RawPacket_Base &)
 
 RawPacket_Base (const char *name=nullptr, short kind=0)
 
 RawPacket_Base (const RawPacket_Base &other)
 
RawPacket_Baseoperator= (const RawPacket_Base &other)
 
- Protected Attributes inherited from inet::RawPacket_Base
ByteArray byteArray
 

Detailed Description

Message that carries raw bytes.

Used with emulation-related features.

Constructor & Destructor Documentation

inet::RawPacket::RawPacket ( const char *  name = nullptr,
int  kind = 0 
)
inline

Constructor.

32 : RawPacket_Base(name, kind) {}
RawPacket_Base(const char *name=nullptr, short kind=0)
inet::RawPacket::RawPacket ( const RawPacket other)
inline

Copy constructor.

37 : RawPacket_Base(other) {}
RawPacket_Base(const char *name=nullptr, short kind=0)

Member Function Documentation

void inet::RawPacket::addDataFromBuffer ( const void *  ptr,
unsigned int  length 
)
virtual

Add data from buffer to the end of existing content.

Parameters
ptrpointer to input buffer
lengthlength of data
25 {
26  byteArray.addDataFromBuffer(ptr, length);
27 }
ByteArray byteArray
Definition: RawPacket_m.h:80
virtual void addDataFromBuffer(const void *ptr, unsigned int length)
Add data from buffer to the end of existing content.
Definition: ByteArray.cc:57
unsigned int inet::RawPacket::copyDataToBuffer ( void *  ptr,
unsigned int  length 
) const
virtual

Copy data content to buffer.

Parameters
ptrpointer to output buffer
lengthlength of buffer, maximum of copied bytes
Returns
: length of copied data

Referenced by inet::serializer::ByteArraySerializer::serialize().

30 {
31  return byteArray.copyDataToBuffer(ptr, length);
32 }
virtual unsigned int copyDataToBuffer(void *ptr, unsigned int length, unsigned int srcOffs=0) const
Copy data content to buffer.
Definition: ByteArray.cc:72
ByteArray byteArray
Definition: RawPacket_m.h:80
virtual RawPacket* inet::RawPacket::dup ( ) const
inlineoverridevirtual

Creates and returns an exact copy of this object.

Reimplemented from inet::RawPacket_Base.

47 { return new RawPacket(*this); }
RawPacket(const char *name=nullptr, int kind=0)
Constructor.
Definition: RawPacket.h:32
RawPacket& inet::RawPacket::operator= ( const RawPacket other)
inline

operator =

42 { RawPacket_Base::operator=(other); return *this; }
RawPacket_Base & operator=(const RawPacket_Base &other)
void inet::RawPacket::removePrefix ( unsigned int  length)
virtual

Truncate data content.

Parameters
lengthThe number of bytes from the beginning of the content be removed Generate assert when not have enough bytes for truncation
35 {
36  byteArray.truncateData(length, 0);
37 }
virtual void truncateData(unsigned int truncleft, unsigned int truncright)
Truncate data content.
Definition: ByteArray.cc:90
ByteArray byteArray
Definition: RawPacket_m.h:80
void inet::RawPacket::setDataFromBuffer ( const void *  ptr,
unsigned int  length 
)
virtual

Set data from buffer.

Parameters
ptrpointer to buffer
lengthlength of data

Referenced by inet::serializer::ByteArraySerializer::deserialize().

20 {
21  byteArray.setDataFromBuffer(ptr, (unsigned int)length);
22 }
virtual void setDataFromBuffer(const void *ptr, unsigned int length)
Copy data from buffer.
Definition: ByteArray.cc:20
ByteArray byteArray
Definition: RawPacket_m.h:80

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