aboutsummaryrefslogtreecommitdiff
path: root/usr.sbin/bluetooth/sdpd/gn.c
diff options
context:
space:
mode:
Diffstat (limited to 'usr.sbin/bluetooth/sdpd/gn.c')
-rw-r--r--usr.sbin/bluetooth/sdpd/gn.c30
1 files changed, 28 insertions, 2 deletions
diff --git a/usr.sbin/bluetooth/sdpd/gn.c b/usr.sbin/bluetooth/sdpd/gn.c
index 618388d45d38..d35c0eea5fda 100644
--- a/usr.sbin/bluetooth/sdpd/gn.c
+++ b/usr.sbin/bluetooth/sdpd/gn.c
@@ -100,8 +100,12 @@ gn_profile_create_protocol_descriptor_list(
uint8_t *buf, uint8_t const * const eob,
uint8_t const *data, uint32_t datalen)
{
+ provider_p provider = (provider_p) data;
+ sdp_gn_profile_p gn = (sdp_gn_profile_p) provider->data;
+
return (bnep_profile_create_protocol_descriptor_list(
- buf, eob, NULL, 0));
+ buf, eob, (uint8_t const *) &gn->psm,
+ sizeof(gn->psm)));
}
static int32_t
@@ -117,6 +121,26 @@ gn_profile_create_security_description(
sizeof(gn->security_description)));
}
+static int32_t
+gn_profile_create_service_availability(
+ uint8_t *buf, uint8_t const * const eob,
+ uint8_t const *data, uint32_t datalen)
+{
+ provider_p provider = (provider_p) data;
+ sdp_gn_profile_p gn = (sdp_gn_profile_p) provider->data;
+
+ return (common_profile_create_service_availability(buf, eob,
+ &gn->load_factor, 1));
+}
+
+static int32_t
+gn_profile_data_valid(uint8_t const *data, uint32_t datalen)
+{
+ sdp_gn_profile_p gn = (sdp_gn_profile_p) data;
+
+ return ((gn->psm == 0)? 0 : 1);
+}
+
static attr_t gn_profile_attrs[] = {
{ SDP_ATTR_SERVICE_RECORD_HANDLE,
common_profile_create_service_record_handle },
@@ -126,6 +150,8 @@ static attr_t gn_profile_attrs[] = {
gn_profile_create_protocol_descriptor_list },
{ SDP_ATTR_LANGUAGE_BASE_ATTRIBUTE_ID_LIST,
common_profile_create_language_base_attribute_id_list },
+ { SDP_ATTR_SERVICE_AVAILABILITY,
+ gn_profile_create_service_availability },
{ SDP_ATTR_BLUETOOTH_PROFILE_DESCRIPTOR_LIST,
gn_profile_create_bluetooth_profile_descriptor_list },
{ SDP_ATTR_PRIMARY_LANGUAGE_BASE_ID + SDP_ATTR_SERVICE_NAME_OFFSET,
@@ -140,7 +166,7 @@ static attr_t gn_profile_attrs[] = {
profile_t gn_profile_descriptor = {
SDP_SERVICE_CLASS_GN,
sizeof(sdp_gn_profile_t),
- common_profile_always_valid,
+ gn_profile_data_valid,
(attr_t const * const) &gn_profile_attrs
};