A Discrete-Event Network Simulator
API
Loading...
Searching...
No Matches
rocketfuel-topology-reader.h
Go to the documentation of this file.
1/*
2 * Copyright (c) 2010 Hajime Tazaki
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License version 2 as
6 * published by the Free Software Foundation;
7 *
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
12 *
13 * You should have received a copy of the GNU General Public License
14 * along with this program; if not, write to the Free Software
15 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
16 *
17 * Author: Hajime Tazaki (tazaki@sfc.wide.ad.jp)
18 */
19
20#ifndef ROCKETFUEL_TOPOLOGY_READER_H
21#define ROCKETFUEL_TOPOLOGY_READER_H
22
23#include "topology-reader.h"
24
25/**
26 * \file
27 * \ingroup topology
28 * ns3::RocketfuelTopologyReader declaration.
29 */
30
31namespace ns3
32{
33
34// ------------------------------------------------------------
35// --------------------------------------------
36/**
37 * \ingroup topology
38 *
39 * \brief Topology file reader (Rocketfuel-format type).
40 *
41 * http://www.cs.washington.edu/research/networking/rocketfuel/
42 *
43 * May 2nd, 2010: Currently only support "weights" file and "cch" file.
44 * http://www.cs.washington.edu/research/networking/rocketfuel/maps/weights-dist.tar.gz
45 * http://www.cs.washington.edu/research/networking/rocketfuel/maps/rocketfuel_maps_cch.tar.gz
46 */
48{
49 public:
50 /**
51 * \brief Get the type ID.
52 * \return The object TypeId
53 */
54 static TypeId GetTypeId();
55
58
59 // Delete copy constructor and assignment operator to avoid misuse
62
63 /**
64 * \brief Main topology reading function.
65 *
66 * This method opens an input stream and reads the Rocketfuel-format file.
67 * Every row represents a topology link (the ids of a couple of nodes),
68 * so the input file is read line by line to figure out how many links
69 * and nodes are in the topology.
70 *
71 * \return The container of the nodes created (or empty container if there was an error)
72 */
73 NodeContainer Read() override;
74
75 private:
76 /**
77 * \brief Topology read function from a file containing the nodes map.
78 *
79 * Parser for the *.cch file available at:
80 * http://www.cs.washington.edu/research/networking/rocketfuel/maps/rocketfuel_maps_cch.tar.gz
81 *
82 * \param [in] argv Argument vector.
83 * \return The container of the nodes created (or empty container if there was an error).
84 */
85 NodeContainer GenerateFromMapsFile(const std::vector<std::string>& argv);
86
87 /**
88 * \brief Topology read function from a file containing the nodes weights.
89 *
90 * Parser for the weights.* file available at:
91 * http://www.cs.washington.edu/research/networking/rocketfuel/maps/weights-dist.tar.gz
92 *
93 * \param [in] argv Argument vector.
94 * \return The container of the nodes created (or empty container if there was an error).
95 */
96 NodeContainer GenerateFromWeightsFile(const std::vector<std::string>& argv);
97
98 /**
99 * \brief Enum of the possible file types.
100 */
102 {
106 };
107
108 /**
109 * \brief Classifies the file type according to its content.
110 *
111 * \param buf the first line of the file being read
112 * \return The file type (RF_MAPS, RF_WEIGHTS, or RF_UNKNOWN)
113 */
114 RF_FileType GetFileType(const std::string& buf);
115
116 int m_linksNumber; //!< Number of links.
117 int m_nodesNumber; //!< Number of nodes.
118 std::map<std::string, Ptr<Node>> m_nodeMap; //!< Map of the nodes (name, node).
119
120 // end class RocketfuelTopologyReader
121};
122
123// end namespace ns3
124}; // namespace ns3
125
126#endif /* ROCKETFUEL_TOPOLOGY_READER_H */
keep track of a set of node pointers.
Topology file reader (Rocketfuel-format type).
RF_FileType
Enum of the possible file types.
RocketfuelTopologyReader & operator=(const RocketfuelTopologyReader &)=delete
RocketfuelTopologyReader(const RocketfuelTopologyReader &)=delete
NodeContainer GenerateFromWeightsFile(const std::vector< std::string > &argv)
Topology read function from a file containing the nodes weights.
std::map< std::string, Ptr< Node > > m_nodeMap
Map of the nodes (name, node).
static TypeId GetTypeId()
Get the type ID.
RF_FileType GetFileType(const std::string &buf)
Classifies the file type according to its content.
NodeContainer GenerateFromMapsFile(const std::vector< std::string > &argv)
Topology read function from a file containing the nodes map.
NodeContainer Read() override
Main topology reading function.
Interface for input file readers management.
a unique identifier for an interface.
Definition: type-id.h:59
Every class exported by the ns3 library is enclosed in the ns3 namespace.
ns3::TopologyReader declaration.