00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017 #ifndef _BUNDLE_EVENT_H_
00018 #define _BUNDLE_EVENT_H_
00019
00020 #include "Bundle.h"
00021 #include "BundleProtocol.h"
00022 #include "BundleRef.h"
00023 #include "BundleList.h"
00024 #include "CustodySignal.h"
00025 #include "contacts/Link.h"
00026 #include "contacts/NamedAttribute.h"
00027 #include "GbofId.h"
00028
00029 namespace dtn {
00030
00037 class Bundle;
00038 class Contact;
00039 class Interface;
00040 class Registration;
00041 class RouteEntry;
00042
00046 typedef enum {
00047 BUNDLE_RECEIVED = 0x1,
00048 BUNDLE_TRANSMITTED,
00049 BUNDLE_DELIVERED,
00050 BUNDLE_DELIVERY,
00051 BUNDLE_EXPIRED,
00052 BUNDLE_NOT_NEEDED,
00053 BUNDLE_FREE,
00054 BUNDLE_FORWARD_TIMEOUT,
00055 BUNDLE_SEND,
00056 BUNDLE_CANCEL,
00057 BUNDLE_CANCELLED,
00058 BUNDLE_INJECT,
00059 BUNDLE_INJECTED,
00060 BUNDLE_ACCEPT_REQUEST,
00061 BUNDLE_DELETE,
00062 BUNDLE_QUERY,
00063 BUNDLE_REPORT,
00064 BUNDLE_ATTRIB_QUERY,
00065 BUNDLE_ATTRIB_REPORT,
00066
00067 CONTACT_UP,
00068 CONTACT_DOWN,
00069 CONTACT_QUERY,
00070 CONTACT_REPORT,
00071 CONTACT_ATTRIB_CHANGED,
00072
00073 LINK_CREATED,
00074 LINK_DELETED,
00075 LINK_AVAILABLE,
00076 LINK_UNAVAILABLE,
00077 LINK_BUSY,
00078 LINK_CREATE,
00079 LINK_DELETE,
00080 LINK_RECONFIGURE,
00081 LINK_QUERY,
00082 LINK_REPORT,
00083 LINK_ATTRIB_CHANGED,
00084
00085 LINK_STATE_CHANGE_REQUEST,
00086
00087 REASSEMBLY_COMPLETED,
00088
00089 REGISTRATION_ADDED,
00090 REGISTRATION_REMOVED,
00091 REGISTRATION_EXPIRED,
00092 REGISTRATION_DELETE,
00093
00094 ROUTE_ADD,
00095 ROUTE_DEL,
00096 ROUTE_QUERY,
00097 ROUTE_REPORT,
00098
00099 CUSTODY_SIGNAL,
00100 CUSTODY_TIMEOUT,
00101
00102 DAEMON_SHUTDOWN,
00103 DAEMON_STATUS,
00104
00105 CLA_SET_PARAMS,
00106 CLA_PARAMS_SET,
00107 CLA_SET_LINK_DEFAULTS,
00108 CLA_EID_REACHABLE,
00109
00110 CLA_BUNDLE_QUEUED_QUERY,
00111 CLA_BUNDLE_QUEUED_REPORT,
00112 CLA_EID_REACHABLE_QUERY,
00113 CLA_EID_REACHABLE_REPORT,
00114 CLA_LINK_ATTRIB_QUERY,
00115 CLA_LINK_ATTRIB_REPORT,
00116 CLA_IFACE_ATTRIB_QUERY,
00117 CLA_IFACE_ATTRIB_REPORT,
00118 CLA_PARAMS_QUERY,
00119 CLA_PARAMS_REPORT,
00120
00121 } event_type_t;
00122
00126 inline const char*
00127 event_to_str(event_type_t event)
00128 {
00129 switch(event) {
00130
00131 case BUNDLE_RECEIVED: return "BUNDLE_RECEIVED";
00132 case BUNDLE_TRANSMITTED: return "BUNDLE_TRANSMITTED";
00133 case BUNDLE_DELIVERED: return "BUNDLE_DELIVERED";
00134 case BUNDLE_DELIVERY: return "BUNDLE_DELIVERY";
00135 case BUNDLE_EXPIRED: return "BUNDLE_EXPIRED";
00136 case BUNDLE_FREE: return "BUNDLE_FREE";
00137 case BUNDLE_NOT_NEEDED: return "BUNDLE_NOT_NEEDED";
00138 case BUNDLE_FORWARD_TIMEOUT:return "BUNDLE_FORWARD_TIMEOUT";
00139 case BUNDLE_SEND: return "BUNDLE_SEND";
00140 case BUNDLE_CANCEL: return "BUNDLE_CANCEL";
00141 case BUNDLE_CANCELLED: return "BUNDLE_CANCELLED";
00142 case BUNDLE_INJECT: return "BUNDLE_INJECT";
00143 case BUNDLE_INJECTED: return "BUNDLE_INJECTED";
00144 case BUNDLE_ACCEPT_REQUEST: return "BUNDLE_ACCEPT_REQUEST";
00145 case BUNDLE_DELETE: return "BUNDLE_DELETE";
00146 case BUNDLE_QUERY: return "BUNDLE_QUERY";
00147 case BUNDLE_REPORT: return "BUNDLE_REPORT";
00148 case BUNDLE_ATTRIB_QUERY: return "BUNDLE_ATTRIB_QUERY";
00149 case BUNDLE_ATTRIB_REPORT: return "BUNDLE_ATTRIB_REPORT";
00150
00151 case CONTACT_UP: return "CONTACT_UP";
00152 case CONTACT_DOWN: return "CONTACT_DOWN";
00153 case CONTACT_QUERY: return "CONTACT_QUERY";
00154 case CONTACT_REPORT: return "CONTACT_REPORT";
00155 case CONTACT_ATTRIB_CHANGED:return "CONTACT_ATTRIB_CHANGED";
00156
00157 case LINK_CREATED: return "LINK_CREATED";
00158 case LINK_DELETED: return "LINK_DELETED";
00159 case LINK_AVAILABLE: return "LINK_AVAILABLE";
00160 case LINK_UNAVAILABLE: return "LINK_UNAVAILABLE";
00161 case LINK_BUSY: return "LINK_BUSY";
00162 case LINK_CREATE: return "LINK_CREATE";
00163 case LINK_DELETE: return "LINK_DELETE";
00164 case LINK_RECONFIGURE: return "LINK_RECONFIGURE";
00165 case LINK_QUERY: return "LINK_QUERY";
00166 case LINK_REPORT: return "LINK_REPORT";
00167 case LINK_ATTRIB_CHANGED: return "LINK_ATTRIB_CHANGED";
00168
00169 case LINK_STATE_CHANGE_REQUEST:return "LINK_STATE_CHANGE_REQUEST";
00170
00171 case REASSEMBLY_COMPLETED: return "REASSEMBLY_COMPLETED";
00172
00173 case REGISTRATION_ADDED: return "REGISTRATION_ADDED";
00174 case REGISTRATION_REMOVED: return "REGISTRATION_REMOVED";
00175 case REGISTRATION_EXPIRED: return "REGISTRATION_EXPIRED";
00176 case REGISTRATION_DELETE: return "REGISTRATION_DELETE";
00177
00178 case ROUTE_ADD: return "ROUTE_ADD";
00179 case ROUTE_DEL: return "ROUTE_DEL";
00180 case ROUTE_QUERY: return "ROUTE_QUERY";
00181 case ROUTE_REPORT: return "ROUTE_REPORT";
00182
00183 case CUSTODY_SIGNAL: return "CUSTODY_SIGNAL";
00184 case CUSTODY_TIMEOUT: return "CUSTODY_TIMEOUT";
00185
00186 case DAEMON_SHUTDOWN: return "SHUTDOWN";
00187 case DAEMON_STATUS: return "DAEMON_STATUS";
00188
00189 case CLA_SET_PARAMS: return "CLA_SET_PARAMS";
00190 case CLA_PARAMS_SET: return "CLA_PARAMS_SET";
00191 case CLA_SET_LINK_DEFAULTS: return "CLA_SET_LINK_DEFAULTS";
00192 case CLA_EID_REACHABLE: return "CLA_EID_REACHABLE";
00193
00194 case CLA_BUNDLE_QUEUED_QUERY: return "CLA_BUNDLE_QUEUED_QUERY";
00195 case CLA_BUNDLE_QUEUED_REPORT: return "CLA_BUNDLE_QUEUED_REPORT";
00196 case CLA_EID_REACHABLE_QUERY: return "CLA_EID_REACHABLE_QUERY";
00197 case CLA_EID_REACHABLE_REPORT: return "CLA_EID_REACHABLE_REPORT";
00198 case CLA_LINK_ATTRIB_QUERY: return "CLA_LINK_ATTRIB_QUERY";
00199 case CLA_LINK_ATTRIB_REPORT: return "CLA_LINK_ATTRIB_REPORT";
00200 case CLA_IFACE_ATTRIB_QUERY: return "CLA_IFACE_ATTRIB_QUERY";
00201 case CLA_IFACE_ATTRIB_REPORT: return "CLA_IFACE_ATTRIB_REPORT";
00202 case CLA_PARAMS_QUERY: return "CLA_PARAMS_QUERY";
00203 case CLA_PARAMS_REPORT: return "CLA_PARAMS_REPORT";
00204
00205 default: return "(invalid event type)";
00206
00207 }
00208 }
00209
00213 typedef enum {
00214 EVENTSRC_PEER = 1,
00215 EVENTSRC_APP = 2,
00216 EVENTSRC_STORE = 3,
00217 EVENTSRC_ADMIN = 4,
00218 EVENTSRC_FRAGMENTATION = 5,
00219 EVENTSRC_ROUTER = 6
00220 } event_source_t;
00221
00226 inline const char*
00227 source_to_str(event_source_t source)
00228 {
00229 switch(source) {
00230
00231 case EVENTSRC_PEER: return "peer";
00232 case EVENTSRC_APP: return "application";
00233 case EVENTSRC_STORE: return "dataStore";
00234 case EVENTSRC_ADMIN: return "admin";
00235 case EVENTSRC_FRAGMENTATION: return "fragmentation";
00236 case EVENTSRC_ROUTER: return "router";
00237
00238 default: return "(invalid source type)";
00239 }
00240 }
00241
00242 class MetadataBlockRequest {
00243 public:
00244 enum QueryType { QueryByIdentifier, QueryByType, QueryAll };
00245
00246 MetadataBlockRequest(QueryType query_type, unsigned int query_value) :
00247 _query_type(query_type), _query_value(query_value) { }
00248
00249 int query_type() const { return _query_type; }
00250 unsigned int query_value() const { return _query_value; }
00251
00252 private:
00253 QueryType _query_type;
00254 unsigned int _query_value;
00255 };
00256 typedef std::vector<MetadataBlockRequest> MetaBlockRequestVector;
00257
00261 class BundleEvent {
00262 public:
00266 const event_type_t type_;
00267
00273 bool daemon_only_;
00274
00278 oasys::Notifier* processed_notifier_;
00279
00283 oasys::Time posted_time_;
00284
00288 const char* type_str() {
00289 return event_to_str(type_);
00290 }
00291
00296 virtual ~BundleEvent() {}
00297
00298 protected:
00303 BundleEvent(event_type_t type)
00304 : type_(type),
00305 daemon_only_(false),
00306 processed_notifier_(NULL) {}
00307 };
00308
00312 class BundleReceivedEvent : public BundleEvent {
00313 public:
00314
00315
00316
00317
00318 BundleReceivedEvent(Bundle* bundle,
00319 event_source_t source,
00320 u_int32_t bytes_received,
00321 const EndpointID& prevhop,
00322 Link* originator = NULL)
00323
00324 : BundleEvent(BUNDLE_RECEIVED),
00325 bundleref_(bundle, "BundleReceivedEvent"),
00326 source_(source),
00327 bytes_received_(bytes_received),
00328 link_(originator, "BundleReceivedEvent"),
00329 prevhop_(prevhop),
00330 registration_(NULL)
00331 {
00332 ASSERT(source == EVENTSRC_PEER);
00333 }
00334
00335
00336
00337
00338
00339 BundleReceivedEvent(Bundle* bundle,
00340 event_source_t source,
00341 Registration* registration)
00342 : BundleEvent(BUNDLE_RECEIVED),
00343 bundleref_(bundle, "BundleReceivedEvent"),
00344 source_(source),
00345 bytes_received_(0),
00346 link_("BundleReceivedEvent"),
00347 prevhop_(EndpointID::NULL_EID()),
00348 registration_(registration)
00349 {
00350 }
00351
00352
00353
00354
00355
00356 BundleReceivedEvent(Bundle* bundle,
00357 event_source_t source)
00358 : BundleEvent(BUNDLE_RECEIVED),
00359 bundleref_(bundle, "BundleReceivedEvent"),
00360 source_(source),
00361 bytes_received_(0),
00362 link_("BundleReceivedEvent"),
00363 prevhop_(EndpointID::NULL_EID()),
00364 registration_(NULL)
00365 {
00366 }
00367
00369 BundleRef bundleref_;
00370
00372 int source_;
00373
00375 u_int32_t bytes_received_;
00376
00378 LinkRef link_;
00379
00381 EndpointID prevhop_;
00382
00384 Registration* registration_;
00385 };
00386
00390 class BundleTransmittedEvent : public BundleEvent {
00391 public:
00392 BundleTransmittedEvent(Bundle* bundle, const ContactRef& contact,
00393 const LinkRef& link, u_int32_t bytes_sent,
00394 u_int32_t reliably_sent)
00395 : BundleEvent(BUNDLE_TRANSMITTED),
00396 bundleref_(bundle, "BundleTransmittedEvent"),
00397 contact_(contact.object(), "BundleTransmittedEvent"),
00398 bytes_sent_(bytes_sent),
00399 reliably_sent_(reliably_sent),
00400 link_(link.object(), "BundleTransmittedEvent") {}
00401
00403 BundleRef bundleref_;
00404
00406 ContactRef contact_;
00407
00409 u_int32_t bytes_sent_;
00410
00414 u_int32_t reliably_sent_;
00415
00418 LinkRef link_;
00419
00420 };
00421
00425 class BundleDeliveredEvent : public BundleEvent {
00426 public:
00427 BundleDeliveredEvent(Bundle* bundle, Registration* registration)
00428 : BundleEvent(BUNDLE_DELIVERED),
00429 bundleref_(bundle, "BundleDeliveredEvent"),
00430 registration_(registration) {}
00431
00433 BundleRef bundleref_;
00434
00436 Registration* registration_;
00437 };
00438
00442 class BundleDeliveryEvent : public BundleEvent {
00443 public:
00444 BundleDeliveryEvent(Bundle* bundle,
00445 event_source_t source)
00446 : BundleEvent(BUNDLE_DELIVERY),
00447 bundleref_(bundle, "BundleDeliveryEvent"),
00448 source_(source) {}
00449
00451 BundleRef bundleref_;
00452
00454 int source_;
00455 };
00456
00460 class BundleExpiredEvent : public BundleEvent {
00461 public:
00462 BundleExpiredEvent(Bundle* bundle)
00463 : BundleEvent(BUNDLE_EXPIRED),
00464 bundleref_(bundle, "BundleExpiredEvent") {}
00465
00467 BundleRef bundleref_;
00468 };
00469
00473 class BundleFreeEvent : public BundleEvent {
00474 public:
00475 BundleFreeEvent(Bundle* bundle)
00476 : BundleEvent(BUNDLE_FREE),
00477 bundle_(bundle)
00478 {
00479
00480 daemon_only_ = true;
00481 }
00482
00484 Bundle* bundle_;
00485 };
00486
00491 class ContactEvent : public BundleEvent {
00492 public:
00496 typedef enum {
00497 INVALID = 0,
00498 NO_INFO,
00499 USER,
00500 BROKEN,
00501 DISCOVERY,
00502 CL_ERROR,
00503 CL_VERSION,
00504 SHUTDOWN,
00505 RECONNECT,
00506 IDLE,
00507 TIMEOUT,
00508 } reason_t;
00509
00513 static const char* reason_to_str(int reason) {
00514 switch(reason) {
00515 case INVALID: return "INVALID";
00516 case NO_INFO: return "no additional info";
00517 case USER: return "user action";
00518 case DISCOVERY: return "link discovery";
00519 case SHUTDOWN: return "peer shut down";
00520 case BROKEN: return "connection broken";
00521 case CL_ERROR: return "cl protocol error";
00522 case CL_VERSION:return "cl version mismatch";
00523 case RECONNECT: return "re-establishing connection";
00524 case IDLE: return "connection idle";
00525 case TIMEOUT: return "schedule timed out";
00526 }
00527 NOTREACHED;
00528 }
00529
00531 ContactEvent(event_type_t type, reason_t reason = NO_INFO)
00532 : BundleEvent(type), reason_(reason) {}
00533
00534 int reason_;
00535 };
00536
00540 class ContactUpEvent : public ContactEvent {
00541 public:
00542 ContactUpEvent(const ContactRef& contact)
00543 : ContactEvent(CONTACT_UP),
00544 contact_(contact.object(), "ContactUpEvent") {}
00545
00547 ContactRef contact_;
00548 };
00549
00553 class ContactDownEvent : public ContactEvent {
00554 public:
00555 ContactDownEvent(const ContactRef& contact, reason_t reason)
00556 : ContactEvent(CONTACT_DOWN, reason),
00557 contact_(contact.object(), "ContactDownEvent") {}
00558
00560 ContactRef contact_;
00561 };
00562
00566 class ContactQueryRequest: public BundleEvent {
00567 public:
00568 ContactQueryRequest() : BundleEvent(CONTACT_QUERY)
00569 {
00570
00571 daemon_only_ = true;
00572 }
00573 };
00574
00575 class ContactReportEvent : public BundleEvent {
00576 public:
00577 ContactReportEvent() : BundleEvent(CONTACT_REPORT) {}
00578 };
00579
00583 class ContactAttributeChangedEvent: public ContactEvent {
00584 public:
00585 ContactAttributeChangedEvent(const ContactRef& contact, reason_t reason)
00586 : ContactEvent(CONTACT_ATTRIB_CHANGED, reason),
00587 contact_(contact.object(), "ContactAttributeChangedEvent") {}
00588
00590 ContactRef contact_;
00591 };
00592
00596 class LinkCreatedEvent : public ContactEvent {
00597 public:
00598 LinkCreatedEvent(const LinkRef& link, reason_t reason = ContactEvent::USER)
00599 : ContactEvent(LINK_CREATED, reason),
00600 link_(link.object(), "LinkCreatedEvent") {}
00601
00603 LinkRef link_;
00604 };
00605
00609 class LinkDeletedEvent : public ContactEvent {
00610 public:
00611 LinkDeletedEvent(const LinkRef& link, reason_t reason = ContactEvent::USER)
00612 : ContactEvent(LINK_DELETED, reason),
00613 link_(link.object(), "LinkDeletedEvent") {}
00614
00616 LinkRef link_;
00617 };
00618
00622 class LinkAvailableEvent : public ContactEvent {
00623 public:
00624 LinkAvailableEvent(const LinkRef& link, reason_t reason)
00625 : ContactEvent(LINK_AVAILABLE, reason),
00626 link_(link.object(), "LinkAvailableEvent") {}
00627
00629 LinkRef link_;
00630 };
00631
00635 class LinkUnavailableEvent : public ContactEvent {
00636 public:
00637 LinkUnavailableEvent(const LinkRef& link, reason_t reason)
00638 : ContactEvent(LINK_UNAVAILABLE, reason),
00639 link_(link.object(), "LinkUnavailableEvent") {}
00640
00642 LinkRef link_;
00643 };
00644
00653 class LinkStateChangeRequest : public ContactEvent {
00654 public:
00656 typedef Link::state_t state_t;
00657
00658 LinkStateChangeRequest(const LinkRef& link, state_t state, reason_t reason)
00659 : ContactEvent(LINK_STATE_CHANGE_REQUEST, reason),
00660 link_(link.object(), "LinkStateChangeRequest"),
00661 state_(state), contact_("LinkStateChangeRequest")
00662 {
00663 daemon_only_ = true;
00664
00665 contact_ = link->contact();
00666 old_state_ = link->state();
00667 }
00668
00669 LinkStateChangeRequest(const oasys::Builder&,
00670 state_t state, reason_t reason)
00671 : ContactEvent(LINK_STATE_CHANGE_REQUEST, reason),
00672 state_(state), contact_("LinkStateChangeRequest")
00673 {
00674 daemon_only_ = true;
00675 }
00676
00678 LinkRef link_;
00679
00681 int state_;
00682
00684 ContactRef contact_;
00685
00687 int old_state_;
00688 };
00689
00693 class RegistrationAddedEvent : public BundleEvent {
00694 public:
00695 RegistrationAddedEvent(Registration* reg, event_source_t source)
00696 : BundleEvent(REGISTRATION_ADDED), registration_(reg),
00697 source_(source) {}
00698
00700 Registration* registration_;
00701
00703 int source_;
00704 };
00705
00709 class RegistrationRemovedEvent : public BundleEvent {
00710 public:
00711 RegistrationRemovedEvent(Registration* reg)
00712 : BundleEvent(REGISTRATION_REMOVED), registration_(reg) {}
00713
00715 Registration* registration_;
00716 };
00717
00721 class RegistrationExpiredEvent : public BundleEvent {
00722 public:
00723 RegistrationExpiredEvent(Registration* registration)
00724 : BundleEvent(REGISTRATION_EXPIRED),
00725 registration_(registration) {}
00726
00728 Registration* registration_;
00729 };
00730
00735 class RegistrationDeleteRequest : public BundleEvent {
00736 public:
00737 RegistrationDeleteRequest(Registration* registration)
00738 : BundleEvent(REGISTRATION_DELETE),
00739 registration_(registration)
00740 {
00741 daemon_only_ = true;
00742 }
00743
00745 Registration* registration_;
00746 };
00747
00751 class RouteAddEvent : public BundleEvent {
00752 public:
00753 RouteAddEvent(RouteEntry* entry)
00754 : BundleEvent(ROUTE_ADD), entry_(entry) {}
00755
00757 RouteEntry* entry_;
00758 };
00759
00763 class RouteDelEvent : public BundleEvent {
00764 public:
00765 RouteDelEvent(const EndpointIDPattern& dest)
00766 : BundleEvent(ROUTE_DEL), dest_(dest) {}
00767
00769 EndpointIDPattern dest_;
00770 };
00771
00775 class RouteQueryRequest: public BundleEvent {
00776 public:
00777 RouteQueryRequest() : BundleEvent(ROUTE_QUERY)
00778 {
00779
00780 daemon_only_ = true;
00781 }
00782 };
00783
00784 class RouteReportEvent : public BundleEvent {
00785 public:
00786 RouteReportEvent() : BundleEvent(ROUTE_REPORT) {}
00787 };
00788
00792 class ReassemblyCompletedEvent : public BundleEvent {
00793 public:
00794 ReassemblyCompletedEvent(Bundle* bundle, BundleList* fragments)
00795 : BundleEvent(REASSEMBLY_COMPLETED),
00796 bundle_(bundle, "ReassemblyCompletedEvent"),
00797 fragments_("ReassemblyCompletedEvent")
00798 {
00799 fragments->move_contents(&fragments_);
00800 }
00801
00803 BundleRef bundle_;
00804
00806 BundleList fragments_;
00807 };
00808
00812 class CustodySignalEvent : public BundleEvent {
00813 public:
00814 CustodySignalEvent(const CustodySignal::data_t& data)
00815 : BundleEvent(CUSTODY_SIGNAL), data_(data) {}
00816
00818 CustodySignal::data_t data_;
00819 };
00820
00824 class CustodyTimeoutEvent : public BundleEvent {
00825 public:
00826 CustodyTimeoutEvent(Bundle* bundle, const LinkRef& link)
00827 : BundleEvent(CUSTODY_TIMEOUT),
00828 bundle_(bundle, "CustodyTimeoutEvent"),
00829 link_(link.object(), "CustodyTimeoutEvent") {}
00830
00832 BundleRef bundle_;
00833
00835 LinkRef link_;
00836 };
00837
00843 class ShutdownRequest : public BundleEvent {
00844 public:
00845 ShutdownRequest() : BundleEvent(DAEMON_SHUTDOWN)
00846 {
00847 daemon_only_ = true;
00848 }
00849 };
00850
00854 class StatusRequest : public BundleEvent {
00855 public:
00856 StatusRequest() : BundleEvent(DAEMON_STATUS)
00857 {
00858 daemon_only_ = true;
00859 }
00860 };
00861
00865 class BundleSendRequest: public BundleEvent {
00866 public:
00867 BundleSendRequest() : BundleEvent(BUNDLE_SEND)
00868 {
00869
00870 daemon_only_ = true;
00871 }
00872
00873 BundleSendRequest(const BundleRef& bundle,
00874 const std::string& link,
00875 int action)
00876 : BundleEvent(BUNDLE_SEND),
00877 bundle_(bundle.object(), "BundleSendRequest"),
00878 link_(link),
00879 action_(action)
00880 {
00881
00882 daemon_only_ = true;
00883 }
00884
00886 BundleRef bundle_;
00887
00889 std::string link_;
00890
00892 int action_;
00893 };
00894
00898 class BundleCancelRequest: public BundleEvent {
00899 public:
00900 BundleCancelRequest() : BundleEvent(BUNDLE_CANCEL)
00901 {
00902
00903 daemon_only_ = true;
00904 }
00905
00906 BundleCancelRequest(const BundleRef& bundle, const std::string& link)
00907 : BundleEvent(BUNDLE_CANCEL),
00908 bundle_(bundle.object(), "BundleCancelRequest"),
00909 link_(link)
00910 {
00911
00912 daemon_only_ = true;
00913 }
00914
00916 BundleRef bundle_;
00917
00919 std::string link_;
00920 };
00921
00925 class BundleSendCancelledEvent : public BundleEvent {
00926 public:
00927 BundleSendCancelledEvent(Bundle* bundle, const LinkRef& link)
00928 : BundleEvent(BUNDLE_CANCELLED),
00929 bundleref_(bundle, "BundleSendCancelledEvent"),
00930 link_(link.object(), "BundleSendCancelledEvent") {}
00931
00933 BundleRef bundleref_;
00934
00936 LinkRef link_;
00937 };
00938
00942 class BundleInjectRequest: public BundleEvent {
00943 public:
00944 BundleInjectRequest() : BundleEvent(BUNDLE_INJECT)
00945 {
00946
00947 daemon_only_ = true;
00948 }
00949
00950
00951 std::string src_;
00952 std::string dest_;
00953 std::string replyto_;
00954 std::string custodian_;
00955 u_int8_t priority_;
00956 u_int32_t expiration_;
00957 std::string payload_file_;
00958
00959
00960 std::string link_;
00961
00962
00963 int action_;
00964
00965
00966 std::string request_id_;
00967 };
00968
00972 class BundleInjectedEvent: public BundleEvent {
00973 public:
00974 BundleInjectedEvent(Bundle *bundle, const std::string &request_id)
00975 : BundleEvent(BUNDLE_INJECTED),
00976 bundleref_(bundle, "BundleInjectedEvent"),
00977 request_id_(request_id)
00978 {
00979 }
00980
00982 BundleRef bundleref_;
00983
00984
00985 std::string request_id_;
00986 };
00987
00991 class BundleDeleteRequest: public BundleEvent {
00992 public:
00993 BundleDeleteRequest() : BundleEvent(BUNDLE_DELETE)
00994 {
00995
00996 daemon_only_ = true;
00997 }
00998
00999 BundleDeleteRequest(Bundle* bundle,
01000 BundleProtocol::status_report_reason_t reason)
01001 : BundleEvent(BUNDLE_DELETE),
01002 bundle_(bundle, "BundleDeleteRequest"),
01003 reason_(reason)
01004 {
01005
01006 daemon_only_ = true;
01007 }
01008
01009 BundleDeleteRequest(const BundleRef& bundle,
01010 BundleProtocol::status_report_reason_t reason)
01011 : BundleEvent(BUNDLE_DELETE),
01012 bundle_(bundle.object(), "BundleDeleteRequest"),
01013 reason_(reason)
01014 {
01015
01016 daemon_only_ = true;
01017 }
01018
01020 BundleRef bundle_;
01021
01023 BundleProtocol::status_report_reason_t reason_;
01024 };
01025
01037 class BundleAcceptRequest : public BundleEvent {
01038 public:
01039 BundleAcceptRequest(const BundleRef& bundle,
01040 event_source_t source,
01041 bool* result,
01042 int* reason)
01043 : BundleEvent(BUNDLE_ACCEPT_REQUEST),
01044 bundle_(bundle.object(), "BundleAcceptRequest"),
01045 source_(source),
01046 result_(result),
01047 reason_(reason)
01048 {
01049 }
01050
01052 BundleRef bundle_;
01053
01055 int source_;
01056
01058 bool* result_;
01059
01061 int* reason_;
01062 };
01063
01067 class BundleQueryRequest: public BundleEvent {
01068 public:
01069 BundleQueryRequest() : BundleEvent(BUNDLE_QUERY)
01070 {
01071
01072 daemon_only_ = true;
01073 }
01074 };
01075
01076 class BundleReportEvent : public BundleEvent {
01077 public:
01078 BundleReportEvent() : BundleEvent(BUNDLE_REPORT) {}
01079 };
01080
01081 class BundleAttributesQueryRequest: public BundleEvent {
01082 public:
01083 BundleAttributesQueryRequest(const std::string& query_id,
01084 const BundleRef& bundle,
01085 const AttributeNameVector& attribute_names)
01086 : BundleEvent(BUNDLE_ATTRIB_QUERY),
01087 query_id_(query_id),
01088 bundle_(bundle.object(), "BundleAttributesQueryRequest"),
01089 attribute_names_(attribute_names) {}
01090
01092 std::string query_id_;
01093
01095 BundleRef bundle_;
01096
01098 AttributeNameVector attribute_names_;
01099
01101 MetaBlockRequestVector metadata_blocks_;
01102 };
01103
01104 class BundleAttributesReportEvent: public BundleEvent {
01105 public:
01106 BundleAttributesReportEvent(const std::string& query_id,
01107 const BundleRef& bundle,
01108 const AttributeNameVector& attribute_names,
01109 const MetaBlockRequestVector& metadata_blocks)
01110 : BundleEvent(BUNDLE_ATTRIB_REPORT),
01111 query_id_(query_id),
01112 bundle_(bundle.object(), "BundleAttributesReportEvent"),
01113 attribute_names_(attribute_names),
01114 metadata_blocks_(metadata_blocks) {}
01115
01117 std::string query_id_;
01118
01120 BundleRef bundle_;
01121
01123 AttributeNameVector attribute_names_;
01124
01126 MetaBlockRequestVector metadata_blocks_;
01127 };
01128
01132 class LinkCreateRequest: public BundleEvent {
01133 public:
01134 LinkCreateRequest(const std::string &name, Link::link_type_t link_type,
01135 const std::string &endpoint,
01136 ConvergenceLayer *cla, AttributeVector ¶meters)
01137 : BundleEvent(LINK_CREATE),
01138 name_(name),
01139 endpoint_(endpoint),
01140 link_type_(link_type),
01141 cla_(cla),
01142 parameters_(parameters)
01143
01144 {
01145
01146 daemon_only_ = true;
01147 }
01148
01150 std::string name_;
01151
01153 std::string endpoint_;
01154
01156 Link::link_type_t link_type_;
01157
01159 ConvergenceLayer *cla_;
01160
01162 AttributeVector parameters_;
01163 };
01164
01168 class LinkReconfigureRequest: public BundleEvent {
01169 public:
01170 LinkReconfigureRequest(const LinkRef& link,
01171 AttributeVector ¶meters)
01172 : BundleEvent(LINK_RECONFIGURE),
01173 link_(link.object(), "LinkReconfigureRequest"),
01174 parameters_(parameters)
01175 {
01176
01177 daemon_only_ = true;
01178 }
01179
01181 LinkRef link_;
01182
01184 AttributeVector parameters_;
01185 };
01186
01190 class LinkDeleteRequest: public BundleEvent {
01191 public:
01192 LinkDeleteRequest(const LinkRef& link) :
01193 BundleEvent(LINK_DELETE),
01194 link_(link.object(), "LinkDeleteRequest")
01195 {
01196
01197 daemon_only_ = true;
01198 }
01199
01201 LinkRef link_;
01202 };
01203
01207 class LinkAttributeChangedEvent: public ContactEvent {
01208 public:
01209 LinkAttributeChangedEvent(const LinkRef& link,
01210 AttributeVector attributes,
01211 reason_t reason = ContactEvent::NO_INFO)
01212 : ContactEvent(LINK_ATTRIB_CHANGED, reason),
01213 link_(link.object(), "LinkAttributeChangedEvent"),
01214 attributes_(attributes)
01215 {
01216 }
01217
01219 LinkRef link_;
01220
01222 AttributeVector attributes_;
01223 };
01224
01228 class LinkQueryRequest: public BundleEvent {
01229 public:
01230 LinkQueryRequest() : BundleEvent(LINK_QUERY)
01231 {
01232
01233 daemon_only_ = true;
01234 }
01235 };
01236
01237 class LinkReportEvent : public BundleEvent {
01238 public:
01239 LinkReportEvent() : BundleEvent(LINK_REPORT) {}
01240 };
01241
01245 class CLASetParamsRequest : public BundleEvent {
01246 public:
01247 CLASetParamsRequest(ConvergenceLayer *cla, AttributeVector ¶meters)
01248 : BundleEvent(CLA_SET_PARAMS), cla_(cla), parameters_(parameters)
01249 {
01250
01251 daemon_only_ = true;
01252 }
01253
01255 ConvergenceLayer *cla_;
01256
01258 AttributeVector parameters_;
01259 };
01260
01264 class CLAParamsSetEvent : public BundleEvent {
01265 public:
01266 CLAParamsSetEvent(ConvergenceLayer *cla, std::string name)
01267 : BundleEvent(CLA_PARAMS_SET), cla_(cla), name_(name) {}
01268
01270 ConvergenceLayer *cla_;
01271
01273 std::string name_;
01274 };
01275
01279 class SetLinkDefaultsRequest : public BundleEvent {
01280 public:
01281 SetLinkDefaultsRequest(AttributeVector ¶meters)
01282 : BundleEvent(CLA_SET_LINK_DEFAULTS), parameters_(parameters)
01283 {
01284
01285 daemon_only_ = true;
01286 }
01287
01289 AttributeVector parameters_;
01290 };
01291
01295 class NewEIDReachableEvent: public BundleEvent {
01296 public:
01297 NewEIDReachableEvent(Interface* iface, const std::string &endpoint)
01298 : BundleEvent(CLA_EID_REACHABLE),
01299 iface_(iface),
01300 endpoint_(endpoint) {}
01301
01303 Interface* iface_;
01304
01306 std::string endpoint_;
01307 };
01308
01313 class CLAQueryReport: public BundleEvent {
01314 public:
01315
01317 std::string query_id_;
01318
01319 protected:
01320
01325 CLAQueryReport(event_type_t type,
01326 const std::string& query_id,
01327 bool daemon_only = false)
01328 : BundleEvent(type),
01329 query_id_(query_id)
01330 {
01331 daemon_only_ = daemon_only;
01332 }
01333 };
01334
01335 class BundleQueuedQueryRequest: public CLAQueryReport {
01336 public:
01337 BundleQueuedQueryRequest(const std::string& query_id,
01338 Bundle* bundle,
01339 const LinkRef& link)
01340 : CLAQueryReport(CLA_BUNDLE_QUEUED_QUERY, query_id, true),
01341 bundle_(bundle, "BundleQueuedQueryRequest"),
01342 link_(link.object(), "BundleQueuedQueryRequest") {}
01343
01345 BundleRef bundle_;
01346
01348 LinkRef link_;
01349 };
01350
01351 class BundleQueuedReportEvent: public CLAQueryReport {
01352 public:
01353 BundleQueuedReportEvent(const std::string& query_id,
01354 bool is_queued)
01355 : CLAQueryReport(CLA_BUNDLE_QUEUED_REPORT, query_id),
01356 is_queued_(is_queued) {}
01357
01360 bool is_queued_;
01361 };
01362
01363 class EIDReachableQueryRequest: public CLAQueryReport {
01364 public:
01365 EIDReachableQueryRequest(const std::string& query_id,
01366 Interface* iface,
01367 const std::string& endpoint)
01368 : CLAQueryReport(CLA_EID_REACHABLE_QUERY, query_id, true),
01369 iface_(iface),
01370 endpoint_(endpoint) {}
01371
01373 Interface* iface_;
01374
01376 std::string endpoint_;
01377 };
01378
01379 class EIDReachableReportEvent: public CLAQueryReport {
01380 public:
01381 EIDReachableReportEvent(const std::string& query_id,
01382 bool is_reachable)
01383 : CLAQueryReport(CLA_EID_REACHABLE_REPORT, query_id),
01384 is_reachable_(is_reachable) {}
01385
01388 bool is_reachable_;
01389 };
01390
01391 class LinkAttributesQueryRequest: public CLAQueryReport {
01392 public:
01393 LinkAttributesQueryRequest(const std::string& query_id,
01394 const LinkRef& link,
01395 const AttributeNameVector& attribute_names)
01396 : CLAQueryReport(CLA_LINK_ATTRIB_QUERY, query_id, true),
01397 link_(link.object(), "LinkAttributesQueryRequest"),
01398 attribute_names_(attribute_names) {}
01399
01401 LinkRef link_;
01402
01404 AttributeNameVector attribute_names_;
01405 };
01406
01407 class LinkAttributesReportEvent: public CLAQueryReport {
01408 public:
01409 LinkAttributesReportEvent(const std::string& query_id,
01410 const AttributeVector& attributes)
01411 : CLAQueryReport(CLA_LINK_ATTRIB_REPORT, query_id),
01412 attributes_(attributes) {}
01413
01415 AttributeVector attributes_;
01416 };
01417
01418 class IfaceAttributesQueryRequest: public CLAQueryReport {
01419 public:
01420 IfaceAttributesQueryRequest(const std::string& query_id,
01421 Interface* iface,
01422 const AttributeNameVector& attribute_names)
01423 : CLAQueryReport(CLA_IFACE_ATTRIB_QUERY, query_id, true),
01424 iface_(iface),
01425 attribute_names_(attribute_names) {}
01426
01428 Interface* iface_;
01429
01431 AttributeNameVector attribute_names_;
01432 };
01433
01434 class IfaceAttributesReportEvent: public CLAQueryReport {
01435 public:
01436 IfaceAttributesReportEvent(const std::string& query_id,
01437 const AttributeVector& attributes)
01438 : CLAQueryReport(CLA_IFACE_ATTRIB_REPORT, query_id),
01439 attributes_(attributes) {}
01440
01442 AttributeVector attributes_;
01443 };
01444
01445 class CLAParametersQueryRequest: public CLAQueryReport {
01446 public:
01447 CLAParametersQueryRequest(const std::string& query_id,
01448 ConvergenceLayer* cla,
01449 const AttributeNameVector& parameter_names)
01450 : CLAQueryReport(CLA_PARAMS_QUERY, query_id, true),
01451 cla_(cla),
01452 parameter_names_(parameter_names) {}
01453
01455 ConvergenceLayer* cla_;
01456
01458 AttributeNameVector parameter_names_;
01459 };
01460
01461 class CLAParametersReportEvent: public CLAQueryReport {
01462 public:
01463 CLAParametersReportEvent(const std::string& query_id,
01464 const AttributeVector& parameters)
01465 : CLAQueryReport(CLA_PARAMS_REPORT, query_id),
01466 parameters_(parameters) {}
01467
01469 AttributeVector parameters_;
01470 };
01471
01472 }
01473
01474 #endif