A Discrete-Event Network Simulator
Home
Tutorials ▼
English
Portuguese
Docs ▼
Wiki
Manual
Models
Develop ▼
API
Bugs
API
Main Page
Related Pages
Modules
Namespaces
Classes
Files
File List
File Members
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Properties
Friends
Macros
Groups
Pages
csma-channel.h
Go to the documentation of this file.
1
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
2
/*
3
* Copyright (c) 2007 Emmanuelle Laprise
4
*
5
* This program is free software; you can redistribute it and/or modify
6
* it under the terms of the GNU General Public License version 2 as
7
* published by the Free Software Foundation;
8
*
9
* This program is distributed in the hope that it will be useful,
10
* but WITHOUT ANY WARRANTY; without even the implied warranty of
11
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12
* GNU General Public License for more details.
13
*
14
* You should have received a copy of the GNU General Public License
15
* along with this program; if not, write to the Free Software
16
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17
*
18
* Author: Emmanuelle Laprise<emmanuelle.laprise@bluekazoo.ca>
19
*/
20
21
#ifndef CSMA_CHANNEL_H
22
#define CSMA_CHANNEL_H
23
24
#include "ns3/channel.h"
25
#include "ns3/ptr.h"
26
#include "ns3/nstime.h"
27
#include "ns3/data-rate.h"
28
29
namespace
ns3 {
30
31
class
Packet;
32
33
class
CsmaNetDevice;
34
41
class
CsmaDeviceRec
{
42
public
:
43
Ptr< CsmaNetDevice >
devicePtr
;
44
bool
active
;
45
46
CsmaDeviceRec
();
47
CsmaDeviceRec
(
Ptr< CsmaNetDevice >
device);
48
CsmaDeviceRec
(
CsmaDeviceRec
const
&);
49
54
bool
IsActive
();
55
};
56
60
enum
WireState
61
{
62
IDLE
,
63
TRANSMITTING
,
64
PROPAGATING
65
};
66
76
class
CsmaChannel
:
public
Channel
77
{
78
public
:
79
static
TypeId
GetTypeId
(
void
);
80
84
CsmaChannel
();
88
virtual
~CsmaChannel
();
89
96
int32_t
Attach
(
Ptr<CsmaNetDevice>
device);
97
109
bool
Detach
(
Ptr<CsmaNetDevice>
device);
110
123
bool
Detach
(uint32_t deviceId);
124
138
bool
Reattach
(uint32_t deviceId);
139
152
bool
Reattach
(
Ptr<CsmaNetDevice>
device);
153
168
bool
TransmitStart
(
Ptr<Packet>
p, uint32_t srcId);
169
184
bool
TransmitEnd
();
185
193
void
PropagationCompleteEvent
();
194
202
int32_t
GetDeviceNum
(
Ptr<CsmaNetDevice>
device);
203
208
WireState
GetState
();
209
217
bool
IsBusy
();
218
228
bool
IsActive
(uint32_t deviceId);
229
234
uint32_t
GetNumActDevices
(
void
);
235
240
virtual
uint32_t
GetNDevices
(
void
)
const
;
241
249
virtual
Ptr<NetDevice>
GetDevice
(uint32_t i)
const
;
250
259
Ptr<CsmaNetDevice>
GetCsmaDevice
(uint32_t i)
const
;
260
267
DataRate
GetDataRate
(
void
);
268
274
Time
GetDelay
(
void
);
275
276
private
:
277
// Avoid implicit copy constructor and assignment (python bindings issues)
278
CsmaChannel
(
CsmaChannel
const
&);
279
CsmaChannel
&
operator =
(
CsmaChannel
const
&);
280
284
DataRate
m_bps
;
285
289
Time
m_delay
;
290
302
std::vector<CsmaDeviceRec>
m_deviceList
;
303
309
Ptr<Packet>
m_currentPkt
;
310
316
uint32_t
m_currentSrc
;
317
321
WireState
m_state
;
322
};
323
324
}
// namespace ns3
325
326
#endif
/* CSMA_CHANNEL_H */
ns3::CsmaChannel::m_currentSrc
uint32_t m_currentSrc
Definition:
csma-channel.h:316
ns3::Time
keep track of time values and allow control of global simulation resolution
Definition:
nstime.h:81
ns3::Ptr
smart pointer class similar to boost::intrusive_ptr
Definition:
ptr.h:59
ns3::CsmaChannel::m_state
WireState m_state
Definition:
csma-channel.h:321
ns3::CsmaChannel::GetNumActDevices
uint32_t GetNumActDevices(void)
Definition:
csma-channel.cc:256
ns3::IDLE
Definition:
csma-channel.h:62
ns3::Channel
Abstract Channel Base Class.
Definition:
channel.h:43
ns3::CsmaChannel::m_deviceList
std::vector< CsmaDeviceRec > m_deviceList
Definition:
csma-channel.h:302
ns3::CsmaChannel::GetState
WireState GetState()
Definition:
csma-channel.cc:332
ns3::CsmaChannel::m_currentPkt
Ptr< Packet > m_currentPkt
Definition:
csma-channel.h:309
ns3::DataRate
Class for representing data rates.
Definition:
data-rate.h:71
ns3::CsmaChannel::~CsmaChannel
virtual ~CsmaChannel()
Destroy a CsmaChannel.
Definition:
csma-channel.cc:61
ns3::TRANSMITTING
Definition:
csma-channel.h:63
ns3::CsmaChannel::Detach
bool Detach(Ptr< CsmaNetDevice > device)
Detach a given netdevice from this channel.
Definition:
csma-channel.cc:154
ns3::CsmaChannel::GetNDevices
virtual uint32_t GetNDevices(void) const
Definition:
csma-channel.cc:271
ns3::CsmaChannel::m_bps
DataRate m_bps
Definition:
csma-channel.h:284
ns3::CsmaChannel::GetDevice
virtual Ptr< NetDevice > GetDevice(uint32_t i) const
Definition:
csma-channel.cc:338
ns3::CsmaChannel::m_delay
Time m_delay
Definition:
csma-channel.h:289
ns3::CsmaChannel::GetDelay
Time GetDelay(void)
Definition:
csma-channel.cc:326
ns3::CsmaChannel::Attach
int32_t Attach(Ptr< CsmaNetDevice > device)
Attach a given netdevice to this channel.
Definition:
csma-channel.cc:68
ns3::PROPAGATING
Definition:
csma-channel.h:64
ns3::WireState
WireState
Definition:
csma-channel.h:60
ns3::CsmaChannel::IsActive
bool IsActive(uint32_t deviceId)
Indicates if a net device is currently attached or detached from the channel.
Definition:
csma-channel.cc:197
ns3::CsmaChannel
Csma Channel.
Definition:
csma-channel.h:76
ns3::CsmaChannel::PropagationCompleteEvent
void PropagationCompleteEvent()
Indicates that the channel has finished propagating the current packet. The channel is released and b...
Definition:
csma-channel.cc:246
ns3::CsmaDeviceRec
CsmaNetDevice Record.
Definition:
csma-channel.h:41
ns3::CsmaDeviceRec::CsmaDeviceRec
CsmaDeviceRec()
Is net device enabled to TX/RX.
Definition:
csma-channel.cc:343
ns3::CsmaChannel::GetDeviceNum
int32_t GetDeviceNum(Ptr< CsmaNetDevice > device)
Definition:
csma-channel.cc:284
ns3::CsmaChannel::CsmaChannel
CsmaChannel()
Create a CsmaChannel.
Definition:
csma-channel.cc:52
ns3::CsmaChannel::TransmitEnd
bool TransmitEnd()
Indicates that the net device has finished transmitting the packet over the channel.
Definition:
csma-channel.cc:203
ns3::CsmaChannel::IsBusy
bool IsBusy()
Indicates if the channel is busy. The channel will only accept new packets for transmission if it is ...
Definition:
csma-channel.cc:307
ns3::CsmaDeviceRec::active
bool active
Pointer to the net device.
Definition:
csma-channel.h:44
ns3::CsmaChannel::GetDataRate
DataRate GetDataRate(void)
Definition:
csma-channel.cc:320
ns3::CsmaDeviceRec::IsActive
bool IsActive()
Definition:
csma-channel.cc:361
ns3::CsmaChannel::GetCsmaDevice
Ptr< CsmaNetDevice > GetCsmaDevice(uint32_t i) const
Definition:
csma-channel.cc:277
ns3::CsmaDeviceRec::devicePtr
Ptr< CsmaNetDevice > devicePtr
Definition:
csma-channel.h:43
ns3::CsmaChannel::Reattach
bool Reattach(uint32_t deviceId)
Reattach a previously detached net device to the channel.
Definition:
csma-channel.cc:105
ns3::TypeId
a unique identifier for an interface.
Definition:
type-id.h:49
ns3::CsmaChannel::TransmitStart
bool TransmitStart(Ptr< Packet > p, uint32_t srcId)
Start transmitting a packet over the channel.
Definition:
csma-channel.cc:172
ns3::CsmaChannel::GetTypeId
static TypeId GetTypeId(void)
Definition:
csma-channel.cc:34
ns3::CsmaChannel::operator=
CsmaChannel & operator=(CsmaChannel const &)
src
csma
model
csma-channel.h
Generated on Sat Nov 16 2013 16:17:38 for ns-3 by
1.8.5