00001 /* 00002 * IMPORTANT: READ BEFORE DOWNLOADING, COPYING, INSTALLING OR USING. By 00003 * downloading, copying, installing or using the software you agree to 00004 * this license. If you do not agree to this license, do not download, 00005 * install, copy or use the software. 00006 * 00007 * Intel Open Source License 00008 * 00009 * Copyright (c) 2005 Intel Corporation. All rights reserved. 00010 * 00011 * Redistribution and use in source and binary forms, with or without 00012 * modification, are permitted provided that the following conditions are 00013 * met: 00014 * 00015 * Redistributions of source code must retain the above copyright 00016 * notice, this list of conditions and the following disclaimer. 00017 * 00018 * Redistributions in binary form must reproduce the above copyright 00019 * notice, this list of conditions and the following disclaimer in the 00020 * documentation and/or other materials provided with the distribution. 00021 * 00022 * Neither the name of the Intel Corporation nor the names of its 00023 * contributors may be used to endorse or promote products derived from 00024 * this software without specific prior written permission. 00025 * 00026 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 00027 * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 00028 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 00029 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE INTEL OR 00030 * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 00031 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 00032 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 00033 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 00034 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 00035 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 00036 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 00037 */ 00038 #ifndef _BUNDLE_EVENT_HANDLER_H_ 00039 #define _BUNDLE_EVENT_HANDLER_H_ 00040 00041 #include <oasys/debug/Log.h> 00042 00043 #include "BundleEvent.h" 00044 00045 namespace dtn { 00046 00053 class BundleEventHandler : public oasys::Logger { 00054 public: 00058 virtual void handle_event(BundleEvent* event) = 0; 00059 00060 protected: 00065 BundleEventHandler(const char* classname, 00066 const char* logpath) 00067 : oasys::Logger(classname, logpath) {} 00068 00073 virtual ~BundleEventHandler() {} 00074 00079 void dispatch_event(BundleEvent* event); 00080 00084 virtual void handle_bundle_received(BundleReceivedEvent* event); 00085 00089 virtual void handle_bundle_transmitted(BundleTransmittedEvent* event); 00090 00094 virtual void handle_bundle_transmit_failed(BundleTransmitFailedEvent* event); 00095 00099 virtual void handle_bundle_delivered(BundleDeliveredEvent* event); 00100 00104 virtual void handle_bundle_expired(BundleExpiredEvent* event); 00105 00110 virtual void handle_bundle_free(BundleFreeEvent* event); 00111 00116 virtual void handle_registration_added(RegistrationAddedEvent* event); 00117 00121 virtual void handle_registration_removed(RegistrationRemovedEvent* event); 00122 00126 virtual void handle_registration_expired(RegistrationExpiredEvent* event); 00127 00131 virtual void handle_contact_up(ContactUpEvent* event); 00132 00136 virtual void handle_contact_down(ContactDownEvent* event); 00137 00141 virtual void handle_link_created(LinkCreatedEvent* event); 00142 00146 virtual void handle_link_deleted(LinkDeletedEvent* event); 00147 00151 virtual void handle_link_available(LinkAvailableEvent* event); 00152 00156 virtual void handle_link_unavailable(LinkUnavailableEvent* event); 00157 00161 virtual void handle_link_state_change_request(LinkStateChangeRequest* req); 00162 00166 virtual void handle_reassembly_completed(ReassemblyCompletedEvent* event); 00167 00172 virtual void handle_route_add(RouteAddEvent* event); 00173 00178 virtual void handle_route_del(RouteDelEvent* event); 00179 00183 virtual void handle_custody_signal(CustodySignalEvent* event); 00184 00188 virtual void handle_custody_timeout(CustodyTimeoutEvent* event); 00189 00193 virtual void handle_shutdown_request(ShutdownRequest* event); 00194 00198 virtual void handle_status_request(StatusRequest* event); 00199 }; 00200 00201 } // namespace dtn 00202 00203 #endif /* _BUNDLE_EVENT_HANDLER_H_ */