Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
senf
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
wiback
senf
Commits
1765021b
Commit
1765021b
authored
16 years ago
by
cni
Browse files
Options
Downloads
Patches
Plain Diff
Packets/80211Bundle: add nextPacketRange and nextPacketType to WLANPacket
parent
f62a0a95
No related branches found
No related tags found
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
Packets/80211Bundle/WLANPacket.cc
+20
-0
20 additions, 0 deletions
Packets/80211Bundle/WLANPacket.cc
Packets/80211Bundle/WLANPacket.hh
+6
-4
6 additions, 4 deletions
Packets/80211Bundle/WLANPacket.hh
Packets/80211Bundle/WLANPacket.test.cc
+6
-1
6 additions, 1 deletion
Packets/80211Bundle/WLANPacket.test.cc
with
32 additions
and
5 deletions
Packets/80211Bundle/WLANPacket.cc
+
20
−
0
View file @
1765021b
...
@@ -81,6 +81,26 @@ prefix_ senf::MACAddressParser senf::WLANPacket_DataFrameParser::bssid()
...
@@ -81,6 +81,26 @@ prefix_ senf::MACAddressParser senf::WLANPacket_DataFrameParser::bssid()
return
addr1
();
return
addr1
();
}
}
prefix_
senf
::
PacketInterpreterBase
::
factory_t
senf
::
WLANPacketType
::
nextPacketType
(
packet
p
)
{
if
(
p
->
is_dataFrame
()
&&
(
p
->
subtype
()
==
0
||
p
->
subtype
()
==
8
))
//data frame and subtype is Data or QoS Data
return
LlcSnapPacket
::
factory
();
return
no_factory
();
}
prefix_
senf
::
PacketInterpreterBase
::
optional_range
senf
::
WLANPacketType
::
nextPacketRange
(
packet
p
)
{
if
(
p
->
is_dataFrame
())
{
size_type
sz
=
24
;
//header length of wlan data frame (WDS is not considered)
if
(
p
->
subtype
()
==
8
)
//subtype QoSData
sz
+=
2
;
//2 bytes for QoS field
return
range
(
boost
::
next
(
p
.
data
().
begin
(),
sz
),
boost
::
prior
(
p
.
data
().
end
(),
4
)
);
//-4 bytes FCS
}
//TODO beacon frame payload
return
no_range
();
}
prefix_
void
senf
::
WLANPacketType
::
dump
(
packet
p
,
std
::
ostream
&
os
)
prefix_
void
senf
::
WLANPacketType
::
dump
(
packet
p
,
std
::
ostream
&
os
)
{
{
...
...
This diff is collapsed.
Click to expand it.
Packets/80211Bundle/WLANPacket.hh
+
6
−
4
View file @
1765021b
...
@@ -39,7 +39,7 @@ namespace senf
...
@@ -39,7 +39,7 @@ namespace senf
struct
WLANPacket_MgtFrameParser
:
public
senf
::
PacketParserBase
struct
WLANPacket_MgtFrameParser
:
public
senf
::
PacketParserBase
{
{
# include SENF_FIXED_PARSER()
# include SENF_FIXED_PARSER()
SENF_PARSER_PRIVATE_BITFIELD
(
subtype
,
4
,
unsigned
);
//<pkgdraw: hide
SENF_PARSER_PRIVATE_BITFIELD
(
subtype
,
4
,
unsigned
);
//<pkgdraw: hide
//skip type and version
//skip type and version
SENF_PARSER_SKIP_BITS
(
4
);
//<pkgdraw: hide
SENF_PARSER_SKIP_BITS
(
4
);
//<pkgdraw: hide
...
@@ -73,7 +73,7 @@ namespace senf
...
@@ -73,7 +73,7 @@ namespace senf
struct
WLANPacket_CtrlFrameParser
:
public
senf
::
PacketParserBase
struct
WLANPacket_CtrlFrameParser
:
public
senf
::
PacketParserBase
{
{
# include SENF_PARSER()
# include SENF_PARSER()
SENF_PARSER_PRIVATE_BITFIELD
(
subtype
,
4
,
unsigned
);
//<pkgdraw: hide
SENF_PARSER_PRIVATE_BITFIELD
(
subtype
,
4
,
unsigned
);
//<pkgdraw: hide
//skip type and version
//skip type and version
SENF_PARSER_SKIP_BITS
(
4
);
//<pkgdraw: hide
SENF_PARSER_SKIP_BITS
(
4
);
//<pkgdraw: hide
...
@@ -220,10 +220,12 @@ namespace senf
...
@@ -220,10 +220,12 @@ namespace senf
typedef
senf
::
ConcretePacket
<
WLANPacketType
>
packet
;
typedef
senf
::
ConcretePacket
<
WLANPacketType
>
packet
;
typedef
WLANPacketParser
parser
;
typedef
WLANPacketParser
parser
;
// using mixin::nextPacketRange;
using
mixin
::
init
;
using
mixin
::
init
;
using
mixin
::
initSize
;
using
mixin
::
initSize
;
using
senf
::
PacketTypeBase
::
nextPacketRange
;;
// using senf::PacketTypeBase::nextPacketRange;
static
optional_range
nextPacketRange
(
packet
p
);
static
factory_t
nextPacketType
(
packet
p
);
static
void
dump
(
packet
p
,
std
::
ostream
&
os
);
static
void
dump
(
packet
p
,
std
::
ostream
&
os
);
// static PacketParserBase::size_type initSize();
// static PacketParserBase::size_type initSize();
...
...
This diff is collapsed.
Click to expand it.
Packets/80211Bundle/WLANPacket.test.cc
+
6
−
1
View file @
1765021b
...
@@ -26,6 +26,7 @@
...
@@ -26,6 +26,7 @@
// Custom includes
// Custom includes
#include
"WLANPacket.hh"
#include
"WLANPacket.hh"
#include
"../../Packets/Packets.hh"
#include
"../../Packets/Packets.hh"
#include
"../DefaultBundle/LlcSnapPacket.hh"
#include
"../../Utils/auto_unit_test.hh"
#include
"../../Utils/auto_unit_test.hh"
#include
<boost/test/test_tools.hpp>
#include
<boost/test/test_tools.hpp>
...
@@ -39,10 +40,11 @@ BOOST_AUTO_UNIT_TEST(WLANPacket_dataFrame_packet)
...
@@ -39,10 +40,11 @@ BOOST_AUTO_UNIT_TEST(WLANPacket_dataFrame_packet)
0x4d
,
0x3e
,
0xc7
,
0x5c
,
0x00
,
0x0b
,
0x6b
,
0x57
,
0x4d
,
0x3e
,
0xc7
,
0x5c
,
0x00
,
0x0b
,
0x6b
,
0x57
,
0x06
,
0xb0
,
0x00
,
0x18
,
0x4d
,
0x6e
,
0x78
,
0x48
,
0x06
,
0xb0
,
0x00
,
0x18
,
0x4d
,
0x6e
,
0x78
,
0x48
,
0x30
,
0x00
,
0x01
,
0x00
,
0x30
,
0x00
,
0x01
,
0x00
,
0x
00
,
0x
00
,
0x0
0
,
0x00
,
0x00
,
0x00
,
0x0
0
,
0x00
,
//
dummy data
0x
aa
,
0x
aa
,
0x0
3
,
0x00
,
0x00
,
0x00
,
0x0
8
,
0x00
,
//
llc header
0x38
,
0x39
,
0x30
,
0x31
//trailer
0x38
,
0x39
,
0x30
,
0x31
//trailer
};
};
senf
::
WLANPacket
p
(
senf
::
WLANPacket
::
create
(
data
));
senf
::
WLANPacket
p
(
senf
::
WLANPacket
::
create
(
data
));
BOOST_CHECK_EQUAL
(
p
->
version
(),
0u
);
BOOST_CHECK_EQUAL
(
p
->
version
(),
0u
);
...
@@ -81,6 +83,9 @@ BOOST_AUTO_UNIT_TEST(WLANPacket_dataFrame_packet)
...
@@ -81,6 +83,9 @@ BOOST_AUTO_UNIT_TEST(WLANPacket_dataFrame_packet)
std
::
ostringstream
oss
(
std
::
ostringstream
::
out
);
std
::
ostringstream
oss
(
std
::
ostringstream
::
out
);
SENF_CHECK_NO_THROW
(
p
.
dump
(
oss
));
SENF_CHECK_NO_THROW
(
p
.
dump
(
oss
));
BOOST_CHECK
(
p
.
next
());
BOOST_CHECK
(
p
.
next
().
is
<
senf
::
LlcSnapPacket
>
()
);
}
}
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment