Commit Graph

37 Commits

Author SHA1 Message Date
Szymon Janc
46d9e2693d neard: Restrict method calls only to neard process
Disallow methods calls from processes other than registered to as
agent.
2013-02-15 16:28:48 +02:00
Szymon Janc
66d880d232 neard: Use service name and not boolean to track if registered to neard 2013-02-15 16:28:06 +02:00
Szymon Janc
4345fd9154 neard: Add support for setting power state in RequestOOB reply
This allows neard to properly set Bluetooth carrier power state in
handover message.
2013-02-15 10:42:21 +02:00
Szymon Janc
127b948210 neard: Check if adapter is powered in PushOOB
For PushOOB adapter needs to be powered as bluetoothd daemon is
expected to perform action on success.
2013-02-15 10:41:22 +02:00
Szymon Janc
d5672b8869 neard: Move pairable check from check_adapter
If device is already paired there is no need to fail with handover
if adapter is not pairable.
2013-02-15 10:40:23 +02:00
Szymon Janc
fe7f8fd83a neard: Add ability to parse 'State' field
This contains hint for power state of remote device Bluetooth adapter.
2013-02-15 10:38:49 +02:00
Szymon Janc
ac83286bb2 neard: Refactor message processing
This refactor code for message processing for future feature addition.
nokia.com:bt and EIR processing is now separated from performing
actions based on received data.
2013-02-15 10:37:55 +02:00
Szymon Janc
2cf03cc883 neard: Adjust errors to latest API changes
neard Handover API was stripped of not really usefull error codes.
2013-02-15 10:36:17 +02:00
Szymon Janc
ee9c08452c neard: Fix memory leak on registering as agent
Message reference was not dropped in register_agent. This fix following
memory leak reported by valgrind:

454 (184 direct, 270 indirect) bytes in 1 blocks are definitely lost in loss record 207 of 220
   at 0x4C29DB4: calloc (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
   by 0x513DCF2: ??? (in /lib/x86_64-linux-gnu/libdbus-1.so.3.5.8)
   by 0x514222E: ??? (in /lib/x86_64-linux-gnu/libdbus-1.so.3.5.8)
   by 0x5149F46: ??? (in /lib/x86_64-linux-gnu/libdbus-1.so.3.5.8)
   by 0x514A070: ??? (in /lib/x86_64-linux-gnu/libdbus-1.so.3.5.8)
   by 0x514AA63: ??? (in /lib/x86_64-linux-gnu/libdbus-1.so.3.5.8)
   by 0x514B0A5: ??? (in /lib/x86_64-linux-gnu/libdbus-1.so.3.5.8)
   by 0x5149E0C: ??? (in /lib/x86_64-linux-gnu/libdbus-1.so.3.5.8)
   by 0x5134D24: ??? (in /lib/x86_64-linux-gnu/libdbus-1.so.3.5.8)
   by 0x5136088: ??? (in /lib/x86_64-linux-gnu/libdbus-1.so.3.5.8)
   by 0x5135643: dbus_connection_send_with_reply_and_block (in /lib/x86_64-linux-gnu/libdbus-1.so.3.5.8)
   by 0x5130C93: dbus_bus_register (in /lib/x86_64-linux-gnu/libdbus-1.so.3.5.8)

102 bytes in 1 blocks are indirectly lost in loss record 154 of 220
   at 0x4C2B7B2: realloc (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
   by 0x514F02F: ??? (in /lib/x86_64-linux-gnu/libdbus-1.so.3.5.8)
   by 0x514F0DD: ??? (in /lib/x86_64-linux-gnu/libdbus-1.so.3.5.8)
   by 0x514F239: ??? (in /lib/x86_64-linux-gnu/libdbus-1.so.3.5.8)
   by 0x514DE0A: ??? (in /lib/x86_64-linux-gnu/libdbus-1.so.3.5.8)
   by 0x514E3D3: ??? (in /lib/x86_64-linux-gnu/libdbus-1.so.3.5.8)
   by 0x513C138: ??? (in /lib/x86_64-linux-gnu/libdbus-1.so.3.5.8)
   by 0x513FF4D: dbus_message_iter_append_basic (in /lib/x86_64-linux-gnu/libdbus-1.so.3.5.8)
   by 0x5141790: dbus_message_new_error (in /lib/x86_64-linux-gnu/libdbus-1.so.3.5.8)
   by 0x5135C70: dbus_connection_dispatch (in /lib/x86_64-linux-gnu/libdbus-1.so.3.5.8)
   by 0x40A747: message_dispatch (mainloop.c:76)
   by 0x4E7A91A: ??? (in /lib/x86_64-linux-gnu/libglib-2.0.so.0.3200.3)

168 bytes in 1 blocks are indirectly lost in loss record 185 of 220
   at 0x4C2B7B2: realloc (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
   by 0x514F02F: ??? (in /lib/x86_64-linux-gnu/libdbus-1.so.3.5.8)
   by 0x514F0DD: ??? (in /lib/x86_64-linux-gnu/libdbus-1.so.3.5.8)
   by 0x514F239: ??? (in /lib/x86_64-linux-gnu/libdbus-1.so.3.5.8)
   by 0x513A3B3: ??? (in /lib/x86_64-linux-gnu/libdbus-1.so.3.5.8)
   by 0x514228F: ??? (in /lib/x86_64-linux-gnu/libdbus-1.so.3.5.8)
   by 0x5149F46: ??? (in /lib/x86_64-linux-gnu/libdbus-1.so.3.5.8)
   by 0x514A070: ??? (in /lib/x86_64-linux-gnu/libdbus-1.so.3.5.8)
   by 0x514AA63: ??? (in /lib/x86_64-linux-gnu/libdbus-1.so.3.5.8)
   by 0x514B0A5: ??? (in /lib/x86_64-linux-gnu/libdbus-1.so.3.5.8)
   by 0x5149E0C: ??? (in /lib/x86_64-linux-gnu/libdbus-1.so.3.5.8)
   by 0x5134D24: ??? (in /lib/x86_64-linux-gnu/libdbus-1.so.3.5.8)
2013-01-29 15:57:31 -06:00
Szymon Janc
e5b216061b neard: Fix passing negative error code to strerror
error_reply expects non-negative error code.
2013-01-29 15:57:27 -06:00
Johan Hedberg
7cd4d622f9 neard: Update to new adapter_get_device API 2013-01-25 11:00:02 +02:00
Johan Hedberg
1678083247 core: Make hash & randomizer const in oob_read_local_cb_t 2013-01-06 19:03:33 +02:00
Marcel Holtmann
d29d258758 plugins: Use btd_adapter_get_index instead of adapter_get_dev_id 2013-01-05 15:29:08 -08:00
Marcel Holtmann
a67c35315c plugins: Use btd_adapter_get_default instead of adapter_get_default 2013-01-05 15:19:10 -08:00
Marcel Holtmann
94f7e306f0 plugins: Remove the total silly usage of gchar and replace it with char 2013-01-04 12:24:09 -08:00
Johan Hedberg
143c325fa4 neard: Prefer adapter_get_default() over manager function 2013-01-03 14:15:37 +02:00
Johan Hedberg
1ff99151e0 neard: Fix agent reference leak 2012-12-18 11:20:01 +02:00
Szymon Janc
6827f2a0b3 adapter: Add btd_adapter_get_pairable function
Add btd_adapter_get_pairable and remove pairable argument from
btd_adapter_get_mode. Use btd_adapter_get_pairable to get pairable
state where needed.
2012-12-17 16:59:24 +02:00
Johan Hedberg
405c68c6dc core: Pass explicit address type info when creating device objects 2012-12-10 13:13:24 +02:00
Johan Hedberg
b8779d2202 Revert "Ensure config.h is included by using CPPFLAGS"
This reverts commit 8a03376544.

The patch needs to be split up and the gdbus/ changes were bogus
compared to the original commit message.

Conflicts:
	Makefile.am
	Makefile.obexd
	profiles/cyclingspeed/cyclingspeed.c
	profiles/heartrate/heartrate.c
	src/error.c
2012-12-07 12:46:04 +02:00
Lucas De Marchi
aa77b0bea9 Use the entire include path for gdbus.h 2012-12-05 17:23:03 +02:00
Lucas De Marchi
8a03376544 Ensure config.h is included by using CPPFLAGS
Instead of trying to include config.h in each file over the tree and
possibly forgetting to include it, give a "-include config.h" argument
to the compiler so it's guaranteed that a) it will be included for all
source files and b) it will be the first header included.

gdbus/ directory is left out, since it would break other projects using
it.
2012-12-05 17:18:07 +02:00
Johan Hedberg
eba1c40cb5 core: Remove unused event.{c,h} 2012-12-04 13:21:26 +02:00
Johan Hedberg
694f069a0d core: Remove unnecessary btd_event_remote_name function 2012-12-04 13:02:40 +02:00
Johan Hedberg
176aa9c4d5 neard: Be more consistent in error handling and variable naming 2012-11-21 14:34:11 +02:00
Frédéric Danis
24973ff51d neard: Set device class in device object
As soon as we have info related to a new device,
device object will be created if it does not exist yet.

Change check_device() to use this device object and
remove call to adapter_remove_device() in it.
2012-11-21 14:34:10 +02:00
Szymon Janc
0b681200d3 neard: Append hash/randomizer in EIR only if remote provided it
Read local OOB data for RequestOOB reply only if remote also provided
hash and randomizer in EIR. This will allow for faster reply when only
discovery is done OOB. It is also required to pass NFC handover test
related to Bluetooth just-works pairing.
2012-11-20 12:24:37 +02:00
Szymon Janc
da68aef922 neard: Add support for nokia.com:bt type
This adds support for parsing nokia.com:bt type supported by some Nokia
NFC enabled devices. This is not fully documented Nokia extension so
to keep implementation sane and simple only PushOOB method suports
this type so only static handover is possible.
2012-11-20 12:23:56 +02:00
Szymon Janc
d823bba949 neard: Move device object checking into separate helper
This will also be used by 'nokia.com:bt' handler.
2012-11-20 12:22:25 +02:00
Szymon Janc
8d7bf14da2 neard: Use ENONET error when adapter is not enabled
This results in returning error 'Disabled' instead of 'No such Device'.
Will allow neard to properly set power state of Bluetooth carrier.
2012-11-20 12:22:17 +02:00
Frédéric Danis
0476408b07 neard: Set device name in cache
If device existed previously, it has been removed before calling of
btd_event_remote_name(), so this just update storage cache and name
property change of device object is not emitted.
2012-11-13 13:31:19 +02:00
Frédéric Danis
a10a9f54ab adapter: Read mode in storage at init
Mgmt interface allows to change connectable and discoverable adapter
status even if the adapter is off. So both status are changed during
adapter init.
Remove on_mode from btd_adapter_get_mode(), as it is no more used.
Update src/mgmt.c and plugins/neard.c
2012-10-25 12:35:20 +03:00
Szymon Janc
0336136efd mgmt: Constify use of bdaddr_t pointer parameters
Mark all input only bdaddr_t pointer parameters as const.
2012-10-05 11:28:26 +03:00
Szymon Janc
899e6561d2 adapter: Convert adapter_get_address into simple getter
Most uses of adapter_get_address were in form of:

bdaddr_t addr;
adapter_get_address(adapter, &addr);
foo(&addr);

Changing it to getter makes code simpler and avoid number of not
needed memcpy.
2012-10-05 11:20:18 +03:00
Szymon Janc
4f80f8dca2 neard: Implement RequestOOB function
This function is used by neard to request data to be transmitted over
OOB channel. It also allows neard to provide data to be used in OOB
pairing without initializing pairing it self.
2012-10-03 22:47:08 +03:00
Szymon Janc
9e09abe54f neard: Implement PushOOB function
This implements PushOOB function which allows neard to pass data used
for discovery and pairing. Only EIR data type is supported.
2012-10-03 22:46:56 +03:00
Szymon Janc
fd1e9c5852 Add initial neard plugin implementation
Initial implementation. Only register and unregister support.
2012-10-03 22:44:51 +03:00