blob: bea3bff2b6bbbe564a5c649a349c80a45e4dad44 [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
25#include "ns3/nstime.h"
26#include "ns3/net-device-container.h"
27#include "ns3/topology-reader.h"
28
29
30#include "ns3/point-to-point-helper.h"
31#include "ns3/point-to-point-net-device.h"
32#include "ns3/internet-stack-helper.h"
33#include "ns3/ipv4-address-helper.h"
34#include "ns3/ipv4-global-routing-helper.h"
35#include "ns3/drop-tail-queue.h"
36#include "ns3/ipv4-interface.h"
37#include "ns3/ipv4.h"
38#include "ns3/string.h"
39#include "ns3/pointer.h"
40#include "ns3/uinteger.h"
41#include <string>
42#include <fstream>
43#include <cstdlib>
44#include <iostream>
45#include <sstream>
46#include <iomanip>
47
48namespace ns3 {
49
50
51 // ------------------------------------------------------------
52 // --------------------------------------------
53 /**
54 * \brief Topology file reader (Rocketfuel-format type).
55 *
56 * http://www.cs.washington.edu/research/networking/rocketfuel/
57 *
58 * May 2nd, 2010: Currently only support "weights" file and "cch" file.
59 * http://www.cs.washington.edu/research/networking/rocketfuel/maps/weights-dist.tar.gz
60 * http://www.cs.washington.edu/research/networking/rocketfuel/maps/rocketfuel_maps_cch.tar.gz
61 */
62 class RocketfuelWeightsReader : public TopologyReader
63 {
64 public:
65 static TypeId GetTypeId (void);
66
67 RocketfuelWeightsReader ();
68 virtual ~RocketfuelWeightsReader ();
69
70 /**
71 * \brief Main topology reading function.
72 *
73 * This method opens an input stream and reads the Rocketfuel-format file.
74 * Every row represents a topology link (the ids of a couple of nodes),
75 * so the input file is read line by line to figure out how many links
76 * and nodes are in the topology.
77 *
78 * \return the container of the nodes created (or empty container if there was an error)
79 */
80 virtual NodeContainer Read (void);
81
82 void ApplySettings(NetDeviceContainer* ndc, NodeContainer* nc);
83
84 private:
85 RocketfuelWeightsReader (const RocketfuelWeightsReader&);
86 RocketfuelWeightsReader& operator= (const RocketfuelWeightsReader&);
87 // Parser for the *.cch file available at:
88 // http://www.cs.washington.edu/research/networking/rocketfuel/maps/rocketfuel_maps_cch.tar.gz
89 NodeContainer GenerateFromMapsFile (int argc, char *argv[]);
90 // Parser for the weights.* file available at:
91 // http://www.cs.washington.edu/research/networking/rocketfuel/maps/weights-dist.tar.gz
92 NodeContainer GenerateFromWeightsFile (int argc, char *argv[]);
93
94 enum RF_FileType
95 {
96 RF_MAPS,
97 RF_WEIGHTS,
98 RF_UNKNOWN
99 };
100 enum RF_FileType GetFileType (const char *);
101
102 // end class RocketfuelWeightsReader
103 };
104
105 // end namespace ns3
106};
107
108
109#endif /* ROCKETFUEL_TOPOLOGY_READER_H */
110
111