Age | Commit message (Collapse) | Author | Files | Lines |
|
|
|
ndef.c handles the Record interface. With the ObjectManager interface,
GetProperties is no longer needed.
|
|
And make it less confusable with the MIMEType property.
|
|
"Android Application Record (AAR)" is not really D-Bus clients
friendly.
|
|
This patch generate via coccinelle with:
@ disable is_null,isnt_null1 @
expression E;
@@
(
- E == NULL
+ !E
|
- E != NULL
+ E
)
|
|
This patch has been created via coccinelle:
// Rule set 1
f(es,
(
- FALSE
+ false
|
- TRUE
+ true
)
,...)
@r2@
type T;
identifier f;
parameter list[n] ps;
identifier i;
@@
T f(ps, near_bool_t i, ...);
@@
identifier r2.f;
expression list [r.n] es;
@@
f(es,
(
- FALSE
+ false
|
- TRUE
+ true
)
,...)
@@
typedef bool;
@@
- near_bool_t
+ bool
// Rule set 2
// This is not a beautiful script but it does the job.
// Improvemtents are welcome.
// Fix all assigments but do not convert yet the type
@@
gboolean x;
@@
x =
(
- TRUE
+ true
|
- FALSE
+ false
)
// Figure out which function signature will to be fixed...
// when we have the defitition
@r@
identifier f;
parameter list[n] ps;
identifier i;
@@
f(ps, gboolean i, ...) { ... }
// ... and now convert all call sites
@@
identifier r.f;
expression list [r.n] es;
@@
f(es,
(
- FALSE
+ false
|
- TRUE
+ true
)
,...)
// Figure out which function signature will to be fixed...
// when we have the declaration only
@r2@
type T;
identifier f;
parameter list[n] ps;
identifier i;
@@
T f(ps, gboolean i, ...);
// ... and now convert all call sites
@@
identifier r2.f;
expression list [r.n] es;
@@
f(es,
(
- FALSE
+ false
|
- TRUE
+ true
)
,...)
// A handfull of the GLib hooks we can't change. Let's remember
// all ther positions.
// 1. timeouts
@k1@
identifier f;
position p;
typedef gpointer;
identifier ptr;
@@
static gboolean@p f(gpointer ptr);
@k2@
identifier f;
position p;
identifier ptr;
@@
static gboolean@p f(gpointer ptr) { ... }
// hash map iterator functions
@k3@
identifier f;
position p;
identifier p1, p2, p3;
@@
static gboolean@p f(gpointer p1, gpointer p2, gpointer p3) { ... }
// 2. GIOChannel
@k4@
identifier f;
position p;
typedef GIOChannel, GIOCondition;
identifier ptr;
identifier ch, cn;
@@
static gboolean@p f(GIOChannel *ch, GIOCondition cn, gpointer ptr);
@k5@
identifier f;
position p;
identifier ptr;
identifier ch, cn;
@@
static gboolean@p f(GIOChannel *ch, GIOCondition cn, gpointer ptr) { ... }
// 3. GSourceFuncs
@k6@
identifier f;
position p;
typedef GSource;
identifier src;
@@
static gboolean@p f(GSource *src, ...) { ... }
// gdbus functions
@k7@
identifier f;
position p;
typedef DBusConnection;
identifier con;
@@
static gboolean@p f(DBusConnection *con, ...) { ... }
// Now convert all gboolean which are are not used for interactin
// with GLib
// Note here happens the magic!
@@
typedef bool;
position p != {k1.p,k2.p,k3.p,k4.p,k5.p,k6.p,k7.p};
@@
- gboolean@p
+ bool
// Update all return types
@@
identifier f;
@@
bool f(...) {
<...
- return TRUE;
+ return true;
...>
}
@@
identifier f;
@@
bool f(...) {
<...
- return FALSE;
+ return false;
...>
}
// Rule set 3
@@
expression E;
symbol TRUE;
symbol FALSE;
@@
(
E
- == TRUE
|
- TRUE == E
+ E
|
- E != TRUE
+ !E
|
- TRUE != E
+ !E
|
- E == FALSE
+ !E
|
- FALSE == E
+ !E
|
E
- != FALSE
|
- FALSE != E
+ E
)
|
|
This allows to acctually create multibye cdr if needed. Currently neard
always use one byte cdr but let us be in match with spec and a bit more
future proof.
|
|
This allows to acctually create multibye cdr if needed. Currently neard
always use one byte cdr but let us be in match with spec and a bit more
future proof.
|
|
This is not used anywhere in the code.
|
|
cdr is a multibyte field. This removes assumption in code that cdr is
one byte only.
|
|
Additional to wifi_wsc MIME type, raw parameter is provided for
sending raw MIME payload as NDEF.
See test/push-device for usage.
|
|
|
|
Android Application Record payload simply contains the Android Market
package name.
|
|
AAR are Android external NDEF records that contain an Android package
name.
|
|
Empty handover select frames are received when the peer notifies us
about not supporting any of the carrier sent in the handover request
frame.
In that case there is nothing to do but disconnecting from the handover
service.
|
|
When running as a 802.11 STA, the Hr should contain an empty WiFi
carrier as we're just asking for WiFi availability from the peer.
Also when running in AP mode, an Hr is not a valid frame to send as
an AP will not be able to initiate the association.
|
|
static handover is going through a different D-Bus path as it would not
make sense to handle both static and dynamic handover from the same code
path.
Static handover means an application explicitely requires to send a
handover select without having previously received a handover request.
This could typically be used for handling WiFi handover through
configuration token from the registrar perspective. The registrar
(a.k.a. the Access Point) would send a configuration token via Handover
and expects the Enrolle (a.k.a. the WiFi STA) to initiate the WiFi
association.
|
|
near_ndef_prepare_hr_message can be used for building Hr frames but also
Hs ones for static handover. So generalize and factorize it and also
rename it to near_ndef_prepare_ho_message().
|
|
near_ndef_prepare_hs_message() does not prepare a generic handover
select message but rather a reply to a handover request.
Those 2 have to be differentiated in order to implement static handover
where a handover select frame is sent without having first seen a
handover request.
|
|
build_ho_record is used for initiating negotiated handover, so it will
only send handover requests.
As such, rename build_ho_record to build_hr_record.
|
|
When the D-Bus message does not contain an SSID (and optionalyy a
passphrase) then we fallback to the WiFi WSC agent. If it's running
in tethering mode then it will reply with an already built WSC TLV
array.
This is needed to push WiFi WSC configuration token over SNEP. Android
is going to support that as a simplified WiFi Handover.
|
|
NDEFs with MIME type records that are not WSC or Bluetooth ones are not
wrong. Their payload won't be processed but the record is kept and
linked to the discovered tag.
NDEF agents will get the binary payload.
Fixes #NFC-45
|
|
Added api to prepare MIME type WSC record for unit tests.
|
|
Removed unnecessary debug statement which is added with
56a275c8841352a9c8a60bdcb3e63ba69fe783c6 commit.
|
|
Implemented mime type record building upon dbus request.
Currently it supports application/vnd.wfa.wsc.
|
|
As previous commit shows doxygen annotation are not really used.
Those annotations require also more focus when reading (and mostly
describe obvious parts of the code) comparing to simple comments.
Also not used doxygen annotations tend to drift away from actual code
and simply confuse developer.
Simply remove doxygen annotations as functions and params names are
self-explanatory anyway. Some comments where left to document
non-obvious behaviour.
|
|
This was accidentally pasted in commit 8a141753.
|
|
This is a constant string and there is no need to calculate its length
in runtime.
|
|
|
|
Make error path a bit cleaner and easier to understand. This also makes
code less confusing to some GCC version (eg. 4.6.3 on Debian ARM) about
variables mime_type and cdr being used without initialization.
make --no-print-directory all-am
CC src/ndef.o
src/ndef.c: In function ‘near_ndef_prepare_ac_and_cfg_records’:
src/ndef.c:1758:6: error: ‘mime_type’ may be used uninitialized in this
function [-Werror=uninitialized]
src/ndef.c:1781:8: note: ‘mime_type’ was declared here
src/ndef.c:1835:36: error: ‘cdr’ may be used uninitialized in this
function [-Werror=uninitialized]
cc1: all warnings being treated as errors
make[1]: *** [src/ndef.o] Error 1
make: *** [all] Error 2
|
|
|
|
|
|
Support for mutliple carrier handling for tag and p2p device.
In case of tag (tag with simple mime type or with static
handover data): First detects number of carriers in a tag
and try to connect/associate with carrier. If connection or
association failed then go for next carrier otherwise return
success.
In case of p2p device (either neard receiving Hr and sending Hr):
If neard receives Hr message with multiple carriers (e.g. bt and
wifi), first extracts multiple carriers data and reply back with
neard's alternative carrier capacity (e.g. It could be 'bt' or 'wifi'
or both or empty). If neard wants to negotiate handover with other
p2p device it sends Hr with available carriers (e.g. bt ot wifi or
both, if there are no carriers replies error to dbus request).
After receiving Hs from other p2p device, it tries to
connect/associate with carriers (ho agents).
|
|
Added support for multiple carrriers request for Hr message. For
multiple carriers dbus request has to be comma separated strings
(e.g. bluetooth,wifi).
|
|
To support multiple carriers in handover request message, implemented
seperate function for handover request message.
|
|
To support multiple carriers in handover select message, implemented
seperate function for handover select message.
|
|
Providing helper functions to create Hanodver select and
request messages.
|
|
Return empty handover select message for unsupported versions of
handover request message.
Implementing separate functions for empty Hs, Hs with carriers
and Hr messages. Next patches contain these functionality.
Separating them because each message requires different
input parameters and preparation conditions. Handover message
preparation is bit different and bigger than other ndef message
types. Also handover messages contain multiple alterative
carriers, configuration messages, collision and error records.
|
|
Added helper funtion to free ndef message structure data.
It is quite helpful to reduce code redundancy.
|
|
This fixes handover validation test #6.
Check that the remote handover server returns a select message
without alternative carriers if a single carrier of unknown type was
sent with the handover request.
|
|
This fixes handover validation test #3.
Verify that the remote handover server handles historic and future
handover request version numbers. The test failed on step 4
(Check version 15.0).
|
|
Handover select frames must not be replied to.
This fixes the following bt-handover error:
"ERROR:dbus.connection:Exception in handler for D-Bus signal"
|
|
Current handover registration apis does not support for carrier
specific registration. Added an extra parameter (carrier type) to
RegisterHandoverAgent and UnregisterHandoverAgent. This is an initial
patch for wifi handover agent registration. WiFi NDEF message handling
will be supported soon.
|
|
To be more generic, renaming structure name from bt_data to
carrier_data.
|
|
This function is used to create both Hs and Hr records.
|
|
Upper layer don't know if action will be held or not when providing
ndef_message for reply. It is possible that reply was provided but
not used and this is not always an error
|
|
It was not used to create ndef message as AC recors is created inside
near_ndef_prepare_handover_record based on response from HO agent.
|
|
There is no need to dynamically allocate record as it is not used
after build_ho_record returns.
|
|
record data needs to be freed before returning ndef.
144 (80 direct, 64 indirect) bytes in 1 blocks are definitely lost in loss record 142 of 190
at 0x4C2B6CD: malloc (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
by 0x4E7FBFD: g_try_malloc0 (in /lib/x86_64-linux-gnu/libglib-2.0.so.0.3200.3)
by 0x424477: __ndef_build_from_message (ndef.c:2950)
by 0x41CEE3: push_ndef (device.c:276)
by 0x40B850: process_message.isra.4 (object.c:285)
by 0x5143C40: ??? (in /lib/x86_64-linux-gnu/libdbus-1.so.3.5.8)
by 0x5135B0F: dbus_connection_dispatch (in /lib/x86_64-linux-gnu/libdbus-1.so.3.5.8)
by 0x409247: message_dispatch (mainloop.c:76)
by 0x4E7A91A: ??? (in /lib/x86_64-linux-gnu/libglib-2.0.so.0.3200.3)
by 0x4E79D52: g_main_context_dispatch (in /lib/x86_64-linux-gnu/libglib-2.0.so.0.3200.3)
by 0x4E7A09F: ??? (in /lib/x86_64-linux-gnu/libglib-2.0.so.0.3200.3)
by 0x4E7A499: g_main_loop_run (in /lib/x86_64-linux-gnu/libglib-2.0.so.0.3200.3)
|
|
When adding AC record for BT handover user state provided in bt_data
to properly indicate BT carrier power state.
|