00001 /* 00002 * wlanmodel/packetproxy.h 00003 * 00004 * Copyright (C) 2008-2009 Reto Gantenbein 00005 * 00006 * This program is free software; you can redistribute it and/or modify 00007 * it under the terms of the GNU General Public License version 2 as 00008 * published by the Free Software Foundation. 00009 */ 00010 00011 #ifndef __PACKETPROXY_H__ 00012 #define __PACKETPROXY_H__ 00013 00014 #include <omnetpp.h> 00015 #include "cUDPSocketRTScheduler.h" 00016 #include "NodeManager.h" 00017 #include "PMTypes.h" 00018 #include "MsgHandler.h" 00019 00023 class PacketProxy : public cSimpleModule 00024 { 00025 private: 00026 cMessage *rtEvent; 00027 cUDPSocketRTScheduler *rtScheduler; 00028 NodeManager *nodeManager; 00029 cOutVector pktProcTime; 00030 00031 //buffer 00032 char inBuffer[DATA_MSG_SIZE]; 00033 int numRecvBytes; 00034 00035 protected: 00036 virtual void initialize(); 00037 00038 //message processing 00039 virtual void handleMessage(cMessage *msg); 00040 void processRegistrationMsg(registrationMsg *msg); 00041 void processDeregistrationMsg(plainMsg *msg); 00042 void processDataMsg(dataMsg *msg); 00043 void processConfigurationMsg(configMsg *msg); 00044 00045 public: 00046 PacketProxy(); 00047 virtual ~PacketProxy(); 00048 static uint8_t getMessageType(msgHeader *header); 00049 00050 static void debugMessage(const char *, int); 00051 static void printConfigMessage(const char *); 00052 static void printRegisterMessage(const char *); 00053 static void printPlainMessage(const char *); 00054 static void printDataMessage(const char *); 00055 }; 00056 00057 #endif