Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
S
scapy
Manage
Activity
Members
Plan
Wiki
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Deploy
Releases
Package Registry
Model registry
Operate
Terraform modules
Analyze
Contributor 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
CodeLinaro
public-release-test-restored
platform
external
scapy
Commits
2c28f06d
Commit
2c28f06d
authored
8 years ago
by
Martijn Thé
Committed by
Guillaume Valadon
8 years ago
Browse files
Options
Downloads
Patches
Plain Diff
Bluetooth: Add LE Connection Update command & event types (#234)
parent
42b7c20d
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
scapy/layers/bluetooth.py
+20
-0
20 additions, 0 deletions
scapy/layers/bluetooth.py
test/bluetooth.uts
+19
-0
19 additions, 0 deletions
test/bluetooth.uts
with
39 additions
and
0 deletions
scapy/layers/bluetooth.py
+
20
−
0
View file @
2c28f06d
...
...
@@ -538,6 +538,16 @@ class HCI_Cmd_LE_Connection_Update(Packet):
class
HCI_Cmd_LE_Create_Connection_Cancel
(
Packet
):
name
=
"
LE Create Connection Cancel
"
class
HCI_Cmd_LE_Connection_Update
(
Packet
):
name
=
"
LE Connection Update
"
fields_desc
=
[
XLEShortField
(
"
handle
"
,
0
),
XLEShortField
(
"
min_interval
"
,
0
),
XLEShortField
(
"
max_interval
"
,
0
),
XLEShortField
(
"
latency
"
,
0
),
XLEShortField
(
"
timeout
"
,
0
),
LEShortField
(
"
min_ce
"
,
0
),
LEShortField
(
"
max_ce
"
,
0xffff
),
]
class
HCI_Cmd_LE_Read_Buffer_Size
(
Packet
):
name
=
"
LE Read Buffer Size
"
...
...
@@ -639,6 +649,14 @@ class HCI_LE_Meta_Connection_Complete(Packet):
LEShortField
(
"
supervision
"
,
42
),
XByteField
(
"
clock_latency
"
,
5
),
]
class
HCI_LE_Meta_Connection_Update_Complete
(
Packet
):
name
=
"
Connection Update Complete
"
fields_desc
=
[
ByteEnumField
(
"
status
"
,
0
,
{
0
:
"
success
"
}),
LEShortField
(
"
handle
"
,
0
),
LEShortField
(
"
interval
"
,
54
),
LEShortField
(
"
latency
"
,
0
),
LEShortField
(
"
timeout
"
,
42
),
]
class
HCI_LE_Meta_Advertising_Report
(
Packet
):
name
=
"
Advertising Report
"
fields_desc
=
[
ByteField
(
"
number
"
,
0
),
...
...
@@ -693,10 +711,12 @@ bind_layers( HCI_Event_Hdr, HCI_Event_Command_Complete, code=0xe)
bind_layers
(
HCI_Event_Hdr
,
HCI_Event_Command_Status
,
code
=
0xf
)
bind_layers
(
HCI_Event_Hdr
,
HCI_Event_Number_Of_Completed_Packets
,
code
=
0x13
)
bind_layers
(
HCI_Event_Hdr
,
HCI_Event_LE_Meta
,
code
=
0x3e
)
bind_layers
(
HCI_Event_Command_Complete
,
HCI_Cmd_Complete_Read_BD_Addr
,
opcode
=
0x1009
)
bind_layers
(
HCI_Event_LE_Meta
,
HCI_LE_Meta_Connection_Complete
,
event
=
1
)
bind_layers
(
HCI_Event_LE_Meta
,
HCI_LE_Meta_Advertising_Report
,
event
=
2
)
bind_layers
(
HCI_Event_LE_Meta
,
HCI_LE_Meta_Connection_Update_Complete
,
event
=
3
)
bind_layers
(
HCI_Event_LE_Meta
,
HCI_LE_Meta_Long_Term_Key_Request
,
event
=
5
)
bind_layers
(
EIR_Hdr
,
EIR_Flags
,
type
=
0x01
)
...
...
This diff is collapsed.
Click to expand it.
test/bluetooth.uts
+
19
−
0
View file @
2c28f06d
...
...
@@ -12,6 +12,25 @@ expected_cmd_raw_data = "01060403341213".decode('hex')
cmd_raw_data = str(HCI_Hdr() / HCI_Command_Hdr() / HCI_Cmd_Disconnect(handle=0x1234))
assert(expected_cmd_raw_data == cmd_raw_data)
= LE Connection Update Command
expected_cmd_raw_data = "0113200e47000a00140001003c000100ffff".decode('hex')
cmd_raw_data = str(
HCI_Hdr() / HCI_Command_Hdr() / HCI_Cmd_LE_Connection_Update(
handle=0x47, min_interval=10, max_interval=20, latency=1, timeout=60,
min_ce=1, max_ce=0xffff))
assert(expected_cmd_raw_data == cmd_raw_data)
+ HCI Events
= LE Connection Update Event
evt_raw_data = "043e0a03004800140001003c00".decode('hex')
evt_pkt = HCI_Hdr(evt_raw_data)
assert(evt_pkt[HCI_LE_Meta_Connection_Update_Complete].handle == 0x48)
assert(evt_pkt[HCI_LE_Meta_Connection_Update_Complete].interval == 20)
assert(evt_pkt[HCI_LE_Meta_Connection_Update_Complete].latency == 1)
assert(evt_pkt[HCI_LE_Meta_Connection_Update_Complete].timeout == 60)
+ Bluetooth LE Advertising / Scan Response Data Parsing
= Parse EIR_Flags, EIR_CompleteList16BitServiceUUIDs, EIR_CompleteLocalName and EIR_TX_Power_Level
...
...
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