OverSim
PacketParser Class Reference

Class that performes parsing of the payload of packets that are send to or received by the tun device. More...

#include <PacketParser.h>

Inheritance diagram for PacketParser:
GenericPacketParser RealWorldTestPacketParser

Public Member Functions

virtual void initialize ()
 Called on initialisation.
virtual void handleMessage (cMessage *msg)
 Is called if the modules receives a message.
virtual char * encapsulatePayload (cPacket *msg, unsigned int *length)=0
 Convert a cMessage to a data block for sending it to the tun device.
virtual cPacket * decapsulatePayload (char *buf, unsigned int length)=0
 Parses a block of data received from the tun device.

Detailed Description

Class that performes parsing of the payload of packets that are send to or received by the tun device.

Definition at line 32 of file PacketParser.h.

Member Function Documentation

virtual cPacket* PacketParser::decapsulatePayload ( char *  buf,
unsigned int  length 
)
pure virtual

Parses a block of data received from the tun device.

Pure virtual function, has to be implemented by inherited classes.

Parameters
bufThe data to be parsed
lengthThe length of the data
Returns
A cMessage containing the parsed data

Implemented in GenericPacketParser, and RealWorldTestPacketParser.

Referenced by RealworldApp::decapsulate(), and UdpOutDevice::decapsulate().

virtual char* PacketParser::encapsulatePayload ( cPacket *  msg,
unsigned int *  length 
)
pure virtual

Convert a cMessage to a data block for sending it to the tun device.

Pure virtual function, has to be implemented by inherited classes.

Parameters
msgA pointer to the message to be converted
lengthA pointer to an integer that will hold the length of the data
Returns
A pointer to the converted data

Implemented in GenericPacketParser, and RealWorldTestPacketParser.

Referenced by RealworldApp::encapsulate(), and UdpOutDevice::encapsulate().

virtual void PacketParser::handleMessage ( cMessage *  msg)
inlinevirtual

Is called if the modules receives a message.

That should never happen

Definition at line 46 of file PacketParser.h.

{
opp_error("A PacketParser is not intendet to receive Messages!");
};
virtual void PacketParser::initialize ( )
inlinevirtual

Called on initialisation.

Definition at line 39 of file PacketParser.h.

{}

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