A Discrete-Event Network Simulator
Home
Tutorials ▼
English
Documentation ▼
Installation
Manual
Models
Contributing
Wiki
Development ▼
API Docs
Issue Tracker
Merge Requests
API
lr-wpan-mac-trailer.h
Go to the documentation of this file.
1
/*
2
* Copyright (c) 2011 The Boeing Company
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:
18
* kwong yin <kwong-sang.yin@boeing.com>
19
* Sascha Alexander Jopen <jopen@cs.uni-bonn.de>
20
* Erwan Livolant <erwan.livolant@inria.fr>
21
*/
22
23
#ifndef LR_WPAN_MAC_TRAILER_H
24
#define LR_WPAN_MAC_TRAILER_H
25
26
#include <ns3/trailer.h>
27
28
namespace
ns3
29
{
30
31
class
Packet;
32
38
class
LrWpanMacTrailer
:
public
Trailer
39
{
40
public
:
46
static
TypeId
GetTypeId
();
47
51
LrWpanMacTrailer
();
52
53
// Inherited from the Trailer class.
54
TypeId
GetInstanceTypeId
()
const override
;
55
void
Print
(std::ostream& os)
const override
;
56
uint32_t
GetSerializedSize
()
const override
;
57
void
Serialize
(
Buffer::Iterator
start
)
const override
;
58
uint32_t
Deserialize
(
Buffer::Iterator
start
)
override
;
59
66
uint16_t
GetFcs
()
const
;
67
73
void
SetFcs
(
Ptr<const Packet>
p);
74
83
bool
CheckFcs
(
Ptr<const Packet>
p);
84
90
void
EnableFcs
(
bool
enable);
91
97
bool
IsFcsEnabled
()
const
;
98
99
private
:
109
uint16_t
GenerateCrc16
(uint8_t*
data
,
int
length);
110
114
uint16_t
m_fcs
;
115
120
bool
m_calcFcs
;
121
};
122
123
}
// namespace ns3
124
125
#endif
/* LR_WPAN_MAC_TRAILER_H */
ns3::Buffer::Iterator
iterator in a Buffer instance
Definition:
buffer.h:100
ns3::LrWpanMacTrailer
Represent the Mac Trailer with the Frame Check Sequence field.
Definition:
lr-wpan-mac-trailer.h:39
ns3::LrWpanMacTrailer::m_calcFcs
bool m_calcFcs
Only if m_calcFcs is true, FCS values will be calculated and used in the trailer.
Definition:
lr-wpan-mac-trailer.h:120
ns3::LrWpanMacTrailer::GetSerializedSize
uint32_t GetSerializedSize() const override
Definition:
lr-wpan-mac-trailer.cc:63
ns3::LrWpanMacTrailer::GetTypeId
static TypeId GetTypeId()
Get the type ID.
Definition:
lr-wpan-mac-trailer.cc:41
ns3::LrWpanMacTrailer::GenerateCrc16
uint16_t GenerateCrc16(uint8_t *data, int length)
Calculate the 16-bit FCS value.
Definition:
lr-wpan-mac-trailer.cc:145
ns3::LrWpanMacTrailer::m_fcs
uint16_t m_fcs
The FCS value stored in this trailer.
Definition:
lr-wpan-mac-trailer.h:114
ns3::LrWpanMacTrailer::LrWpanMacTrailer
LrWpanMacTrailer()
Default constructor for a MAC trailer with disabled FCS calculation.
Definition:
lr-wpan-mac-trailer.cc:34
ns3::LrWpanMacTrailer::Deserialize
uint32_t Deserialize(Buffer::Iterator start) override
Definition:
lr-wpan-mac-trailer.cc:76
ns3::LrWpanMacTrailer::GetFcs
uint16_t GetFcs() const
Get this trailers FCS value.
Definition:
lr-wpan-mac-trailer.cc:85
ns3::LrWpanMacTrailer::SetFcs
void SetFcs(Ptr< const Packet > p)
Calculate and set the FCS value based on the given packet.
Definition:
lr-wpan-mac-trailer.cc:91
ns3::LrWpanMacTrailer::Serialize
void Serialize(Buffer::Iterator start) const override
Definition:
lr-wpan-mac-trailer.cc:69
ns3::LrWpanMacTrailer::CheckFcs
bool CheckFcs(Ptr< const Packet > p)
Check the FCS of a given packet against the FCS value stored in the trailer.
Definition:
lr-wpan-mac-trailer.cc:108
ns3::LrWpanMacTrailer::Print
void Print(std::ostream &os) const override
Definition:
lr-wpan-mac-trailer.cc:57
ns3::LrWpanMacTrailer::EnableFcs
void EnableFcs(bool enable)
Enable or disable FCS calculation for this trailer.
Definition:
lr-wpan-mac-trailer.cc:129
ns3::LrWpanMacTrailer::GetInstanceTypeId
TypeId GetInstanceTypeId() const override
Get the most derived TypeId for this Object.
Definition:
lr-wpan-mac-trailer.cc:51
ns3::LrWpanMacTrailer::IsFcsEnabled
bool IsFcsEnabled() const
Query if FCS calculation is enabled for this trailer.
Definition:
lr-wpan-mac-trailer.cc:139
ns3::Ptr< const Packet >
ns3::Trailer
Protocol trailer serialization and deserialization.
Definition:
trailer.h:41
ns3::TypeId
a unique identifier for an interface.
Definition:
type-id.h:59
ns3
Every class exported by the ns3 library is enclosed in the ns3 namespace.
two-ray-to-three-gpp-ch-calibration.start
start
Definition:
two-ray-to-three-gpp-ch-calibration.py:520
data
uint8_t data[writeSize]
Definition:
socket-bound-tcp-static-routing.cc:52
src
lr-wpan
model
lr-wpan-mac-trailer.h
Generated on Sun Mar 3 2024 17:11:00 for ns-3 by
1.9.1