IBR-DTNSuite  0.8
daemon/src/net/TransferAbortedEvent.h
Go to the documentation of this file.
00001 /*
00002  * TransferAbortedEvent.h
00003  *
00004  *  Created on: 16.02.2010
00005  *      Author: morgenro
00006  */
00007 
00008 #ifndef TRANSFERABORTEDEVENT_H_
00009 #define TRANSFERABORTEDEVENT_H_
00010 
00011 #include "core/Event.h"
00012 #include "ibrdtn/data/BundleID.h"
00013 #include "ibrdtn/data/EID.h"
00014 #include <string>
00015 
00016 namespace dtn
00017 {
00018         namespace net
00019         {
00020                 class TransferAbortedEvent : public dtn::core::Event
00021                 {
00022                 public:
00023                         enum AbortReason
00024                         {
00025                                 REASON_UNDEFINED = 0,
00026                                 REASON_CONNECTION_DOWN = 1,
00027                                 REASON_REFUSED = 2,
00028                                 REASON_RETRY_LIMIT_REACHED = 3,
00029                                 REASON_BUNDLE_DELETED = 4
00030                         };
00031 
00032                         virtual ~TransferAbortedEvent();
00033 
00034                         const std::string getName() const;
00035 
00036                         string toString() const;
00037 
00038                         static const std::string className;
00039 
00040                         static void raise(const dtn::data::EID &peer, const dtn::data::Bundle &bundle, const AbortReason reason = REASON_UNDEFINED);
00041                         static void raise(const dtn::data::EID &peer, const dtn::data::BundleID &id, const AbortReason reason = REASON_UNDEFINED);
00042 
00043                         const dtn::data::EID& getPeer() const;
00044                         const dtn::data::BundleID& getBundleID() const;
00045 
00046                         const AbortReason reason;
00047 
00048                 private:
00049                         static const std::string getReason(const AbortReason reason);
00050 
00051                         const dtn::data::EID _peer;
00052                         const dtn::data::BundleID _bundle;
00053                         TransferAbortedEvent(const dtn::data::EID &peer, const dtn::data::Bundle &bundle, const AbortReason reason);
00054                         TransferAbortedEvent(const dtn::data::EID &peer, const dtn::data::BundleID &id, const AbortReason reason);
00055                 };
00056         }
00057 }
00058 
00059 #endif /* TRANSFERABORTEDEVENT_H_ */