/usr/include/ns3/point-to-point-channel.h is in libns3-dev 3.13+dfsg-1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 | /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/*
* Copyright (c) 2007 University of Washington
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 as
* published by the Free Software Foundation;
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#ifndef POINT_TO_POINT_CHANNEL_H
#define POINT_TO_POINT_CHANNEL_H
#include <list>
#include "ns3/channel.h"
#include "ns3/ptr.h"
#include "ns3/nstime.h"
#include "ns3/data-rate.h"
#include "ns3/traced-callback.h"
namespace ns3 {
class PointToPointNetDevice;
class Packet;
/**
* \ingroup point-to-point
* \brief Simple Point To Point Channel.
*
* This class represents a very simple point to point channel. Think full
* duplex RS-232 or RS-422 with null modem and no handshaking. There is no
* multi-drop capability on this channel -- there can be a maximum of two
* point-to-point net devices connected.
*
* There are two "wires" in the channel. The first device connected gets the
* [0] wire to transmit on. The second device gets the [1] wire. There is a
* state (IDLE, TRANSMITTING) associated with each wire.
*/
class PointToPointChannel : public Channel
{
public:
static TypeId GetTypeId (void);
/**
* \brief Create a PointToPointChannel
*
* By default, you get a channel that
* has zero transmission delay.
*/
PointToPointChannel ();
/**
* \brief Attach a given netdevice to this channel
* \param device pointer to the netdevice to attach to the channel
*/
void Attach (Ptr<PointToPointNetDevice> device);
/**
* \brief Transmit a packet over this channel
* \param p Packet to transmit
* \param src Source PointToPointNetDevice
* \param txTime Transmit time to apply
* \returns true if successful (currently always true)
*/
virtual bool TransmitStart (Ptr<Packet> p, Ptr<PointToPointNetDevice> src, Time txTime);
/**
* \brief Get number of devices on this channel
* \returns number of devices on this channel
*/
virtual uint32_t GetNDevices (void) const;
/*
* \brief Get PointToPointNetDevice corresponding to index i on this channel
* \param i Index number of the device requested
* \returns Ptr to PointToPointNetDevice requested
*/
Ptr<PointToPointNetDevice> GetPointToPointDevice (uint32_t i) const;
/*
* \brief Get NetDevice corresponding to index i on this channel
* \param i Index number of the device requested
* \returns Ptr to NetDevice requested
*/
virtual Ptr<NetDevice> GetDevice (uint32_t i) const;
protected:
/*
* \brief Get the delay associated with this channel
* \returns Time delay
*/
Time GetDelay (void) const;
/*
* \brief Check to make sure the link is initialized
* \returns true if initialized, asserts otherwise
*/
bool IsInitialized (void) const;
/*
* \brief Get the net-device source
* \param i the link requested
* \returns Ptr to PointToPointNetDevice source for the
* specified link
*/
Ptr<PointToPointNetDevice> GetSource (uint32_t i) const;
/*
* \brief Get the net-device destination
* \param i the link requested
* \returns Ptr to PointToPointNetDevice destination for
* the specified link
*/
Ptr<PointToPointNetDevice> GetDestination (uint32_t i) const;
private:
// Each point to point link has exactly two net devices
static const int N_DEVICES = 2;
Time m_delay;
int32_t m_nDevices;
/**
* The trace source for the packet transmission animation events that the
* device can fire.
* Arguments to the callback are the packet, transmitting
* net device, receiving net device, transmission time and
* packet receipt time.
*
* @see class CallBackTraceSource
*/
TracedCallback<Ptr<const Packet>, // Packet being transmitted
Ptr<NetDevice>, // Transmitting NetDevice
Ptr<NetDevice>, // Receiving NetDevice
Time, // Amount of time to transmit the pkt
Time // Last bit receive time (relative to now)
> m_txrxPointToPoint;
enum WireState
{
INITIALIZING,
IDLE,
TRANSMITTING,
PROPAGATING
};
class Link
{
public:
Link() : m_state (INITIALIZING), m_src (0), m_dst (0) {}
WireState m_state;
Ptr<PointToPointNetDevice> m_src;
Ptr<PointToPointNetDevice> m_dst;
};
Link m_link[N_DEVICES];
};
} // namespace ns3
#endif /* POINT_TO_POINT_CHANNEL_H */
|