OLD | NEW |
(Empty) | |
| 1 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */ |
| 2 /* |
| 3 * Copyright (c) 2008 INRIA |
| 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: Mathieu Lacage <mathieu.lacage@sophia.inria.fr> |
| 19 * Modified by: NIST |
| 20 */ |
| 21 #include "nist-udp-groupecho-helper.h" |
| 22 #include "ns3/nist-udp-groupecho-server.h" |
| 23 #include "ns3/uinteger.h" |
| 24 #include "ns3/names.h" |
| 25 #include "ns3/boolean.h" |
| 26 |
| 27 namespace ns3 { |
| 28 |
| 29 NistUdpGroupEchoServerHelper::NistUdpGroupEchoServerHelper (uint16_t port) |
| 30 { |
| 31 m_factory.SetTypeId (NistUdpGroupEchoServer::GetTypeId ()); |
| 32 SetAttribute ("Port", UintegerValue (port)); |
| 33 } |
| 34 |
| 35 NistUdpGroupEchoServerHelper::NistUdpGroupEchoServerHelper (uint16_t port, dou
ble stime) |
| 36 { |
| 37 m_factory.SetTypeId (NistUdpGroupEchoServer::GetTypeId ()); |
| 38 SetAttribute ("Port", UintegerValue (port)); |
| 39 SetAttribute ("Timeout", DoubleValue (stime)); |
| 40 } |
| 41 |
| 42 NistUdpGroupEchoServerHelper::NistUdpGroupEchoServerHelper (uint16_t port, dou
ble stime, bool echoback) |
| 43 { |
| 44 m_factory.SetTypeId (NistUdpGroupEchoServer::GetTypeId ()); |
| 45 SetAttribute ("Port", UintegerValue (port)); |
| 46 SetAttribute ("Timeout", DoubleValue (stime)); |
| 47 SetAttribute ("Echo", BooleanValue (echoback)); |
| 48 } |
| 49 |
| 50 void· |
| 51 NistUdpGroupEchoServerHelper::SetAttribute ( |
| 52 std::string name,· |
| 53 const AttributeValue &value) |
| 54 { |
| 55 m_factory.Set (name, value); |
| 56 } |
| 57 |
| 58 ApplicationContainer |
| 59 NistUdpGroupEchoServerHelper::Install (Ptr<Node> node) const |
| 60 { |
| 61 return ApplicationContainer (InstallPriv (node)); |
| 62 } |
| 63 |
| 64 ApplicationContainer |
| 65 NistUdpGroupEchoServerHelper::Install (std::string nodeName) const |
| 66 { |
| 67 Ptr<Node> node = Names::Find<Node> (nodeName); |
| 68 return ApplicationContainer (InstallPriv (node)); |
| 69 } |
| 70 |
| 71 ApplicationContainer |
| 72 NistUdpGroupEchoServerHelper::Install (NodeContainer c) const |
| 73 { |
| 74 ApplicationContainer apps; |
| 75 for (NodeContainer::Iterator i = c.Begin (); i != c.End (); ++i) |
| 76 { |
| 77 apps.Add (InstallPriv (*i)); |
| 78 } |
| 79 |
| 80 return apps; |
| 81 } |
| 82 |
| 83 Ptr<Application> |
| 84 NistUdpGroupEchoServerHelper::InstallPriv (Ptr<Node> node) const |
| 85 { |
| 86 Ptr<Application> app = m_factory.Create<NistUdpGroupEchoServer> (); |
| 87 node->AddApplication (app); |
| 88 |
| 89 return app; |
| 90 } |
| 91 |
| 92 } // namespace ns3 |
OLD | NEW |