Ilya Moiseenko | 1eff17d | 2011-08-17 10:55:53 -0700 | [diff] [blame] | 1 | /* -*- Mode: C++; c-file-style: "gnu"; indent-tabs-mode:nil; -*- */ |
| 2 | /* |
| 3 | * Copyright (c) 2011 University of California, Los Angeles |
| 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: Ilya Moiseenko <iliamo@cs.ucla.edu> |
| 19 | */ |
| 20 | |
| 21 | #ifndef __ANNOTATED_TOPOLOGY_READER_H__ |
| 22 | #define __ANNOTATED_TOPOLOGY_READER_H__ |
| 23 | |
Ilya Moiseenko | 1eff17d | 2011-08-17 10:55:53 -0700 | [diff] [blame] | 24 | #include "ns3/topology-reader.h" |
Ilya Moiseenko | 7dd43be | 2011-08-18 18:57:12 -0700 | [diff] [blame] | 25 | #include "ns3/nstime.h" |
| 26 | #include "ns3/log.h" |
| 27 | #include "ns3/net-device-container.h" |
| 28 | #include "ns3/point-to-point-helper.h" |
| 29 | #include "ns3/point-to-point-net-device.h" |
Ilya Moiseenko | 58d2667 | 2011-12-08 13:48:06 -0800 | [diff] [blame] | 30 | #include "ns3/internet-stack-helper.h" |
| 31 | #include "ns3/ipv4-address-helper.h" |
| 32 | #include "ns3/ipv4-global-routing-helper.h" |
Ilya Moiseenko | 7dd43be | 2011-08-18 18:57:12 -0700 | [diff] [blame] | 33 | #include "ns3/drop-tail-queue.h" |
Ilya Moiseenko | 58d2667 | 2011-12-08 13:48:06 -0800 | [diff] [blame] | 34 | #include "ns3/ipv4-interface.h" |
| 35 | #include "ns3/ipv4.h" |
Ilya Moiseenko | 7dd43be | 2011-08-18 18:57:12 -0700 | [diff] [blame] | 36 | #include "ns3/string.h" |
| 37 | #include "ns3/pointer.h" |
| 38 | #include "ns3/uinteger.h" |
Ilya Moiseenko | 58d2667 | 2011-12-08 13:48:06 -0800 | [diff] [blame] | 39 | #include "ns3/ipv4-address.h" |
Ilya Moiseenko | 7dd43be | 2011-08-18 18:57:12 -0700 | [diff] [blame] | 40 | #include <string> |
| 41 | #include <fstream> |
| 42 | #include <cstdlib> |
| 43 | #include <iostream> |
| 44 | #include <sstream> |
Ilya Moiseenko | 1eff17d | 2011-08-17 10:55:53 -0700 | [diff] [blame] | 45 | |
Ilya Moiseenko | 58d2667 | 2011-12-08 13:48:06 -0800 | [diff] [blame] | 46 | #include "ns3/animation-interface.h" |
| 47 | #include "ns3/constant-position-mobility-model.h" |
| 48 | #include "ns3/random-variable.h" |
| 49 | |
Ilya Moiseenko | 1eff17d | 2011-08-17 10:55:53 -0700 | [diff] [blame] | 50 | namespace ns3 |
| 51 | { |
Ilya Moiseenko | 7dd43be | 2011-08-18 18:57:12 -0700 | [diff] [blame] | 52 | |
| 53 | /** |
| 54 | * \brief This class reads annotated topology and apply settings to the corresponding nodes and links |
| 55 | * Input File Format |
| 56 | * 1st line is NumberOfNodes TAB NumberofLinks |
Ilya Moiseenko | 58d2667 | 2011-12-08 13:48:06 -0800 | [diff] [blame] | 57 | * Nth line is NodeID1 TAB NodeID2 TAB DataRateKBPS TAB OSPF TAB DelayMiliseconds TAB QueueSizeInPacketsNode1 TAB QueueSizeInPacketsNode2 |
Ilya Moiseenko | 7dd43be | 2011-08-18 18:57:12 -0700 | [diff] [blame] | 58 | * |
| 59 | */ |
| 60 | class AnnotatedTopologyReader : public TopologyReader |
| 61 | { |
| 62 | public: |
| 63 | typedef std::list< Link >::iterator LinksIterator; |
| 64 | static TypeId GetTypeId (void); |
| 65 | |
| 66 | AnnotatedTopologyReader (); |
| 67 | virtual ~AnnotatedTopologyReader (); |
| 68 | |
| 69 | |
Ilya Moiseenko | 1eff17d | 2011-08-17 10:55:53 -0700 | [diff] [blame] | 70 | /** |
Ilya Moiseenko | 7dd43be | 2011-08-18 18:57:12 -0700 | [diff] [blame] | 71 | * \brief Main annotated topology reading function. |
| 72 | * |
| 73 | * This method opens an input stream and reads topology file with annotations. |
| 74 | * |
| 75 | * \return the container of the nodes created (or empty container if there was an error) |
| 76 | */ |
| 77 | virtual NodeContainer Read (void); |
| 78 | |
| 79 | /** |
| 80 | * \brief This method applies setting to corresponding nodes and links |
| 81 | * NetDeviceContainer must be allocated |
| 82 | * NodeContainer from Read method |
Ilya Moiseenko | 1eff17d | 2011-08-17 10:55:53 -0700 | [diff] [blame] | 83 | */ |
Ilya Moiseenko | 7dd43be | 2011-08-18 18:57:12 -0700 | [diff] [blame] | 84 | void ApplySettings(NetDeviceContainer *ndc, NodeContainer* nc); |
Ilya Moiseenko | 58d2667 | 2011-12-08 13:48:06 -0800 | [diff] [blame] | 85 | |
| 86 | //void ApplyOspfMetric(NetDeviceContainer* ndc, NodeContainer* nc); |
| 87 | void BoundingBox (NodeContainer* nc, double ulx, double uly, double lrx, double lry); |
Ilya Moiseenko | 1eff17d | 2011-08-17 10:55:53 -0700 | [diff] [blame] | 88 | |
Ilya Moiseenko | 7dd43be | 2011-08-18 18:57:12 -0700 | [diff] [blame] | 89 | private: |
| 90 | AnnotatedTopologyReader (const AnnotatedTopologyReader&); |
| 91 | AnnotatedTopologyReader& operator= (const AnnotatedTopologyReader&); |
| 92 | }; |
Ilya Moiseenko | 1eff17d | 2011-08-17 10:55:53 -0700 | [diff] [blame] | 93 | } |
| 94 | |
| 95 | |
| 96 | #endif |
| 97 | |
| 98 | |