00001 /* 00002 * Copyright 2005-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_HANDLER_H_ 00018 #define _BUNDLE_EVENT_HANDLER_H_ 00019 00020 #include <oasys/debug/Log.h> 00021 00022 #include "BundleEvent.h" 00023 00024 namespace dtn { 00025 00032 class BundleEventHandler : public oasys::Logger { 00033 public: 00037 virtual void handle_event(BundleEvent* event) = 0; 00038 00039 protected: 00044 BundleEventHandler(const char* classname, 00045 const char* logpath) 00046 : oasys::Logger(classname, logpath) {} 00047 00052 virtual ~BundleEventHandler() {} 00053 00058 void dispatch_event(BundleEvent* event); 00059 00063 virtual void handle_bundle_received(BundleReceivedEvent* event); 00064 00068 virtual void handle_bundle_transmitted(BundleTransmittedEvent* event); 00069 00073 virtual void handle_bundle_transmit_failed(BundleTransmitFailedEvent* event); 00074 00078 virtual void handle_bundle_delivered(BundleDeliveredEvent* event); 00079 00083 virtual void handle_bundle_expired(BundleExpiredEvent* event); 00084 00089 virtual void handle_bundle_free(BundleFreeEvent* event); 00090 00094 virtual void handle_bundle_send(BundleSendRequest* event); 00095 00099 virtual void handle_bundle_cancel(BundleCancelRequest* event); 00100 00104 virtual void handle_bundle_inject(BundleInjectRequest* event); 00105 00109 virtual void handle_bundle_accept(BundleAcceptRequest* event); 00110 00114 virtual void handle_bundle_query(BundleQueryRequest* request); 00115 00119 virtual void handle_bundle_report(BundleReportEvent* request); 00120 00125 virtual void handle_registration_added(RegistrationAddedEvent* event); 00126 00130 virtual void handle_registration_removed(RegistrationRemovedEvent* event); 00131 00135 virtual void handle_registration_expired(RegistrationExpiredEvent* event); 00136 00140 virtual void handle_contact_up(ContactUpEvent* event); 00141 00145 virtual void handle_contact_down(ContactDownEvent* event); 00146 00150 virtual void handle_contact_query(ContactQueryRequest* request); 00151 00155 virtual void handle_contact_report(ContactReportEvent* request); 00156 00160 virtual void handle_link_created(LinkCreatedEvent* event); 00161 00165 virtual void handle_link_deleted(LinkDeletedEvent* event); 00166 00170 virtual void handle_link_available(LinkAvailableEvent* event); 00171 00175 virtual void handle_link_unavailable(LinkUnavailableEvent* event); 00176 00180 virtual void handle_link_state_change_request(LinkStateChangeRequest* req); 00181 00185 virtual void handle_link_create(LinkCreateRequest* request); 00186 00190 virtual void handle_link_query(LinkQueryRequest* request); 00191 00195 virtual void handle_link_report(LinkReportEvent* request); 00196 00200 virtual void handle_reassembly_completed(ReassemblyCompletedEvent* event); 00201 00206 virtual void handle_route_add(RouteAddEvent* event); 00207 00212 virtual void handle_route_del(RouteDelEvent* event); 00213 00217 virtual void handle_route_query(RouteQueryRequest* request); 00218 00222 virtual void handle_route_report(RouteReportEvent* request); 00223 00227 virtual void handle_custody_signal(CustodySignalEvent* event); 00228 00232 virtual void handle_custody_timeout(CustodyTimeoutEvent* event); 00233 00237 virtual void handle_shutdown_request(ShutdownRequest* event); 00238 00242 virtual void handle_status_request(StatusRequest* event); 00243 }; 00244 00245 } // namespace dtn 00246 00247 #endif /* _BUNDLE_EVENT_HANDLER_H_ */