src/helper/internet-stack-helper.cc
author Nicola Baldo <nbaldo@cttc.es>
Thu, 13 Aug 2009 09:36:53 +0200
changeset 4709 b0743dbc4e55
parent 4695 637b9cacd0b5
child 4712 74ed62336c36
permissions -rw-r--r--
bug 639: add configurable capture size to pcap
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
2833
f3474fd850b2 add missing license headers
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2737
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: 2737
diff changeset
     2
/*
f3474fd850b2 add missing license headers
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2737
diff changeset
     3
 * Copyright (c) 2008 INRIA
f3474fd850b2 add missing license headers
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2737
diff changeset
     4
 *
f3474fd850b2 add missing license headers
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2737
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: 2737
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: 2737
diff changeset
     7
 * published by the Free Software Foundation;
f3474fd850b2 add missing license headers
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2737
diff changeset
     8
 *
f3474fd850b2 add missing license headers
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2737
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: 2737
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: 2737
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: 2737
diff changeset
    12
 * GNU General Public License for more details.
f3474fd850b2 add missing license headers
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2737
diff changeset
    13
 *
f3474fd850b2 add missing license headers
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2737
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: 2737
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: 2737
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: 2737
diff changeset
    17
 *
f3474fd850b2 add missing license headers
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2737
diff changeset
    18
 * Author: Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
4472
e20a31541404 src/ and utils/ changes for IPv4 routing rework
Tom Henderson <tomh@tomh.org>
parents: 4147
diff changeset
    19
 * Author: Faker Moatamri <faker.moatamri@sophia.inria.fr>
e20a31541404 src/ and utils/ changes for IPv4 routing rework
Tom Henderson <tomh@tomh.org>
parents: 4147
diff changeset
    20
 */
e20a31541404 src/ and utils/ changes for IPv4 routing rework
Tom Henderson <tomh@tomh.org>
parents: 4147
diff changeset
    21
e20a31541404 src/ and utils/ changes for IPv4 routing rework
Tom Henderson <tomh@tomh.org>
parents: 4147
diff changeset
    22
/**
e20a31541404 src/ and utils/ changes for IPv4 routing rework
Tom Henderson <tomh@tomh.org>
parents: 4147
diff changeset
    23
 * \ingroup internetStack
e20a31541404 src/ and utils/ changes for IPv4 routing rework
Tom Henderson <tomh@tomh.org>
parents: 4147
diff changeset
    24
 * \defgroup internetStackModel Internet Stack Model
e20a31541404 src/ and utils/ changes for IPv4 routing rework
Tom Henderson <tomh@tomh.org>
parents: 4147
diff changeset
    25
 *
e20a31541404 src/ and utils/ changes for IPv4 routing rework
Tom Henderson <tomh@tomh.org>
parents: 4147
diff changeset
    26
 * \section internetStackTracingModel Tracing in the Internet Stack
e20a31541404 src/ and utils/ changes for IPv4 routing rework
Tom Henderson <tomh@tomh.org>
parents: 4147
diff changeset
    27
 *
e20a31541404 src/ and utils/ changes for IPv4 routing rework
Tom Henderson <tomh@tomh.org>
parents: 4147
diff changeset
    28
 * The internet stack provides a number of trace sources in its various
e20a31541404 src/ and utils/ changes for IPv4 routing rework
Tom Henderson <tomh@tomh.org>
parents: 4147
diff changeset
    29
 * protocol implementations.  These trace sources can be hooked using your own 
e20a31541404 src/ and utils/ changes for IPv4 routing rework
Tom Henderson <tomh@tomh.org>
parents: 4147
diff changeset
    30
 * custom trace code, or you can use our helper functions in some cases to 
e20a31541404 src/ and utils/ changes for IPv4 routing rework
Tom Henderson <tomh@tomh.org>
parents: 4147
diff changeset
    31
 * arrange for tracing to be enabled.
e20a31541404 src/ and utils/ changes for IPv4 routing rework
Tom Henderson <tomh@tomh.org>
parents: 4147
diff changeset
    32
 *
e20a31541404 src/ and utils/ changes for IPv4 routing rework
Tom Henderson <tomh@tomh.org>
parents: 4147
diff changeset
    33
 * \subsection internetStackArpTracingModel Tracing in ARP
e20a31541404 src/ and utils/ changes for IPv4 routing rework
Tom Henderson <tomh@tomh.org>
parents: 4147
diff changeset
    34
 *
e20a31541404 src/ and utils/ changes for IPv4 routing rework
Tom Henderson <tomh@tomh.org>
parents: 4147
diff changeset
    35
 * ARP provides two trace hooks, one in the cache, and one in the layer three
e20a31541404 src/ and utils/ changes for IPv4 routing rework
Tom Henderson <tomh@tomh.org>
parents: 4147
diff changeset
    36
 * protocol.  The trace accessor in the cache is given the name "Drop."  When
e20a31541404 src/ and utils/ changes for IPv4 routing rework
Tom Henderson <tomh@tomh.org>
parents: 4147
diff changeset
    37
 * a packet is transmitted over an interface that requires ARP, it is first
e20a31541404 src/ and utils/ changes for IPv4 routing rework
Tom Henderson <tomh@tomh.org>
parents: 4147
diff changeset
    38
 * queued for transmission in the ARP cache until the required MAC address is
e20a31541404 src/ and utils/ changes for IPv4 routing rework
Tom Henderson <tomh@tomh.org>
parents: 4147
diff changeset
    39
 * resolved.  There are a number of retries that may be done trying to get the 
e20a31541404 src/ and utils/ changes for IPv4 routing rework
Tom Henderson <tomh@tomh.org>
parents: 4147
diff changeset
    40
 * address, and if the maximum retry count is exceeded the packet in question 
e20a31541404 src/ and utils/ changes for IPv4 routing rework
Tom Henderson <tomh@tomh.org>
parents: 4147
diff changeset
    41
 * is dropped by ARP.  The single trace hook in the ARP cache is called,
e20a31541404 src/ and utils/ changes for IPv4 routing rework
Tom Henderson <tomh@tomh.org>
parents: 4147
diff changeset
    42
 *
e20a31541404 src/ and utils/ changes for IPv4 routing rework
Tom Henderson <tomh@tomh.org>
parents: 4147
diff changeset
    43
 * - If an outbound packet is placed in the ARP cache pending address resolution
e20a31541404 src/ and utils/ changes for IPv4 routing rework
Tom Henderson <tomh@tomh.org>
parents: 4147
diff changeset
    44
 *   and no resolution can be made within the maximum retry count, the outbound 
e20a31541404 src/ and utils/ changes for IPv4 routing rework
Tom Henderson <tomh@tomh.org>
parents: 4147
diff changeset
    45
 *   packet is dropped and this trace is fired;
e20a31541404 src/ and utils/ changes for IPv4 routing rework
Tom Henderson <tomh@tomh.org>
parents: 4147
diff changeset
    46
 *
e20a31541404 src/ and utils/ changes for IPv4 routing rework
Tom Henderson <tomh@tomh.org>
parents: 4147
diff changeset
    47
 * A second trace hook lives in the ARP L3 protocol (also named "Drop") and may 
e20a31541404 src/ and utils/ changes for IPv4 routing rework
Tom Henderson <tomh@tomh.org>
parents: 4147
diff changeset
    48
 * be called for a  number of reasons.
e20a31541404 src/ and utils/ changes for IPv4 routing rework
Tom Henderson <tomh@tomh.org>
parents: 4147
diff changeset
    49
 *
e20a31541404 src/ and utils/ changes for IPv4 routing rework
Tom Henderson <tomh@tomh.org>
parents: 4147
diff changeset
    50
 * - If an ARP reply is received for an entry that is not waiting for a reply,
e20a31541404 src/ and utils/ changes for IPv4 routing rework
Tom Henderson <tomh@tomh.org>
parents: 4147
diff changeset
    51
 *   the ARP reply packet is dropped and this trace is fired;
e20a31541404 src/ and utils/ changes for IPv4 routing rework
Tom Henderson <tomh@tomh.org>
parents: 4147
diff changeset
    52
 * - If an ARP reply is received for a non-existant entry, the ARP reply packet 
e20a31541404 src/ and utils/ changes for IPv4 routing rework
Tom Henderson <tomh@tomh.org>
parents: 4147
diff changeset
    53
 *   is dropped and this trace is fired;
e20a31541404 src/ and utils/ changes for IPv4 routing rework
Tom Henderson <tomh@tomh.org>
parents: 4147
diff changeset
    54
 * - If an ARP cache entry is in the DEAD state (has timed out) and an ARP reply
e20a31541404 src/ and utils/ changes for IPv4 routing rework
Tom Henderson <tomh@tomh.org>
parents: 4147
diff changeset
    55
 *   packet is received, the reply packet is dropped and this trace is fired.
e20a31541404 src/ and utils/ changes for IPv4 routing rework
Tom Henderson <tomh@tomh.org>
parents: 4147
diff changeset
    56
 * - Each ARP cache entry has a queue of pending packets.  If the size of the
e20a31541404 src/ and utils/ changes for IPv4 routing rework
Tom Henderson <tomh@tomh.org>
parents: 4147
diff changeset
    57
 *   queue is exceeded, the outbound packet is dropped and this trace is fired.
e20a31541404 src/ and utils/ changes for IPv4 routing rework
Tom Henderson <tomh@tomh.org>
parents: 4147
diff changeset
    58
 *
e20a31541404 src/ and utils/ changes for IPv4 routing rework
Tom Henderson <tomh@tomh.org>
parents: 4147
diff changeset
    59
 * \subsection internetStackIpv4TracingModel Tracing in IPv4
e20a31541404 src/ and utils/ changes for IPv4 routing rework
Tom Henderson <tomh@tomh.org>
parents: 4147
diff changeset
    60
 *
e20a31541404 src/ and utils/ changes for IPv4 routing rework
Tom Henderson <tomh@tomh.org>
parents: 4147
diff changeset
    61
 * The IPv4 layer three protocol provides three trace hooks.  These are the 
e20a31541404 src/ and utils/ changes for IPv4 routing rework
Tom Henderson <tomh@tomh.org>
parents: 4147
diff changeset
    62
 * "Tx" (ns3::Ipv4L3Protocol::m_txTrace), "Rx" (ns3::Ipv4L3Protocol::m_rxTrace) 
e20a31541404 src/ and utils/ changes for IPv4 routing rework
Tom Henderson <tomh@tomh.org>
parents: 4147
diff changeset
    63
 * and "Drop" (ns3::Ipv4L3Protocol::m_dropTrace) trace sources.
e20a31541404 src/ and utils/ changes for IPv4 routing rework
Tom Henderson <tomh@tomh.org>
parents: 4147
diff changeset
    64
 *
e20a31541404 src/ and utils/ changes for IPv4 routing rework
Tom Henderson <tomh@tomh.org>
parents: 4147
diff changeset
    65
 * The "Tx" trace is fired in a number of situations, all of which indicate that
e20a31541404 src/ and utils/ changes for IPv4 routing rework
Tom Henderson <tomh@tomh.org>
parents: 4147
diff changeset
    66
 * a given packet is about to be sent down to a given ns3::Ipv4Interface.
e20a31541404 src/ and utils/ changes for IPv4 routing rework
Tom Henderson <tomh@tomh.org>
parents: 4147
diff changeset
    67
 *
e20a31541404 src/ and utils/ changes for IPv4 routing rework
Tom Henderson <tomh@tomh.org>
parents: 4147
diff changeset
    68
 * - In the case of a packet destined for the broadcast address, the 
e20a31541404 src/ and utils/ changes for IPv4 routing rework
Tom Henderson <tomh@tomh.org>
parents: 4147
diff changeset
    69
 *   Ipv4InterfaceList is iterated and for every interface that is up and can
e20a31541404 src/ and utils/ changes for IPv4 routing rework
Tom Henderson <tomh@tomh.org>
parents: 4147
diff changeset
    70
 *   fragment the packet or has a large enough MTU to transmit the packet,
e20a31541404 src/ and utils/ changes for IPv4 routing rework
Tom Henderson <tomh@tomh.org>
parents: 4147
diff changeset
    71
 *   the trace is hit.  See ns3::Ipv4L3Protocol::Send.
e20a31541404 src/ and utils/ changes for IPv4 routing rework
Tom Henderson <tomh@tomh.org>
parents: 4147
diff changeset
    72
 *
e20a31541404 src/ and utils/ changes for IPv4 routing rework
Tom Henderson <tomh@tomh.org>
parents: 4147
diff changeset
    73
 * - In the case of a packet that needs routing, the "Tx" trace may be fired
e20a31541404 src/ and utils/ changes for IPv4 routing rework
Tom Henderson <tomh@tomh.org>
parents: 4147
diff changeset
    74
 *   just before a packet is sent to the interface appropriate to the default 
e20a31541404 src/ and utils/ changes for IPv4 routing rework
Tom Henderson <tomh@tomh.org>
parents: 4147
diff changeset
    75
 *   gateway.  See ns3::Ipv4L3Protocol::SendRealOut.
e20a31541404 src/ and utils/ changes for IPv4 routing rework
Tom Henderson <tomh@tomh.org>
parents: 4147
diff changeset
    76
 *
e20a31541404 src/ and utils/ changes for IPv4 routing rework
Tom Henderson <tomh@tomh.org>
parents: 4147
diff changeset
    77
 * - Also in the case of a packet that needs routing, the "Tx" trace may be 
e20a31541404 src/ and utils/ changes for IPv4 routing rework
Tom Henderson <tomh@tomh.org>
parents: 4147
diff changeset
    78
 *   fired just before a packet is sent to the outgoing interface appropriate
e20a31541404 src/ and utils/ changes for IPv4 routing rework
Tom Henderson <tomh@tomh.org>
parents: 4147
diff changeset
    79
 *   to the discovered route.  See ns3::Ipv4L3Protocol::SendRealOut.
e20a31541404 src/ and utils/ changes for IPv4 routing rework
Tom Henderson <tomh@tomh.org>
parents: 4147
diff changeset
    80
 *
e20a31541404 src/ and utils/ changes for IPv4 routing rework
Tom Henderson <tomh@tomh.org>
parents: 4147
diff changeset
    81
 * The "Rx" trace is fired when a packet is passed from the device up to the
e20a31541404 src/ and utils/ changes for IPv4 routing rework
Tom Henderson <tomh@tomh.org>
parents: 4147
diff changeset
    82
 * ns3::Ipv4L3Protocol::Receive function.
e20a31541404 src/ and utils/ changes for IPv4 routing rework
Tom Henderson <tomh@tomh.org>
parents: 4147
diff changeset
    83
 *
e20a31541404 src/ and utils/ changes for IPv4 routing rework
Tom Henderson <tomh@tomh.org>
parents: 4147
diff changeset
    84
 * - In the receive function, the Ipv4InterfaceList is iterated, and if the
e20a31541404 src/ and utils/ changes for IPv4 routing rework
Tom Henderson <tomh@tomh.org>
parents: 4147
diff changeset
    85
 *   Ipv4Interface corresponding to the receiving device is fount to be in the
e20a31541404 src/ and utils/ changes for IPv4 routing rework
Tom Henderson <tomh@tomh.org>
parents: 4147
diff changeset
    86
 *   UP state, the trace is fired.
e20a31541404 src/ and utils/ changes for IPv4 routing rework
Tom Henderson <tomh@tomh.org>
parents: 4147
diff changeset
    87
 *
e20a31541404 src/ and utils/ changes for IPv4 routing rework
Tom Henderson <tomh@tomh.org>
parents: 4147
diff changeset
    88
 * The "Drop" trace is fired in any case where the packet is dropped (in both
e20a31541404 src/ and utils/ changes for IPv4 routing rework
Tom Henderson <tomh@tomh.org>
parents: 4147
diff changeset
    89
 * the transmit and receive paths).
e20a31541404 src/ and utils/ changes for IPv4 routing rework
Tom Henderson <tomh@tomh.org>
parents: 4147
diff changeset
    90
 *
e20a31541404 src/ and utils/ changes for IPv4 routing rework
Tom Henderson <tomh@tomh.org>
parents: 4147
diff changeset
    91
 * - In the ns3::Ipv4Interface::Receive function, the packet is dropped and the
e20a31541404 src/ and utils/ changes for IPv4 routing rework
Tom Henderson <tomh@tomh.org>
parents: 4147
diff changeset
    92
 *   drop trace is hit if the interface corresponding to the receiving device
e20a31541404 src/ and utils/ changes for IPv4 routing rework
Tom Henderson <tomh@tomh.org>
parents: 4147
diff changeset
    93
 *   is in the DOWN state.
e20a31541404 src/ and utils/ changes for IPv4 routing rework
Tom Henderson <tomh@tomh.org>
parents: 4147
diff changeset
    94
 *
e20a31541404 src/ and utils/ changes for IPv4 routing rework
Tom Henderson <tomh@tomh.org>
parents: 4147
diff changeset
    95
 * - Also in the ns3::Ipv4Interface::Receive function, the packet is dropped and
e20a31541404 src/ and utils/ changes for IPv4 routing rework
Tom Henderson <tomh@tomh.org>
parents: 4147
diff changeset
    96
 *   the drop trace is hit if the checksum is found to be bad.
e20a31541404 src/ and utils/ changes for IPv4 routing rework
Tom Henderson <tomh@tomh.org>
parents: 4147
diff changeset
    97
 *
e20a31541404 src/ and utils/ changes for IPv4 routing rework
Tom Henderson <tomh@tomh.org>
parents: 4147
diff changeset
    98
 * - In ns3::Ipv4L3Protocol::Send, an outgoing packet bound for the broadcast
e20a31541404 src/ and utils/ changes for IPv4 routing rework
Tom Henderson <tomh@tomh.org>
parents: 4147
diff changeset
    99
 *   address is dropped and the "Drop" trace is fired if the "don't fragement"
e20a31541404 src/ and utils/ changes for IPv4 routing rework
Tom Henderson <tomh@tomh.org>
parents: 4147
diff changeset
   100
 *   bit is set and fragmentation is available and required.
e20a31541404 src/ and utils/ changes for IPv4 routing rework
Tom Henderson <tomh@tomh.org>
parents: 4147
diff changeset
   101
 *
e20a31541404 src/ and utils/ changes for IPv4 routing rework
Tom Henderson <tomh@tomh.org>
parents: 4147
diff changeset
   102
 * - Also in ns3::Ipv4L3Protocol::Send, an outgoing packet destined for the 
e20a31541404 src/ and utils/ changes for IPv4 routing rework
Tom Henderson <tomh@tomh.org>
parents: 4147
diff changeset
   103
 *   broadcast address is dropped and the "Drop" trace is hit if fragmentation
e20a31541404 src/ and utils/ changes for IPv4 routing rework
Tom Henderson <tomh@tomh.org>
parents: 4147
diff changeset
   104
 *   is not available and is required (MTU < packet size).
e20a31541404 src/ and utils/ changes for IPv4 routing rework
Tom Henderson <tomh@tomh.org>
parents: 4147
diff changeset
   105
 *
e20a31541404 src/ and utils/ changes for IPv4 routing rework
Tom Henderson <tomh@tomh.org>
parents: 4147
diff changeset
   106
 * - In the case of a broadcast address, an outgoing packet is cloned for each
e20a31541404 src/ and utils/ changes for IPv4 routing rework
Tom Henderson <tomh@tomh.org>
parents: 4147
diff changeset
   107
 *   outgoing interface.  If any of the interfaces is in the DOWN state, the 
e20a31541404 src/ and utils/ changes for IPv4 routing rework
Tom Henderson <tomh@tomh.org>
parents: 4147
diff changeset
   108
 *   "Drop" trace event fires with a reference to the copied packet.
e20a31541404 src/ and utils/ changes for IPv4 routing rework
Tom Henderson <tomh@tomh.org>
parents: 4147
diff changeset
   109
 *
e20a31541404 src/ and utils/ changes for IPv4 routing rework
Tom Henderson <tomh@tomh.org>
parents: 4147
diff changeset
   110
 * - In the case of a packet requiring a route, an outgoing packet is dropped
e20a31541404 src/ and utils/ changes for IPv4 routing rework
Tom Henderson <tomh@tomh.org>
parents: 4147
diff changeset
   111
 *   and the "Drop" trace event fires if no route to the remote host is found.
e20a31541404 src/ and utils/ changes for IPv4 routing rework
Tom Henderson <tomh@tomh.org>
parents: 4147
diff changeset
   112
 *
e20a31541404 src/ and utils/ changes for IPv4 routing rework
Tom Henderson <tomh@tomh.org>
parents: 4147
diff changeset
   113
 * - In ns3::Ipv4L3Protocol::SendRealOut, an outgoing packet being routed
e20a31541404 src/ and utils/ changes for IPv4 routing rework
Tom Henderson <tomh@tomh.org>
parents: 4147
diff changeset
   114
 *   is dropped and the "Drop" trace is fired if the "don't fragement" bit is 
e20a31541404 src/ and utils/ changes for IPv4 routing rework
Tom Henderson <tomh@tomh.org>
parents: 4147
diff changeset
   115
 *   set and fragmentation is available and required.
e20a31541404 src/ and utils/ changes for IPv4 routing rework
Tom Henderson <tomh@tomh.org>
parents: 4147
diff changeset
   116
 *
e20a31541404 src/ and utils/ changes for IPv4 routing rework
Tom Henderson <tomh@tomh.org>
parents: 4147
diff changeset
   117
 * - Also in ns3::Ipv4L3Protocol::SendRealOut, an outgoing packet being routed
e20a31541404 src/ and utils/ changes for IPv4 routing rework
Tom Henderson <tomh@tomh.org>
parents: 4147
diff changeset
   118
 *   is dropped and the "Drop" trace is hit if fragmentation is not available 
e20a31541404 src/ and utils/ changes for IPv4 routing rework
Tom Henderson <tomh@tomh.org>
parents: 4147
diff changeset
   119
 *   and is required (MTU < packet size).
e20a31541404 src/ and utils/ changes for IPv4 routing rework
Tom Henderson <tomh@tomh.org>
parents: 4147
diff changeset
   120
 *
e20a31541404 src/ and utils/ changes for IPv4 routing rework
Tom Henderson <tomh@tomh.org>
parents: 4147
diff changeset
   121
 * - An outgoing packet being routed is dropped and the "Drop" trace event fires
e20a31541404 src/ and utils/ changes for IPv4 routing rework
Tom Henderson <tomh@tomh.org>
parents: 4147
diff changeset
   122
 *   if the required Ipv4Interface is in the DOWN state.
e20a31541404 src/ and utils/ changes for IPv4 routing rework
Tom Henderson <tomh@tomh.org>
parents: 4147
diff changeset
   123
 *
e20a31541404 src/ and utils/ changes for IPv4 routing rework
Tom Henderson <tomh@tomh.org>
parents: 4147
diff changeset
   124
 * - If a packet is being forwarded, and the TTL is exceeded (see
e20a31541404 src/ and utils/ changes for IPv4 routing rework
Tom Henderson <tomh@tomh.org>
parents: 4147
diff changeset
   125
 *   ns3::Ipv4L3Protocol::DoForward), the packet is dropped and the "Drop" trace 
e20a31541404 src/ and utils/ changes for IPv4 routing rework
Tom Henderson <tomh@tomh.org>
parents: 4147
diff changeset
   126
 *   event is fired.
e20a31541404 src/ and utils/ changes for IPv4 routing rework
Tom Henderson <tomh@tomh.org>
parents: 4147
diff changeset
   127
 *
e20a31541404 src/ and utils/ changes for IPv4 routing rework
Tom Henderson <tomh@tomh.org>
parents: 4147
diff changeset
   128
 * \subsection internetStackNs3TCPTracingModel Tracing in ns-3 TCP
e20a31541404 src/ and utils/ changes for IPv4 routing rework
Tom Henderson <tomh@tomh.org>
parents: 4147
diff changeset
   129
 *
e20a31541404 src/ and utils/ changes for IPv4 routing rework
Tom Henderson <tomh@tomh.org>
parents: 4147
diff changeset
   130
 * There is currently one trace source in the ns-3 TCP implementation named
e20a31541404 src/ and utils/ changes for IPv4 routing rework
Tom Henderson <tomh@tomh.org>
parents: 4147
diff changeset
   131
 * "CongestionWindow" (see ns3::TcpSocketImpl::m_cWnd).  This is set in a number
e20a31541404 src/ and utils/ changes for IPv4 routing rework
Tom Henderson <tomh@tomh.org>
parents: 4147
diff changeset
   132
 * of places (see file tcp-socket-impl.cc) whenever the value of the congestion
e20a31541404 src/ and utils/ changes for IPv4 routing rework
Tom Henderson <tomh@tomh.org>
parents: 4147
diff changeset
   133
 * window is changed.
e20a31541404 src/ and utils/ changes for IPv4 routing rework
Tom Henderson <tomh@tomh.org>
parents: 4147
diff changeset
   134
 *
e20a31541404 src/ and utils/ changes for IPv4 routing rework
Tom Henderson <tomh@tomh.org>
parents: 4147
diff changeset
   135
 * \subsection internetStackNscTCPTracingModel Tracing in NSC TCP
e20a31541404 src/ and utils/ changes for IPv4 routing rework
Tom Henderson <tomh@tomh.org>
parents: 4147
diff changeset
   136
 *
e20a31541404 src/ and utils/ changes for IPv4 routing rework
Tom Henderson <tomh@tomh.org>
parents: 4147
diff changeset
   137
 * There is currently one trace source in the Network Simulation Cradle TCP 
e20a31541404 src/ and utils/ changes for IPv4 routing rework
Tom Henderson <tomh@tomh.org>
parents: 4147
diff changeset
   138
 * implementation named "CongestionWindow" (see ns3::NscTcpSocketImpl::m_cWnd).
e20a31541404 src/ and utils/ changes for IPv4 routing rework
Tom Henderson <tomh@tomh.org>
parents: 4147
diff changeset
   139
 * This is set in a number of places (see file nsc-tcp-socket-impl.cc) when 
e20a31541404 src/ and utils/ changes for IPv4 routing rework
Tom Henderson <tomh@tomh.org>
parents: 4147
diff changeset
   140
 * the value of the cogestion window is initially set.  Note that this is not
e20a31541404 src/ and utils/ changes for IPv4 routing rework
Tom Henderson <tomh@tomh.org>
parents: 4147
diff changeset
   141
 * instrumented from the underlying TCP implementaion.
e20a31541404 src/ and utils/ changes for IPv4 routing rework
Tom Henderson <tomh@tomh.org>
parents: 4147
diff changeset
   142
 *
e20a31541404 src/ and utils/ changes for IPv4 routing rework
Tom Henderson <tomh@tomh.org>
parents: 4147
diff changeset
   143
 * \subsection internetStackNs3UdpTracingModel Tracing in ns-3 UDP
e20a31541404 src/ and utils/ changes for IPv4 routing rework
Tom Henderson <tomh@tomh.org>
parents: 4147
diff changeset
   144
 *
e20a31541404 src/ and utils/ changes for IPv4 routing rework
Tom Henderson <tomh@tomh.org>
parents: 4147
diff changeset
   145
 * There is currently one trace source in the ns-3 UDP implementation named
e20a31541404 src/ and utils/ changes for IPv4 routing rework
Tom Henderson <tomh@tomh.org>
parents: 4147
diff changeset
   146
 * "Drop" (see ns3::UdpSocketImpl::m_dropTrace).  This is set when a packet
e20a31541404 src/ and utils/ changes for IPv4 routing rework
Tom Henderson <tomh@tomh.org>
parents: 4147
diff changeset
   147
 * is received in ns3::UdpSocketImpl::ForwardUp and the receive buffer cannot
e20a31541404 src/ and utils/ changes for IPv4 routing rework
Tom Henderson <tomh@tomh.org>
parents: 4147
diff changeset
   148
 * accomodate the encapsulated data.
2833
f3474fd850b2 add missing license headers
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2737
diff changeset
   149
 */
3848
affd0834debc address bug 393 (need to overload Install methods for python)
Craig Dowell <craigdo@ee.washington.edu>
parents: 3579
diff changeset
   150
2995
b72805b3ca69 Align helper API use of Install()
Tom Henderson <tomh@tomh.org>
parents: 2887
diff changeset
   151
#include "ns3/assert.h"
b72805b3ca69 Align helper API use of Install()
Tom Henderson <tomh@tomh.org>
parents: 2887
diff changeset
   152
#include "ns3/log.h"
b72805b3ca69 Align helper API use of Install()
Tom Henderson <tomh@tomh.org>
parents: 2887
diff changeset
   153
#include "ns3/object.h"
4147
5d8530130930 rename object-names.{cc,h} to names.{cc,h} per convention
Craig Dowell <craigdo@ee.washington.edu>
parents: 4140
diff changeset
   154
#include "ns3/names.h"
2995
b72805b3ca69 Align helper API use of Install()
Tom Henderson <tomh@tomh.org>
parents: 2887
diff changeset
   155
#include "ns3/ipv4.h"
2737
c692287f91da aggregate PacketSocketFactory unconditionally.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2708
diff changeset
   156
#include "ns3/packet-socket-factory.h"
2845
2398826af6b4 Add IP layer tracing helpers to InternetStackHelper
Raj Bhattacharjea <raj.b@gatech.edu>
parents: 2834
diff changeset
   157
#include "ns3/config.h"
3009
db5fab391eac bug 170
Craig Dowell <craigdo@ee.washington.edu>
parents: 2996
diff changeset
   158
#include "ns3/simulator.h"
4472
e20a31541404 src/ and utils/ changes for IPv4 routing rework
Tom Henderson <tomh@tomh.org>
parents: 4147
diff changeset
   159
#include "ns3/string.h"
e20a31541404 src/ and utils/ changes for IPv4 routing rework
Tom Henderson <tomh@tomh.org>
parents: 4147
diff changeset
   160
#include "ns3/net-device.h"
e20a31541404 src/ and utils/ changes for IPv4 routing rework
Tom Henderson <tomh@tomh.org>
parents: 4147
diff changeset
   161
#include "ns3/callback.h"
e20a31541404 src/ and utils/ changes for IPv4 routing rework
Tom Henderson <tomh@tomh.org>
parents: 4147
diff changeset
   162
#include "ns3/node.h"
e20a31541404 src/ and utils/ changes for IPv4 routing rework
Tom Henderson <tomh@tomh.org>
parents: 4147
diff changeset
   163
#include "ns3/core-config.h"
4616
a84f60b6cd12 bug 600: lower the default routing priority of Ipv4GlobalRouting; move to helper
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 4573
diff changeset
   164
#include "internet-stack-helper.h"
a84f60b6cd12 bug 600: lower the default routing priority of Ipv4GlobalRouting; move to helper
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 4573
diff changeset
   165
#include "ipv4-list-routing-helper.h"
a84f60b6cd12 bug 600: lower the default routing priority of Ipv4GlobalRouting; move to helper
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 4573
diff changeset
   166
#include "ipv4-static-routing-helper.h"
a84f60b6cd12 bug 600: lower the default routing priority of Ipv4GlobalRouting; move to helper
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 4573
diff changeset
   167
#include "ipv4-global-routing-helper.h"
3365
6409d2460601 bug 245: build failure with gcc 4.3.x
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 3009
diff changeset
   168
#include <limits>
2708
83cc896e501c InternetStackHelper.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   169
83cc896e501c InternetStackHelper.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   170
namespace ns3 {
83cc896e501c InternetStackHelper.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   171
2845
2398826af6b4 Add IP layer tracing helpers to InternetStackHelper
Raj Bhattacharjea <raj.b@gatech.edu>
parents: 2834
diff changeset
   172
std::vector<InternetStackHelper::Trace> InternetStackHelper::m_traces;
2398826af6b4 Add IP layer tracing helpers to InternetStackHelper
Raj Bhattacharjea <raj.b@gatech.edu>
parents: 2834
diff changeset
   173
std::string InternetStackHelper::m_pcapBaseFilename;
4695
637b9cacd0b5 bug 642: allow multiple InternetStackHelpers to be instantiated
Tom Henderson <tomh@tomh.org>
parents: 4616
diff changeset
   174
bool InternetStackHelper::m_isInitialized = false;
2845
2398826af6b4 Add IP layer tracing helpers to InternetStackHelper
Raj Bhattacharjea <raj.b@gatech.edu>
parents: 2834
diff changeset
   175
4472
e20a31541404 src/ and utils/ changes for IPv4 routing rework
Tom Henderson <tomh@tomh.org>
parents: 4147
diff changeset
   176
InternetStackHelper::InternetStackHelper ()
3579
9e5eaef3e082 nsc: enable network simulation cradle
Florian Westphal <fw@strlen.de>
parents: 3365
diff changeset
   177
{
4472
e20a31541404 src/ and utils/ changes for IPv4 routing rework
Tom Henderson <tomh@tomh.org>
parents: 4147
diff changeset
   178
  SetTcp ("ns3::TcpL4Protocol");
4616
a84f60b6cd12 bug 600: lower the default routing priority of Ipv4GlobalRouting; move to helper
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 4573
diff changeset
   179
  static Ipv4StaticRoutingHelper staticRouting;
a84f60b6cd12 bug 600: lower the default routing priority of Ipv4GlobalRouting; move to helper
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 4573
diff changeset
   180
  static Ipv4GlobalRoutingHelper globalRouting;
a84f60b6cd12 bug 600: lower the default routing priority of Ipv4GlobalRouting; move to helper
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 4573
diff changeset
   181
  static Ipv4ListRoutingHelper listRouting;
4695
637b9cacd0b5 bug 642: allow multiple InternetStackHelpers to be instantiated
Tom Henderson <tomh@tomh.org>
parents: 4616
diff changeset
   182
  if (m_isInitialized == false)
637b9cacd0b5 bug 642: allow multiple InternetStackHelpers to be instantiated
Tom Henderson <tomh@tomh.org>
parents: 4616
diff changeset
   183
    {
637b9cacd0b5 bug 642: allow multiple InternetStackHelpers to be instantiated
Tom Henderson <tomh@tomh.org>
parents: 4616
diff changeset
   184
      // Only add these once
637b9cacd0b5 bug 642: allow multiple InternetStackHelpers to be instantiated
Tom Henderson <tomh@tomh.org>
parents: 4616
diff changeset
   185
      listRouting.Add (staticRouting, 0);
637b9cacd0b5 bug 642: allow multiple InternetStackHelpers to be instantiated
Tom Henderson <tomh@tomh.org>
parents: 4616
diff changeset
   186
      listRouting.Add (globalRouting, -10);
637b9cacd0b5 bug 642: allow multiple InternetStackHelpers to be instantiated
Tom Henderson <tomh@tomh.org>
parents: 4616
diff changeset
   187
      m_isInitialized = true;
637b9cacd0b5 bug 642: allow multiple InternetStackHelpers to be instantiated
Tom Henderson <tomh@tomh.org>
parents: 4616
diff changeset
   188
    }
4616
a84f60b6cd12 bug 600: lower the default routing priority of Ipv4GlobalRouting; move to helper
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 4573
diff changeset
   189
  SetRoutingHelper (listRouting);
a84f60b6cd12 bug 600: lower the default routing priority of Ipv4GlobalRouting; move to helper
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 4573
diff changeset
   190
}
a84f60b6cd12 bug 600: lower the default routing priority of Ipv4GlobalRouting; move to helper
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 4573
diff changeset
   191
a84f60b6cd12 bug 600: lower the default routing priority of Ipv4GlobalRouting; move to helper
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 4573
diff changeset
   192
void 
a84f60b6cd12 bug 600: lower the default routing priority of Ipv4GlobalRouting; move to helper
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 4573
diff changeset
   193
InternetStackHelper::SetRoutingHelper (const Ipv4RoutingHelper &routing)
a84f60b6cd12 bug 600: lower the default routing priority of Ipv4GlobalRouting; move to helper
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 4573
diff changeset
   194
{
a84f60b6cd12 bug 600: lower the default routing priority of Ipv4GlobalRouting; move to helper
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 4573
diff changeset
   195
  m_routing = &routing;
3579
9e5eaef3e082 nsc: enable network simulation cradle
Florian Westphal <fw@strlen.de>
parents: 3365
diff changeset
   196
}
9e5eaef3e082 nsc: enable network simulation cradle
Florian Westphal <fw@strlen.de>
parents: 3365
diff changeset
   197
3009
db5fab391eac bug 170
Craig Dowell <craigdo@ee.washington.edu>
parents: 2996
diff changeset
   198
void
db5fab391eac bug 170
Craig Dowell <craigdo@ee.washington.edu>
parents: 2996
diff changeset
   199
InternetStackHelper::Cleanup (void)
db5fab391eac bug 170
Craig Dowell <craigdo@ee.washington.edu>
parents: 2996
diff changeset
   200
{
db5fab391eac bug 170
Craig Dowell <craigdo@ee.washington.edu>
parents: 2996
diff changeset
   201
  uint32_t illegal = std::numeric_limits<uint32_t>::max();
db5fab391eac bug 170
Craig Dowell <craigdo@ee.washington.edu>
parents: 2996
diff changeset
   202
db5fab391eac bug 170
Craig Dowell <craigdo@ee.washington.edu>
parents: 2996
diff changeset
   203
  for (std::vector<Trace>::iterator i = m_traces.begin ();
db5fab391eac bug 170
Craig Dowell <craigdo@ee.washington.edu>
parents: 2996
diff changeset
   204
       i != m_traces.end (); i++)
db5fab391eac bug 170
Craig Dowell <craigdo@ee.washington.edu>
parents: 2996
diff changeset
   205
  {
db5fab391eac bug 170
Craig Dowell <craigdo@ee.washington.edu>
parents: 2996
diff changeset
   206
    i->nodeId = illegal;
db5fab391eac bug 170
Craig Dowell <craigdo@ee.washington.edu>
parents: 2996
diff changeset
   207
    i->interfaceId = illegal;
db5fab391eac bug 170
Craig Dowell <craigdo@ee.washington.edu>
parents: 2996
diff changeset
   208
    i->writer = 0;
db5fab391eac bug 170
Craig Dowell <craigdo@ee.washington.edu>
parents: 2996
diff changeset
   209
  }
db5fab391eac bug 170
Craig Dowell <craigdo@ee.washington.edu>
parents: 2996
diff changeset
   210
  m_traces.clear ();
db5fab391eac bug 170
Craig Dowell <craigdo@ee.washington.edu>
parents: 2996
diff changeset
   211
}
db5fab391eac bug 170
Craig Dowell <craigdo@ee.washington.edu>
parents: 2996
diff changeset
   212
3579
9e5eaef3e082 nsc: enable network simulation cradle
Florian Westphal <fw@strlen.de>
parents: 3365
diff changeset
   213
void
4472
e20a31541404 src/ and utils/ changes for IPv4 routing rework
Tom Henderson <tomh@tomh.org>
parents: 4147
diff changeset
   214
InternetStackHelper::SetTcp (const std::string tid)
3579
9e5eaef3e082 nsc: enable network simulation cradle
Florian Westphal <fw@strlen.de>
parents: 3365
diff changeset
   215
{
4472
e20a31541404 src/ and utils/ changes for IPv4 routing rework
Tom Henderson <tomh@tomh.org>
parents: 4147
diff changeset
   216
  m_tcpFactory.SetTypeId (tid);
e20a31541404 src/ and utils/ changes for IPv4 routing rework
Tom Henderson <tomh@tomh.org>
parents: 4147
diff changeset
   217
}
e20a31541404 src/ and utils/ changes for IPv4 routing rework
Tom Henderson <tomh@tomh.org>
parents: 4147
diff changeset
   218
e20a31541404 src/ and utils/ changes for IPv4 routing rework
Tom Henderson <tomh@tomh.org>
parents: 4147
diff changeset
   219
void 
e20a31541404 src/ and utils/ changes for IPv4 routing rework
Tom Henderson <tomh@tomh.org>
parents: 4147
diff changeset
   220
InternetStackHelper::SetTcp (std::string tid, std::string n0, const AttributeValue &v0)
e20a31541404 src/ and utils/ changes for IPv4 routing rework
Tom Henderson <tomh@tomh.org>
parents: 4147
diff changeset
   221
{
e20a31541404 src/ and utils/ changes for IPv4 routing rework
Tom Henderson <tomh@tomh.org>
parents: 4147
diff changeset
   222
  m_tcpFactory.SetTypeId (tid);
e20a31541404 src/ and utils/ changes for IPv4 routing rework
Tom Henderson <tomh@tomh.org>
parents: 4147
diff changeset
   223
  m_tcpFactory.Set (n0,v0);
3579
9e5eaef3e082 nsc: enable network simulation cradle
Florian Westphal <fw@strlen.de>
parents: 3365
diff changeset
   224
}
9e5eaef3e082 nsc: enable network simulation cradle
Florian Westphal <fw@strlen.de>
parents: 3365
diff changeset
   225
2708
83cc896e501c InternetStackHelper.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   226
void 
3848
affd0834debc address bug 393 (need to overload Install methods for python)
Craig Dowell <craigdo@ee.washington.edu>
parents: 3579
diff changeset
   227
InternetStackHelper::Install (NodeContainer c) const
2708
83cc896e501c InternetStackHelper.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   228
{
83cc896e501c InternetStackHelper.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   229
  for (NodeContainer::Iterator i = c.Begin (); i != c.End (); ++i)
83cc896e501c InternetStackHelper.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   230
    {
3848
affd0834debc address bug 393 (need to overload Install methods for python)
Craig Dowell <craigdo@ee.washington.edu>
parents: 3579
diff changeset
   231
      Install (*i);
affd0834debc address bug 393 (need to overload Install methods for python)
Craig Dowell <craigdo@ee.washington.edu>
parents: 3579
diff changeset
   232
    }
affd0834debc address bug 393 (need to overload Install methods for python)
Craig Dowell <craigdo@ee.washington.edu>
parents: 3579
diff changeset
   233
}
3579
9e5eaef3e082 nsc: enable network simulation cradle
Florian Westphal <fw@strlen.de>
parents: 3365
diff changeset
   234
4616
a84f60b6cd12 bug 600: lower the default routing priority of Ipv4GlobalRouting; move to helper
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 4573
diff changeset
   235
void 
a84f60b6cd12 bug 600: lower the default routing priority of Ipv4GlobalRouting; move to helper
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 4573
diff changeset
   236
InternetStackHelper::InstallAll (void) const
a84f60b6cd12 bug 600: lower the default routing priority of Ipv4GlobalRouting; move to helper
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 4573
diff changeset
   237
{
a84f60b6cd12 bug 600: lower the default routing priority of Ipv4GlobalRouting; move to helper
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 4573
diff changeset
   238
  Install (NodeContainer::GetGlobal ());
a84f60b6cd12 bug 600: lower the default routing priority of Ipv4GlobalRouting; move to helper
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 4573
diff changeset
   239
}
a84f60b6cd12 bug 600: lower the default routing priority of Ipv4GlobalRouting; move to helper
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 4573
diff changeset
   240
a84f60b6cd12 bug 600: lower the default routing priority of Ipv4GlobalRouting; move to helper
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 4573
diff changeset
   241
void
a84f60b6cd12 bug 600: lower the default routing priority of Ipv4GlobalRouting; move to helper
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 4573
diff changeset
   242
InternetStackHelper::CreateAndAggregateObjectFromTypeId (Ptr<Node> node, const std::string typeId)
4472
e20a31541404 src/ and utils/ changes for IPv4 routing rework
Tom Henderson <tomh@tomh.org>
parents: 4147
diff changeset
   243
{
e20a31541404 src/ and utils/ changes for IPv4 routing rework
Tom Henderson <tomh@tomh.org>
parents: 4147
diff changeset
   244
  ObjectFactory factory;
e20a31541404 src/ and utils/ changes for IPv4 routing rework
Tom Henderson <tomh@tomh.org>
parents: 4147
diff changeset
   245
  factory.SetTypeId(typeId);
e20a31541404 src/ and utils/ changes for IPv4 routing rework
Tom Henderson <tomh@tomh.org>
parents: 4147
diff changeset
   246
  Ptr<Object> protocol = factory.Create <Object> ();
e20a31541404 src/ and utils/ changes for IPv4 routing rework
Tom Henderson <tomh@tomh.org>
parents: 4147
diff changeset
   247
  node->AggregateObject (protocol);
e20a31541404 src/ and utils/ changes for IPv4 routing rework
Tom Henderson <tomh@tomh.org>
parents: 4147
diff changeset
   248
}
e20a31541404 src/ and utils/ changes for IPv4 routing rework
Tom Henderson <tomh@tomh.org>
parents: 4147
diff changeset
   249
3848
affd0834debc address bug 393 (need to overload Install methods for python)
Craig Dowell <craigdo@ee.washington.edu>
parents: 3579
diff changeset
   250
void
affd0834debc address bug 393 (need to overload Install methods for python)
Craig Dowell <craigdo@ee.washington.edu>
parents: 3579
diff changeset
   251
InternetStackHelper::Install (Ptr<Node> node) const
affd0834debc address bug 393 (need to overload Install methods for python)
Craig Dowell <craigdo@ee.washington.edu>
parents: 3579
diff changeset
   252
{
affd0834debc address bug 393 (need to overload Install methods for python)
Craig Dowell <craigdo@ee.washington.edu>
parents: 3579
diff changeset
   253
  if (node->GetObject<Ipv4> () != 0)
affd0834debc address bug 393 (need to overload Install methods for python)
Craig Dowell <craigdo@ee.washington.edu>
parents: 3579
diff changeset
   254
    {
affd0834debc address bug 393 (need to overload Install methods for python)
Craig Dowell <craigdo@ee.washington.edu>
parents: 3579
diff changeset
   255
      NS_FATAL_ERROR ("InternetStackHelper::Install(): Aggregating " 
affd0834debc address bug 393 (need to overload Install methods for python)
Craig Dowell <craigdo@ee.washington.edu>
parents: 3579
diff changeset
   256
                      "an InternetStack to a node with an existing Ipv4 object");
affd0834debc address bug 393 (need to overload Install methods for python)
Craig Dowell <craigdo@ee.washington.edu>
parents: 3579
diff changeset
   257
      return;
2708
83cc896e501c InternetStackHelper.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   258
    }
3848
affd0834debc address bug 393 (need to overload Install methods for python)
Craig Dowell <craigdo@ee.washington.edu>
parents: 3579
diff changeset
   259
4472
e20a31541404 src/ and utils/ changes for IPv4 routing rework
Tom Henderson <tomh@tomh.org>
parents: 4147
diff changeset
   260
  CreateAndAggregateObjectFromTypeId (node, "ns3::ArpL3Protocol");
e20a31541404 src/ and utils/ changes for IPv4 routing rework
Tom Henderson <tomh@tomh.org>
parents: 4147
diff changeset
   261
  CreateAndAggregateObjectFromTypeId (node, "ns3::Ipv4L3Protocol");
e20a31541404 src/ and utils/ changes for IPv4 routing rework
Tom Henderson <tomh@tomh.org>
parents: 4147
diff changeset
   262
  CreateAndAggregateObjectFromTypeId (node, "ns3::Icmpv4L4Protocol");
e20a31541404 src/ and utils/ changes for IPv4 routing rework
Tom Henderson <tomh@tomh.org>
parents: 4147
diff changeset
   263
  CreateAndAggregateObjectFromTypeId (node, "ns3::UdpL4Protocol");
e20a31541404 src/ and utils/ changes for IPv4 routing rework
Tom Henderson <tomh@tomh.org>
parents: 4147
diff changeset
   264
  node->AggregateObject (m_tcpFactory.Create<Object> ());
3848
affd0834debc address bug 393 (need to overload Install methods for python)
Craig Dowell <craigdo@ee.washington.edu>
parents: 3579
diff changeset
   265
  Ptr<PacketSocketFactory> factory = CreateObject<PacketSocketFactory> ();
affd0834debc address bug 393 (need to overload Install methods for python)
Craig Dowell <craigdo@ee.washington.edu>
parents: 3579
diff changeset
   266
  node->AggregateObject (factory);
4472
e20a31541404 src/ and utils/ changes for IPv4 routing rework
Tom Henderson <tomh@tomh.org>
parents: 4147
diff changeset
   267
  // Set routing
e20a31541404 src/ and utils/ changes for IPv4 routing rework
Tom Henderson <tomh@tomh.org>
parents: 4147
diff changeset
   268
  Ptr<Ipv4> ipv4 = node->GetObject<Ipv4> ();
4616
a84f60b6cd12 bug 600: lower the default routing priority of Ipv4GlobalRouting; move to helper
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 4573
diff changeset
   269
  Ptr<Ipv4RoutingProtocol> ipv4Routing = m_routing->Create (node);
4561
cf6e27dd3a08 Move Ipv4ListRouting to src/internet-stack; get rid of Impl class
Tom Henderson <tomh@tomh.org>
parents: 4560
diff changeset
   270
  ipv4->SetRoutingProtocol (ipv4Routing);
2708
83cc896e501c InternetStackHelper.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   271
}
83cc896e501c InternetStackHelper.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   272
2845
2398826af6b4 Add IP layer tracing helpers to InternetStackHelper
Raj Bhattacharjea <raj.b@gatech.edu>
parents: 2834
diff changeset
   273
void
4140
6bbf05bf4826 Brute force all of the helpers to use object name service
Craig Dowell <craigdo@ee.washington.edu>
parents: 3863
diff changeset
   274
InternetStackHelper::Install (std::string nodeName) const
6bbf05bf4826 Brute force all of the helpers to use object name service
Craig Dowell <craigdo@ee.washington.edu>
parents: 3863
diff changeset
   275
{
6bbf05bf4826 Brute force all of the helpers to use object name service
Craig Dowell <craigdo@ee.washington.edu>
parents: 3863
diff changeset
   276
  Ptr<Node> node = Names::Find<Node> (nodeName);
6bbf05bf4826 Brute force all of the helpers to use object name service
Craig Dowell <craigdo@ee.washington.edu>
parents: 3863
diff changeset
   277
  Install (node);
6bbf05bf4826 Brute force all of the helpers to use object name service
Craig Dowell <craigdo@ee.washington.edu>
parents: 3863
diff changeset
   278
}
6bbf05bf4826 Brute force all of the helpers to use object name service
Craig Dowell <craigdo@ee.washington.edu>
parents: 3863
diff changeset
   279
void
3863
4222173d1e6d Add an InternetStackHelper method to do ascii tracing on drop events
Tom Henderson <tomh@tomh.org>
parents: 3848
diff changeset
   280
InternetStackHelper::EnableAscii (std::ostream &os, NodeContainer n)
4222173d1e6d Add an InternetStackHelper method to do ascii tracing on drop events
Tom Henderson <tomh@tomh.org>
parents: 3848
diff changeset
   281
{
4222173d1e6d Add an InternetStackHelper method to do ascii tracing on drop events
Tom Henderson <tomh@tomh.org>
parents: 3848
diff changeset
   282
  Packet::EnablePrinting ();
4222173d1e6d Add an InternetStackHelper method to do ascii tracing on drop events
Tom Henderson <tomh@tomh.org>
parents: 3848
diff changeset
   283
  std::ostringstream oss;
4222173d1e6d Add an InternetStackHelper method to do ascii tracing on drop events
Tom Henderson <tomh@tomh.org>
parents: 3848
diff changeset
   284
  for (NodeContainer::Iterator i = n.Begin (); i != n.End (); ++i)
4222173d1e6d Add an InternetStackHelper method to do ascii tracing on drop events
Tom Henderson <tomh@tomh.org>
parents: 3848
diff changeset
   285
    {
4222173d1e6d Add an InternetStackHelper method to do ascii tracing on drop events
Tom Henderson <tomh@tomh.org>
parents: 3848
diff changeset
   286
      Ptr<Node> node = *i;
4222173d1e6d Add an InternetStackHelper method to do ascii tracing on drop events
Tom Henderson <tomh@tomh.org>
parents: 3848
diff changeset
   287
      oss << "/NodeList/" << node->GetId () << "/$ns3::Ipv4L3Protocol/Drop";
4222173d1e6d Add an InternetStackHelper method to do ascii tracing on drop events
Tom Henderson <tomh@tomh.org>
parents: 3848
diff changeset
   288
      Config::Connect (oss.str (), MakeBoundCallback (&InternetStackHelper::AsciiDropEvent, &os));
4222173d1e6d Add an InternetStackHelper method to do ascii tracing on drop events
Tom Henderson <tomh@tomh.org>
parents: 3848
diff changeset
   289
      oss.str ("");
4222173d1e6d Add an InternetStackHelper method to do ascii tracing on drop events
Tom Henderson <tomh@tomh.org>
parents: 3848
diff changeset
   290
      oss << "/NodeList/" << node->GetId () << "/$ns3::ArpL3Protocol/Drop";
4222173d1e6d Add an InternetStackHelper method to do ascii tracing on drop events
Tom Henderson <tomh@tomh.org>
parents: 3848
diff changeset
   291
      Config::Connect (oss.str (), MakeBoundCallback (&InternetStackHelper::AsciiDropEvent, &os));
4222173d1e6d Add an InternetStackHelper method to do ascii tracing on drop events
Tom Henderson <tomh@tomh.org>
parents: 3848
diff changeset
   292
      oss.str ("");
4222173d1e6d Add an InternetStackHelper method to do ascii tracing on drop events
Tom Henderson <tomh@tomh.org>
parents: 3848
diff changeset
   293
    }
4222173d1e6d Add an InternetStackHelper method to do ascii tracing on drop events
Tom Henderson <tomh@tomh.org>
parents: 3848
diff changeset
   294
}
4222173d1e6d Add an InternetStackHelper method to do ascii tracing on drop events
Tom Henderson <tomh@tomh.org>
parents: 3848
diff changeset
   295
4222173d1e6d Add an InternetStackHelper method to do ascii tracing on drop events
Tom Henderson <tomh@tomh.org>
parents: 3848
diff changeset
   296
void
4222173d1e6d Add an InternetStackHelper method to do ascii tracing on drop events
Tom Henderson <tomh@tomh.org>
parents: 3848
diff changeset
   297
InternetStackHelper::EnableAsciiAll (std::ostream &os)
4222173d1e6d Add an InternetStackHelper method to do ascii tracing on drop events
Tom Henderson <tomh@tomh.org>
parents: 3848
diff changeset
   298
{
4222173d1e6d Add an InternetStackHelper method to do ascii tracing on drop events
Tom Henderson <tomh@tomh.org>
parents: 3848
diff changeset
   299
  EnableAscii (os, NodeContainer::GetGlobal ());
4222173d1e6d Add an InternetStackHelper method to do ascii tracing on drop events
Tom Henderson <tomh@tomh.org>
parents: 3848
diff changeset
   300
}
4222173d1e6d Add an InternetStackHelper method to do ascii tracing on drop events
Tom Henderson <tomh@tomh.org>
parents: 3848
diff changeset
   301
4222173d1e6d Add an InternetStackHelper method to do ascii tracing on drop events
Tom Henderson <tomh@tomh.org>
parents: 3848
diff changeset
   302
void
2996
a83b94e277d4 EnablePcap()->EnablePcapAll(); EnableAscii()->EnableAsciiAll()
Tom Henderson <tomh@tomh.org>
parents: 2995
diff changeset
   303
InternetStackHelper::EnablePcapAll (std::string filename)
2845
2398826af6b4 Add IP layer tracing helpers to InternetStackHelper
Raj Bhattacharjea <raj.b@gatech.edu>
parents: 2834
diff changeset
   304
{
3009
db5fab391eac bug 170
Craig Dowell <craigdo@ee.washington.edu>
parents: 2996
diff changeset
   305
  Simulator::ScheduleDestroy (&InternetStackHelper::Cleanup);
db5fab391eac bug 170
Craig Dowell <craigdo@ee.washington.edu>
parents: 2996
diff changeset
   306
2845
2398826af6b4 Add IP layer tracing helpers to InternetStackHelper
Raj Bhattacharjea <raj.b@gatech.edu>
parents: 2834
diff changeset
   307
  InternetStackHelper::m_pcapBaseFilename = filename;
2398826af6b4 Add IP layer tracing helpers to InternetStackHelper
Raj Bhattacharjea <raj.b@gatech.edu>
parents: 2834
diff changeset
   308
  Config::Connect ("/NodeList/*/$ns3::Ipv4L3Protocol/Tx",
3848
affd0834debc address bug 393 (need to overload Install methods for python)
Craig Dowell <craigdo@ee.washington.edu>
parents: 3579
diff changeset
   309
                   MakeCallback (&InternetStackHelper::LogTxIp));
2845
2398826af6b4 Add IP layer tracing helpers to InternetStackHelper
Raj Bhattacharjea <raj.b@gatech.edu>
parents: 2834
diff changeset
   310
  Config::Connect ("/NodeList/*/$ns3::Ipv4L3Protocol/Rx",
3848
affd0834debc address bug 393 (need to overload Install methods for python)
Craig Dowell <craigdo@ee.washington.edu>
parents: 3579
diff changeset
   311
                   MakeCallback (&InternetStackHelper::LogRxIp));
2845
2398826af6b4 Add IP layer tracing helpers to InternetStackHelper
Raj Bhattacharjea <raj.b@gatech.edu>
parents: 2834
diff changeset
   312
}
2398826af6b4 Add IP layer tracing helpers to InternetStackHelper
Raj Bhattacharjea <raj.b@gatech.edu>
parents: 2834
diff changeset
   313
2398826af6b4 Add IP layer tracing helpers to InternetStackHelper
Raj Bhattacharjea <raj.b@gatech.edu>
parents: 2834
diff changeset
   314
uint32_t
2398826af6b4 Add IP layer tracing helpers to InternetStackHelper
Raj Bhattacharjea <raj.b@gatech.edu>
parents: 2834
diff changeset
   315
InternetStackHelper::GetNodeIndex (std::string context)
2398826af6b4 Add IP layer tracing helpers to InternetStackHelper
Raj Bhattacharjea <raj.b@gatech.edu>
parents: 2834
diff changeset
   316
{
2398826af6b4 Add IP layer tracing helpers to InternetStackHelper
Raj Bhattacharjea <raj.b@gatech.edu>
parents: 2834
diff changeset
   317
  std::string::size_type pos;
2398826af6b4 Add IP layer tracing helpers to InternetStackHelper
Raj Bhattacharjea <raj.b@gatech.edu>
parents: 2834
diff changeset
   318
  pos = context.find ("/NodeList/");
2398826af6b4 Add IP layer tracing helpers to InternetStackHelper
Raj Bhattacharjea <raj.b@gatech.edu>
parents: 2834
diff changeset
   319
  NS_ASSERT (pos == 0);
2398826af6b4 Add IP layer tracing helpers to InternetStackHelper
Raj Bhattacharjea <raj.b@gatech.edu>
parents: 2834
diff changeset
   320
  std::string::size_type afterNodeIndex = context.find ("/", 11);
2398826af6b4 Add IP layer tracing helpers to InternetStackHelper
Raj Bhattacharjea <raj.b@gatech.edu>
parents: 2834
diff changeset
   321
  NS_ASSERT (afterNodeIndex != std::string::npos);
2398826af6b4 Add IP layer tracing helpers to InternetStackHelper
Raj Bhattacharjea <raj.b@gatech.edu>
parents: 2834
diff changeset
   322
  std::string index = context.substr (10, afterNodeIndex - 10);
2398826af6b4 Add IP layer tracing helpers to InternetStackHelper
Raj Bhattacharjea <raj.b@gatech.edu>
parents: 2834
diff changeset
   323
  std::istringstream iss;
2398826af6b4 Add IP layer tracing helpers to InternetStackHelper
Raj Bhattacharjea <raj.b@gatech.edu>
parents: 2834
diff changeset
   324
  iss.str (index);
2398826af6b4 Add IP layer tracing helpers to InternetStackHelper
Raj Bhattacharjea <raj.b@gatech.edu>
parents: 2834
diff changeset
   325
  uint32_t nodeIndex;
2398826af6b4 Add IP layer tracing helpers to InternetStackHelper
Raj Bhattacharjea <raj.b@gatech.edu>
parents: 2834
diff changeset
   326
  iss >> nodeIndex;
2398826af6b4 Add IP layer tracing helpers to InternetStackHelper
Raj Bhattacharjea <raj.b@gatech.edu>
parents: 2834
diff changeset
   327
  return nodeIndex;
2398826af6b4 Add IP layer tracing helpers to InternetStackHelper
Raj Bhattacharjea <raj.b@gatech.edu>
parents: 2834
diff changeset
   328
}
2398826af6b4 Add IP layer tracing helpers to InternetStackHelper
Raj Bhattacharjea <raj.b@gatech.edu>
parents: 2834
diff changeset
   329
2398826af6b4 Add IP layer tracing helpers to InternetStackHelper
Raj Bhattacharjea <raj.b@gatech.edu>
parents: 2834
diff changeset
   330
void
2398826af6b4 Add IP layer tracing helpers to InternetStackHelper
Raj Bhattacharjea <raj.b@gatech.edu>
parents: 2834
diff changeset
   331
InternetStackHelper::LogTxIp (std::string context, Ptr<const Packet> packet, uint32_t interfaceIndex)
2398826af6b4 Add IP layer tracing helpers to InternetStackHelper
Raj Bhattacharjea <raj.b@gatech.edu>
parents: 2834
diff changeset
   332
{
2398826af6b4 Add IP layer tracing helpers to InternetStackHelper
Raj Bhattacharjea <raj.b@gatech.edu>
parents: 2834
diff changeset
   333
  Ptr<PcapWriter> writer = InternetStackHelper::GetStream (GetNodeIndex (context), interfaceIndex);
2398826af6b4 Add IP layer tracing helpers to InternetStackHelper
Raj Bhattacharjea <raj.b@gatech.edu>
parents: 2834
diff changeset
   334
  writer->WritePacket (packet);
2398826af6b4 Add IP layer tracing helpers to InternetStackHelper
Raj Bhattacharjea <raj.b@gatech.edu>
parents: 2834
diff changeset
   335
}
2398826af6b4 Add IP layer tracing helpers to InternetStackHelper
Raj Bhattacharjea <raj.b@gatech.edu>
parents: 2834
diff changeset
   336
2398826af6b4 Add IP layer tracing helpers to InternetStackHelper
Raj Bhattacharjea <raj.b@gatech.edu>
parents: 2834
diff changeset
   337
void
2398826af6b4 Add IP layer tracing helpers to InternetStackHelper
Raj Bhattacharjea <raj.b@gatech.edu>
parents: 2834
diff changeset
   338
InternetStackHelper::LogRxIp (std::string context, Ptr<const Packet> packet, uint32_t interfaceIndex)
2398826af6b4 Add IP layer tracing helpers to InternetStackHelper
Raj Bhattacharjea <raj.b@gatech.edu>
parents: 2834
diff changeset
   339
{
2398826af6b4 Add IP layer tracing helpers to InternetStackHelper
Raj Bhattacharjea <raj.b@gatech.edu>
parents: 2834
diff changeset
   340
  Ptr<PcapWriter> writer = InternetStackHelper::GetStream (GetNodeIndex (context), interfaceIndex);
2398826af6b4 Add IP layer tracing helpers to InternetStackHelper
Raj Bhattacharjea <raj.b@gatech.edu>
parents: 2834
diff changeset
   341
  writer->WritePacket (packet);
2398826af6b4 Add IP layer tracing helpers to InternetStackHelper
Raj Bhattacharjea <raj.b@gatech.edu>
parents: 2834
diff changeset
   342
}
2398826af6b4 Add IP layer tracing helpers to InternetStackHelper
Raj Bhattacharjea <raj.b@gatech.edu>
parents: 2834
diff changeset
   343
2398826af6b4 Add IP layer tracing helpers to InternetStackHelper
Raj Bhattacharjea <raj.b@gatech.edu>
parents: 2834
diff changeset
   344
Ptr<PcapWriter>
2398826af6b4 Add IP layer tracing helpers to InternetStackHelper
Raj Bhattacharjea <raj.b@gatech.edu>
parents: 2834
diff changeset
   345
InternetStackHelper::GetStream (uint32_t nodeId, uint32_t interfaceId)
2398826af6b4 Add IP layer tracing helpers to InternetStackHelper
Raj Bhattacharjea <raj.b@gatech.edu>
parents: 2834
diff changeset
   346
{
2398826af6b4 Add IP layer tracing helpers to InternetStackHelper
Raj Bhattacharjea <raj.b@gatech.edu>
parents: 2834
diff changeset
   347
  for (std::vector<Trace>::iterator i = m_traces.begin ();
2398826af6b4 Add IP layer tracing helpers to InternetStackHelper
Raj Bhattacharjea <raj.b@gatech.edu>
parents: 2834
diff changeset
   348
       i != m_traces.end (); i++)
2398826af6b4 Add IP layer tracing helpers to InternetStackHelper
Raj Bhattacharjea <raj.b@gatech.edu>
parents: 2834
diff changeset
   349
  {
2398826af6b4 Add IP layer tracing helpers to InternetStackHelper
Raj Bhattacharjea <raj.b@gatech.edu>
parents: 2834
diff changeset
   350
    if (i->nodeId == nodeId &&
2398826af6b4 Add IP layer tracing helpers to InternetStackHelper
Raj Bhattacharjea <raj.b@gatech.edu>
parents: 2834
diff changeset
   351
        i->interfaceId == interfaceId)
2398826af6b4 Add IP layer tracing helpers to InternetStackHelper
Raj Bhattacharjea <raj.b@gatech.edu>
parents: 2834
diff changeset
   352
    {
2398826af6b4 Add IP layer tracing helpers to InternetStackHelper
Raj Bhattacharjea <raj.b@gatech.edu>
parents: 2834
diff changeset
   353
      return i->writer;
2398826af6b4 Add IP layer tracing helpers to InternetStackHelper
Raj Bhattacharjea <raj.b@gatech.edu>
parents: 2834
diff changeset
   354
    }
2398826af6b4 Add IP layer tracing helpers to InternetStackHelper
Raj Bhattacharjea <raj.b@gatech.edu>
parents: 2834
diff changeset
   355
  }
2398826af6b4 Add IP layer tracing helpers to InternetStackHelper
Raj Bhattacharjea <raj.b@gatech.edu>
parents: 2834
diff changeset
   356
  InternetStackHelper::Trace trace;
2398826af6b4 Add IP layer tracing helpers to InternetStackHelper
Raj Bhattacharjea <raj.b@gatech.edu>
parents: 2834
diff changeset
   357
  trace.nodeId = nodeId;
2398826af6b4 Add IP layer tracing helpers to InternetStackHelper
Raj Bhattacharjea <raj.b@gatech.edu>
parents: 2834
diff changeset
   358
  trace.interfaceId = interfaceId;
4709
b0743dbc4e55 bug 639: add configurable capture size to pcap
Nicola Baldo <nbaldo@cttc.es>
parents: 4695
diff changeset
   359
  trace.writer = CreateObject<PcapWriter> ();
2845
2398826af6b4 Add IP layer tracing helpers to InternetStackHelper
Raj Bhattacharjea <raj.b@gatech.edu>
parents: 2834
diff changeset
   360
  std::ostringstream oss;
2865
d40eb18a4da0 Point regression tests to final locations, update release steps, bug 158
Craig Dowell <craigdo@ee.washington.edu>
parents: 2845
diff changeset
   361
  oss << m_pcapBaseFilename << "-" << nodeId << "-" << interfaceId << ".pcap";
2845
2398826af6b4 Add IP layer tracing helpers to InternetStackHelper
Raj Bhattacharjea <raj.b@gatech.edu>
parents: 2834
diff changeset
   362
  trace.writer->Open (oss.str ());
2398826af6b4 Add IP layer tracing helpers to InternetStackHelper
Raj Bhattacharjea <raj.b@gatech.edu>
parents: 2834
diff changeset
   363
  trace.writer->WriteIpHeader ();
2398826af6b4 Add IP layer tracing helpers to InternetStackHelper
Raj Bhattacharjea <raj.b@gatech.edu>
parents: 2834
diff changeset
   364
  m_traces.push_back (trace);
2398826af6b4 Add IP layer tracing helpers to InternetStackHelper
Raj Bhattacharjea <raj.b@gatech.edu>
parents: 2834
diff changeset
   365
  return trace.writer;
2398826af6b4 Add IP layer tracing helpers to InternetStackHelper
Raj Bhattacharjea <raj.b@gatech.edu>
parents: 2834
diff changeset
   366
}
2708
83cc896e501c InternetStackHelper.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   367
3863
4222173d1e6d Add an InternetStackHelper method to do ascii tracing on drop events
Tom Henderson <tomh@tomh.org>
parents: 3848
diff changeset
   368
void
4222173d1e6d Add an InternetStackHelper method to do ascii tracing on drop events
Tom Henderson <tomh@tomh.org>
parents: 3848
diff changeset
   369
InternetStackHelper::AsciiDropEvent (std::ostream *os, std::string path, Ptr<const Packet> packet)
4222173d1e6d Add an InternetStackHelper method to do ascii tracing on drop events
Tom Henderson <tomh@tomh.org>
parents: 3848
diff changeset
   370
{
4222173d1e6d Add an InternetStackHelper method to do ascii tracing on drop events
Tom Henderson <tomh@tomh.org>
parents: 3848
diff changeset
   371
  *os << "d " << Simulator::Now ().GetSeconds () << " ";
4222173d1e6d Add an InternetStackHelper method to do ascii tracing on drop events
Tom Henderson <tomh@tomh.org>
parents: 3848
diff changeset
   372
  *os << path << " " << *packet << std::endl;
4222173d1e6d Add an InternetStackHelper method to do ascii tracing on drop events
Tom Henderson <tomh@tomh.org>
parents: 3848
diff changeset
   373
}
4222173d1e6d Add an InternetStackHelper method to do ascii tracing on drop events
Tom Henderson <tomh@tomh.org>
parents: 3848
diff changeset
   374
2708
83cc896e501c InternetStackHelper.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   375
} // namespace ns3