00001 /* 00002 * Copyright 2007 Baylor University 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 _PROPHET_ROUTER_H_ 00018 #define _PROPHET_ROUTER_H_ 00019 00020 #include "prophet/Alarm.h" 00021 #include "prophet/Params.h" 00022 #include "prophet/Controller.h" 00023 #include "ProphetBundleCore.h" 00024 #include "BundleRouter.h" 00025 #include <oasys/thread/SpinLock.h> 00026 00027 namespace dtn 00028 { 00029 00030 class ProphetRouter : public BundleRouter 00031 { 00032 public: 00033 typedef prophet::ProphetParams Params; 00034 00038 ProphetRouter(); 00039 00043 virtual ~ProphetRouter(); 00044 00048 void initialize(); 00049 00053 static bool is_init() { return is_init_; } 00054 00058 void get_routing_state(oasys::StringBuffer*); 00059 00061 bool accept_bundle(Bundle*,int*); 00062 void handle_event(BundleEvent*); 00063 void handle_bundle_received(BundleReceivedEvent*); 00064 void handle_bundle_delivered(BundleDeliveredEvent*); 00065 void handle_bundle_expired(BundleExpiredEvent*); 00066 void handle_bundle_transmitted(BundleTransmittedEvent*); 00067 void handle_contact_up(ContactUpEvent*); 00068 void handle_contact_down(ContactDownEvent*); 00069 void handle_link_available(LinkAvailableEvent*); 00070 void shutdown(); 00072 00074 void set_queue_policy(); 00075 void set_hello_interval(); 00076 void set_max_route(); 00078 00082 static prophet::ProphetParams params_; 00083 00084 protected: 00085 00086 ProphetBundleCore* core_; 00087 prophet::Controller* oracle_; 00088 oasys::SpinLock* lock_; 00089 static bool is_init_; 00090 00091 }; // class ProphetRouter 00092 00093 }; // namespace dtn 00094 00095 #endif // _PROPHET_ROUTER_H_