|
INET Framework for OMNeT++/OMNEST
|
00001 // 00002 // Copyright (C) 2006 Andras Babos and Andras Varga 00003 // 00004 // This program is free software; you can redistribute it and/or 00005 // modify it under the terms of the GNU Lesser General Public License 00006 // as published by the Free Software Foundation; either version 2 00007 // of the License, or (at your option) any later version. 00008 // 00009 // This program is distributed in the hope that it will be useful, 00010 // but WITHOUT ANY WARRANTY; without even the implied warranty of 00011 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00012 // GNU Lesser General Public License for more details. 00013 // 00014 // You should have received a copy of the GNU Lesser General Public License 00015 // along with this program; if not, see <http://www.gnu.org/licenses/>. 00016 // 00017 00018 #ifndef __INET_MESSAGEHANDLER_H 00019 #define __INET_MESSAGEHANDLER_H 00020 00021 #include "IMessageHandler.h" 00022 #include "HelloHandler.h" 00023 #include "DatabaseDescriptionHandler.h" 00024 #include "LinkStateRequestHandler.h" 00025 #include "LinkStateUpdateHandler.h" 00026 #include "LinkStateAcknowledgementHandler.h" 00027 #include "OSPFTimer_m.h" 00028 #include "IPControlInfo.h" 00029 #include "OSPFInterface.h" 00030 //#include "OSPFNeighbor.h" 00031 00032 namespace OSPF { 00033 00034 class MessageHandler : public IMessageHandler { 00035 private: 00036 cSimpleModule* ospfModule; 00037 00038 HelloHandler helloHandler; 00039 DatabaseDescriptionHandler ddHandler; 00040 LinkStateRequestHandler lsRequestHandler; 00041 LinkStateUpdateHandler lsUpdateHandler; 00042 LinkStateAcknowledgementHandler lsAckHandler; 00043 00044 public: 00045 MessageHandler (Router* containingRouter, cSimpleModule* containingModule); 00046 00047 void MessageReceived(cMessage* message); 00048 void HandleTimer (OSPFTimer* timer); 00049 00050 void ProcessPacket (OSPFPacket* packet, Interface* unused1 = NULL, Neighbor* unused2 = NULL); 00051 00052 void SendPacket (OSPFPacket* packet, IPv4Address destination, int outputIfIndex, short ttl = 1); 00053 void ClearTimer (OSPFTimer* timer); 00054 void StartTimer (OSPFTimer* timer, simtime_t delay); 00055 00056 void PrintEvent (const char* eventString, const Interface* onInterface = NULL, const Neighbor* forNeighbor = NULL) const; 00057 void PrintHelloPacket (const OSPFHelloPacket* helloPacket, IPv4Address destination, int outputIfIndex) const; 00058 void PrintDatabaseDescriptionPacket (const OSPFDatabaseDescriptionPacket* ddPacket, IPv4Address destination, int outputIfIndex) const; 00059 void PrintLinkStateRequestPacket (const OSPFLinkStateRequestPacket* requestPacket, IPv4Address destination, int outputIfIndex) const; 00060 void PrintLinkStateUpdatePacket (const OSPFLinkStateUpdatePacket* updatePacket, IPv4Address destination, int outputIfIndex) const; 00061 void PrintLinkStateAcknowledgementPacket(const OSPFLinkStateAcknowledgementPacket* ackPacket, IPv4Address destination, int outputIfIndex) const; 00062 00063 // Authentication not implemented 00064 bool AuthenticatePacket (OSPFPacket* packet) { return true; } 00065 }; 00066 00067 } // namespace OSPF 00068 00069 #endif // __INET_MESSAGEHANDLER_H 00070