blob: ac7f2d650262e627920117716c70c69a40b27d67 [file] [log] [blame]
Alexander Afanasyevad3757f2012-04-17 10:27:59 -07001/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil -*- */
2/*
3 * Copyright (c) 2011 UCLA
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 CCNX_GLOBAL_ROUTER_H
22#define CCNX_GLOBAL_ROUTER_H
23
24#include "ns3/object.h"
25#include "ns3/ptr.h"
26
27#include <list>
28#include <boost/tuple/tuple.hpp>
29
30namespace ns3 {
31
32class Channel;
33class Ccnx;
34class CcnxFace;
35class CcnxNameComponents;
36
37class CcnxGlobalRouter : public Object
38{
39public:
40 typedef boost::tuple< Ptr< CcnxGlobalRouter >, Ptr< CcnxFace >, Ptr< CcnxGlobalRouter > > Incidency;
41 typedef std::list< Incidency > IncidencyList;
42
43 /**
44 * \brief Interface ID
45 *
46 * \return interface ID
47 */
48 static TypeId
49 GetTypeId ();
50
51 CcnxGlobalRouter ();
52
53 uint32_t
54 GetId () const;
55
56 Ptr<Ccnx>
57 GetCcnx () const;
58
59 void
60 AddLocalPrefix (Ptr< CcnxNameComponents > prefix);
61
62 /**
63 *
64 */
65 void
66 AddIncidency (Ptr< CcnxFace > face, Ptr< CcnxGlobalRouter > ccnx);
67
68 IncidencyList &
69 GetIncidencies ();
70
71 // ??
72protected:
73 virtual void
74 NotifyNewAggregate ();
75
76private:
77 uint32_t m_id;
78
79 Ptr<Ccnx> m_ccnx;
80 std::list< Ptr<CcnxNameComponents> > m_localPrefixes;
81 IncidencyList m_incidencies;
82
83 static uint32_t m_idCounter;
84};
85
86inline bool
87operator == (const CcnxGlobalRouter::Incidency &a,
88 const CcnxGlobalRouter::Incidency &b)
89{
90 return a.get<0> () == b.get<0> () &&
91 a.get<1> () == b.get<1> () &&
92 a.get<2> () == b.get<2> ();
93}
94
95inline bool
96operator != (const CcnxGlobalRouter::Incidency &a,
97 const CcnxGlobalRouter::Incidency &b)
98{
99 return ! (a == b);
100}
101
102}
103
104#endif // CCNX_GLOBAL_ROUTER_H