src/node/node.h
author Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
Thu, 30 Aug 2007 14:54:05 +0200
changeset 1403 0286b806eee1
parent 1401 96a21130865c
child 1412 9ce52d4f530b
permissions -rw-r--r--
add doxygen for each TraceSourceElement subclass
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
1175
00ad4ec69939 small cleanups
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 936
diff changeset
     1
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
00ad4ec69939 small cleanups
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 936
diff changeset
     2
/*
00ad4ec69939 small cleanups
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 936
diff changeset
     3
 * Copyright (c) 2006 Georgia Tech Research Corporation, INRIA
00ad4ec69939 small cleanups
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 936
diff changeset
     4
 *
00ad4ec69939 small cleanups
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 936
diff changeset
     5
 * This program is free software; you can redistribute it and/or modify
00ad4ec69939 small cleanups
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 936
diff changeset
     6
 * it under the terms of the GNU General Public License version 2 as
00ad4ec69939 small cleanups
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 936
diff changeset
     7
 * published by the Free Software Foundation;
00ad4ec69939 small cleanups
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 936
diff changeset
     8
 *
00ad4ec69939 small cleanups
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 936
diff changeset
     9
 * This program is distributed in the hope that it will be useful,
00ad4ec69939 small cleanups
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 936
diff changeset
    10
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
00ad4ec69939 small cleanups
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 936
diff changeset
    11
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00ad4ec69939 small cleanups
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 936
diff changeset
    12
 * GNU General Public License for more details.
00ad4ec69939 small cleanups
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 936
diff changeset
    13
 *
00ad4ec69939 small cleanups
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 936
diff changeset
    14
 * You should have received a copy of the GNU General Public License
00ad4ec69939 small cleanups
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 936
diff changeset
    15
 * along with this program; if not, write to the Free Software
00ad4ec69939 small cleanups
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 936
diff changeset
    16
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
00ad4ec69939 small cleanups
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 936
diff changeset
    17
 *
00ad4ec69939 small cleanups
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 936
diff changeset
    18
 * Authors: George F. Riley<riley@ece.gatech.edu>
00ad4ec69939 small cleanups
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 936
diff changeset
    19
 *          Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
00ad4ec69939 small cleanups
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 936
diff changeset
    20
 */
00ad4ec69939 small cleanups
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 936
diff changeset
    21
#ifndef NODE_H
00ad4ec69939 small cleanups
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 936
diff changeset
    22
#define NODE_H
232
8cd08910f9a1 initial node base class from george's repo.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    23
8cd08910f9a1 initial node base class from george's repo.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    24
#include <vector>
8cd08910f9a1 initial node base class from george's repo.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    25
710
2a9c061219a7 port code from Interface to Object
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 607
diff changeset
    26
#include "ns3/object.h"
1176
4894ea885c0f implement the Node::ProtocolHandler support.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1175
diff changeset
    27
#include "ns3/callback.h"
1229
e4cfe4094c10 build with the new TraceContextElement API
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1195
diff changeset
    28
#include "ns3/trace-context-element.h"
355
d18da75542c7 Add static node factory methods to class Node
Tom Henderson <tomh@tomh.org>
parents: 345
diff changeset
    29
232
8cd08910f9a1 initial node base class from george's repo.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    30
namespace ns3 {
8cd08910f9a1 initial node base class from george's repo.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    31
345
47b41507a45a move channel.cc channel.h to node directory; merge ns-3-tracing from mathieu
Tom Henderson <tomh@tomh.org>
parents: 244
diff changeset
    32
class TraceContext;
47b41507a45a move channel.cc channel.h to node directory; merge ns-3-tracing from mathieu
Tom Henderson <tomh@tomh.org>
parents: 244
diff changeset
    33
class TraceResolver;
447
180117abfb04 add NetDevice list into Node base class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 381
diff changeset
    34
class NetDevice;
585
a009b03b720a remove ApplicationList. Move functionality to Node class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 580
diff changeset
    35
class Application;
1176
4894ea885c0f implement the Node::ProtocolHandler support.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1175
diff changeset
    36
class Packet;
1186
909e9eb2124e rework the NetDevice <-> Node interface
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1176
diff changeset
    37
class Address;
1194
b8e957eb0a94 replace Node::DoCreateTraceResolver with Node::DoFillTraceResolver
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1186
diff changeset
    38
class CompositeTraceResolver;
232
8cd08910f9a1 initial node base class from george's repo.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    39
1403
0286b806eee1 add doxygen for each TraceSourceElement subclass
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1401
diff changeset
    40
/**
0286b806eee1 add doxygen for each TraceSourceElement subclass
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1401
diff changeset
    41
 * \brief hold in a TraceContext the index of a NetDevice within a Node
0286b806eee1 add doxygen for each TraceSourceElement subclass
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1401
diff changeset
    42
 */
1229
e4cfe4094c10 build with the new TraceContextElement API
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1195
diff changeset
    43
class NodeNetDeviceIndex : public TraceContextElement
e4cfe4094c10 build with the new TraceContextElement API
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1195
diff changeset
    44
{
e4cfe4094c10 build with the new TraceContextElement API
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1195
diff changeset
    45
public:
e4cfe4094c10 build with the new TraceContextElement API
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1195
diff changeset
    46
  NodeNetDeviceIndex ();
e4cfe4094c10 build with the new TraceContextElement API
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1195
diff changeset
    47
  NodeNetDeviceIndex (uint32_t index);
1403
0286b806eee1 add doxygen for each TraceSourceElement subclass
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1401
diff changeset
    48
  /**
0286b806eee1 add doxygen for each TraceSourceElement subclass
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1401
diff changeset
    49
   * \returns the index of the NetDevice within its container Node.
0286b806eee1 add doxygen for each TraceSourceElement subclass
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1401
diff changeset
    50
   */
1229
e4cfe4094c10 build with the new TraceContextElement API
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1195
diff changeset
    51
  uint32_t Get (void) const;
e4cfe4094c10 build with the new TraceContextElement API
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1195
diff changeset
    52
  void Print (std::ostream &os) const;
1401
96a21130865c GetName -> GetTypeName
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1383
diff changeset
    53
  std::string GetTypeName (void) const;
1229
e4cfe4094c10 build with the new TraceContextElement API
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1195
diff changeset
    54
  static uint16_t GetUid (void);
e4cfe4094c10 build with the new TraceContextElement API
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1195
diff changeset
    55
private:
e4cfe4094c10 build with the new TraceContextElement API
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1195
diff changeset
    56
  uint32_t m_index;
e4cfe4094c10 build with the new TraceContextElement API
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1195
diff changeset
    57
};
e4cfe4094c10 build with the new TraceContextElement API
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1195
diff changeset
    58
595
3e77d7b90b9c add dox documentation for Node
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 594
diff changeset
    59
/**
728
95c426b1cb60 rename INode to Node
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 710
diff changeset
    60
 * \brief A network Node.
595
3e77d7b90b9c add dox documentation for Node
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 594
diff changeset
    61
 *
3e77d7b90b9c add dox documentation for Node
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 594
diff changeset
    62
 * This class holds together:
3e77d7b90b9c add dox documentation for Node
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 594
diff changeset
    63
 *   - a list of NetDevice objects which represent the network interfaces
728
95c426b1cb60 rename INode to Node
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 710
diff changeset
    64
 *     of this node which are connected to other Node instances through
595
3e77d7b90b9c add dox documentation for Node
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 594
diff changeset
    65
 *     Channel instances.
3e77d7b90b9c add dox documentation for Node
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 594
diff changeset
    66
 *   - a list of Application objects which represent the userspace
728
95c426b1cb60 rename INode to Node
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 710
diff changeset
    67
 *     traffic generation applications which interact with the Node
595
3e77d7b90b9c add dox documentation for Node
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 594
diff changeset
    68
 *     through the Socket API.
3e77d7b90b9c add dox documentation for Node
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 594
diff changeset
    69
 *   - a node Id: a unique per-node identifier.
3e77d7b90b9c add dox documentation for Node
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 594
diff changeset
    70
 *   - a system Id: a unique Id used for parallel simulations.
3e77d7b90b9c add dox documentation for Node
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 594
diff changeset
    71
 *   - a trace resolver which can be used to connect user trace sinks
3e77d7b90b9c add dox documentation for Node
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 594
diff changeset
    72
 *     to the node's trace sources.
3e77d7b90b9c add dox documentation for Node
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 594
diff changeset
    73
 *
728
95c426b1cb60 rename INode to Node
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 710
diff changeset
    74
 * Every Node created is added to the NodeList automatically.
595
3e77d7b90b9c add dox documentation for Node
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 594
diff changeset
    75
 */
728
95c426b1cb60 rename INode to Node
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 710
diff changeset
    76
class Node : public Object
484
cf7fbb84d74b rework the Node and NodeList classes to manage reference counts correctly
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 482
diff changeset
    77
{
512
5404e1e41f82 make Node derive from NsUnknown rather than Object
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 484
diff changeset
    78
public:
580
80f53b488bd3 rename Iid to InterfaceId
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 579
diff changeset
    79
  static const InterfaceId iid;
361
9b159ff6dbcb Clean up parameter passing per TOm's request
George F. Riley<riley@ece.gatech.edu>
parents: 359
diff changeset
    80
1186
909e9eb2124e rework the NetDevice <-> Node interface
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1176
diff changeset
    81
  /**
909e9eb2124e rework the NetDevice <-> Node interface
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1176
diff changeset
    82
   * Must be invoked by subclasses only.
909e9eb2124e rework the NetDevice <-> Node interface
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1176
diff changeset
    83
   */
909e9eb2124e rework the NetDevice <-> Node interface
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1176
diff changeset
    84
  Node();
909e9eb2124e rework the NetDevice <-> Node interface
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1176
diff changeset
    85
  /**
909e9eb2124e rework the NetDevice <-> Node interface
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1176
diff changeset
    86
   * \param systemId a unique integer used for parallel simulations.
909e9eb2124e rework the NetDevice <-> Node interface
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1176
diff changeset
    87
   *
909e9eb2124e rework the NetDevice <-> Node interface
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1176
diff changeset
    88
   * Must be invoked by subclasses only.
909e9eb2124e rework the NetDevice <-> Node interface
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1176
diff changeset
    89
   */
909e9eb2124e rework the NetDevice <-> Node interface
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1176
diff changeset
    90
  Node(uint32_t systemId);
909e9eb2124e rework the NetDevice <-> Node interface
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1176
diff changeset
    91
728
95c426b1cb60 rename INode to Node
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 710
diff changeset
    92
  virtual ~Node();
244
caff04d90a66 remove SetNodeId and implement GetId and GetSystemId
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 242
diff changeset
    93
595
3e77d7b90b9c add dox documentation for Node
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 594
diff changeset
    94
  /**
3e77d7b90b9c add dox documentation for Node
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 594
diff changeset
    95
   * \returns the unique id of this node.
3e77d7b90b9c add dox documentation for Node
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 594
diff changeset
    96
   * 
728
95c426b1cb60 rename INode to Node
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 710
diff changeset
    97
   * This unique id happens to be also the index of the Node into
595
3e77d7b90b9c add dox documentation for Node
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 594
diff changeset
    98
   * the NodeList. 
3e77d7b90b9c add dox documentation for Node
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 594
diff changeset
    99
   */
244
caff04d90a66 remove SetNodeId and implement GetId and GetSystemId
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 242
diff changeset
   100
  uint32_t GetId (void) const;
595
3e77d7b90b9c add dox documentation for Node
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 594
diff changeset
   101
3e77d7b90b9c add dox documentation for Node
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 594
diff changeset
   102
  /**
3e77d7b90b9c add dox documentation for Node
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 594
diff changeset
   103
   * \returns the system id for parallel simulations associated
3e77d7b90b9c add dox documentation for Node
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 594
diff changeset
   104
   *          to this node.
3e77d7b90b9c add dox documentation for Node
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 594
diff changeset
   105
   */
244
caff04d90a66 remove SetNodeId and implement GetId and GetSystemId
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 242
diff changeset
   106
  uint32_t GetSystemId (void) const;
232
8cd08910f9a1 initial node base class from george's repo.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   107
595
3e77d7b90b9c add dox documentation for Node
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 594
diff changeset
   108
  /**
3e77d7b90b9c add dox documentation for Node
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 594
diff changeset
   109
   * \param device NetDevice to associate to this node.
728
95c426b1cb60 rename INode to Node
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 710
diff changeset
   110
   * \returns the index of the NetDevice into the Node's list of
595
3e77d7b90b9c add dox documentation for Node
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 594
diff changeset
   111
   *          NetDevice.
3e77d7b90b9c add dox documentation for Node
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 594
diff changeset
   112
   *
3e77d7b90b9c add dox documentation for Node
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 594
diff changeset
   113
   * Associate this device to this node.
3e77d7b90b9c add dox documentation for Node
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 594
diff changeset
   114
   * This method is called automatically from NetDevice::NetDevice
3e77d7b90b9c add dox documentation for Node
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 594
diff changeset
   115
   * so the user has little reason to call this method himself.
1186
909e9eb2124e rework the NetDevice <-> Node interface
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1176
diff changeset
   116
   * The index returned is always non-zero.
595
3e77d7b90b9c add dox documentation for Node
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 594
diff changeset
   117
   */
568
e1660959ecbb use Ptr<> everywhere Object or NsUnknown are used
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 525
diff changeset
   118
  uint32_t AddDevice (Ptr<NetDevice> device);
595
3e77d7b90b9c add dox documentation for Node
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 594
diff changeset
   119
  /**
3e77d7b90b9c add dox documentation for Node
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 594
diff changeset
   120
   * \param index the index of the requested NetDevice
728
95c426b1cb60 rename INode to Node
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 710
diff changeset
   121
   * \returns the requested NetDevice associated to this Node.
1186
909e9eb2124e rework the NetDevice <-> Node interface
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1176
diff changeset
   122
   *
909e9eb2124e rework the NetDevice <-> Node interface
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1176
diff changeset
   123
   * The indexes used by the GetDevice method start at one and
909e9eb2124e rework the NetDevice <-> Node interface
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1176
diff changeset
   124
   * end at GetNDevices ()
595
3e77d7b90b9c add dox documentation for Node
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 594
diff changeset
   125
   */
568
e1660959ecbb use Ptr<> everywhere Object or NsUnknown are used
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 525
diff changeset
   126
  Ptr<NetDevice> GetDevice (uint32_t index) const;
595
3e77d7b90b9c add dox documentation for Node
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 594
diff changeset
   127
  /**
3e77d7b90b9c add dox documentation for Node
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 594
diff changeset
   128
   * \returns the number of NetDevice instances associated
728
95c426b1cb60 rename INode to Node
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 710
diff changeset
   129
   *          to this Node.
595
3e77d7b90b9c add dox documentation for Node
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 594
diff changeset
   130
   */
447
180117abfb04 add NetDevice list into Node base class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 381
diff changeset
   131
  uint32_t GetNDevices (void) const;
180117abfb04 add NetDevice list into Node base class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 381
diff changeset
   132
595
3e77d7b90b9c add dox documentation for Node
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 594
diff changeset
   133
  /**
3e77d7b90b9c add dox documentation for Node
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 594
diff changeset
   134
   * \param application Application to associate to this node.
728
95c426b1cb60 rename INode to Node
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 710
diff changeset
   135
   * \returns the index of the Application within the Node's list
595
3e77d7b90b9c add dox documentation for Node
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 594
diff changeset
   136
   *          of Application.
3e77d7b90b9c add dox documentation for Node
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 594
diff changeset
   137
   *
728
95c426b1cb60 rename INode to Node
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 710
diff changeset
   138
   * Associated this Application to this Node. This method is called
595
3e77d7b90b9c add dox documentation for Node
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 594
diff changeset
   139
   * automatically from Application::Application so the user
3e77d7b90b9c add dox documentation for Node
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 594
diff changeset
   140
   * has little reasons to call this method directly.
3e77d7b90b9c add dox documentation for Node
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 594
diff changeset
   141
   */
585
a009b03b720a remove ApplicationList. Move functionality to Node class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 580
diff changeset
   142
  uint32_t AddApplication (Ptr<Application> application);
595
3e77d7b90b9c add dox documentation for Node
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 594
diff changeset
   143
  /**
3e77d7b90b9c add dox documentation for Node
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 594
diff changeset
   144
   * \param index
3e77d7b90b9c add dox documentation for Node
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 594
diff changeset
   145
   * \returns the application associated to this requested index
728
95c426b1cb60 rename INode to Node
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 710
diff changeset
   146
   *          within this Node.
595
3e77d7b90b9c add dox documentation for Node
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 594
diff changeset
   147
   */
585
a009b03b720a remove ApplicationList. Move functionality to Node class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 580
diff changeset
   148
  Ptr<Application> GetApplication (uint32_t index) const;
595
3e77d7b90b9c add dox documentation for Node
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 594
diff changeset
   149
  /**
728
95c426b1cb60 rename INode to Node
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 710
diff changeset
   150
   * \returns the number of applications associated to this Node.
595
3e77d7b90b9c add dox documentation for Node
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 594
diff changeset
   151
   */
585
a009b03b720a remove ApplicationList. Move functionality to Node class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 580
diff changeset
   152
  uint32_t GetNApplications (void) const;
a009b03b720a remove ApplicationList. Move functionality to Node class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 580
diff changeset
   153
1176
4894ea885c0f implement the Node::ProtocolHandler support.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1175
diff changeset
   154
  /**
4894ea885c0f implement the Node::ProtocolHandler support.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1175
diff changeset
   155
   * A protocol handler
4894ea885c0f implement the Node::ProtocolHandler support.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1175
diff changeset
   156
   */
1186
909e9eb2124e rework the NetDevice <-> Node interface
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1176
diff changeset
   157
  typedef Callback<void,Ptr<NetDevice>, const Packet &,uint16_t,const Address &> ProtocolHandler;
1176
4894ea885c0f implement the Node::ProtocolHandler support.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1175
diff changeset
   158
  /**
4894ea885c0f implement the Node::ProtocolHandler support.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1175
diff changeset
   159
   * \param handler the handler to register
4894ea885c0f implement the Node::ProtocolHandler support.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1175
diff changeset
   160
   * \param protocolType the type of protocol this handler is 
1186
909e9eb2124e rework the NetDevice <-> Node interface
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1176
diff changeset
   161
   *        interested in. This protocol type is a so-called
909e9eb2124e rework the NetDevice <-> Node interface
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1176
diff changeset
   162
   *        EtherType, as registered here:
909e9eb2124e rework the NetDevice <-> Node interface
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1176
diff changeset
   163
   *        http://standards.ieee.org/regauth/ethertype/eth.txt
909e9eb2124e rework the NetDevice <-> Node interface
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1176
diff changeset
   164
   *        the value zero is interpreted as matching all
909e9eb2124e rework the NetDevice <-> Node interface
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1176
diff changeset
   165
   *        protocols.
1176
4894ea885c0f implement the Node::ProtocolHandler support.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1175
diff changeset
   166
   * \param device the device attached to this handler. If the
4894ea885c0f implement the Node::ProtocolHandler support.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1175
diff changeset
   167
   *        value is zero, the handler is attached to all
4894ea885c0f implement the Node::ProtocolHandler support.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1175
diff changeset
   168
   *        devices on this node.
4894ea885c0f implement the Node::ProtocolHandler support.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1175
diff changeset
   169
   */
4894ea885c0f implement the Node::ProtocolHandler support.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1175
diff changeset
   170
  void RegisterProtocolHandler (ProtocolHandler handler, 
4894ea885c0f implement the Node::ProtocolHandler support.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1175
diff changeset
   171
                                uint16_t protocolType,
4894ea885c0f implement the Node::ProtocolHandler support.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1175
diff changeset
   172
                                Ptr<NetDevice> device);
4894ea885c0f implement the Node::ProtocolHandler support.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1175
diff changeset
   173
  /**
4894ea885c0f implement the Node::ProtocolHandler support.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1175
diff changeset
   174
   * \param handler the handler to unregister
4894ea885c0f implement the Node::ProtocolHandler support.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1175
diff changeset
   175
   *
4894ea885c0f implement the Node::ProtocolHandler support.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1175
diff changeset
   176
   * After this call returns, the input handler will never
4894ea885c0f implement the Node::ProtocolHandler support.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1175
diff changeset
   177
   * be invoked anymore.
4894ea885c0f implement the Node::ProtocolHandler support.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1175
diff changeset
   178
   */
4894ea885c0f implement the Node::ProtocolHandler support.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1175
diff changeset
   179
  void UnregisterProtocolHandler (ProtocolHandler handler);
4894ea885c0f implement the Node::ProtocolHandler support.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1175
diff changeset
   180
513
b7c7ea629de9 make L3Demux an NsUnknown object.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 512
diff changeset
   181
protected:
1383
12f30b7defb4 constify
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1364
diff changeset
   182
  virtual Ptr<TraceResolver> GetTraceResolver (void) const;
595
3e77d7b90b9c add dox documentation for Node
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 594
diff changeset
   183
  /**
3e77d7b90b9c add dox documentation for Node
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 594
diff changeset
   184
   * The dispose method. Subclasses must override this method
728
95c426b1cb60 rename INode to Node
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 710
diff changeset
   185
   * and must chain up to it by calling Node::DoDispose at the
595
3e77d7b90b9c add dox documentation for Node
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 594
diff changeset
   186
   * end of their own DoDispose method.
3e77d7b90b9c add dox documentation for Node
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 594
diff changeset
   187
   */
513
b7c7ea629de9 make L3Demux an NsUnknown object.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 512
diff changeset
   188
  virtual void DoDispose (void);
447
180117abfb04 add NetDevice list into Node base class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 381
diff changeset
   189
private:
1341
f685d4bf320f use the Object::GetTraceResolver tracing support rather than the old adhoc tracing code
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1333
diff changeset
   190
595
3e77d7b90b9c add dox documentation for Node
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 594
diff changeset
   191
  /**
728
95c426b1cb60 rename INode to Node
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 710
diff changeset
   192
   * \param device the device added to this Node.
595
3e77d7b90b9c add dox documentation for Node
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 594
diff changeset
   193
   *
728
95c426b1cb60 rename INode to Node
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 710
diff changeset
   194
   * This method is invoked whenever a user calls Node::AddDevice.
595
3e77d7b90b9c add dox documentation for Node
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 594
diff changeset
   195
   * Subclasses are expected to call NetDevice::SetReceiveCallback
3e77d7b90b9c add dox documentation for Node
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 594
diff changeset
   196
   * at this point to setup the node's receive function for
3e77d7b90b9c add dox documentation for Node
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 594
diff changeset
   197
   * the NetDevice packets.
3e77d7b90b9c add dox documentation for Node
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 594
diff changeset
   198
   */
1176
4894ea885c0f implement the Node::ProtocolHandler support.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1175
diff changeset
   199
  virtual void NotifyDeviceAdded (Ptr<NetDevice> device);
4894ea885c0f implement the Node::ProtocolHandler support.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1175
diff changeset
   200
1186
909e9eb2124e rework the NetDevice <-> Node interface
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1176
diff changeset
   201
  bool ReceiveFromDevice (Ptr<NetDevice> device, const Packet &packet, 
909e9eb2124e rework the NetDevice <-> Node interface
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1176
diff changeset
   202
                          uint16_t protocol, const Address &from);
909e9eb2124e rework the NetDevice <-> Node interface
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1176
diff changeset
   203
  void Construct (void);
447
180117abfb04 add NetDevice list into Node base class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 381
diff changeset
   204
1176
4894ea885c0f implement the Node::ProtocolHandler support.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1175
diff changeset
   205
  struct ProtocolHandlerEntry {
4894ea885c0f implement the Node::ProtocolHandler support.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1175
diff changeset
   206
    ProtocolHandler handler;
4894ea885c0f implement the Node::ProtocolHandler support.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1175
diff changeset
   207
    uint16_t protocol;
4894ea885c0f implement the Node::ProtocolHandler support.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1175
diff changeset
   208
    Ptr<NetDevice> device;
4894ea885c0f implement the Node::ProtocolHandler support.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1175
diff changeset
   209
  };
4894ea885c0f implement the Node::ProtocolHandler support.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1175
diff changeset
   210
  typedef std::vector<struct Node::ProtocolHandlerEntry> ProtocolHandlerList;
728
95c426b1cb60 rename INode to Node
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 710
diff changeset
   211
  uint32_t    m_id;         // Node id for this node
244
caff04d90a66 remove SetNodeId and implement GetId and GetSystemId
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 242
diff changeset
   212
  uint32_t    m_sid;        // System id for this node
568
e1660959ecbb use Ptr<> everywhere Object or NsUnknown are used
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 525
diff changeset
   213
  std::vector<Ptr<NetDevice> > m_devices;
585
a009b03b720a remove ApplicationList. Move functionality to Node class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 580
diff changeset
   214
  std::vector<Ptr<Application> > m_applications;
1176
4894ea885c0f implement the Node::ProtocolHandler support.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1175
diff changeset
   215
  ProtocolHandlerList m_handlers;
232
8cd08910f9a1 initial node base class from george's repo.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   216
};
8cd08910f9a1 initial node base class from george's repo.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   217
355
d18da75542c7 Add static node factory methods to class Node
Tom Henderson <tomh@tomh.org>
parents: 345
diff changeset
   218
} //namespace ns3
605
3a62e5c4de75 rename internet-node.h to i-node-impl.h
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 604
diff changeset
   219
1175
00ad4ec69939 small cleanups
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 936
diff changeset
   220
#endif /* NODE_H */