BundleEvent.h

Go to the documentation of this file.
00001 /*
00002  *    Copyright 2004-2006 Intel Corporation
00003  * 
00004  *    Licensed under the Apache License, Version 2.0 (the "License");
00005  *    you may not use this file except in compliance with the License.
00006  *    You may obtain a copy of the License at
00007  * 
00008  *        http://www.apache.org/licenses/LICENSE-2.0
00009  * 
00010  *    Unless required by applicable law or agreed to in writing, software
00011  *    distributed under the License is distributed on an "AS IS" BASIS,
00012  *    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
00013  *    See the License for the specific language governing permissions and
00014  *    limitations under the License.
00015  */
00016 
00017 #ifndef _BUNDLE_EVENT_H_
00018 #define _BUNDLE_EVENT_H_
00019 
00020 #include "Bundle.h"
00021 #include "BundleRef.h"
00022 #include "BundleList.h"
00023 #include "CustodySignal.h"
00024 #include "contacts/Link.h"
00025 
00026 #include <oasys/serialize/Serialize.h>
00027 
00028 namespace dtn {
00029 
00036 class Bundle;
00037 class Contact;
00038 class Interface;
00039 class Registration;
00040 class RouteEntry;
00041 class Link;
00042 
00046 typedef enum {
00047     BUNDLE_RECEIVED = 0x1,      
00048     BUNDLE_TRANSMITTED,         
00049     BUNDLE_TRANSMIT_FAILED,     
00050     BUNDLE_DELIVERED,           
00051     BUNDLE_DELIVERY,            
00052     BUNDLE_EXPIRED,             
00053     BUNDLE_FREE,                
00054     BUNDLE_FORWARD_TIMEOUT,     
00055     BUNDLE_SEND,                
00056     BUNDLE_CANCEL,              
00057     BUNDLE_INJECT,              
00058     BUNDLE_ACCEPT_REQUEST,      
00059     BUNDLE_QUERY,               
00060     BUNDLE_REPORT,              
00061 
00062     CONTACT_UP,                 
00063     CONTACT_DOWN,               
00064     CONTACT_QUERY,              
00065     CONTACT_REPORT,             
00066 
00067     LINK_CREATED,               
00068     LINK_DELETED,               
00069     LINK_AVAILABLE,             
00070     LINK_UNAVAILABLE,           
00071     LINK_CREATE,                
00072     LINK_QUERY,                 
00073     LINK_REPORT,                
00074 
00075     LINK_STATE_CHANGE_REQUEST,  
00076 
00077     REASSEMBLY_COMPLETED,       
00078 
00079     REGISTRATION_ADDED,         
00080     REGISTRATION_REMOVED,       
00081     REGISTRATION_EXPIRED,       
00082 
00083     ROUTE_ADD,                  
00084     ROUTE_DEL,                  
00085     ROUTE_QUERY,                
00086     ROUTE_REPORT,               
00087 
00088     CUSTODY_SIGNAL,             
00089     CUSTODY_TIMEOUT,            
00090 
00091     DAEMON_SHUTDOWN,            
00092     DAEMON_STATUS,              
00093 
00094 } event_type_t;
00095 
00099 inline const char*
00100 event_to_str(event_type_t event, bool xml=false)
00101 {
00102     switch(event) {
00103 
00104     case BUNDLE_RECEIVED:       return xml ? "bundle_received_event" : "BUNDLE_RECEIVED";
00105     case BUNDLE_TRANSMITTED:    return xml ? "bundle_transmitted_event" : "BUNDLE_TRANSMITTED";
00106     case BUNDLE_TRANSMIT_FAILED:return xml ? "bundle_transmit_failed_event" : "BUNDLE_TRANSMIT_FAILED";
00107     case BUNDLE_DELIVERED:      return "BUNDLE_DELIVERED";
00108     case BUNDLE_DELIVERY:       return xml ? "bundle_delivery_event" : "BUNDLE_DELIVERY";
00109     case BUNDLE_EXPIRED:        return xml ? "bundle_expired_event" : "BUNDLE_EXPIRED";
00110     case BUNDLE_FREE:           return "BUNDLE_FREE";
00111     case BUNDLE_FORWARD_TIMEOUT:return "BUNDLE_FORWARD_TIMEOUT";
00112     case BUNDLE_SEND:           return xml ? "send_bundle_action" : "BUNDLE_SEND";
00113     case BUNDLE_CANCEL:         return xml ? "cancel_bundle_action" : "BUNDLE_CANCEL";
00114     case BUNDLE_INJECT:         return xml ? "inject_bundle_action" : "BUNDLE_INJECT";
00115     case BUNDLE_ACCEPT_REQUEST: return xml ? "bundle_accept_request" : "BUNDLE_ACCEPT_REQUEST";
00116     case BUNDLE_QUERY:          return xml ? "bundle_query" : "BUNDLE_QUERY";
00117     case BUNDLE_REPORT:         return xml ? "bundle_report" : "BUNDLE_REPORT";
00118 
00119     case CONTACT_UP:            return xml ? "contact_up_event" : "CONTACT_UP";
00120     case CONTACT_DOWN:          return xml ? "contact_down_event" : "CONTACT_DOWN";
00121     case CONTACT_QUERY:         return xml ? "contact_query" : "CONTACT_QUERY";
00122     case CONTACT_REPORT:        return xml ? "contact_report" : "CONTACT_REPORT";
00123 
00124     case LINK_CREATED:          return xml ? "link_created_event" : "LINK_CREATED";
00125     case LINK_DELETED:          return xml ? "link_deleted_event" : "LINK_DELETED";
00126     case LINK_AVAILABLE:        return xml ? "link_available_event" : "LINK_AVAILABLE";
00127     case LINK_UNAVAILABLE:      return xml ? "link_unavailable_event" : "LINK_UNAVAILABLE";
00128     case LINK_CREATE:           return "LINK_CREATE";
00129     case LINK_QUERY:            return xml ? "link_query" : "LINK_QUERY";
00130     case LINK_REPORT:           return xml ? "link_report" : "LINK_REPORT";
00131 
00132     case LINK_STATE_CHANGE_REQUEST:return "LINK_STATE_CHANGE_REQUEST";
00133 
00134     case REASSEMBLY_COMPLETED:  return "REASSEMBLY_COMPLETED";
00135 
00136     case REGISTRATION_ADDED:    return xml ? "registration_added_event" : "REGISTRATION_ADDED";
00137     case REGISTRATION_REMOVED:  return xml ? "registration_removed_event" : "REGISTRATION_REMOVED";
00138     case REGISTRATION_EXPIRED:  return xml ? "registration_expired_event" : "REGISTRATION_EXPIRED";
00139 
00140     case ROUTE_ADD:             return xml ? "route_add_event" : "ROUTE_ADD";
00141     case ROUTE_DEL:             return xml ? "route_delete_event" : "ROUTE_DEL";
00142     case ROUTE_QUERY:           return xml ? "route_query" : "ROUTE_QUERY";
00143     case ROUTE_REPORT:          return xml ? "route_report" : "ROUTE_REPORT";
00144 
00145     case CUSTODY_SIGNAL:        return xml ? "custody_signal_event" : "CUSTODY_SIGNAL";
00146     case CUSTODY_TIMEOUT:       return xml ? "custody_timeout_event" : "CUSTODY_TIMEOUT";
00147     
00148     case DAEMON_SHUTDOWN:       return "SHUTDOWN";
00149     case DAEMON_STATUS:         return "DAEMON_STATUS";
00150         
00151     default:                    return "(invalid event type)";
00152     }
00153 }
00154 
00158 typedef enum {
00159     EVENTSRC_PEER   = 1,        
00160     EVENTSRC_APP    = 2,        
00161     EVENTSRC_STORE  = 3,        
00162     EVENTSRC_ADMIN  = 4,        
00163     EVENTSRC_FRAGMENTATION = 5  
00164 } event_source_t;
00165 
00170 inline const char*
00171 source_to_str(event_source_t source)
00172 {
00173     switch(source) {
00174 
00175     case EVENTSRC_PEER:             return "peer";
00176     case EVENTSRC_APP:              return "application";
00177     case EVENTSRC_STORE:            return "dataStore";
00178     case EVENTSRC_ADMIN:            return "admin";
00179     case EVENTSRC_FRAGMENTATION:    return "fragmentation";
00180 
00181     default:                        return "(invalid source type)";
00182     }
00183 }
00184 
00188 class BundleEvent : public oasys::SerializableObject {
00189 public:
00193     const event_type_t type_;
00194 
00200     bool daemon_only_;
00201 
00205     oasys::Notifier* processed_notifier_;
00206 
00210     const char* type_str() {
00211         return event_to_str(type_);
00212     }
00213 
00218     virtual ~BundleEvent() {}
00219 
00220     // Virtual function inherited from SerializableObject
00221     virtual void serialize(oasys::SerializeAction*) {}
00222 
00223 protected:
00228     BundleEvent(event_type_t type)
00229         : type_(type),
00230           daemon_only_(false),
00231           processed_notifier_(NULL) {}
00232 };
00233 
00237 class BundleReceivedEvent : public BundleEvent {
00238 public:
00239     /*
00240      * Constructor -- if the bytes_received is unspecified it is
00241      * assumed to be the length of the bundle.
00242      */
00243     BundleReceivedEvent(Bundle* bundle,
00244                         event_source_t source,
00245                         u_int32_t bytes_received = 0,
00246                         Contact* originator = NULL)
00247 
00248         : BundleEvent(BUNDLE_RECEIVED),
00249           bundleref_(bundle, "BundleReceivedEvent"),
00250           source_(source),
00251           bytes_received_(bytes_received),
00252           contact_(originator, "BundleReceivedEvent")
00253     {
00254     }
00255 
00256     // Virtual function inherited from SerializableObject
00257     virtual void serialize(oasys::SerializeAction* a);
00258 
00260     BundleRef bundleref_;
00261 
00263     int source_;
00264 
00266     u_int32_t bytes_received_;
00267 
00269     ContactRef contact_;
00270 };
00271 
00275 class BundleTransmittedEvent : public BundleEvent {
00276 public:
00277     BundleTransmittedEvent(Bundle* bundle, const ContactRef& contact,
00278                            Link* link, u_int32_t bytes_sent,
00279                            u_int32_t reliably_sent)
00280         : BundleEvent(BUNDLE_TRANSMITTED),
00281           bundleref_(bundle, "BundleTransmittedEvent"),
00282           contact_(contact.object(), "BundleTransmittedEvent"),
00283           bytes_sent_(bytes_sent),
00284           reliably_sent_(reliably_sent),
00285           link_(link) {}
00286 
00287     // Virtual function inherited from SerializableObject
00288     virtual void serialize(oasys::SerializeAction* a);
00289 
00291     BundleRef bundleref_;
00292 
00294     ContactRef contact_;
00295 
00297     u_int32_t bytes_sent_;
00298 
00302     u_int32_t reliably_sent_;
00303 
00306     Link* link_;
00307 
00308 };
00309 
00315 class BundleTransmitFailedEvent : public BundleEvent {
00316 public:
00317      BundleTransmitFailedEvent(Bundle* bundle, const ContactRef& contact,
00318                                Link* link)
00319         : BundleEvent(BUNDLE_TRANSMIT_FAILED),
00320           bundleref_(bundle, "BundleTransmitFailedEvent"),
00321           contact_(contact.object(), "BundleTransmitFailedEvent"),
00322           link_(link) {}
00323 
00324     // Virtual function inherited from SerializableObject
00325     virtual void serialize(oasys::SerializeAction* a);
00326 
00328     BundleRef bundleref_;
00329 
00331     ContactRef contact_;
00332 
00335     Link* link_;
00336 };
00337 
00341 class BundleDeliveredEvent : public BundleEvent {
00342 public:
00343     BundleDeliveredEvent(Bundle* bundle, Registration* registration)
00344         : BundleEvent(BUNDLE_DELIVERED),
00345           bundleref_(bundle, "BundleDeliveredEvent"),
00346           registration_(registration) {}
00347 
00348     // Virtual function inherited from SerializableObject
00349     virtual void serialize(oasys::SerializeAction*) {}
00350 
00352     BundleRef bundleref_;
00353 
00355     Registration* registration_;
00356 };
00357 
00361 class BundleDeliveryEvent : public BundleEvent {
00362 public:
00363     BundleDeliveryEvent(Bundle* bundle,
00364                          event_source_t source)
00365         : BundleEvent(BUNDLE_DELIVERY),
00366           bundleref_(bundle, "BundleDeliveryEvent"),
00367           source_(source) {}
00368 
00369     // Virtual function inherited from SerializableObject
00370     virtual void serialize(oasys::SerializeAction* a);
00371 
00373     BundleRef bundleref_;
00374 
00376     int source_;
00377 };
00378 
00382 class BundleExpiredEvent : public BundleEvent {
00383 public:
00384     BundleExpiredEvent(Bundle* bundle)
00385         : BundleEvent(BUNDLE_EXPIRED),
00386           bundleref_(bundle, "BundleExpiredEvent") {}
00387 
00388     // Virtual function inherited from SerializableObject
00389     virtual void serialize(oasys::SerializeAction* a);
00390 
00392     BundleRef bundleref_;
00393 };
00394 
00398 class BundleFreeEvent : public BundleEvent {
00399 public:
00400     BundleFreeEvent(Bundle* bundle)
00401         : BundleEvent(BUNDLE_FREE),
00402           bundle_(bundle)
00403     {
00404         // should be processed only by the daemon
00405         daemon_only_ = true;
00406     }
00407 
00408     // Virtual function inherited from SerializableObject
00409     virtual void serialize(oasys::SerializeAction*) {}
00410     
00412     Bundle* bundle_;
00413 };
00414 
00419 class ContactEvent : public BundleEvent {
00420 public:
00424     typedef enum {
00425         INVALID = 0,    
00426         NO_INFO,        
00427         USER,           
00428         BROKEN,         
00429         CL_ERROR,       
00430         CL_VERSION,     
00431         SHUTDOWN,       
00432         RECONNECT,      
00433         IDLE,           
00434         TIMEOUT,        
00435         UNBLOCKED       
00436     } reason_t;
00437 
00441     static const char* reason_to_str(int reason) {
00442         switch(reason) {
00443         case INVALID:   return "INVALID";
00444         case NO_INFO:   return "no additional info";
00445         case USER:      return "user action";
00446         case SHUTDOWN:  return "peer shut down";
00447         case BROKEN:    return "connection broken";
00448         case CL_ERROR:  return "cl protocol error";
00449         case CL_VERSION:return "cl version mismatch";
00450         case RECONNECT: return "re-establishing connection";
00451         case IDLE:      return "connection idle";
00452         case TIMEOUT:   return "schedule timed out";
00453         case UNBLOCKED: return "no longer busy";
00454         }
00455         NOTREACHED;
00456     }
00457 
00459     ContactEvent(event_type_t type, reason_t reason = NO_INFO)
00460         : BundleEvent(type), reason_(reason) {}
00461 
00462     // Virtual function inherited from SerializableObject
00463     virtual void serialize(oasys::SerializeAction*) {}
00464 
00465     int reason_;        
00466 };
00467 
00471 class ContactUpEvent : public ContactEvent {
00472 public:
00473     ContactUpEvent(const ContactRef& contact)
00474         : ContactEvent(CONTACT_UP),
00475           contact_(contact.object(), "ContactUpEvent") {}
00476 
00477     // Virtual function inherited from SerializableObject
00478     virtual void serialize(oasys::SerializeAction* a);
00479 
00481     ContactRef contact_;
00482 };
00483 
00487 class ContactDownEvent : public ContactEvent {
00488 public:
00489     ContactDownEvent(const ContactRef& contact, reason_t reason)
00490         : ContactEvent(CONTACT_DOWN, reason),
00491           contact_(contact.object(), "ContactDownEvent") {}
00492 
00493     // Virtual function inherited from SerializableObject
00494     virtual void serialize(oasys::SerializeAction* a);
00495 
00497     ContactRef contact_;
00498 };
00499 
00503 class ContactQueryRequest: public BundleEvent {
00504 public:
00505     ContactQueryRequest() : BundleEvent(CONTACT_QUERY)
00506     {
00507         // should be processed only by the daemon
00508         daemon_only_ = true;
00509     }
00510 
00511     // Virtual function inherited from SerializableObject
00512     virtual void serialize(oasys::SerializeAction*) {}
00513 };
00514 
00515 class ContactReportEvent : public BundleEvent {
00516 public:
00517     ContactReportEvent() : BundleEvent(CONTACT_REPORT) {}
00518 
00519     // Virtual function inherited from SerializableObject
00520     virtual void serialize(oasys::SerializeAction* a);
00521 };
00522 
00526 class LinkCreatedEvent : public ContactEvent {
00527 public:
00528     LinkCreatedEvent(Link* link)
00529         : ContactEvent(LINK_CREATED, ContactEvent::USER), link_(link) {}
00530 
00531     // Virtual function inherited from SerializableObject
00532     virtual void serialize(oasys::SerializeAction* a);
00533 
00534     Link* link_;
00535 };
00536 
00540 class LinkDeletedEvent : public ContactEvent {
00541 public:
00542     LinkDeletedEvent(Link* link)
00543         : ContactEvent(LINK_DELETED, ContactEvent::USER), link_(link) {}
00544 
00545     // Virtual function inherited from SerializableObject
00546     virtual void serialize(oasys::SerializeAction* a);
00547 
00549     Link* link_;
00550 };
00551 
00555 class LinkAvailableEvent : public ContactEvent {
00556 public:
00557     LinkAvailableEvent(Link* link, reason_t reason)
00558         : ContactEvent(LINK_AVAILABLE, reason), link_(link) {}
00559 
00560     // Virtual function inherited from SerializableObject
00561     virtual void serialize(oasys::SerializeAction* a);
00562 
00563     Link* link_;
00564 };
00565 
00569 class LinkUnavailableEvent : public ContactEvent {
00570 public:
00571     LinkUnavailableEvent(Link* link, reason_t reason)
00572         : ContactEvent(LINK_UNAVAILABLE, reason), link_(link) {}
00573 
00574     // Virtual function inherited from SerializableObject
00575     virtual void serialize(oasys::SerializeAction* a);
00576 
00578     Link* link_;
00579 };
00580 
00589 class LinkStateChangeRequest : public ContactEvent {
00590 public:
00592     typedef Link::state_t state_t;
00593 
00594     LinkStateChangeRequest(Link* link, state_t state, reason_t reason)
00595         : ContactEvent(LINK_STATE_CHANGE_REQUEST, reason),
00596           link_(link), state_(state), contact_("LinkStateChangeRequest")
00597     {
00598         daemon_only_ = true;
00599         
00600         contact_   = link->contact();
00601         old_state_ = link->state();
00602     }
00603 
00604     LinkStateChangeRequest(const oasys::Builder&,
00605                            state_t state, reason_t reason)
00606         : ContactEvent(LINK_STATE_CHANGE_REQUEST, reason),
00607           state_(state), contact_("LinkStateChangeRequest")
00608     {
00609         daemon_only_ = true;
00610     }
00611 
00612     // Virtual function inherited from SerializableObject
00613     virtual void serialize(oasys::SerializeAction* a);
00614 
00616     Link* link_;
00617 
00619     int state_;
00620     
00622     ContactRef contact_;
00623 
00625     int old_state_;
00626 };
00627 
00631 class RegistrationAddedEvent : public BundleEvent {
00632 public:
00633     RegistrationAddedEvent(Registration* reg, event_source_t source)
00634         : BundleEvent(REGISTRATION_ADDED), registration_(reg),
00635           source_(source) {}
00636 
00637     // Virtual function inherited from SerializableObject
00638     virtual void serialize(oasys::SerializeAction*);
00639 
00641     Registration* registration_;
00642 
00644     int source_;
00645 };
00646 
00650 class RegistrationRemovedEvent : public BundleEvent {
00651 public:
00652     RegistrationRemovedEvent(Registration* reg)
00653         : BundleEvent(REGISTRATION_REMOVED), registration_(reg) {}
00654 
00655     // Virtual function inherited from SerializableObject
00656     virtual void serialize(oasys::SerializeAction*);
00657 
00659     Registration* registration_;
00660 };
00661 
00665 class RegistrationExpiredEvent : public BundleEvent {
00666 public:
00667     RegistrationExpiredEvent(u_int32_t regid)
00668         : BundleEvent(REGISTRATION_EXPIRED), regid_(regid) {}
00669 
00670     // Virtual function inherited from SerializableObject
00671     virtual void serialize(oasys::SerializeAction*);
00672 
00674     u_int32_t regid_;
00675 };
00676 
00680 class RouteAddEvent : public BundleEvent {
00681 public:
00682     RouteAddEvent(RouteEntry* entry)
00683         : BundleEvent(ROUTE_ADD), entry_(entry) {}
00684 
00685     // Virtual function inherited from SerializableObject
00686     virtual void serialize(oasys::SerializeAction* a);
00687 
00689     RouteEntry* entry_;
00690 };
00691 
00695 class RouteDelEvent : public BundleEvent {
00696 public:
00697     RouteDelEvent(const EndpointIDPattern& dest)
00698         : BundleEvent(ROUTE_DEL), dest_(dest) {}
00699 
00700     // Virtual function inherited from SerializableObject
00701     virtual void serialize(oasys::SerializeAction* a);
00702 
00704     EndpointIDPattern dest_;
00705 };
00706 
00710 class RouteQueryRequest: public BundleEvent {
00711 public:
00712     RouteQueryRequest() : BundleEvent(ROUTE_QUERY)
00713     {
00714         // should be processed only by the daemon
00715         daemon_only_ = true;
00716     }
00717 
00718     // Virtual function inherited from SerializableObject
00719     virtual void serialize(oasys::SerializeAction*) {}
00720 };
00721 
00722 class RouteReportEvent : public BundleEvent {
00723 public:
00724     RouteReportEvent() : BundleEvent(ROUTE_REPORT) {}
00725 
00726     // Virtual function inherited from SerializableObject
00727     virtual void serialize(oasys::SerializeAction*) {}
00728 };
00729 
00733 class ReassemblyCompletedEvent : public BundleEvent {
00734 public:
00735     ReassemblyCompletedEvent(Bundle* bundle, BundleList* fragments)
00736         : BundleEvent(REASSEMBLY_COMPLETED),
00737           bundle_(bundle, "ReassemblyCompletedEvent"),
00738           fragments_("ReassemblyCompletedEvent")
00739     {
00740         fragments->move_contents(&fragments_);
00741     }
00742 
00743     // Virtual function inherited from SerializableObject
00744     virtual void serialize(oasys::SerializeAction*) {}
00745 
00747     BundleRef bundle_;
00748 
00750     BundleList fragments_;
00751 };
00752 
00756 class CustodySignalEvent : public BundleEvent {
00757 public:
00758     CustodySignalEvent(const CustodySignal::data_t& data)
00759         : BundleEvent(CUSTODY_SIGNAL), data_(data) {}
00760 
00761     // Virtual function inherited from SerializableObject
00762     virtual void serialize(oasys::SerializeAction* a);
00763     
00765     CustodySignal::data_t data_;
00766 };
00767 
00771 class CustodyTimeoutEvent : public BundleEvent {
00772 public:
00773     CustodyTimeoutEvent(Bundle* bundle, Link* link)
00774         : BundleEvent(CUSTODY_TIMEOUT),
00775           bundle_(bundle, "CustodyTimeoutEvent"),
00776           link_(link) {}
00777 
00778     // Virtual function inherited from SerializableObject
00779     virtual void serialize(oasys::SerializeAction* a);
00780 
00782     BundleRef bundle_;
00783 
00785     Link* link_;
00786 };
00787 
00794 class ShutdownRequest : public BundleEvent {
00795 public:
00796     ShutdownRequest() : BundleEvent(DAEMON_SHUTDOWN)
00797     {
00798         daemon_only_ = true;
00799     }
00800 
00801     // Virtual function inherited from SerializableObject
00802     virtual void serialize(oasys::SerializeAction*) {}
00803 };
00804 
00808 class StatusRequest : public BundleEvent {
00809 public:
00810     StatusRequest() : BundleEvent(DAEMON_STATUS)
00811     {
00812         daemon_only_ = true;
00813     }
00814 
00815     // Virtual function inherited from SerializableObject
00816     virtual void serialize(oasys::SerializeAction*) {}
00817 };
00818 
00822 class BundleSendRequest: public BundleEvent {
00823 public:
00824     BundleSendRequest() : BundleEvent(BUNDLE_SEND)
00825     {
00826         // should be processed only by the daemon
00827         daemon_only_ = true;
00828     }
00829 
00830     // Virtual function inherited from SerializableObject
00831     virtual void serialize(oasys::SerializeAction* a);
00832 
00834     u_int32_t bundleid_;
00835 
00837     std::string link_;
00838 
00840     int action_;
00841 };
00842 
00846 class BundleCancelRequest: public BundleEvent {
00847 public:
00848     BundleCancelRequest() : BundleEvent(BUNDLE_CANCEL)
00849     {
00850         // should be processed only by the daemon
00851         daemon_only_ = true;
00852     }
00853 
00854     // Virtual function inherited from SerializableObject
00855     virtual void serialize(oasys::SerializeAction* a);
00856 
00858     u_int32_t bundleid_;
00859 
00861     std::string link_;
00862 };
00863 
00867 class BundleInjectRequest: public BundleEvent {
00868 public:
00869     BundleInjectRequest() : BundleEvent(BUNDLE_INJECT)
00870     {
00871         // should be processed only by the daemon
00872         daemon_only_ = true;
00873     }
00874 
00875     // Virtual function inherited from SerializableObject
00876     virtual void serialize(oasys::SerializeAction* a);
00877 
00878     // Bundle properties
00879     std::string src_;
00880     std::string dest_;
00881     std::string replyto_;
00882     std::string custodian_;
00883     u_int8_t    priority_;
00884     u_int32_t   expiration_;
00885     std::string payload_;
00886 
00887     // Outgoing link
00888     std::string link_;
00889 
00890     // Forwarding action
00891     int action_;
00892 };
00893 
00905 class BundleAcceptRequest : public BundleEvent {
00906 public:
00907     BundleAcceptRequest(const BundleRef& bundle,
00908                         event_source_t   source,
00909                         bool*            result,
00910                         int*             reason)
00911         : BundleEvent(BUNDLE_ACCEPT_REQUEST),
00912           bundle_(bundle.object(), "BundleAcceptRequest"),
00913           source_(source),
00914           result_(result),
00915           reason_(reason)
00916     {
00917     }
00918     
00919     // Virtual function inherited from SerializableObject
00920     virtual void serialize(oasys::SerializeAction* a);
00921 
00923     BundleRef bundle_;
00924 
00926     int source_;
00927 
00929     bool* result_;
00930 
00932     int* reason_;
00933 };
00934 
00938 class BundleQueryRequest: public BundleEvent {
00939 public:
00940     BundleQueryRequest() : BundleEvent(BUNDLE_QUERY)
00941     {
00942         // should be processed only by the daemon
00943         daemon_only_ = true;
00944     }
00945 
00946     // Virtual function inherited from SerializableObject
00947     virtual void serialize(oasys::SerializeAction*) {}
00948 };
00949 
00950 class BundleReportEvent : public BundleEvent {
00951 public:
00952     BundleReportEvent() : BundleEvent(BUNDLE_REPORT) {}
00953 
00954     // Virtual function inherited from SerializableObject
00955     virtual void serialize(oasys::SerializeAction* a);
00956 };
00957 
00961 class LinkCreateRequest: public BundleEvent {
00962 public:
00963     LinkCreateRequest() : BundleEvent(LINK_CREATE)
00964     {
00965         // should be processed only by the daemon
00966         daemon_only_ = true;
00967     }
00968 
00969     // Virtual function inherited from SerializableObject
00970     virtual void serialize(oasys::SerializeAction*) {
00971         NOTIMPLEMENTED;
00972     }
00973 
00975     std::string endpoint_;
00976 
00978     Interface *interface_;
00979 };
00980 
00984 class LinkQueryRequest: public BundleEvent {
00985 public:
00986     LinkQueryRequest() : BundleEvent(LINK_QUERY)
00987     {
00988         // should be processed only by the daemon
00989         daemon_only_ = true;
00990     }
00991 
00992     // Virtual function inherited from SerializableObject
00993     virtual void serialize(oasys::SerializeAction*) {}
00994 };
00995 
00996 class LinkReportEvent : public BundleEvent {
00997 public:
00998     LinkReportEvent() : BundleEvent(LINK_REPORT) {}
00999 
01000     // Virtual function inherited from SerializableObject
01001     virtual void serialize(oasys::SerializeAction* a);
01002 };
01003 
01004 } // namespace dtn
01005 
01006 #endif /* _BUNDLE_EVENT_H_ */

Generated on Sat Sep 8 08:36:16 2007 for DTN Reference Implementation by  doxygen 1.5.3