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 #ifdef HAVE_CONFIG_H 00018 # include <dtn-config.h> 00019 #endif 00020 00021 #include "BundleEventHandler.h" 00022 00023 namespace dtn { 00024 00029 void 00030 BundleEventHandler::dispatch_event(BundleEvent* e) 00031 { 00032 log_debug("dispatching event (%p) %s", e, e->type_str()); 00033 00034 switch(e->type_) { 00035 00036 case BUNDLE_RECEIVED: 00037 handle_bundle_received((BundleReceivedEvent*)e); 00038 break; 00039 00040 case BUNDLE_TRANSMITTED: 00041 handle_bundle_transmitted((BundleTransmittedEvent*)e); 00042 break; 00043 00044 case BUNDLE_DELIVERED: 00045 handle_bundle_delivered((BundleDeliveredEvent*)e); 00046 break; 00047 00048 case BUNDLE_EXPIRED: 00049 handle_bundle_expired((BundleExpiredEvent*)e); 00050 break; 00051 00052 case BUNDLE_FREE: 00053 handle_bundle_free((BundleFreeEvent*)e); 00054 break; 00055 00056 case BUNDLE_SEND: 00057 handle_bundle_send((BundleSendRequest*)e); 00058 break; 00059 00060 case BUNDLE_CANCEL: 00061 handle_bundle_cancel((BundleCancelRequest*)e); 00062 break; 00063 00064 case BUNDLE_CANCELLED: 00065 handle_bundle_cancelled((BundleSendCancelledEvent*)e); 00066 break; 00067 00068 case BUNDLE_INJECT: 00069 handle_bundle_inject((BundleInjectRequest*)e); 00070 break; 00071 00072 case BUNDLE_INJECTED: 00073 handle_bundle_injected((BundleInjectedEvent*)e); 00074 break; 00075 00076 case BUNDLE_DELETE: 00077 handle_bundle_delete((BundleDeleteRequest*)e); 00078 break; 00079 00080 case BUNDLE_ACCEPT_REQUEST: 00081 handle_bundle_accept((BundleAcceptRequest*)e); 00082 break; 00083 00084 case BUNDLE_QUERY: 00085 handle_bundle_query((BundleQueryRequest*)e); 00086 break; 00087 00088 case BUNDLE_REPORT: 00089 handle_bundle_report((BundleReportEvent*)e); 00090 break; 00091 00092 case BUNDLE_ATTRIB_QUERY: 00093 handle_bundle_attributes_query((BundleAttributesQueryRequest*)e); 00094 break; 00095 00096 case BUNDLE_ATTRIB_REPORT: 00097 handle_bundle_attributes_report((BundleAttributesReportEvent*)e); 00098 break; 00099 00100 case REGISTRATION_ADDED: 00101 handle_registration_added((RegistrationAddedEvent*)e); 00102 break; 00103 00104 case REGISTRATION_REMOVED: 00105 handle_registration_removed((RegistrationRemovedEvent*)e); 00106 break; 00107 00108 case REGISTRATION_EXPIRED: 00109 handle_registration_expired((RegistrationExpiredEvent*)e); 00110 break; 00111 00112 case REGISTRATION_DELETE: 00113 handle_registration_delete((RegistrationDeleteRequest*)e); 00114 break; 00115 00116 case ROUTE_ADD: 00117 handle_route_add((RouteAddEvent*)e); 00118 break; 00119 00120 case ROUTE_DEL: 00121 handle_route_del((RouteDelEvent*)e); 00122 break; 00123 00124 case ROUTE_QUERY: 00125 handle_route_query((RouteQueryRequest*)e); 00126 break; 00127 00128 case ROUTE_REPORT: 00129 handle_route_report((RouteReportEvent*)e); 00130 break; 00131 00132 case CONTACT_UP: 00133 handle_contact_up((ContactUpEvent*)e); 00134 break; 00135 00136 case CONTACT_DOWN: 00137 handle_contact_down((ContactDownEvent*)e); 00138 break; 00139 00140 case CONTACT_QUERY: 00141 handle_contact_query((ContactQueryRequest*)e); 00142 break; 00143 00144 case CONTACT_REPORT: 00145 handle_contact_report((ContactReportEvent*)e); 00146 break; 00147 00148 case CONTACT_ATTRIB_CHANGED: 00149 handle_contact_attribute_changed((ContactAttributeChangedEvent*)e); 00150 break; 00151 00152 case LINK_CREATED: 00153 handle_link_created((LinkCreatedEvent*)e); 00154 break; 00155 00156 case LINK_DELETED: 00157 handle_link_deleted((LinkDeletedEvent*)e); 00158 break; 00159 00160 case LINK_AVAILABLE: 00161 handle_link_available((LinkAvailableEvent*)e); 00162 break; 00163 00164 case LINK_UNAVAILABLE: 00165 handle_link_unavailable((LinkUnavailableEvent*)e); 00166 break; 00167 00168 case LINK_STATE_CHANGE_REQUEST: 00169 handle_link_state_change_request((LinkStateChangeRequest*)e); 00170 break; 00171 00172 case LINK_CREATE: 00173 handle_link_create((LinkCreateRequest*)e); 00174 break; 00175 00176 case LINK_DELETE: 00177 handle_link_delete((LinkDeleteRequest*)e); 00178 break; 00179 00180 case LINK_RECONFIGURE: 00181 handle_link_reconfigure((LinkReconfigureRequest*)e); 00182 break; 00183 00184 case LINK_QUERY: 00185 handle_link_query((LinkQueryRequest*)e); 00186 break; 00187 00188 case LINK_REPORT: 00189 handle_link_report((LinkReportEvent*)e); 00190 break; 00191 00192 case LINK_ATTRIB_CHANGED: 00193 handle_link_attribute_changed((LinkAttributeChangedEvent*)e); 00194 break; 00195 00196 case REASSEMBLY_COMPLETED: 00197 handle_reassembly_completed((ReassemblyCompletedEvent*)e); 00198 break; 00199 00200 case CUSTODY_SIGNAL: 00201 handle_custody_signal((CustodySignalEvent*)e); 00202 break; 00203 00204 case CUSTODY_TIMEOUT: 00205 handle_custody_timeout((CustodyTimeoutEvent*)e); 00206 break; 00207 00208 case DAEMON_SHUTDOWN: 00209 handle_shutdown_request((ShutdownRequest*)e); 00210 break; 00211 00212 case DAEMON_STATUS: 00213 handle_status_request((StatusRequest*)e); 00214 break; 00215 00216 case CLA_SET_PARAMS: 00217 handle_cla_set_params((CLASetParamsRequest*)e); 00218 break; 00219 00220 case CLA_PARAMS_SET: 00221 handle_cla_params_set((CLAParamsSetEvent*)e); 00222 break; 00223 00224 case CLA_SET_LINK_DEFAULTS: 00225 handle_set_link_defaults((SetLinkDefaultsRequest*)e); 00226 break; 00227 00228 case CLA_EID_REACHABLE: 00229 handle_new_eid_reachable((NewEIDReachableEvent*)e); 00230 break; 00231 00232 case CLA_BUNDLE_QUEUED_QUERY: 00233 handle_bundle_queued_query((BundleQueuedQueryRequest*)e); 00234 break; 00235 00236 case CLA_BUNDLE_QUEUED_REPORT: 00237 handle_bundle_queued_report((BundleQueuedReportEvent*)e); 00238 break; 00239 00240 case CLA_EID_REACHABLE_QUERY: 00241 handle_eid_reachable_query((EIDReachableQueryRequest*)e); 00242 break; 00243 00244 case CLA_EID_REACHABLE_REPORT: 00245 handle_eid_reachable_report((EIDReachableReportEvent*)e); 00246 break; 00247 00248 case CLA_LINK_ATTRIB_QUERY: 00249 handle_link_attributes_query((LinkAttributesQueryRequest*)e); 00250 break; 00251 00252 case CLA_LINK_ATTRIB_REPORT: 00253 handle_link_attributes_report((LinkAttributesReportEvent*)e); 00254 break; 00255 00256 case CLA_IFACE_ATTRIB_QUERY: 00257 handle_iface_attributes_query((IfaceAttributesQueryRequest*)e); 00258 break; 00259 00260 case CLA_IFACE_ATTRIB_REPORT: 00261 handle_iface_attributes_report((IfaceAttributesReportEvent*)e); 00262 break; 00263 00264 case CLA_PARAMS_QUERY: 00265 handle_cla_parameters_query((CLAParametersQueryRequest*)e); 00266 break; 00267 00268 case CLA_PARAMS_REPORT: 00269 handle_cla_parameters_report((CLAParametersReportEvent*)e); 00270 break; 00271 00272 default: 00273 PANIC("unimplemented event type %d", e->type_); 00274 } 00275 } 00276 00280 void 00281 BundleEventHandler::handle_bundle_received(BundleReceivedEvent*) 00282 { 00283 } 00284 00288 void 00289 BundleEventHandler::handle_bundle_transmitted(BundleTransmittedEvent*) 00290 { 00291 } 00292 00296 void 00297 BundleEventHandler::handle_bundle_delivered(BundleDeliveredEvent*) 00298 { 00299 } 00300 00304 void 00305 BundleEventHandler::handle_bundle_expired(BundleExpiredEvent*) 00306 { 00307 } 00308 00313 void 00314 BundleEventHandler::handle_bundle_free(BundleFreeEvent*) 00315 { 00316 } 00317 00321 void 00322 BundleEventHandler::handle_bundle_send(BundleSendRequest*) 00323 { 00324 } 00325 00329 void 00330 BundleEventHandler::handle_bundle_cancel(BundleCancelRequest*) 00331 { 00332 } 00333 00337 void 00338 BundleEventHandler::handle_bundle_cancelled(BundleSendCancelledEvent*) 00339 { 00340 } 00341 00345 void 00346 BundleEventHandler::handle_bundle_inject(BundleInjectRequest*) 00347 { 00348 } 00349 00353 void 00354 BundleEventHandler::handle_bundle_injected(BundleInjectedEvent*) 00355 { 00356 } 00357 00361 void 00362 BundleEventHandler::handle_bundle_delete(BundleDeleteRequest*) 00363 { 00364 } 00365 00369 void 00370 BundleEventHandler::handle_bundle_accept(BundleAcceptRequest*) 00371 { 00372 } 00373 00377 void 00378 BundleEventHandler::handle_bundle_query(BundleQueryRequest*) 00379 { 00380 } 00381 00385 void 00386 BundleEventHandler::handle_bundle_report(BundleReportEvent*) 00387 { 00388 } 00389 00393 void 00394 BundleEventHandler::handle_bundle_attributes_query(BundleAttributesQueryRequest*) 00395 { 00396 } 00397 00401 void 00402 BundleEventHandler::handle_bundle_attributes_report(BundleAttributesReportEvent*) 00403 { 00404 } 00405 00410 void 00411 BundleEventHandler::handle_registration_added(RegistrationAddedEvent*) 00412 { 00413 } 00414 00418 void 00419 BundleEventHandler::handle_registration_removed(RegistrationRemovedEvent*) 00420 { 00421 } 00422 00426 void 00427 BundleEventHandler::handle_registration_expired(RegistrationExpiredEvent*) 00428 { 00429 } 00430 00434 void 00435 BundleEventHandler::handle_registration_delete(RegistrationDeleteRequest*) 00436 { 00437 } 00438 00442 void 00443 BundleEventHandler::handle_contact_up(ContactUpEvent*) 00444 { 00445 } 00446 00450 void 00451 BundleEventHandler::handle_contact_down(ContactDownEvent*) 00452 { 00453 } 00454 00458 void 00459 BundleEventHandler::handle_contact_query(ContactQueryRequest*) 00460 { 00461 } 00462 00466 void 00467 BundleEventHandler::handle_contact_report(ContactReportEvent*) 00468 { 00469 } 00470 00474 void 00475 BundleEventHandler::handle_contact_attribute_changed(ContactAttributeChangedEvent*) 00476 { 00477 } 00478 00482 void 00483 BundleEventHandler::handle_link_created(LinkCreatedEvent*) 00484 { 00485 } 00486 00490 void 00491 BundleEventHandler::handle_link_deleted(LinkDeletedEvent*) 00492 { 00493 } 00494 00498 void 00499 BundleEventHandler::handle_link_available(LinkAvailableEvent*) 00500 { 00501 } 00502 00506 void 00507 BundleEventHandler::handle_link_unavailable(LinkUnavailableEvent*) 00508 { 00509 } 00510 00514 void 00515 BundleEventHandler::handle_link_state_change_request(LinkStateChangeRequest*) 00516 { 00517 } 00518 00522 void 00523 BundleEventHandler::handle_link_create(LinkCreateRequest*) 00524 { 00525 } 00526 00530 void 00531 BundleEventHandler::handle_link_delete(LinkDeleteRequest*) 00532 { 00533 } 00534 00538 void 00539 BundleEventHandler::handle_link_reconfigure(LinkReconfigureRequest*) 00540 { 00541 } 00542 00546 void 00547 BundleEventHandler::handle_link_query(LinkQueryRequest*) 00548 { 00549 } 00550 00554 void 00555 BundleEventHandler::handle_link_report(LinkReportEvent*) 00556 { 00557 } 00558 00562 void 00563 BundleEventHandler::handle_link_attribute_changed(LinkAttributeChangedEvent*) 00564 { 00565 } 00566 00570 void 00571 BundleEventHandler::handle_reassembly_completed(ReassemblyCompletedEvent*) 00572 { 00573 } 00574 00579 void 00580 BundleEventHandler::handle_route_add(RouteAddEvent*) 00581 { 00582 } 00583 00588 void 00589 BundleEventHandler::handle_route_del(RouteDelEvent*) 00590 { 00591 } 00592 00596 void 00597 BundleEventHandler::handle_route_query(RouteQueryRequest*) 00598 { 00599 } 00600 00604 void 00605 BundleEventHandler::handle_route_report(RouteReportEvent*) 00606 { 00607 } 00608 00612 void 00613 BundleEventHandler::handle_custody_signal(CustodySignalEvent*) 00614 { 00615 } 00616 00620 void 00621 BundleEventHandler::handle_custody_timeout(CustodyTimeoutEvent*) 00622 { 00623 } 00624 00628 void 00629 BundleEventHandler::handle_shutdown_request(ShutdownRequest*) 00630 { 00631 } 00632 00636 void 00637 BundleEventHandler::handle_status_request(StatusRequest*) 00638 { 00639 } 00640 00644 void 00645 BundleEventHandler::handle_cla_set_params(CLASetParamsRequest*) 00646 { 00647 } 00648 00652 void 00653 BundleEventHandler::handle_cla_params_set(CLAParamsSetEvent*) 00654 { 00655 } 00656 00660 void 00661 BundleEventHandler::handle_set_link_defaults(SetLinkDefaultsRequest*) 00662 { 00663 } 00664 00668 void 00669 BundleEventHandler::handle_new_eid_reachable(NewEIDReachableEvent*) 00670 { 00671 } 00672 00676 void 00677 BundleEventHandler::handle_bundle_queued_query(BundleQueuedQueryRequest*) 00678 { 00679 } 00680 00681 void 00682 BundleEventHandler::handle_bundle_queued_report(BundleQueuedReportEvent*) 00683 { 00684 } 00685 00686 void 00687 BundleEventHandler::handle_eid_reachable_query(EIDReachableQueryRequest*) 00688 { 00689 } 00690 00691 void 00692 BundleEventHandler::handle_eid_reachable_report(EIDReachableReportEvent*) 00693 { 00694 } 00695 00696 void 00697 BundleEventHandler::handle_link_attributes_query(LinkAttributesQueryRequest*) 00698 { 00699 } 00700 00701 void 00702 BundleEventHandler::handle_link_attributes_report(LinkAttributesReportEvent*) 00703 { 00704 } 00705 00706 void 00707 BundleEventHandler::handle_iface_attributes_query(IfaceAttributesQueryRequest*) 00708 { 00709 } 00710 00711 void 00712 BundleEventHandler::handle_iface_attributes_report(IfaceAttributesReportEvent*) 00713 { 00714 } 00715 00716 void 00717 BundleEventHandler::handle_cla_parameters_query(CLAParametersQueryRequest*) 00718 { 00719 } 00720 00721 void 00722 BundleEventHandler::handle_cla_parameters_report(CLAParametersReportEvent*) 00723 { 00724 } 00725 00726 } // namespace dtn