As per spec (BT spec 4.1 Vol[3], Part F, chapter 3.4.5.4) we need to
take opcode, handle and parameters to generate signature.
In order to support it signing is moved to att.c, place where pdu is
encoded
This patch adds gatt_discover_desc() function which performs descriptor
discovery in a manner similar to gatt_discover_char(), i.e. it does
complete discovery procedure and returns list of descriptors found when
finished. For 16-bit UUIDs in addition to string UUID, short UUID is
provided.
It's also possible to specify single descriptor UUID to look for and
discovery procedure is interrupted as soon as UUID is found. This way
no more than one descriptor is returned which is useful when searching
for common descriptors like CCC.
Properties are defined by GATT specification. This patch moves and
renames the defines related to Characteristic properties bits from
attrib/att.h to attrib/gatt.h
GATT/ATT use little-endian byte order format for 128-bit UUID. No matter
the system byte order representation, internally the core will handle
128-bit UUID on big-endian format.
This patch moves GATT UUIDs definitions to a common header. uuid.h contains
helper functions to manipulate Bluetooth UUIDs and some common BR/EDR services
UUIDs.
Use number instead of "min_len", which is easier to review (with help of
the documented parameter sizes).
valuelen is redundant as *vlen can be used directly.
Both userspace and kernel enforce a minimum ATT MTU of 23 octets, which
is also used as minimum size for buffers passed to ATT encoding
functions. Therefore, it is unnecessary to perform these checks on ATT
requests that are guaranteed to fit into 23 octets.
Also document ATT parameter lengths where a constant is being used for
calculating the PDU length.
Use standard C types instead of GLib ones (which are unnecessary here)
and move the "status" parameter to the first position, so it is
consistent with other callbacks.
The __func__ macro is part of the C99 standard whereas __FUNCTION__ is a
legacy gcc specific alias for it:
http://gcc.gnu.org/onlinedocs/gcc/Function-Names.html
Additionally, checkpatch.pl that's commonly used to verify coding style
also recommends to use __func__ instead of __FUNCTION__.
Custom GATT services typically use 128-bits UUIDs; this patch allows for
using gatt_service_add to define such services by adding a new option
GATT_OPT_CHR_UUID, which allows for passing bt_uuid_t* values. Note, a
previous patch renamed the old GATT_OPT_CHR_UUID into
GATT_OPT_CHR_UUID16.
To paraphrase Anderson Lizardo: "h" was overflowing for 128-bit services
because the handle is incremented after each attribute is added so at
the end we had: 0xffff + 1 == 0 (h is uint16_t).
As it seems more complex to try to remove the overflow without affecting
the logic too much, we update the assertion.