Commit Graph

82 Commits

Author SHA1 Message Date
Johan Hedberg
0f6fb5c0de emulator: Add basic security mode 3 support 2014-01-09 14:51:51 +02:00
Johan Hedberg
1c3b4eabd0 emulator: Add missing PIN Code Request Reply bit to supported commands 2014-01-08 17:47:08 +02:00
Johan Hedberg
f9b9a06c93 emulator: Fix emitting incorrect auth complete on acceptor side 2014-01-08 16:37:35 +02:00
Johan Hedberg
f8052a6616 emulator: Add initial support for Link Key Notify event 2014-01-08 16:37:34 +02:00
Johan Hedberg
1dd5b101c5 emulator: Add basic support for PIN Code Request Reply command 2014-01-08 16:37:34 +02:00
Johan Hedberg
4f53c2c3cc emulator: Add basic support for Link Key Request Reply command 2014-01-08 16:37:33 +02:00
Johan Hedberg
ed2254b20c emulator: Add initial support for PIN Code Request Negative Reply 2014-01-08 16:37:33 +02:00
Johan Hedberg
52682e25b7 emulator: Add initial handling for link key req neg reply 2014-01-08 16:37:32 +02:00
Johan Hedberg
e6a16562a4 emulator: Add basic auth request completion support 2014-01-08 16:37:32 +02:00
Andrei Emeltchenko
1ae9c6a645 btdev: Return Command Status for Authentication Requested
Add support for "Authentication Requested" command
2014-01-08 16:37:32 +02:00
Marcel Holtmann
0007671cf8 emulator: Add support for secure connections host support commands 2013-12-28 19:13:55 -08:00
Johan Hedberg
a2685ac211 emulator/btdev: Add initial support for HCI_LE_Long_Term_Key_Request_Reply 2013-11-29 14:41:14 +02:00
Johan Hedberg
c56b263fbf emulator/btdev: Add basic support for HCI_LE_Start_Encryption 2013-11-29 14:11:06 +02:00
Johan Hedberg
c8217dc462 emulator/btdev: Fix existing connection check in disconnection logic 2013-11-29 11:17:39 +02:00
Johan Hedberg
3204c443ad emulator/btdev: Simplify connection request logic
We should return page timeout both when the remote exists but just
doesn't have page scan enabled as well as when the remote doesn't exist.
2013-11-29 11:13:09 +02:00
Marcel Holtmann
bdaa349ba5 emulator: Add support for reading IAC information 2013-10-14 14:43:58 -07:00
Marcel Holtmann
f8b11ca9d9 monitor: Fix broken assoc_fragment structure value 2013-10-07 12:47:07 -07:00
Marcel Holtmann
065783d0a2 emulator: Add support for read local amp assoc command 2013-10-05 10:31:14 -07:00
Johan Hedberg
724a904228 emulator: Add basic support for LE connections 2013-09-19 20:39:02 +03:00
Johan Hedberg
26218dbf24 emulator: Remove redundant empty line 2013-09-19 10:06:57 -05:00
Johan Hedberg
84a0738622 emulator: Add missing HCI commands to the supported commands response 2013-09-11 10:54:41 +03:00
Johan Hedberg
d87776a264 emulator: Disallow SCO HCI commands on LE-only controllers 2013-09-11 10:54:22 +03:00
Johan Hedberg
4b95a69b61 emulator: Disallow HCI_Write_Current_IAP_LAP for LE-only controllers 2013-09-11 10:53:56 +03:00
Marcel Holtmann
aa6c727822 emulator: Add support for reading local out-of-band data 2013-09-11 00:04:35 -07:00
Marcel Holtmann
44f2f61e9f emulator: Add support for LE test commands 2013-09-07 21:36:38 -07:00
Marcel Holtmann
840fbec181 emulator: Add emulation a few more HCI commands 2013-09-07 21:28:34 -07:00
Marcel Holtmann
d68010fb9d emulator: Add support for host buffer size and LE rand commands 2013-09-07 16:35:22 -07:00
Marcel Holtmann
da05e084ae emulator: Fix up AFH channel assessment structures 2013-08-27 19:21:28 -07:00
Frédéric Dalleau
7d0783b711 emulator: Add btdev_get_features API (needed for SCO tests) 2013-08-01 12:54:32 +03:00
Frédéric Dalleau
287304526a emulator: Add SCO connection creation support 2013-08-01 12:54:32 +03:00
Bruna Moreira
c582e850a8 emulator: Add new function for running all hooks
It was defined four hook types and they are run before/after the first
part of default command processing and send event. Note that hook return
will define if the emulator will process/send next events (calling the
default_cmd_completion() function or not).
2013-07-24 09:05:56 -07:00
Eder Ruiz Maria
0714d4ee67 emulator: cmd_status() using send_packet() for run hooks easily
Now like cmd_command(), cmd_status() directly uses send_packet() instead
of send_event(), consequently cmd_status() must build the hci packet
without help of send_event(). With this change the events sent by
default_cmd() no more use send_event(), who is a good place to run hooks
for BTDEV_HOOK_POST_EVT. And the functions cmd_command() and
cmd_status() can run hooks for BTDEV_HOOK_POST_CMD.
2013-07-24 09:05:45 -07:00
Eder Ruiz Maria
6eef674964 emulator: Split default_cmd() for better command and event handler
Now except for command complete event and command status event, all
other are handled by default_cmd_completion(). With this we can easily
add hooks in some points.
2013-07-24 09:04:03 -07:00
Eder Ruiz Maria
653a17cc3b emulator: Add support for delete a hook 2013-07-24 09:03:49 -07:00
Eder Ruiz Maria
7fcddf9989 emulator: Add hook only if there aren't other with same type and opcode 2013-07-24 09:03:02 -07:00
Eder Ruiz Maria
37199df506 emulator: Add support for pre/post command/event hooks
Now who use emulator can add hooks to manipulate hci packets before
and after process commands and send events.
2013-07-24 09:02:52 -07:00
Jefferson Delfes
328231416b emulator: Implement LE advertising report
When a virtual device starts a LE advertising, emulator searches for
other virtual devices that are in scan mode, in order to send adv data
to these devices.
Inverse goes when LE scan is enabled. Emulator searches virtual devices
that are in advertising mode and copy adv data to them.
2013-07-05 11:56:48 +03:00
Jefferson Delfes
2aab109f42 emulator: Dummy LE set advertising parameters
Implement basic LE set adv parameters command.
2013-07-05 11:56:25 +03:00
Jefferson Delfes
8d3386453a emulator: Disallow LE set scan params command when scan is enabled
When LE scan is enabled, the command LE set scan parameters should
return a command disallowed in status of command complete event.
2013-07-05 11:56:13 +03:00
Jefferson Delfes
5616bb9686 emulator: Store LE scan state of virtual controller
The LE command set scan enable can change the scan state of virtual
controller.
2013-07-05 11:55:57 +03:00
Jefferson Delfes
ba6460907a emulator: Implement basic LE set adv enable command
Store advertising state of virtual controller in btdev struct.
2013-07-05 11:55:33 +03:00
Jefferson Delfes
f1877f83b2 emulator: Store LE advertising data length in btdev
LE advertising data length will be used for emulating reports in other
virtual devices.
2013-07-05 11:55:09 +03:00
Anderson Lizardo
14b00ae8d2 emulator: Fix Remote Name Request Cancel command complete
The Command Complete event for this HCI command contains two parameters,
status and bd_addr.
2013-06-17 13:49:19 +03:00
Anderson Lizardo
fc2911aae7 emulator: Fix uninitialised memory usage on inquiry
This happens when using "btvirt -l2" and running "discoverable on" on
hci1 and "scan on" on hci0 using bluetoothctl:

==1870== Syscall param write(buf) points to uninitialised byte(s)
==1870==    at 0x4114443: __write_nocancel (syscall-template.S:82)
==1870==    by 0x804B503: send_packet (btdev.c:478)
==1870==    by 0x804B599: send_event (btdev.c:503)
==1870==    by 0x804B8C0: inquiry_complete (btdev.c:589)
==1870==    by 0x804C538: default_cmd (btdev.c:881)
==1870==    by 0x804E5DE: process_cmd (btdev.c:1559)
==1870==    by 0x804E646: btdev_receive_h4 (btdev.c:1577)
==1870==    by 0x804A487: vhci_read_callback (vhci.c:82)
==1870==    by 0x804923E: mainloop_run (mainloop.c:142)
==1870==    by 0x8048FD4: main (main.c:145)
==1870==  Address 0x41e4d0f is 15 bytes inside a block of size 258
alloc'd
==1870==    at 0x402B56C: malloc (vg_replace_malloc.c:270)
==1870==    by 0x804B531: send_event (btdev.c:490)
==1870==    by 0x804B8C0: inquiry_complete (btdev.c:589)
==1870==    by 0x804C538: default_cmd (btdev.c:881)
==1870==    by 0x804E5DE: process_cmd (btdev.c:1559)
==1870==    by 0x804E646: btdev_receive_h4 (btdev.c:1577)
==1870==    by 0x804A487: vhci_read_callback (vhci.c:82)
==1870==    by 0x804923E: mainloop_run (mainloop.c:142)
==1870==    by 0x8048FD4: main (main.c:145)
==1870==
2013-06-17 13:49:17 +03:00
Johan Hedberg
dcd5640ece emulator: Fix typo in supported command comment 2013-06-13 12:19:00 +03:00
Johan Hedberg
c27f48e426 emulator: Fix btdev connectability test (0x02 is page scan) 2013-05-28 11:14:16 +03:00
Johan Hedberg
890fac2917 emulator: Remove unneeded btdev_set_bdaddr function 2013-04-30 13:21:23 +03:00
Jefferson Delfes
b895b60dcf emulator: Add getter function for device address in btdev
This helper function returns bdaddr field from btdev.
2013-04-30 13:01:58 +03:00
Johan Hedberg
1e0aa26199 emulator: Remove extended features from LE-only controllers 2013-04-19 16:51:07 +03:00
Johan Hedberg
d311de1295 emulator: Move Event Mask Page 2 from BR/EDR to BR/EDR/LE 2013-04-19 16:50:21 +03:00