Initial support for route calculations with Boost.Graph library (BGL)
diff --git a/model/ccnx-global-router.cc b/model/ccnx-global-router.cc
new file mode 100644
index 0000000..c61169b
--- /dev/null
+++ b/model/ccnx-global-router.cc
@@ -0,0 +1,100 @@
+/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil -*- */
+/*
+ * Copyright (c) 2011 UCLA
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation;
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ *
+ * Author: Alexander Afanasyev <alexander.afanasyev@ucla.edu>
+ */
+
+#include "ccnx-global-router.h"
+
+#include "ns3/ccnx.h"
+#include "ns3/ccnx-face.h"
+#include "ns3/ccnx-name-components.h"
+
+#include "ns3/channel.h"
+
+using namespace boost;
+
+namespace ns3 {
+
+uint32_t CcnxGlobalRouter::m_idCounter = 0;
+
+NS_OBJECT_ENSURE_REGISTERED (CcnxGlobalRouter);
+
+TypeId
+CcnxGlobalRouter::GetTypeId ()
+{
+ static TypeId tid = TypeId ("ns3::CcnxGlobalRouter")
+ .SetGroupName ("Ccnx")
+ .SetParent<Object> ()
+ ;
+ return tid;
+}
+
+CcnxGlobalRouter::CcnxGlobalRouter ()
+{
+ m_id = m_idCounter;
+ m_idCounter ++;
+}
+
+void
+CcnxGlobalRouter::NotifyNewAggregate ()
+{
+ if (m_ccnx == 0)
+ {
+ m_ccnx = GetObject<Ccnx> ();
+ }
+ Object::NotifyNewAggregate ();
+}
+
+uint32_t
+CcnxGlobalRouter::GetId () const
+{
+ return m_id;
+}
+
+Ptr<Ccnx>
+CcnxGlobalRouter::GetCcnx () const
+{
+ return m_ccnx;
+}
+
+void
+CcnxGlobalRouter::AddLocalPrefix (Ptr< CcnxNameComponents > prefix)
+{
+ m_localPrefixes.push_back (prefix);
+}
+
+void
+CcnxGlobalRouter::AddIncidency (Ptr< CcnxFace > face, Ptr< CcnxGlobalRouter > gr)
+{
+ m_incidencies.push_back (make_tuple (this, face, gr));
+}
+
+CcnxGlobalRouter::IncidencyList &
+CcnxGlobalRouter::GetIncidencies ()
+{
+ return m_incidencies;
+}
+
+// void
+// CcnxGlobalRouter::AddIncidencyChannel (Ptr< CcnxFace > face, Ptr< Channel > channel)
+// {
+// m_incidenciesChannel.push_back (make_tuple (face, channel));
+// }
+
+}
+
diff --git a/model/ccnx-global-router.h b/model/ccnx-global-router.h
new file mode 100644
index 0000000..ac7f2d6
--- /dev/null
+++ b/model/ccnx-global-router.h
@@ -0,0 +1,104 @@
+/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil -*- */
+/*
+ * Copyright (c) 2011 UCLA
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation;
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ *
+ * Author: Alexander Afanasyev <alexander.afanasyev@ucla.edu>
+ */
+
+#ifndef CCNX_GLOBAL_ROUTER_H
+#define CCNX_GLOBAL_ROUTER_H
+
+#include "ns3/object.h"
+#include "ns3/ptr.h"
+
+#include <list>
+#include <boost/tuple/tuple.hpp>
+
+namespace ns3 {
+
+class Channel;
+class Ccnx;
+class CcnxFace;
+class CcnxNameComponents;
+
+class CcnxGlobalRouter : public Object
+{
+public:
+ typedef boost::tuple< Ptr< CcnxGlobalRouter >, Ptr< CcnxFace >, Ptr< CcnxGlobalRouter > > Incidency;
+ typedef std::list< Incidency > IncidencyList;
+
+ /**
+ * \brief Interface ID
+ *
+ * \return interface ID
+ */
+ static TypeId
+ GetTypeId ();
+
+ CcnxGlobalRouter ();
+
+ uint32_t
+ GetId () const;
+
+ Ptr<Ccnx>
+ GetCcnx () const;
+
+ void
+ AddLocalPrefix (Ptr< CcnxNameComponents > prefix);
+
+ /**
+ *
+ */
+ void
+ AddIncidency (Ptr< CcnxFace > face, Ptr< CcnxGlobalRouter > ccnx);
+
+ IncidencyList &
+ GetIncidencies ();
+
+ // ??
+protected:
+ virtual void
+ NotifyNewAggregate ();
+
+private:
+ uint32_t m_id;
+
+ Ptr<Ccnx> m_ccnx;
+ std::list< Ptr<CcnxNameComponents> > m_localPrefixes;
+ IncidencyList m_incidencies;
+
+ static uint32_t m_idCounter;
+};
+
+inline bool
+operator == (const CcnxGlobalRouter::Incidency &a,
+ const CcnxGlobalRouter::Incidency &b)
+{
+ return a.get<0> () == b.get<0> () &&
+ a.get<1> () == b.get<1> () &&
+ a.get<2> () == b.get<2> ();
+}
+
+inline bool
+operator != (const CcnxGlobalRouter::Incidency &a,
+ const CcnxGlobalRouter::Incidency &b)
+{
+ return ! (a == b);
+}
+
+}
+
+#endif // CCNX_GLOBAL_ROUTER_H