blob: 21c214414edd256e372f43dfe863b5b3ca3c045c [file] [log] [blame]
Ilya Moiseenko58d26672011-12-08 13:48:06 -08001/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
2/*
3 * Copyright (c) 2010 Hajime Tazaki
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: Hajime Tazaki (tazaki@sfc.wide.ad.jp)
19 * Ilya Moiseenko <iliamo@cs.ucla.edu>
20 */
21
22#ifndef ROCKETFUEL_TOPOLOGY_READER_H
23#define ROCKETFUEL_TOPOLOGY_READER_H
24
Ilya Moiseenko58d26672011-12-08 13:48:06 -080025#include "ns3/topology-reader.h"
Alexander Afanasyev07827182011-12-13 01:07:32 -080026#include "ns3/net-device-container.h"
Ilya Moiseenko58d26672011-12-08 13:48:06 -080027
28namespace ns3 {
29
30
31 // ------------------------------------------------------------
32 // --------------------------------------------
33 /**
34 * \brief Topology file reader (Rocketfuel-format type).
35 *
36 * http://www.cs.washington.edu/research/networking/rocketfuel/
37 *
38 * May 2nd, 2010: Currently only support "weights" file and "cch" file.
39 * http://www.cs.washington.edu/research/networking/rocketfuel/maps/weights-dist.tar.gz
40 * http://www.cs.washington.edu/research/networking/rocketfuel/maps/rocketfuel_maps_cch.tar.gz
41 */
42 class RocketfuelWeightsReader : public TopologyReader
43 {
44 public:
45 static TypeId GetTypeId (void);
46
47 RocketfuelWeightsReader ();
48 virtual ~RocketfuelWeightsReader ();
49
50 /**
51 * \brief Main topology reading function.
52 *
53 * This method opens an input stream and reads the Rocketfuel-format file.
54 * Every row represents a topology link (the ids of a couple of nodes),
55 * so the input file is read line by line to figure out how many links
56 * and nodes are in the topology.
57 *
58 * \return the container of the nodes created (or empty container if there was an error)
59 */
Ilya Moiseenko09ac8992011-12-12 17:55:42 -080060 NodeContainer Read (std::string latenciesFile);
61
Ilya Moiseenko58d26672011-12-08 13:48:06 -080062 virtual NodeContainer Read (void);
63
64 void ApplySettings(NetDeviceContainer* ndc, NodeContainer* nc);
65
66 private:
67 RocketfuelWeightsReader (const RocketfuelWeightsReader&);
68 RocketfuelWeightsReader& operator= (const RocketfuelWeightsReader&);
Ilya Moiseenko58d26672011-12-08 13:48:06 -080069 // Parser for the weights.* file available at:
70 // http://www.cs.washington.edu/research/networking/rocketfuel/maps/weights-dist.tar.gz
Ilya Moiseenko09ac8992011-12-12 17:55:42 -080071 NodeContainer GenerateFromWeightsFile (int argc, char *argv[], char *argl[]);
Ilya Moiseenko58d26672011-12-08 13:48:06 -080072
73 enum RF_FileType
74 {
75 RF_MAPS,
76 RF_WEIGHTS,
77 RF_UNKNOWN
78 };
79 enum RF_FileType GetFileType (const char *);
80
81 // end class RocketfuelWeightsReader
82 };
83
84 // end namespace ns3
85};
86
87
88#endif /* ROCKETFUEL_TOPOLOGY_READER_H */
89
90