OLD | NEW |
(Empty) | |
| 1 /* -*- Mode: C++; c-file-style: "gnu"; indent-tabs-mode:nil; -*- */ |
| 2 /* |
| 3 * Copyright (c) 2008 INRIA |
| 4 * Copyright (c) 2013 Magister Solutions |
| 5 * |
| 6 * This program is free software; you can redistribute it and/or modify |
| 7 * it under the terms of the GNU General Public License version 2 as |
| 8 * published by the Free Software Foundation; |
| 9 * |
| 10 * This program is distributed in the hope that it will be useful, |
| 11 * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 13 * GNU General Public License for more details. |
| 14 * |
| 15 * You should have received a copy of the GNU General Public License |
| 16 * along with this program; if not, write to the Free Software |
| 17 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
| 18 * |
| 19 * Original work author (from packet-sink-helper.cc): |
| 20 * - Mathieu Lacage <mathieu.lacage@sophia.inria.fr> |
| 21 * |
| 22 * Converted to 3GPP HTTP web browsing traffic models by: |
| 23 * - Budiarto Herman <budiarto.herman@magister.fi> |
| 24 * |
| 25 */ |
| 26 |
| 27 #include <ns3/names.h> |
| 28 #include "three-gpp-http-helper.h" |
| 29 |
| 30 namespace ns3 { |
| 31 |
| 32 |
| 33 // 3GPP HTTP CLIENT HELPER /////////////////////////////////////////////////////
//// |
| 34 |
| 35 ThreeGppHttpClientHelper::ThreeGppHttpClientHelper (const Address &address) |
| 36 { |
| 37 m_factory.SetTypeId ("ns3::ThreeGppHttpClient"); |
| 38 m_factory.Set ("RemoteServerAddress", AddressValue (address)); |
| 39 } |
| 40 |
| 41 void |
| 42 ThreeGppHttpClientHelper::SetAttribute (const std::string &name, |
| 43 const AttributeValue &value) |
| 44 { |
| 45 m_factory.Set (name, value); |
| 46 } |
| 47 |
| 48 ApplicationContainer |
| 49 ThreeGppHttpClientHelper::Install (Ptr<Node> node) const |
| 50 { |
| 51 return ApplicationContainer (InstallPriv (node)); |
| 52 } |
| 53 |
| 54 ApplicationContainer |
| 55 ThreeGppHttpClientHelper::Install (const std::string &nodeName) const |
| 56 { |
| 57 Ptr<Node> node = Names::Find<Node> (nodeName); |
| 58 return ApplicationContainer (InstallPriv (node)); |
| 59 } |
| 60 |
| 61 ApplicationContainer |
| 62 ThreeGppHttpClientHelper::Install (NodeContainer c) const |
| 63 { |
| 64 ApplicationContainer apps; |
| 65 for (NodeContainer::Iterator i = c.Begin (); i != c.End (); ++i) |
| 66 { |
| 67 apps.Add (InstallPriv (*i)); |
| 68 } |
| 69 |
| 70 return apps; |
| 71 } |
| 72 |
| 73 Ptr<Application> |
| 74 ThreeGppHttpClientHelper::InstallPriv (Ptr<Node> node) const |
| 75 { |
| 76 Ptr<Application> app = m_factory.Create<Application> (); |
| 77 node->AddApplication (app); |
| 78 |
| 79 return app; |
| 80 } |
| 81 |
| 82 |
| 83 // HTTP SERVER HELPER ///////////////////////////////////////////////////////// |
| 84 |
| 85 ThreeGppHttpServerHelper::ThreeGppHttpServerHelper (const Address &address) |
| 86 { |
| 87 m_factory.SetTypeId ("ns3::ThreeGppHttpServer"); |
| 88 m_factory.Set ("LocalAddress", AddressValue (address)); |
| 89 } |
| 90 |
| 91 void |
| 92 ThreeGppHttpServerHelper::SetAttribute (const std::string &name, |
| 93
const AttributeValue &value) |
| 94 { |
| 95 m_factory.Set (name, value); |
| 96 } |
| 97 |
| 98 ApplicationContainer |
| 99 ThreeGppHttpServerHelper::Install (Ptr<Node> node) const |
| 100 { |
| 101 return ApplicationContainer (InstallPriv (node)); |
| 102 } |
| 103 |
| 104 ApplicationContainer |
| 105 ThreeGppHttpServerHelper::Install (const std::string &nodeName) const |
| 106 { |
| 107 Ptr<Node> node = Names::Find<Node> (nodeName); |
| 108 return ApplicationContainer (InstallPriv (node)); |
| 109 } |
| 110 |
| 111 ApplicationContainer |
| 112 ThreeGppHttpServerHelper::Install (NodeContainer c) const |
| 113 { |
| 114 ApplicationContainer apps; |
| 115 for (NodeContainer::Iterator i = c.Begin (); i != c.End (); ++i) |
| 116 { |
| 117 apps.Add (InstallPriv (*i)); |
| 118 } |
| 119 |
| 120 return apps; |
| 121 } |
| 122 |
| 123 Ptr<Application> |
| 124 ThreeGppHttpServerHelper::InstallPriv (Ptr<Node> node) const |
| 125 { |
| 126 Ptr<Application> app = m_factory.Create<Application> (); |
| 127 node->AddApplication (app); |
| 128 |
| 129 return app; |
| 130 } |
| 131 |
| 132 |
| 133 } // end of `namespace ns3` |
OLD | NEW |