A Discrete-Event Network Simulator
Home
Tutorials ▼
English
Documentation ▼
Installation
Manual
Models
Contributing
Wiki
Development ▼
API Docs
Issue Tracker
Merge Requests
API
aloha-noack-mac-header.cc
Go to the documentation of this file.
1
/*
2
* Copyright (c) 2009 CTTC
3
*
4
* This program is free software; you can redistribute it and/or modify
5
* it under the terms of the GNU General Public License version 2 as
6
* published by the Free Software Foundation;
7
*
8
* This program is distributed in the hope that it will be useful,
9
* but WITHOUT ANY WARRANTY; without even the implied warranty of
10
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11
* GNU General Public License for more details.
12
*
13
* You should have received a copy of the GNU General Public License
14
* along with this program; if not, write to the Free Software
15
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
16
*
17
* Author: Nicola Baldo <nbaldo@cttc.es>
18
*/
19
20
#include "
aloha-noack-mac-header.h
"
21
22
#include <ns3/log.h>
23
24
namespace
ns3
25
{
26
27
NS_LOG_COMPONENT_DEFINE
(
"AlohaNoackMacHeader"
);
28
29
NS_OBJECT_ENSURE_REGISTERED
(AlohaNoackMacHeader);
30
31
TypeId
32
AlohaNoackMacHeader::GetTypeId
()
33
{
34
static
TypeId
tid =
TypeId
(
"ns3::AlohaNoackMacHeader"
)
35
.
SetParent
<
Header
>()
36
.SetGroupName(
"Spectrum"
)
37
.AddConstructor<
AlohaNoackMacHeader
>();
38
return
tid;
39
}
40
41
TypeId
42
AlohaNoackMacHeader::GetInstanceTypeId
()
const
43
{
44
return
GetTypeId
();
45
}
46
47
uint32_t
48
AlohaNoackMacHeader::GetSerializedSize
()
const
49
{
50
return
12;
51
}
52
53
void
54
AlohaNoackMacHeader::Serialize
(
Buffer::Iterator
start
)
const
55
{
56
WriteTo
(
start
,
m_destination
);
57
WriteTo
(
start
,
m_source
);
58
}
59
60
uint32_t
61
AlohaNoackMacHeader::Deserialize
(
Buffer::Iterator
start
)
62
{
63
ReadFrom
(
start
,
m_destination
);
64
ReadFrom
(
start
,
m_source
);
65
return
GetSerializedSize
();
66
}
67
68
void
69
AlohaNoackMacHeader::Print
(std::ostream& os)
const
70
{
71
os <<
"src="
<<
m_source
<<
"dst="
<<
m_destination
;
72
}
73
74
void
75
AlohaNoackMacHeader::SetSource
(
Mac48Address
source)
76
{
77
m_source
= source;
78
}
79
80
Mac48Address
81
AlohaNoackMacHeader::GetSource
()
const
82
{
83
return
m_source
;
84
}
85
86
void
87
AlohaNoackMacHeader::SetDestination
(
Mac48Address
dst)
88
{
89
m_destination
= dst;
90
}
91
92
Mac48Address
93
AlohaNoackMacHeader::GetDestination
()
const
94
{
95
return
m_destination
;
96
}
97
98
}
// namespace ns3
aloha-noack-mac-header.h
ns3::AlohaNoackMacHeader
Header for the AlohaNoack NetDevice.
Definition:
aloha-noack-mac-header.h:36
ns3::AlohaNoackMacHeader::GetSource
Mac48Address GetSource() const
Get the source address.
Definition:
aloha-noack-mac-header.cc:81
ns3::AlohaNoackMacHeader::m_source
Mac48Address m_source
source address
Definition:
aloha-noack-mac-header.h:72
ns3::AlohaNoackMacHeader::Serialize
void Serialize(Buffer::Iterator start) const override
Definition:
aloha-noack-mac-header.cc:54
ns3::AlohaNoackMacHeader::SetDestination
void SetDestination(Mac48Address destination)
Set the destination address.
Definition:
aloha-noack-mac-header.cc:87
ns3::AlohaNoackMacHeader::Print
void Print(std::ostream &os) const override
Definition:
aloha-noack-mac-header.cc:69
ns3::AlohaNoackMacHeader::GetSerializedSize
uint32_t GetSerializedSize() const override
Definition:
aloha-noack-mac-header.cc:48
ns3::AlohaNoackMacHeader::GetTypeId
static TypeId GetTypeId()
Get the type ID.
Definition:
aloha-noack-mac-header.cc:32
ns3::AlohaNoackMacHeader::GetDestination
Mac48Address GetDestination() const
Get the destination address.
Definition:
aloha-noack-mac-header.cc:93
ns3::AlohaNoackMacHeader::m_destination
Mac48Address m_destination
destination address
Definition:
aloha-noack-mac-header.h:73
ns3::AlohaNoackMacHeader::SetSource
void SetSource(Mac48Address source)
Set the source address.
Definition:
aloha-noack-mac-header.cc:75
ns3::AlohaNoackMacHeader::GetInstanceTypeId
TypeId GetInstanceTypeId() const override
Get the most derived TypeId for this Object.
Definition:
aloha-noack-mac-header.cc:42
ns3::Buffer::Iterator
iterator in a Buffer instance
Definition:
buffer.h:100
ns3::Header
Protocol header serialization and deserialization.
Definition:
header.h:44
ns3::Header::Deserialize
virtual uint32_t Deserialize(Buffer::Iterator start)=0
Deserialize the object from a buffer iterator.
ns3::Mac48Address
an EUI-48 address
Definition:
mac48-address.h:46
ns3::TypeId
a unique identifier for an interface.
Definition:
type-id.h:59
ns3::TypeId::SetParent
TypeId SetParent(TypeId tid)
Set the parent TypeId.
Definition:
type-id.cc:931
NS_LOG_COMPONENT_DEFINE
#define NS_LOG_COMPONENT_DEFINE(name)
Define a Log component with a specific name.
Definition:
log.h:202
NS_OBJECT_ENSURE_REGISTERED
#define NS_OBJECT_ENSURE_REGISTERED(type)
Register an Object subclass with the TypeId system.
Definition:
object-base.h:46
ns3
Every class exported by the ns3 library is enclosed in the ns3 namespace.
ns3::WriteTo
void WriteTo(Buffer::Iterator &i, Ipv4Address ad)
Write an Ipv4Address to a Buffer.
Definition:
address-utils.cc:31
ns3::ReadFrom
void ReadFrom(Buffer::Iterator &i, Ipv4Address &ad)
Read an Ipv4Address from a Buffer.
Definition:
address-utils.cc:84
two-ray-to-three-gpp-ch-calibration.start
start
Definition:
two-ray-to-three-gpp-ch-calibration.py:520
src
spectrum
model
aloha-noack-mac-header.cc
Generated on Sun Mar 3 2024 17:11:08 for ns-3 by
1.9.1