#include <RealworldApp.h>
Inheritance diagram for RealworldApp:
Public Member Functions | |
Module_Class_Members (RealworldApp, RealworldConnector, 0) | |
Protected Member Functions | |
virtual char * | encapsulate (cMessage *msg, unsigned int *length) |
Converts an IP datagram to a data block for sending it to the tun device. | |
virtual cMessage * | decapsulate (char *buf, uint32_t length) |
Parses data received from the tun device and converts it into a cMessage. | |
virtual bool | isApp () |
The Connector connects to an application, so this method to returns "true". |
cMessage * RealworldApp::decapsulate | ( | char * | buf, | |
uint32_t | length | |||
) | [protected, virtual] |
Parses data received from the tun device and converts it into a cMessage.
buf | A pointer to the data to be parsed | |
length | The length of the buffer in bytes |
Implements RealworldConnector.
00024 { 00025 cMessage* payload = 0; 00026 // "Decode" packet: 16bit payload length|payload 00027 payload = parser->decapsulatePayload( buf, length ); 00028 if (!payload) { 00029 ev << "RealworldApp: Parsing of Payload failed, dropping packet.\n"; 00030 } 00031 00032 delete buf; 00033 return payload; 00034 }
char * RealworldApp::encapsulate | ( | cMessage * | msg, | |
unsigned int * | length | |||
) | [protected, virtual] |
Converts an IP datagram to a data block for sending it to the tun device.
msg | A pointer to the message to be converted | |
length | A pointer to an int that will hold the length of the converted data |
Implements RealworldConnector.
00008 { 00009 unsigned int payloadLen; 00010 // parse payload 00011 char* payload = parser->encapsulatePayload(msg, &payloadLen); 00012 if (!payload ) 00013 return NULL; 00014 00015 if(payloadLen > 0xffff) { 00016 opp_error("RealworldApp: Encapsulating packet failed: packet too long"); 00017 } 00018 *length = payloadLen; 00019 00020 return payload; 00021 }
virtual bool RealworldApp::isApp | ( | ) | [inline, protected, virtual] |
The Connector connects to an application, so this method to returns "true".
Reimplemented from RealworldConnector.
RealworldApp::Module_Class_Members | ( | RealworldApp | , | |
RealworldConnector | , | |||
0 | ||||
) |