A Discrete-Event Network Simulator
Home
Tutorials ▼
English
Portuguese
Docs ▼
Wiki
Manual
Models
Develop ▼
API
Bugs
API
src
lr-wpan
model
lr-wpan-mac-trailer.h
Go to the documentation of this file.
1
/* -*- Mode: C++; c-file-style: "gnu"; indent-tabs-mode:nil; -*- */
2
/*
3
* Copyright (c) 2011 The Boeing Company
4
*
5
* This program is free software; you can redistribute it and/or modify
6
* it under the terms of the GNU General Public License version 2 as
7
* published by the Free Software Foundation;
8
*
9
* This program is distributed in the hope that it will be useful,
10
* but WITHOUT ANY WARRANTY; without even the implied warranty of
11
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12
* GNU General Public License for more details.
13
*
14
* You should have received a copy of the GNU General Public License
15
* along with this program; if not, write to the Free Software
16
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17
*
18
* Author:
19
* kwong yin <kwong-sang.yin@boeing.com>
20
* Sascha Alexander Jopen <jopen@cs.uni-bonn.de>
21
* Erwan Livolant <erwan.livolant@inria.fr>
22
*/
23
24
#ifndef LR_WPAN_MAC_TRAILER_H
25
#define LR_WPAN_MAC_TRAILER_H
26
27
#include <ns3/trailer.h>
28
29
namespace
ns3
{
30
31
class
Packet;
32
38
class
LrWpanMacTrailer
:
public
Trailer
39
{
40
public
:
44
static
const
uint16_t
LR_WPAN_MAC_FCS_LENGTH
;
45
51
static
TypeId
GetTypeId
(
void
);
52
56
LrWpanMacTrailer
(
void
);
57
58
// Inherited from the Trailer class.
59
virtual
TypeId
GetInstanceTypeId
(
void
)
const
;
60
virtual
void
Print
(std::ostream &os)
const
;
61
virtual
uint32_t
GetSerializedSize
(
void
)
const
;
62
virtual
void
Serialize
(
Buffer::Iterator
start
)
const
;
63
virtual
uint32_t
Deserialize
(
Buffer::Iterator
start
);
64
71
uint16_t
GetFcs
(
void
)
const
;
72
78
void
SetFcs
(
Ptr<const Packet>
p);
79
88
bool
CheckFcs
(
Ptr<const Packet>
p);
89
95
void
EnableFcs
(
bool
enable);
96
102
bool
IsFcsEnabled
(
void
);
103
104
private
:
114
uint16_t
GenerateCrc16
(uint8_t *
data
,
int
length);
115
119
uint16_t
m_fcs
;
120
125
bool
m_calcFcs
;
126
127
};
128
129
}
// namespace ns3
130
131
#endif
/* LR_WPAN_MAC_TRAILER_H */
ns3::LrWpanMacTrailer::EnableFcs
void EnableFcs(bool enable)
Enable or disable FCS calculation for this trailer.
Definition:
lr-wpan-mac-trailer.cc:128
ns3::Ptr< const Packet >
ns3::LrWpanMacTrailer::IsFcsEnabled
bool IsFcsEnabled(void)
Query if FCS calculation is enabled for this trailer.
Definition:
lr-wpan-mac-trailer.cc:138
ns3::LrWpanMacTrailer::GetSerializedSize
virtual uint32_t GetSerializedSize(void) const
Definition:
lr-wpan-mac-trailer.cc:62
ns3::LrWpanMacTrailer::GetInstanceTypeId
virtual TypeId GetInstanceTypeId(void) const
Get the most derived TypeId for this Object.
Definition:
lr-wpan-mac-trailer.cc:50
visualizer.core.start
def start()
Definition:
core.py:1844
ns3::Buffer::Iterator
iterator in a Buffer instance
Definition:
buffer.h:98
ns3::LrWpanMacTrailer::Deserialize
virtual uint32_t Deserialize(Buffer::Iterator start)
Definition:
lr-wpan-mac-trailer.cc:75
ns3::LrWpanMacTrailer::GetFcs
uint16_t GetFcs(void) const
Get this trailers FCS value.
Definition:
lr-wpan-mac-trailer.cc:84
data
uint8_t data[writeSize]
Definition:
socket-bound-tcp-static-routing.cc:53
ns3::LrWpanMacTrailer::LrWpanMacTrailer
LrWpanMacTrailer(void)
Default constructor for a MAC trailer with disabled FCS calculation.
Definition:
lr-wpan-mac-trailer.cc:32
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:90
ns3::Trailer
Protocol trailer serialization and deserialization.
Definition:
trailer.h:40
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:125
ns3
Every class exported by the ns3 library is enclosed in the ns3 namespace.
ns3::LrWpanMacTrailer::LR_WPAN_MAC_FCS_LENGTH
static const uint16_t LR_WPAN_MAC_FCS_LENGTH
The length in octets of the IEEE 802.15.4 MAC FCS field.
Definition:
lr-wpan-mac-trailer.h:44
ns3::LrWpanMacTrailer
Represent the Mac Trailer with the Frame Check Sequence field.
Definition:
lr-wpan-mac-trailer.h:38
ns3::LrWpanMacTrailer::Serialize
virtual void Serialize(Buffer::Iterator start) const
Definition:
lr-wpan-mac-trailer.cc:68
ns3::LrWpanMacTrailer::GenerateCrc16
uint16_t GenerateCrc16(uint8_t *data, int length)
Calculate the 16-bit FCS value.
Definition:
lr-wpan-mac-trailer.cc:144
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:107
ns3::TypeId
a unique identifier for an interface.
Definition:
type-id.h:58
ns3::LrWpanMacTrailer::Print
virtual void Print(std::ostream &os) const
Definition:
lr-wpan-mac-trailer.cc:56
ns3::LrWpanMacTrailer::m_fcs
uint16_t m_fcs
The FCS value stored in this trailer.
Definition:
lr-wpan-mac-trailer.h:119
ns3::LrWpanMacTrailer::GetTypeId
static TypeId GetTypeId(void)
Get the type ID.
Definition:
lr-wpan-mac-trailer.cc:39
Generated on Wed Nov 7 2018 10:01:58 for ns-3 by
1.8.14