A Discrete-Event Network Simulator
API
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
29namespace ns3 {
30
31class Packet;
32
39{
40public:
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;
64
71 uint16_t GetFcs (void) const;
72
79
89
95 void EnableFcs (bool enable);
96
102 bool IsFcsEnabled (void);
103
104private:
114 uint16_t GenerateCrc16 (uint8_t *data, int length);
115
119 uint16_t m_fcs;
120
126
127};
128
129} // namespace ns3
130
131#endif /* LR_WPAN_MAC_TRAILER_H */
iterator in a Buffer instance
Definition: buffer.h:99
Represent the Mac Trailer with the Frame Check Sequence field.
bool IsFcsEnabled(void)
Query if FCS calculation is enabled for this trailer.
virtual uint32_t Deserialize(Buffer::Iterator start)
bool m_calcFcs
Only if m_calcFcs is true, FCS values will be calculated and used in the trailer.
LrWpanMacTrailer(void)
Default constructor for a MAC trailer with disabled FCS calculation.
virtual uint32_t GetSerializedSize(void) const
virtual TypeId GetInstanceTypeId(void) const
Get the most derived TypeId for this Object.
static const uint16_t LR_WPAN_MAC_FCS_LENGTH
The length in octets of the IEEE 802.15.4 MAC FCS field.
uint16_t GenerateCrc16(uint8_t *data, int length)
Calculate the 16-bit FCS value.
uint16_t m_fcs
The FCS value stored in this trailer.
virtual void Print(std::ostream &os) const
virtual void Serialize(Buffer::Iterator start) const
void SetFcs(Ptr< const Packet > p)
Calculate and set the FCS value based on the given packet.
uint16_t GetFcs(void) const
Get this trailers FCS value.
bool CheckFcs(Ptr< const Packet > p)
Check the FCS of a given packet against the FCS value stored in the trailer.
void EnableFcs(bool enable)
Enable or disable FCS calculation for this trailer.
static TypeId GetTypeId(void)
Get the type ID.
Protocol trailer serialization and deserialization.
Definition: trailer.h:41
a unique identifier for an interface.
Definition: type-id.h:59
Every class exported by the ns3 library is enclosed in the ns3 namespace.
def start()
Definition: core.py:1852
uint8_t data[writeSize]