NS-3 based Named Data Networking (NDN) simulator
ndnSIM: NDN, CCN, CCNx, content centric networks
API Documentation
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Groups Pages
ndn-fib.h
1 /* -*- Mode: C++; c-file-style: "gnu"; indent-tabs-mode:nil -*- */
2 /*
3  * Copyright (c) 2011-2013 University of California, Los Angeles
4  *
5  * This program is free software; you can redistribute it and/or modify
6  * it under the terms of the GNU General Public License version 2 as
7  * published by the Free Software Foundation;
8  *
9  * This program is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12  * GNU General Public License for more details.
13  *
14  * You should have received a copy of the GNU General Public License
15  * along with this program; if not, write to the Free Software
16  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17  *
18  * Author: Alexander Afanasyev <alexander.afanasyev@ucla.edu>
19  */
20 
21 #ifndef _NDN_FIB_H_
22 #define _NDN_FIB_H_
23 
24 #include "ns3/simple-ref-count.h"
25 #include "ns3/node.h"
26 
27 #include "ns3/ndn-fib-entry.h"
28 
29 namespace ns3 {
30 namespace ndn {
31 
32 class Interest;
33 typedef Interest InterestHeader;
34 
44 class Fib : public Object
45 {
46 public:
52  static TypeId GetTypeId ();
56  Fib () {}
57 
61  virtual ~Fib () { };
62 
71  virtual Ptr<fib::Entry>
72  LongestPrefixMatch (const Interest &interest) = 0;
73 
80  virtual Ptr<fib::Entry>
81  Find (const Name &prefix) = 0;
82 
92  virtual Ptr<fib::Entry>
93  Add (const Name &prefix, Ptr<Face> face, int32_t metric) = 0;
94 
104  virtual Ptr<fib::Entry>
105  Add (const Ptr<const Name> &prefix, Ptr<Face> face, int32_t metric) = 0;
106 
115  virtual void
116  Remove (const Ptr<const Name> &prefix) = 0;
117 
121  virtual void
122  InvalidateAll () = 0;
123 
128  virtual void
129  RemoveFromAll (Ptr<Face> face) = 0;
130 
134  virtual void
135  Print (std::ostream &os) const = 0;
136 
140  virtual uint32_t
141  GetSize () const = 0;
142 
146  virtual Ptr<const fib::Entry>
147  Begin () const = 0;
148 
152  virtual Ptr<fib::Entry>
153  Begin () = 0;
154 
158  virtual Ptr<const fib::Entry>
159  End () const = 0;
160 
164  virtual Ptr<fib::Entry>
165  End () = 0;
166 
170  virtual Ptr<const fib::Entry>
171  Next (Ptr<const fib::Entry>) const = 0;
172 
176  virtual Ptr<fib::Entry>
177  Next (Ptr<fib::Entry>) = 0;
178 
182 
186  static inline Ptr<Fib>
187  GetFib (Ptr<Object> node);
188 
192 
193 private:
194  Fib (const Fib&) {} ;
195 };
196 
199 
200 std::ostream& operator<< (std::ostream& os, const Fib &fib);
201 
202 Ptr<Fib>
203 Fib::GetFib (Ptr<Object> node)
204 {
205  return node->GetObject<Fib> ();
206 }
207 
208 } // namespace ndn
209 } // namespace ns3
210 
211 #endif // _NDN_FIB_H_
Class for NDN Name.
Definition: name.h:29
virtual Ptr< const fib::Entry > Next(Ptr< const fib::Entry >) const =0
Advance the iterator.
virtual Ptr< fib::Entry > Add(const Name &prefix, Ptr< Face > face, int32_t metric)=0
Add or update FIB entry.
static TypeId GetTypeId()
Interface ID.
Definition: ndn-fib.cc:30
virtual void Print(std::ostream &os) const =0
Print out entries in FIB.
virtual void InvalidateAll()=0
Invalidate all FIB entries.
virtual Ptr< fib::Entry > LongestPrefixMatch(const Interest &interest)=0
Perform longest prefix match.
virtual void Remove(const Ptr< const Name > &prefix)=0
Remove FIB entry.
Fib()
Default constructor.
Definition: ndn-fib.h:56
virtual ~Fib()
Virtual destructor.
Definition: ndn-fib.h:61
Class implementing FIB functionality.
Definition: ndn-fib.h:44
virtual Ptr< fib::Entry > Find(const Name &prefix)=0
Get FIB entry for the prefix (exact match)
virtual void RemoveFromAll(Ptr< Face > face)=0
Remove all references to a face from FIB.
NDN Interest (wire formats are defined in wire)
Definition: ndn-interest.h:43
static Ptr< Fib > GetFib(Ptr< Object > node)
Static call to cheat python bindings.
Definition: ndn-fib.h:203
virtual uint32_t GetSize() const =0
Get number of entries in FIB.
virtual Ptr< const fib::Entry > End() const =0
Return item next after last (no order guaranteed)
virtual Ptr< const fib::Entry > Begin() const =0
Return first element of FIB (no order guaranteed)