RouteTable.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_ROUTETABLE_H_
00018 #define _BUNDLE_ROUTETABLE_H_
00019 
00020 #include <set>
00021 #include <oasys/debug/Log.h>
00022 #include <oasys/util/StringBuffer.h>
00023 #include <oasys/serialize/Serialize.h>
00024 
00025 #include "RouteEntry.h"
00026 
00027 namespace dtn {
00028 
00033 class RouteTable : public oasys::Logger {
00034 public:
00038     RouteTable(const std::string& router_name);
00039 
00043     virtual ~RouteTable();
00044 
00048     bool add_entry(RouteEntry* entry);
00049     
00053     bool del_entry(const EndpointIDPattern& dest, Link* next_hop);
00054     
00060     size_t del_entries(const EndpointIDPattern& dest);
00061     
00067     size_t del_entries_for_nexthop(Link* next_hop);
00068 
00076     size_t get_matching(const EndpointID& eid, Link* next_hop,
00077                         RouteEntryVec* entry_set) const;
00078     
00084     size_t get_matching(const EndpointID& eid,
00085                         RouteEntryVec* entry_set) const
00086     {
00087         return get_matching(eid, NULL, entry_set);
00088     }
00089     
00093     void dump(oasys::StringBuffer* buf, EndpointIDVector* long_eids) const;
00094 
00098     int size() { return route_table_.size(); }
00099 
00104     const RouteEntryVec *route_table();
00105 
00109     oasys::Lock* lock() { return &lock_; }
00110 
00111 protected:
00113     RouteEntryVec route_table_;
00114 
00118     mutable oasys::SpinLock lock_;
00119 };
00120 
00121 } // namespace dtn
00122 
00123 #endif /* _BUNDLE_ROUTETABLE_H_ */

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