A Discrete-Event Network Simulator
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
33 {
34  static TypeId tid = TypeId("ns3::AlohaNoackMacHeader")
35  .SetParent<Header>()
36  .SetGroupName("Spectrum")
37  .AddConstructor<AlohaNoackMacHeader>();
38  return tid;
39 }
40 
41 TypeId
43 {
44  return GetTypeId();
45 }
46 
47 uint32_t
49 {
50  return 12;
51 }
52 
53 void
55 {
58 }
59 
60 uint32_t
62 {
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
76 {
77  m_source = source;
78 }
79 
82 {
83  return m_source;
84 }
85 
86 void
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.
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
virtual uint32_t Deserialize(Buffer::Iterator start)=0
Deserialize the object from a buffer iterator.
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:931
#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.