A Discrete-Event Network Simulator
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 * 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
21
22#include <ns3/log.h>
23
24namespace ns3
25{
26
27NS_LOG_COMPONENT_DEFINE("AlohaNoackMacHeader");
28
29NS_OBJECT_ENSURE_REGISTERED(AlohaNoackMacHeader);
30
31TypeId
33{
34 static TypeId tid = TypeId("ns3::AlohaNoackMacHeader")
36 .SetGroupName("Spectrum")
37 .AddConstructor<AlohaNoackMacHeader>();
38 return tid;
39}
40
43{
44 return GetTypeId();
45}
46
49{
50 return 12;
51}
52
53void
55{
56 WriteTo(start, m_destination);
57 WriteTo(start, m_source);
58}
59
62{
63 ReadFrom(start, m_destination);
64 ReadFrom(start, m_source);
65 return GetSerializedSize();
66}
67
68void
69AlohaNoackMacHeader::Print(std::ostream& os) const
70{
71 os << "src=" << m_source << "dst=" << m_destination;
72}
73
74void
76{
77 m_source = source;
78}
79
82{
83 return m_source;
84}
85
86void
88{
89 m_destination = dst;
90}
91
94{
95 return m_destination;
96}
97
98} // namespace ns3
Header for the AlohaNoack NetDevice.
Mac48Address GetSource() const
Get the source address.
Mac48Address m_source
source address
void Serialize(Buffer::Iterator start) const override
void SetDestination(Mac48Address destination)
Set the destination address.
uint32_t Deserialize(Buffer::Iterator start) override
void Print(std::ostream &os) const override
uint32_t GetSerializedSize() const override
static TypeId GetTypeId()
Get the type ID.
Mac48Address GetDestination() const
Get the destination address.
Mac48Address m_destination
destination address
void SetSource(Mac48Address source)
Set the source address.
TypeId GetInstanceTypeId() const override
Get the most derived TypeId for this Object.
iterator in a Buffer instance
Definition: buffer.h:100
Protocol header serialization and deserialization.
Definition: header.h:44
an EUI-48 address
Definition: mac48-address.h:46
a unique identifier for an interface.
Definition: type-id.h:59
TypeId SetParent(TypeId tid)
Set the parent TypeId.
Definition: type-id.cc:932
#define NS_LOG_COMPONENT_DEFINE(name)
Define a Log component with a specific name.
Definition: log.h:202
#define NS_OBJECT_ENSURE_REGISTERED(type)
Register an Object subclass with the TypeId system.
Definition: object-base.h:46
Every class exported by the ns3 library is enclosed in the ns3 namespace.
void WriteTo(Buffer::Iterator &i, Ipv4Address ad)
Write an Ipv4Address to a Buffer.
void ReadFrom(Buffer::Iterator &i, Ipv4Address &ad)
Read an Ipv4Address from a Buffer.