src/helper/on-off-helper.h
author Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
Sat, 04 Jul 2009 08:15:48 +0200
changeset 4654 2eaebe77d66b
parent 4481 9250a25ee683
permissions -rw-r--r--
Added tag ns-3.5 for changeset c975274c9707
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
2833
f3474fd850b2 add missing license headers
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2731
diff changeset
     1
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
f3474fd850b2 add missing license headers
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2731
diff changeset
     2
/*
f3474fd850b2 add missing license headers
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2731
diff changeset
     3
 * Copyright (c) 2008 INRIA
f3474fd850b2 add missing license headers
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2731
diff changeset
     4
 *
f3474fd850b2 add missing license headers
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2731
diff changeset
     5
 * This program is free software; you can redistribute it and/or modify
f3474fd850b2 add missing license headers
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2731
diff changeset
     6
 * it under the terms of the GNU General Public License version 2 as
f3474fd850b2 add missing license headers
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2731
diff changeset
     7
 * published by the Free Software Foundation;
f3474fd850b2 add missing license headers
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2731
diff changeset
     8
 *
f3474fd850b2 add missing license headers
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2731
diff changeset
     9
 * This program is distributed in the hope that it will be useful,
f3474fd850b2 add missing license headers
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2731
diff changeset
    10
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
f3474fd850b2 add missing license headers
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2731
diff changeset
    11
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
f3474fd850b2 add missing license headers
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2731
diff changeset
    12
 * GNU General Public License for more details.
f3474fd850b2 add missing license headers
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2731
diff changeset
    13
 *
f3474fd850b2 add missing license headers
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2731
diff changeset
    14
 * You should have received a copy of the GNU General Public License
f3474fd850b2 add missing license headers
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2731
diff changeset
    15
 * along with this program; if not, write to the Free Software
f3474fd850b2 add missing license headers
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2731
diff changeset
    16
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
f3474fd850b2 add missing license headers
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2731
diff changeset
    17
 *
f3474fd850b2 add missing license headers
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2731
diff changeset
    18
 * Author: Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
f3474fd850b2 add missing license headers
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2731
diff changeset
    19
 */
2731
9eb9988afd08 a bunch of new helpers.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    20
#ifndef ON_OFF_HELPER_H
9eb9988afd08 a bunch of new helpers.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    21
#define ON_OFF_HELPER_H
9eb9988afd08 a bunch of new helpers.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    22
9eb9988afd08 a bunch of new helpers.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    23
#include <stdint.h>
9eb9988afd08 a bunch of new helpers.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    24
#include <string>
9eb9988afd08 a bunch of new helpers.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    25
#include "ns3/object-factory.h"
9eb9988afd08 a bunch of new helpers.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    26
#include "ns3/address.h"
9eb9988afd08 a bunch of new helpers.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    27
#include "ns3/attribute.h"
9eb9988afd08 a bunch of new helpers.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    28
#include "ns3/net-device.h"
9eb9988afd08 a bunch of new helpers.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    29
#include "node-container.h"
9eb9988afd08 a bunch of new helpers.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    30
#include "application-container.h"
9eb9988afd08 a bunch of new helpers.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    31
9eb9988afd08 a bunch of new helpers.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    32
namespace ns3 {
9eb9988afd08 a bunch of new helpers.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    33
3558
e24c4db6fd71 doxygen OnOffHelper.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2965
diff changeset
    34
/**
e24c4db6fd71 doxygen OnOffHelper.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2965
diff changeset
    35
 * \brief instanciate an ns3::OnOffApplication on a set of nodes.
e24c4db6fd71 doxygen OnOffHelper.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2965
diff changeset
    36
 */
2731
9eb9988afd08 a bunch of new helpers.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    37
class OnOffHelper
9eb9988afd08 a bunch of new helpers.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    38
{
9eb9988afd08 a bunch of new helpers.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    39
public:
3558
e24c4db6fd71 doxygen OnOffHelper.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2965
diff changeset
    40
  /**
e24c4db6fd71 doxygen OnOffHelper.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2965
diff changeset
    41
   * \param protocol the name of the protocol to use to send traffic
e24c4db6fd71 doxygen OnOffHelper.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2965
diff changeset
    42
   *        by the applications. This string identifies the socket
e24c4db6fd71 doxygen OnOffHelper.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2965
diff changeset
    43
   *        factory type used to create sockets for the applications.
e24c4db6fd71 doxygen OnOffHelper.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2965
diff changeset
    44
   *        A typical value would be ns3::UdpSocketFactory.
e24c4db6fd71 doxygen OnOffHelper.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2965
diff changeset
    45
   * \param address the address of the remote node to send traffic
e24c4db6fd71 doxygen OnOffHelper.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2965
diff changeset
    46
   *        to.
e24c4db6fd71 doxygen OnOffHelper.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2965
diff changeset
    47
   */
2890
172baa5960ff rework app constructors
Craig Dowell <craigdo@ee.washington.edu>
parents: 2887
diff changeset
    48
  OnOffHelper (std::string protocol, Address address);
2731
9eb9988afd08 a bunch of new helpers.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    49
3558
e24c4db6fd71 doxygen OnOffHelper.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2965
diff changeset
    50
  /**
e24c4db6fd71 doxygen OnOffHelper.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2965
diff changeset
    51
   * \param name the name of the application attribute to set
e24c4db6fd71 doxygen OnOffHelper.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2965
diff changeset
    52
   * \param value the value of the application attribute to set
e24c4db6fd71 doxygen OnOffHelper.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2965
diff changeset
    53
   */
2965
4b28e9740e3b get rid of Attribute class. Use AttributeValue subclasses directly.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2890
diff changeset
    54
  void SetAttribute (std::string name, const AttributeValue &value);
2731
9eb9988afd08 a bunch of new helpers.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    55
3558
e24c4db6fd71 doxygen OnOffHelper.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2965
diff changeset
    56
  /**
e24c4db6fd71 doxygen OnOffHelper.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2965
diff changeset
    57
   * Install an ns3::OnOffApplication on each node of the input container
e24c4db6fd71 doxygen OnOffHelper.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2965
diff changeset
    58
   * configured with all the attributes set with SetAttribute.
3848
affd0834debc address bug 393 (need to overload Install methods for python)
Craig Dowell <craigdo@ee.washington.edu>
parents: 3558
diff changeset
    59
   *
affd0834debc address bug 393 (need to overload Install methods for python)
Craig Dowell <craigdo@ee.washington.edu>
parents: 3558
diff changeset
    60
   * \param c NodeContainer of the set of nodes on which an OnOffApplication 
affd0834debc address bug 393 (need to overload Install methods for python)
Craig Dowell <craigdo@ee.washington.edu>
parents: 3558
diff changeset
    61
   * will be installed.
3997
a66553c56a8f make a pass through doxygen fixing errors
Craig Dowell <craigdo@ee.washington.edu>
parents: 3848
diff changeset
    62
   * \returns Container of Ptr to the applications installed.
3558
e24c4db6fd71 doxygen OnOffHelper.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2965
diff changeset
    63
   */
3848
affd0834debc address bug 393 (need to overload Install methods for python)
Craig Dowell <craigdo@ee.washington.edu>
parents: 3558
diff changeset
    64
  ApplicationContainer Install (NodeContainer c) const;
affd0834debc address bug 393 (need to overload Install methods for python)
Craig Dowell <craigdo@ee.washington.edu>
parents: 3558
diff changeset
    65
affd0834debc address bug 393 (need to overload Install methods for python)
Craig Dowell <craigdo@ee.washington.edu>
parents: 3558
diff changeset
    66
  /**
3997
a66553c56a8f make a pass through doxygen fixing errors
Craig Dowell <craigdo@ee.washington.edu>
parents: 3848
diff changeset
    67
   * Install an ns3::OnOffApplication on the node configured with all the 
a66553c56a8f make a pass through doxygen fixing errors
Craig Dowell <craigdo@ee.washington.edu>
parents: 3848
diff changeset
    68
   * attributes set with SetAttribute.
3848
affd0834debc address bug 393 (need to overload Install methods for python)
Craig Dowell <craigdo@ee.washington.edu>
parents: 3558
diff changeset
    69
   *
3997
a66553c56a8f make a pass through doxygen fixing errors
Craig Dowell <craigdo@ee.washington.edu>
parents: 3848
diff changeset
    70
   * \param node The node on which an OnOffApplication will be installed.
a66553c56a8f make a pass through doxygen fixing errors
Craig Dowell <craigdo@ee.washington.edu>
parents: 3848
diff changeset
    71
   * \returns Container of Ptr to the applications installed.
3848
affd0834debc address bug 393 (need to overload Install methods for python)
Craig Dowell <craigdo@ee.washington.edu>
parents: 3558
diff changeset
    72
   */
affd0834debc address bug 393 (need to overload Install methods for python)
Craig Dowell <craigdo@ee.washington.edu>
parents: 3558
diff changeset
    73
  ApplicationContainer Install (Ptr<Node> node) const;
2731
9eb9988afd08 a bunch of new helpers.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    74
4140
6bbf05bf4826 Brute force all of the helpers to use object name service
Craig Dowell <craigdo@ee.washington.edu>
parents: 3997
diff changeset
    75
  /**
6bbf05bf4826 Brute force all of the helpers to use object name service
Craig Dowell <craigdo@ee.washington.edu>
parents: 3997
diff changeset
    76
   * Install an ns3::OnOffApplication on the node configured with all the 
6bbf05bf4826 Brute force all of the helpers to use object name service
Craig Dowell <craigdo@ee.washington.edu>
parents: 3997
diff changeset
    77
   * attributes set with SetAttribute.
6bbf05bf4826 Brute force all of the helpers to use object name service
Craig Dowell <craigdo@ee.washington.edu>
parents: 3997
diff changeset
    78
   *
4481
9250a25ee683 Doxygen cleanup
Tom Henderson <tomh@tomh.org>
parents: 4140
diff changeset
    79
   * \param nodeName The node on which an OnOffApplication will be installed.
4140
6bbf05bf4826 Brute force all of the helpers to use object name service
Craig Dowell <craigdo@ee.washington.edu>
parents: 3997
diff changeset
    80
   * \returns Container of Ptr to the applications installed.
6bbf05bf4826 Brute force all of the helpers to use object name service
Craig Dowell <craigdo@ee.washington.edu>
parents: 3997
diff changeset
    81
   */
6bbf05bf4826 Brute force all of the helpers to use object name service
Craig Dowell <craigdo@ee.washington.edu>
parents: 3997
diff changeset
    82
  ApplicationContainer Install (std::string nodeName) const;
6bbf05bf4826 Brute force all of the helpers to use object name service
Craig Dowell <craigdo@ee.washington.edu>
parents: 3997
diff changeset
    83
2731
9eb9988afd08 a bunch of new helpers.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    84
private:
3997
a66553c56a8f make a pass through doxygen fixing errors
Craig Dowell <craigdo@ee.washington.edu>
parents: 3848
diff changeset
    85
  /**
a66553c56a8f make a pass through doxygen fixing errors
Craig Dowell <craigdo@ee.washington.edu>
parents: 3848
diff changeset
    86
   * Install an ns3::OnOffApplication on the node configured with all the 
a66553c56a8f make a pass through doxygen fixing errors
Craig Dowell <craigdo@ee.washington.edu>
parents: 3848
diff changeset
    87
   * attributes set with SetAttribute.
a66553c56a8f make a pass through doxygen fixing errors
Craig Dowell <craigdo@ee.washington.edu>
parents: 3848
diff changeset
    88
   *
a66553c56a8f make a pass through doxygen fixing errors
Craig Dowell <craigdo@ee.washington.edu>
parents: 3848
diff changeset
    89
   * \param node The node on which an OnOffApplication will be installed.
a66553c56a8f make a pass through doxygen fixing errors
Craig Dowell <craigdo@ee.washington.edu>
parents: 3848
diff changeset
    90
   * \returns Ptr to the application installed.
a66553c56a8f make a pass through doxygen fixing errors
Craig Dowell <craigdo@ee.washington.edu>
parents: 3848
diff changeset
    91
   */
3848
affd0834debc address bug 393 (need to overload Install methods for python)
Craig Dowell <craigdo@ee.washington.edu>
parents: 3558
diff changeset
    92
  Ptr<Application> InstallPriv (Ptr<Node> node) const;
2731
9eb9988afd08 a bunch of new helpers.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    93
  std::string m_protocol;
9eb9988afd08 a bunch of new helpers.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    94
  Address m_remote;
9eb9988afd08 a bunch of new helpers.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    95
  ObjectFactory m_factory;
9eb9988afd08 a bunch of new helpers.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    96
};
9eb9988afd08 a bunch of new helpers.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    97
9eb9988afd08 a bunch of new helpers.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    98
} // namespace ns3
9eb9988afd08 a bunch of new helpers.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    99
9eb9988afd08 a bunch of new helpers.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   100
#endif /* ON_OFF_HELPER_H */
9eb9988afd08 a bunch of new helpers.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   101