A Discrete-Event Network Simulator
API
uan-header-common.h
Go to the documentation of this file.
1/*
2 * Copyright (c) 2009 University of Washington
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: Leonard Tracy <lentracy@gmail.com>
18 */
19
20#ifndef UAN_HEADER_COMMON_H
21#define UAN_HEADER_COMMON_H
22
23#include "ns3/header.h"
24#include "ns3/mac8-address.h"
25#include "ns3/nstime.h"
26#include "ns3/simulator.h"
27
28namespace ns3
29{
30
37{
38 uint8_t m_type : 4;
39 uint8_t m_protocolNumber : 4;
40};
41
64class UanHeaderCommon : public Header
65{
66 public:
79 const Mac8Address dest,
80 uint8_t type,
81 uint8_t protocolNumber);
83 ~UanHeaderCommon() override;
84
89 static TypeId GetTypeId();
90
96 void SetDest(Mac8Address dest);
102 void SetSrc(Mac8Address src);
109 void SetType(uint8_t type);
116 void SetProtocolNumber(uint16_t protocolNumber);
117
123 Mac8Address GetDest() const;
129 Mac8Address GetSrc() const;
135 uint8_t GetType() const;
141 uint16_t GetProtocolNumber() const;
142
143 // Inherited methods
144 uint32_t GetSerializedSize() const override;
145 void Serialize(Buffer::Iterator start) const override;
147 void Print(std::ostream& os) const override;
148 TypeId GetInstanceTypeId() const override;
149
150 private:
154
155}; // class UanHeaderCommon
156
157} // namespace ns3
158
159#endif /* UAN_HEADER_COMMON_H */
iterator in a Buffer instance
Definition: buffer.h:100
Protocol header serialization and deserialization.
Definition: header.h:44
A class used for addressing MAC8 MAC's.
Definition: mac8-address.h:44
a unique identifier for an interface.
Definition: type-id.h:60
Common packet header fields.
static TypeId GetTypeId()
Register this type.
void SetSrc(Mac8Address src)
Set the source address.
uint32_t Deserialize(Buffer::Iterator start) override
uint32_t GetSerializedSize() const override
Mac8Address m_dest
The destination address.
uint8_t GetType() const
Get the header type value.
Mac8Address m_src
The source address.
Mac8Address GetDest() const
Get the destination address.
UanHeaderCommon()
Default constructor.
void SetProtocolNumber(uint16_t protocolNumber)
Set the packet type.
void Serialize(Buffer::Iterator start) const override
Mac8Address GetSrc() const
Get the source address.
UanProtocolBits m_uanProtocolBits
The type and protocol bits.
void SetDest(Mac8Address dest)
Set the destination address.
void SetType(uint8_t type)
Set the header type.
~UanHeaderCommon() override
Destructor.
void Print(std::ostream &os) const override
uint16_t GetProtocolNumber() const
Get the packet type value.
TypeId GetInstanceTypeId() const override
Get the most derived TypeId for this Object.
Every class exported by the ns3 library is enclosed in the ns3 namespace.
def start()
Definition: core.py:1864
UAN protocol descriptor.
uint8_t m_protocolNumber
protocol number (4 bits)
uint8_t m_type
type (4 bits)