A Discrete-Event Network Simulator
Home
Tutorials ▼
English
Documentation ▼
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
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
2
/*
3
* Copyright (c) 2009 CTTC
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: Nicola Baldo <nbaldo@cttc.es>
19
*/
20
21
#include <ns3/log.h>
22
#include "
aloha-noack-mac-header.h
"
23
24
25
namespace
ns3
{
26
27
NS_LOG_COMPONENT_DEFINE
(
"AlohaNoackMacHeader"
);
28
29
NS_OBJECT_ENSURE_REGISTERED
(AlohaNoackMacHeader);
30
31
TypeId
32
AlohaNoackMacHeader::GetTypeId
(
void
)
33
{
34
static
TypeId
tid =
TypeId
(
"ns3::AlohaNoackMacHeader"
)
35
.
SetParent
<
Header
> ()
36
.SetGroupName (
"Spectrum"
)
37
.AddConstructor<
AlohaNoackMacHeader
> ()
38
;
39
return
tid;
40
}
41
42
TypeId
43
AlohaNoackMacHeader::GetInstanceTypeId
(
void
)
const
44
{
45
return
GetTypeId
();
46
}
47
48
49
50
uint32_t
51
AlohaNoackMacHeader::GetSerializedSize
(
void
)
const
52
{
53
return
12;
54
}
55
56
57
58
void
59
AlohaNoackMacHeader::Serialize
(
Buffer::Iterator
start
)
const
60
{
61
WriteTo
(
start
,
m_destination
);
62
WriteTo
(
start
,
m_source
);
63
}
64
65
uint32_t
66
AlohaNoackMacHeader::Deserialize
(
Buffer::Iterator
start
)
67
{
68
ReadFrom
(
start
,
m_destination
);
69
ReadFrom
(
start
,
m_source
);
70
return
GetSerializedSize
();
71
}
72
73
74
void
75
AlohaNoackMacHeader::Print
(std::ostream &os)
const
76
{
77
os <<
"src="
<<
m_source
78
<<
"dst="
<<
m_destination
;
79
}
80
81
82
void
83
AlohaNoackMacHeader::SetSource
(
Mac48Address
source)
84
{
85
m_source
= source;
86
}
87
88
Mac48Address
89
AlohaNoackMacHeader::GetSource
()
const
90
{
91
return
m_source
;
92
}
93
94
void
95
AlohaNoackMacHeader::SetDestination
(
Mac48Address
dst)
96
{
97
m_destination
= dst;
98
}
99
100
Mac48Address
101
AlohaNoackMacHeader::GetDestination
()
const
102
{
103
return
m_destination
;
104
}
105
106
107
108
109
}
// namespace ns3
110
111
aloha-noack-mac-header.h
ns3::AlohaNoackMacHeader
Header for the AlohaNoack NetDevice.
Definition:
aloha-noack-mac-header.h:37
ns3::AlohaNoackMacHeader::GetSource
Mac48Address GetSource() const
Get the source address.
Definition:
aloha-noack-mac-header.cc:89
ns3::AlohaNoackMacHeader::Print
virtual void Print(std::ostream &os) const
Definition:
aloha-noack-mac-header.cc:75
ns3::AlohaNoackMacHeader::m_source
Mac48Address m_source
source address
Definition:
aloha-noack-mac-header.h:73
ns3::AlohaNoackMacHeader::GetTypeId
static TypeId GetTypeId(void)
Get the type ID.
Definition:
aloha-noack-mac-header.cc:32
ns3::AlohaNoackMacHeader::Serialize
virtual void Serialize(Buffer::Iterator start) const
Definition:
aloha-noack-mac-header.cc:59
ns3::AlohaNoackMacHeader::SetDestination
void SetDestination(Mac48Address destination)
Set the destination address.
Definition:
aloha-noack-mac-header.cc:95
ns3::AlohaNoackMacHeader::GetSerializedSize
virtual uint32_t GetSerializedSize(void) const
Definition:
aloha-noack-mac-header.cc:51
ns3::AlohaNoackMacHeader::GetDestination
Mac48Address GetDestination() const
Get the destination address.
Definition:
aloha-noack-mac-header.cc:101
ns3::AlohaNoackMacHeader::m_destination
Mac48Address m_destination
destination address
Definition:
aloha-noack-mac-header.h:74
ns3::AlohaNoackMacHeader::SetSource
void SetSource(Mac48Address source)
Set the source address.
Definition:
aloha-noack-mac-header.cc:83
ns3::AlohaNoackMacHeader::GetInstanceTypeId
virtual TypeId GetInstanceTypeId(void) const
Get the most derived TypeId for this Object.
Definition:
aloha-noack-mac-header.cc:43
ns3::Buffer::Iterator
iterator in a Buffer instance
Definition:
buffer.h:99
ns3::Header
Protocol header serialization and deserialization.
Definition:
header.h:43
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:44
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:922
NS_LOG_COMPONENT_DEFINE
#define NS_LOG_COMPONENT_DEFINE(name)
Define a Log component with a specific name.
Definition:
log.h:205
NS_OBJECT_ENSURE_REGISTERED
#define NS_OBJECT_ENSURE_REGISTERED(type)
Register an Object subclass with the TypeId system.
Definition:
object-base.h:45
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:28
ns3::ReadFrom
void ReadFrom(Buffer::Iterator &i, Ipv4Address &ad)
Read an Ipv4Address from a Buffer.
Definition:
address-utils.cc:70
visualizer.core.start
def start()
Definition:
core.py:1853
src
spectrum
model
aloha-noack-mac-header.cc
Generated on Tue Feb 6 2024 19:21:27 for ns-3 by
1.9.1