#ifndef MOOSE_HELPER_H
#define MOOSE_HELPER_H
+#include "ns3/topology.h"
#include "ns3/node.h"
#include "ns3/moose-bridge-net-device.h"
#include "ns3/moose-bridge-helper.h"
typedef boost::graph_traits< graph_t >::vertex_descriptor vertex_descriptor;
typedef boost::graph_traits< graph_t >::edge_descriptor edge_descriptor;
- struct Topology {
-
- public:
- long bridges;
- long hosts;
- typedef std::map<long,long> HostLinks;
- typedef std::pair<long,long> BridgeLink;
-
- struct BridgeLinkCompare {
- // we don't care about ordering inside a pair, but we do care about pair order
-
- bool operator()( BridgeLink const &lhs, BridgeLink const &rhs) {
- if(lhs.first < lhs.first){
- if(rhs.first < rhs.second){
- return (lhs.first < rhs.first) ? true : (lhs.second < rhs.second);
- } else {
- return (lhs.first < rhs.second) ? true : (lhs.second < rhs.first);
- }
- } else {
- if(rhs.first < rhs.second){
- return (lhs.second < rhs.first) ? true : (lhs.first < rhs.second);
- } else {
- return (lhs.second < rhs.second) ? true : (lhs.first < rhs.first);
- }
- }
- }
- };
-
- typedef std::set<BridgeLink, BridgeLinkCompare> BridgeLinks;
-
- HostLinks hostLinks;
- BridgeLinks bridgeLinks;
-
- };
-
struct Network {
Topology t;
--- /dev/null
+/* -*- Mode: C++; c-file-style: "gnu"; indent-tabs-mode:nil; -*- */
+/*
+ * Copyright (c) 2008,2009 IITP RAS
+ *
+ * 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: Richard Whitehouse <ns3@richardwhiuk.com>
+ */
+
+#include "topology.h"
+#include "ns3/log.h"
+
+NS_LOG_COMPONENT_DEFINE ("MooseHelper");
+
+namespace ns3 {
+
+bool Topology::BridgeLinkCompare::operator()( BridgeLink const &lhs, BridgeLink const &rhs) {
+ if(lhs.first < lhs.first){
+ if(rhs.first < rhs.second){
+ return (lhs.first < rhs.first) ? true : (lhs.second < rhs.second);
+ } else {
+ return (lhs.first < rhs.second) ? true : (lhs.second < rhs.first);
+ }
+ } else {
+ if(rhs.first < rhs.second){
+ return (lhs.second < rhs.first) ? true : (lhs.first < rhs.second);
+ } else {
+ return (lhs.second < rhs.second) ? true : (lhs.first < rhs.first);
+ }
+ }
+}
+
+
+}
--- /dev/null
+/* -*- Mode: C++; c-file-style: "gnu"; indent-tabs-mode:nil; -*- */
+/*
+ * Copyright (c) 2008,2009 IITP RAS
+ *
+ * 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: Richard Whitehouse <ns3@richardwhiuk.com>
+ */
+
+#ifndef TOPOLOGY_H
+#define TOPOLOGY_H
+
+#include <map>
+#include <set>
+
+namespace ns3 {
+
+/**
+ * \ingroup topology
+ *
+ * \brief Represents a topology
+ */
+
+struct Topology {
+
+public:
+ long bridges;
+ long hosts;
+ typedef std::map<long,long> HostLinks;
+ typedef std::pair<long,long> BridgeLink;
+
+ struct BridgeLinkCompare {
+ // we don't care about ordering inside a pair, but we do care about pair order
+
+ bool operator()( BridgeLink const &lhs, BridgeLink const &rhs);
+
+ };
+
+ typedef std::set<BridgeLink, BridgeLinkCompare> BridgeLinks;
+
+ HostLinks hostLinks;
+ BridgeLinks bridgeLinks;
+
+};
+
+}
+
+#endif
+
--- /dev/null
+## -*- Mode: python; py-indent-offset: 4; indent-tabs-mode: nil; coding: utf-8; -*-
+
+def build(bld):
+ obj = bld.create_ns3_module('topology', ['node'])
+ obj.source = [
+ 'model/topology.cc'
+ ]
+ headers = bld.new_task_gen('ns3header')
+ headers.module = 'topology'
+ headers.source = [
+ 'model/topology.h'
+ ]
+
'contrib/topology-read',
'contrib/energy',
'tools/visualizer',
+ 'topology',
'simulation'
)