A Discrete-Event Network Simulator
Home
Tutorials ▼
English
Documentation ▼
Installation
Manual
Models
Contributing
Wiki
Development ▼
API Docs
Issue Tracker
Merge Requests
API
Loading...
Searching...
No Matches
aloha-noack-mac-header.cc
Go to the documentation of this file.
1
/*
2
* Copyright (c) 2009 CTTC
3
*
4
* SPDX-License-Identifier: GPL-2.0-only
5
*
6
* Author: Nicola Baldo <nbaldo@cttc.es>
7
*/
8
9
#include "
aloha-noack-mac-header.h
"
10
11
#include <ns3/log.h>
12
13
namespace
ns3
14
{
15
16
NS_LOG_COMPONENT_DEFINE
(
"AlohaNoackMacHeader"
);
17
18
NS_OBJECT_ENSURE_REGISTERED
(AlohaNoackMacHeader);
19
20
TypeId
21
AlohaNoackMacHeader::GetTypeId
()
22
{
23
static
TypeId
tid =
TypeId
(
"ns3::AlohaNoackMacHeader"
)
24
.
SetParent
<
Header
>()
25
.SetGroupName(
"Spectrum"
)
26
.AddConstructor<
AlohaNoackMacHeader
>();
27
return
tid;
28
}
29
30
TypeId
31
AlohaNoackMacHeader::GetInstanceTypeId
()
const
32
{
33
return
GetTypeId
();
34
}
35
36
uint32_t
37
AlohaNoackMacHeader::GetSerializedSize
()
const
38
{
39
return
12;
40
}
41
42
void
43
AlohaNoackMacHeader::Serialize
(
Buffer::Iterator
start)
const
44
{
45
WriteTo
(start,
m_destination
);
46
WriteTo
(start,
m_source
);
47
}
48
49
uint32_t
50
AlohaNoackMacHeader::Deserialize
(
Buffer::Iterator
start)
51
{
52
ReadFrom
(start,
m_destination
);
53
ReadFrom
(start,
m_source
);
54
return
GetSerializedSize
();
55
}
56
57
void
58
AlohaNoackMacHeader::Print
(std::ostream& os)
const
59
{
60
os <<
"src="
<<
m_source
<<
"dst="
<<
m_destination
;
61
}
62
63
void
64
AlohaNoackMacHeader::SetSource
(
Mac48Address
source)
65
{
66
m_source
= source;
67
}
68
69
Mac48Address
70
AlohaNoackMacHeader::GetSource
()
const
71
{
72
return
m_source
;
73
}
74
75
void
76
AlohaNoackMacHeader::SetDestination
(
Mac48Address
dst)
77
{
78
m_destination
= dst;
79
}
80
81
Mac48Address
82
AlohaNoackMacHeader::GetDestination
()
const
83
{
84
return
m_destination
;
85
}
86
87
}
// namespace ns3
aloha-noack-mac-header.h
ns3::AlohaNoackMacHeader
Header for the AlohaNoack NetDevice.
Definition
aloha-noack-mac-header.h:25
ns3::AlohaNoackMacHeader::GetSource
Mac48Address GetSource() const
Get the source address.
Definition
aloha-noack-mac-header.cc:70
ns3::AlohaNoackMacHeader::m_source
Mac48Address m_source
source address
Definition
aloha-noack-mac-header.h:61
ns3::AlohaNoackMacHeader::Serialize
void Serialize(Buffer::Iterator start) const override
Definition
aloha-noack-mac-header.cc:43
ns3::AlohaNoackMacHeader::SetDestination
void SetDestination(Mac48Address destination)
Set the destination address.
Definition
aloha-noack-mac-header.cc:76
ns3::AlohaNoackMacHeader::Deserialize
uint32_t Deserialize(Buffer::Iterator start) override
Definition
aloha-noack-mac-header.cc:50
ns3::AlohaNoackMacHeader::Print
void Print(std::ostream &os) const override
Definition
aloha-noack-mac-header.cc:58
ns3::AlohaNoackMacHeader::GetSerializedSize
uint32_t GetSerializedSize() const override
Definition
aloha-noack-mac-header.cc:37
ns3::AlohaNoackMacHeader::GetTypeId
static TypeId GetTypeId()
Get the type ID.
Definition
aloha-noack-mac-header.cc:21
ns3::AlohaNoackMacHeader::GetDestination
Mac48Address GetDestination() const
Get the destination address.
Definition
aloha-noack-mac-header.cc:82
ns3::AlohaNoackMacHeader::m_destination
Mac48Address m_destination
destination address
Definition
aloha-noack-mac-header.h:62
ns3::AlohaNoackMacHeader::SetSource
void SetSource(Mac48Address source)
Set the source address.
Definition
aloha-noack-mac-header.cc:64
ns3::AlohaNoackMacHeader::GetInstanceTypeId
TypeId GetInstanceTypeId() const override
Get the most derived TypeId for this Object.
Definition
aloha-noack-mac-header.cc:31
ns3::Buffer::Iterator
iterator in a Buffer instance
Definition
buffer.h:89
ns3::Header
Protocol header serialization and deserialization.
Definition
header.h:33
ns3::Mac48Address
an EUI-48 address
Definition
mac48-address.h:35
ns3::TypeId
a unique identifier for an interface.
Definition
type-id.h:48
ns3::TypeId::SetParent
TypeId SetParent(TypeId tid)
Set the parent TypeId.
Definition
type-id.cc:1001
uint32_t
NS_LOG_COMPONENT_DEFINE
#define NS_LOG_COMPONENT_DEFINE(name)
Define a Log component with a specific name.
Definition
log.h:191
NS_OBJECT_ENSURE_REGISTERED
#define NS_OBJECT_ENSURE_REGISTERED(type)
Register an Object subclass with the TypeId system.
Definition
object-base.h:35
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:21
ns3::ReadFrom
void ReadFrom(Buffer::Iterator &i, Ipv4Address &ad)
Read an Ipv4Address from a Buffer.
Definition
address-utils.cc:74
src
spectrum
model
aloha-noack-mac-header.cc
Generated on Fri Nov 8 2024 13:59:06 for ns-3 by
1.11.0