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 * SPDX-License-Identifier: GPL-2.0-only
5 *
6 * Author: Hajime Tazaki (tazaki@sfc.wide.ad.jp)
7 */
8
9#ifndef ROCKETFUEL_TOPOLOGY_READER_H
10#define ROCKETFUEL_TOPOLOGY_READER_H
11
12#include "topology-reader.h"
13
14/**
15 * \file
16 * \ingroup topology
17 * ns3::RocketfuelTopologyReader declaration.
18 */
19
20namespace ns3
21{
22
23// ------------------------------------------------------------
24// --------------------------------------------
25/**
26 * \ingroup topology
27 *
28 * \brief Topology file reader (Rocketfuel-format type).
29 *
30 * http://www.cs.washington.edu/research/networking/rocketfuel/
31 *
32 * May 2nd, 2010: Currently only support "weights" file and "cch" file.
33 * http://www.cs.washington.edu/research/networking/rocketfuel/maps/weights-dist.tar.gz
34 * http://www.cs.washington.edu/research/networking/rocketfuel/maps/rocketfuel_maps_cch.tar.gz
35 */
37{
38 public:
39 /**
40 * \brief Get the type ID.
41 * \return The object TypeId
42 */
43 static TypeId GetTypeId();
44
47
48 // Delete copy constructor and assignment operator to avoid misuse
51
52 /**
53 * \brief Main topology reading function.
54 *
55 * This method opens an input stream and reads the Rocketfuel-format file.
56 * Every row represents a topology link (the ids of a couple of nodes),
57 * so the input file is read line by line to figure out how many links
58 * and nodes are in the topology.
59 *
60 * \return The container of the nodes created (or empty container if there was an error)
61 */
62 NodeContainer Read() override;
63
64 private:
65 /**
66 * \brief Topology read function from a file containing the nodes map.
67 *
68 * Parser for the *.cch file available at:
69 * http://www.cs.washington.edu/research/networking/rocketfuel/maps/rocketfuel_maps_cch.tar.gz
70 *
71 * \param [in] argv Argument vector.
72 * \return The container of the nodes created (or empty container if there was an error).
73 */
74 NodeContainer GenerateFromMapsFile(const std::vector<std::string>& argv);
75
76 /**
77 * \brief Topology read function from a file containing the nodes weights.
78 *
79 * Parser for the weights.* file available at:
80 * http://www.cs.washington.edu/research/networking/rocketfuel/maps/weights-dist.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 GenerateFromWeightsFile(const std::vector<std::string>& argv);
86
87 /**
88 * \brief Enum of the possible file types.
89 */
96
97 /**
98 * \brief Classifies the file type according to its content.
99 *
100 * \param buf the first line of the file being read
101 * \return The file type (RF_MAPS, RF_WEIGHTS, or RF_UNKNOWN)
102 */
103 RF_FileType GetFileType(const std::string& buf);
104
105 int m_linksNumber; //!< Number of links.
106 int m_nodesNumber; //!< Number of nodes.
107 std::map<std::string, Ptr<Node>> m_nodeMap; //!< Map of the nodes (name, node).
108
109 // end class RocketfuelTopologyReader
110};
111
112// end namespace ns3
113}; // namespace ns3
114
115#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:48
Every class exported by the ns3 library is enclosed in the ns3 namespace.
ns3::TopologyReader declaration.