BundleRouter.h

Go to the documentation of this file.
00001 /*
00002  *    Copyright 2004-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_ROUTER_H_
00018 #define _BUNDLE_ROUTER_H_
00019 
00020 #include <vector>
00021 #include <oasys/debug/Logger.h>
00022 #include <oasys/thread/Thread.h>
00023 #include <oasys/util/StringUtils.h>
00024 
00025 #include "bundling/BundleEvent.h"
00026 #include "bundling/BundleEventHandler.h"
00027 #include "naming/EndpointID.h"
00028 
00029 namespace dtn {
00030 
00031 class BundleActions;
00032 class BundleRouter;
00033 class StringBuffer;
00034 
00038 typedef std::vector<BundleRouter*> BundleRouterList;
00039 
00060 class BundleRouter : public BundleEventHandler {
00061 public:
00066     static BundleRouter* create_router(const char* type);
00067 
00072     static struct Config {
00073         Config();
00074         
00076         std::string type_;
00077         
00080         bool add_nexthop_routes_;
00081         
00083         int default_priority_;
00084 
00086         u_int64_t storage_quota_;
00087         
00088     } config_;
00089     
00093     virtual ~BundleRouter();
00094 
00095     /*
00096      *  called after all the global data structures are set up
00097      */
00098     virtual void initialize();
00099 
00104     virtual void handle_event(BundleEvent* event) = 0;
00105 
00116     virtual bool accept_bundle(Bundle* bundle, int* errp);
00117     
00121     virtual void get_routing_state(oasys::StringBuffer* buf) = 0;
00122 
00126     virtual void shutdown();
00127     
00128 protected:
00132     BundleRouter(const char* classname, const std::string& name);
00133 
00135     std::string name_;
00136     
00138     BundleList* pending_bundles_;
00139 
00141     BundleList* custody_bundles_;
00142 
00145     BundleActions* actions_;
00146     
00147 };
00148 
00149 } // namespace dtn
00150 
00151 #endif /* _BUNDLE_ROUTER_H_ */

Generated on Thu Jun 7 12:54:26 2007 for DTN Reference Implementation by  doxygen 1.5.1