BaseNetwLayer.h

00001 /* -*- mode:c++ -*- ********************************************************
00002  * file:        BaseNetwLayer.h
00003  *
00004  * author:      Daniel Willkomm
00005  *
00006  * copyright:   (C) 2004 Telecommunication Networks Group (TKN) at
00007  *              Technische Universitaet Berlin, Germany.
00008  *
00009  *              This program is free software; you can redistribute it
00010  *              and/or modify it under the terms of the GNU General Public
00011  *              License as published by the Free Software Foundation; either
00012  *              version 2 of the License, or (at your option) any later
00013  *              version.
00014  *              For further information see file COPYING
00015  *              in the top level directory
00016  ***************************************************************************
00017  * part of:     framework implementation developed by tkn
00018  * description: network layer: general class for the network layer
00019  *              subclass to create your own network layer
00020  **************************************************************************/
00021 
00022 
00023 #ifndef SIMPLE_NETW_LAYER_H
00024 #define SIMPLE_NETW_LAYER_H
00025 
00026 #include <BaseLayer.h>
00027 
00028 #include <ArpInterface.h>
00029 #include <NetwPkt_m.h>
00030 #include <SimpleAddress.h>
00031 
00039 class BaseNetwLayer : public BaseLayer
00040 {
00041 public:
00043   enum BaseNetwMessageKinds {
00046     LAST_BASE_NETW_MESSAGE_KIND = 24000,
00047   };
00049   enum BaseNetwControlKinds {
00052     LAST_BASE_NETW_CONTROL_KIND = 24500,
00053   };
00054 
00055 protected:
00060     int headerLength;
00061 
00063     ArpInterface* arp;
00064 
00066     int myNetwAddr;
00067 
00069     bool coreDebug;
00070 
00071 public:
00072     //Module_Class_Members(BaseNetwLayer,BaseLayer,0);
00073 
00075     virtual void initialize(int);
00076 
00077   protected:
00088 
00090     virtual void handleUpperMsg(cMessage* msg);
00091 
00093     virtual void handleLowerMsg(cMessage* msg);
00094 
00096     virtual void handleSelfMsg(cMessage* msg){
00097   error("BaseNetwLayer does not handle self messages");
00098     };
00099 
00101     virtual void handleLowerControl(cMessage* msg);
00102 
00104     virtual void handleUpperControl(cMessage* msg){
00105         error("BaseNetwLayer does not handle control messages");
00106     };
00107 
00111     virtual cMessage* decapsMsg(NetwPkt*);
00112 
00114     virtual NetwPkt* encapsMsg(cPacket*);
00115 };
00116 
00117 #endif