A Discrete-Event Network Simulator
QKDNetSim v2.0 (NS-3 v3.41) @ (+)
Home
Tutorials ▼
English
Documentation ▼
Installation
Manual
Models
Contributing
Wiki
Development ▼
API Docs
Issue Tracker
Merge Requests
API
Main Page
Related Pages
Modules
Namespaces
Namespace List
Namespace Members
All
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
Functions
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
y
Variables
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
r
s
t
u
v
w
x
Typedefs
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
r
s
t
u
v
w
Enumerations
a
b
c
d
e
f
g
h
i
l
m
n
o
p
q
r
s
t
v
w
Enumerator
a
b
c
d
e
f
h
i
l
m
n
o
p
q
r
s
t
u
v
w
Classes
Class List
Class Index
Class Hierarchy
Class Members
All
:
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
~
Functions
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
~
Variables
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
Typedefs
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
Enumerations
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
Enumerator
a
b
c
d
e
f
g
h
i
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
Properties
Related Functions
:
a
b
c
d
e
g
h
i
j
l
m
n
o
p
q
r
s
t
u
w
Files
File List
File Members
All
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
Functions
_
a
b
c
d
e
f
g
h
i
l
m
n
o
p
q
r
s
t
u
v
w
Variables
a
b
c
d
e
f
g
h
i
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
Typedefs
Enumerations
Enumerator
c
e
i
l
o
r
s
t
v
Macros
_
a
b
c
d
e
f
g
h
i
j
l
m
n
o
p
r
s
t
u
v
w
Examples
•
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Properties
Friends
Macros
Modules
Pages
lr-wpan-packet-print.cc
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: Tom Henderson <thomas.r.henderson@boeing.com>
18
*/
19
#include <ns3/core-module.h>
20
#include <ns3/lr-wpan-module.h>
21
22
#include <iostream>
23
24
using namespace
ns3
;
25
26
int
27
main(
int
argc,
char
* argv[])
28
{
29
Packet::EnablePrinting
();
30
Packet::EnableChecking
();
31
LrWpanMacHeader
macHdr(
LrWpanMacHeader::LRWPAN_MAC_BEACON
, 0);
// sequence number set to 0
32
macHdr.SetSrcAddrMode(2);
// short addr
33
macHdr.SetDstAddrMode(0);
// no addr
34
// ... other setters
35
36
uint16_t srcPanId = 100;
37
Mac16Address
srcWpanAddr(
"00:11"
);
38
39
macHdr.SetSrcAddrFields(srcPanId, srcWpanAddr);
40
41
LrWpanMacTrailer
macTrailer;
42
43
Ptr<Packet>
p = Create<Packet>(20);
// 20 bytes of dummy data
44
45
p->
AddHeader
(macHdr);
46
p->
AddTrailer
(macTrailer);
47
48
p->
Print
(std::cout);
49
std::cout << std::endl;
50
return
0;
51
}
ns3::LrWpanMacHeader
Represent the Mac Header with the Frame Control and Sequence Number fields.
Definition:
lr-wpan-mac-header.h:52
ns3::LrWpanMacHeader::LRWPAN_MAC_BEACON
@ LRWPAN_MAC_BEACON
LRWPAN_MAC_BEACON.
Definition:
lr-wpan-mac-header.h:59
ns3::LrWpanMacTrailer
Represent the Mac Trailer with the Frame Check Sequence field.
Definition:
lr-wpan-mac-trailer.h:39
ns3::Mac16Address
This class can contain 16 bit addresses.
Definition:
mac16-address.h:44
ns3::Packet::EnableChecking
static void EnableChecking()
Enable packets metadata checking.
Definition:
packet.cc:603
ns3::Packet::AddHeader
void AddHeader(const Header &header)
Add header to this packet.
Definition:
packet.cc:268
ns3::Packet::Print
void Print(std::ostream &os) const
Print the packet contents.
Definition:
packet.cc:456
ns3::Packet::EnablePrinting
static void EnablePrinting()
Enable printing packets metadata.
Definition:
packet.cc:596
ns3::Packet::AddTrailer
void AddTrailer(const Trailer &trailer)
Add trailer to this packet.
Definition:
packet.cc:324
ns3::Ptr< Packet >
ns3
Every class exported by the ns3 library is enclosed in the ns3 namespace.
src
lr-wpan
examples
lr-wpan-packet-print.cc
Generated on Sun Mar 3 2024 17:11:00 for ns-3 by
1.9.1