Main Page | Modules | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Class Members | Related Pages

DroppedPacket.h

00001 /* -*- mode:c++ -*- ********************************************************
00002  * file:        DroppedPacket.h
00003  *
00004  * author:      Andreas Koepke
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  **************************************************************************/
00019 
00020 #ifndef DroppedPacket_H
00021 #define DroppedPacket_H
00022 
00023 #include <omnetpp.h>
00024 #include <Blackboard.h>
00025 #include <sstream>
00026 
00040 class  DroppedPacket : public BBItem
00041 {
00042     BBITEM_METAINFO(BBItem);
00043     
00044  public:
00046     enum Reasons
00047     {
00048         NONE = 746216,
00049         QUEUE,
00050         CHANNEL,
00051         RETRIES
00052     };
00053 
00054 protected:
00056     Reasons reason;
00057 
00058 public:
00059 
00061     Reasons getReason() const {
00062         return reason;
00063     }
00064     
00066     void setReason(Reasons r) {
00067         reason=r;
00068     }
00069 
00071     DroppedPacket(Reasons r=NONE) : BBItem(), reason(r) {
00072     };
00073 
00075     std::string info() const {
00076         std::ostringstream ost;
00077         ost << " Packet was dropped, because ";
00078         switch(reason) {
00079         case NONE:
00080             ost<<"no reason as yet";
00081             break;
00082         case QUEUE:
00083             ost<<"the queue was full";
00084             break;
00085         case CHANNEL:
00086             ost<<"the transmission channel could not be acquired";
00087             break;
00088         case RETRIES:
00089             ost<<"the numbe of retries was exceeded "
00090                <<"(the receiver did not respond with an ACK?)";
00091             break;
00092         default: ost << "???"; break;
00093         }
00094         return ost.str();
00095     }
00096 };
00097 
00098 #endif

Generated on Fri Jan 12 08:29:32 2007 for Mobility Framework by  doxygen 1.4.4