00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
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