Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/usr.bin/sdpquery update several profiles, bringing up to dat...



details:   https://anonhg.NetBSD.org/src/rev/919e4ad5f2e0
branches:  trunk
changeset: 342193:919e4ad5f2e0
user:      plunky <plunky%NetBSD.org@localhost>
date:      Fri Dec 11 21:05:18 2015 +0000

description:
update several profiles, bringing up to date decoding of all the
Bluetooth 1.1->4.2 Service Discovery specifications I could find,
namely:

    Wireless Access Protocol
    Multi-Profile Specification
    Calendar, Tasks & Notes
    Message Access Profile
    Message Notification Service
    Global Navigation Satellite System
    Health Device Profile
    File Transfer Protocol
    3D Display
    General Access Profile
    Generic Attribute Server

all documentation is on bluetooth.org, under

    https://www.bluetooth.org/en-us/specification

diffstat:

 usr.bin/sdpquery/print.c |  355 +++++++++++++++++++++++++++++++++++++++++++++-
 1 files changed, 342 insertions(+), 13 deletions(-)

diffs (truncated from 547 to 300 lines):

diff -r 6ed60dc11171 -r 919e4ad5f2e0 usr.bin/sdpquery/print.c
--- a/usr.bin/sdpquery/print.c  Fri Dec 11 19:47:52 2015 +0000
+++ b/usr.bin/sdpquery/print.c  Fri Dec 11 21:05:18 2015 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: print.c,v 1.21 2015/03/16 19:10:48 plunky Exp $        */
+/*     $NetBSD: print.c,v 1.22 2015/12/11 21:05:18 plunky Exp $        */
 
 /*-
  * Copyright (c) 2009 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include <sys/cdefs.h>
-__RCSID("$NetBSD: print.c,v 1.21 2015/03/16 19:10:48 plunky Exp $");
+__RCSID("$NetBSD: print.c,v 1.22 2015/12/11 21:05:18 plunky Exp $");
 
 #include <ctype.h>
 #include <iconv.h>
@@ -103,6 +103,9 @@
 static void print_avrcp_features(sdp_data_t *);
 static void print_supported_data_stores(sdp_data_t *);
 static void print_supported_formats(sdp_data_t *);
+static void print_wap_addr(sdp_data_t *);
+static void print_wap_gateway(sdp_data_t *);
+static void print_wap_type(sdp_data_t *);
 static void print_hid_version(sdp_data_t *);
 static void print_hid_device_subclass(sdp_data_t *);
 static void print_hid_descriptor_list(sdp_data_t *);
@@ -114,15 +117,22 @@
 static void print_net_access_type(sdp_data_t *);
 static void print_pnp_source(sdp_data_t *);
 static void print_mas_types(sdp_data_t *);
-static void print_supported_repositories(sdp_data_t *);
+static void print_map_features(sdp_data_t *);
+static void print_pse_repositories(sdp_data_t *);
+static void print_pse_features(sdp_data_t *);
+static void print_hdp_features(sdp_data_t *);
+static void print_hdp_specification(sdp_data_t *);
+static void print_mcap_procedures(sdp_data_t *);
 static void print_character_repertoires(sdp_data_t *);
 static void print_bip_capabilities(sdp_data_t *);
 static void print_bip_features(sdp_data_t *);
 static void print_bip_functions(sdp_data_t *);
 static void print_bip_capacity(sdp_data_t *);
 static void print_1284id(sdp_data_t *);
+static void print_ctn_features(sdp_data_t *);
 
 static void print_rfcomm(sdp_data_t *);
+static void print_att(sdp_data_t *);
 static void print_bnep(sdp_data_t *);
 static void print_avctp(sdp_data_t *);
 static void print_avdtp(sdp_data_t *);
@@ -135,6 +145,7 @@
        { 0x0004, "TCP",                                NULL },
        { 0x0005, "TCS_BIN",                            NULL },
        { 0x0006, "TCS_AT",                             NULL },
+       { 0x0007, "ATT",                                print_att },
        { 0x0008, "OBEX",                               NULL },
        { 0x0009, "IP",                                 NULL },
        { 0x000a, "FTP",                                NULL },
@@ -216,9 +227,14 @@
 };
 
 attr_t opush_attrs[] = { /* Object Push */
+       { 0x0200, "GeopL2capPSM",                       print_uint16x },
        { 0x0303, "SupportedFormatsList",               print_supported_formats },
 };
 
+attr_t ft_attrs[] = { /* File Transfer */
+       { 0x0200, "GeopL2capPSM",                       print_uint16x },
+};
+
 attr_t hset_attrs[] = {        /* Headset */
        { 0x0302, "RemoteAudioVolumeControl",           print_bool },
 };
@@ -230,11 +246,20 @@
        { 0x0305, "AudioFeedbackSupport",               print_bool },
 };
 
+attr_t wap_attrs[] = { /* WAP Bearer */
+       { 0x0306, "NetworkAddress",                     print_wap_addr },
+       { 0x0307, "WAPGateway",                         print_wap_gateway },
+       { 0x0308, "HomePageURL",                        print_url },
+       { 0x0309, "WAPStackType",                       print_wap_type },
+};
+
 attr_t panu_attrs[] = {        /* Personal Area Networking User */
+       { 0x0200, "IpSubnet",                           print_string },
        { 0x030a, "SecurityDescription",                print_security_description },
 };
 
 attr_t nap_attrs[] = { /* Network Access Point */
+       { 0x0200, "IpSubnet",                           print_string },
        { 0x030a, "SecurityDescription",                print_security_description },
        { 0x030b, "NetAccessType",                      print_net_access_type },
        { 0x030c, "MaxNetAccessRate",                   print_uint32d },
@@ -243,6 +268,7 @@
 };
 
 attr_t gn_attrs[] = {  /* Group Network */
+       { 0x0200, "IpSubnet",                           print_string },
        { 0x030a, "SecurityDescription",                print_security_description },
        { 0x030d, "IPv4Subnet",                         print_string },
        { 0x030e, "IPv6Subnet",                         print_string },
@@ -270,6 +296,7 @@
 };
 
 attr_t bi_attrs[] = {  /* Basic Imaging */
+       { 0x0200, "GeopL2capPSM",                       print_uint16x },
        { 0x0310, "SupportedCapabilities",              print_bip_capabilities },
        { 0x0311, "SupportedFeatures",                  print_bip_features },
        { 0x0312, "SupportedFunctions",                 print_bip_functions },
@@ -306,6 +333,8 @@
        { 0x020c, "HIDSupervisionTimeout",              print_uint16d },
        { 0x020d, "HIDNormallyConnectable",             print_bool },
        { 0x020e, "HIDBootDevice",                      print_bool },
+       { 0x020f, "HIDHostMaxLatency",                  print_uint16d },
+       { 0x0210, "HIDHostMinTimeout",                  print_uint16d },
 };
 
 attr_t hcr_attrs[] = { /* Hardcopy Cable Replacement */
@@ -315,6 +344,21 @@
        { 0x0306, "DeviceLocation",                     print_utf8_string },
 };
 
+attr_t mps_attrs[] = { /* Multi-Profile Specification */
+       { 0x0200, "SingleDeviceSupportedScenarios",     NULL },
+       { 0x0201, "MultiDeviceSupportedScenarios",      NULL },
+       { 0x0202, "SupportedProfileAndProtocolDependencies", print_uint16x },
+};
+
+attr_t cas_attrs[] = { /* Calendar, Tasks & Notes Access */
+       { 0x0315, "InstanceID",                         print_uint8d },
+       { 0x0317, "SupportedFeatures",                  print_ctn_features },
+};
+
+attr_t cns_attrs[] = { /* Calendar, Tasks & Notes Notification */
+       { 0x0317, "SupportedFeatures",                  print_ctn_features },
+};
+
 attr_t pnp_attrs[] = { /* Device ID */
        { 0x0200, "SpecificationID",                    print_profile_version },
        { 0x0201, "VendorID",                           print_uint16x },
@@ -325,12 +369,31 @@
 };
 
 attr_t mas_attrs[] = { /* Message Access Server */
+       { 0x0200, "GeopL2capPSM",                       print_uint16x },
        { 0x0315, "InstanceID",                         print_uint8d },
        { 0x0316, "SupportedMessageTypes",              print_mas_types },
+       { 0x0317, "SupportedFeatures",                  print_map_features },
+};
+
+attr_t mns_attrs[] = { /* Message Notification Server */
+       { 0x0200, "GeopL2capPSM",                       print_uint16x },
+       { 0x0317, "SupportedFeatures",                  print_map_features },
+};
+
+attr_t gnss_attrs[] = {        /* Global Navigation Satellite System Server */
+       { 0x0200, "SupportedFeatures",                  print_uint16x },
 };
 
 attr_t pse_attrs[] = { /* Phonebook Access Server */
-       { 0x0314, "SupportedRepositories",              print_supported_repositories },
+       { 0x0200, "GeopL2capPSM",                       print_uint16x },
+       { 0x0314, "SupportedRepositories",              print_pse_repositories },
+       { 0x0317, "SupportedFeatures",                  print_pse_features },
+};
+
+attr_t hdp_attrs[] = { /* Health Device Profile */
+       { 0x0200, "SupportedFeaturesList",              print_hdp_features },
+       { 0x0301, "DataExchangeSpecification",          print_hdp_specification },
+       { 0x0302, "MCAPSupportedProcedures",            print_mcap_procedures },
 };
 
 #define A(a)   a, __arraycount(a)
@@ -343,7 +406,7 @@
        { 0x1103, "Dialup Networking",                  A(dun_attrs) },
        { 0x1104, "IrMC Sync",                          A(irmc_sync_attrs) },
        { 0x1105, "Object Push",                        A(opush_attrs) },
-       { 0x1106, "File Transfer",                      NULL, 0 },
+       { 0x1106, "File Transfer",                      A(ft_attrs) },
        { 0x1107, "IrMC Sync Command",                  NULL, 0 },
        { 0x1108, "Headset",                            A(hset_attrs) },
        { 0x1109, "Cordless Telephony",                 A(ct_attrs) },
@@ -356,7 +419,7 @@
        { 0x1110, "Intercom",                           NULL, 0 },
        { 0x1111, "Fax",                                A(fax_attrs) },
        { 0x1112, "Headset Audio Gateway",              NULL, 0 },
-       { 0x1113, "WAP",                                NULL, 0 },
+       { 0x1113, "WAP",                                A(wap_attrs) },
        { 0x1114, "WAP Client",                         NULL, 0 },
        { 0x1115, "Personal Area Networking User",      A(panu_attrs) },
        { 0x1116, "Network Access Point",               A(nap_attrs) },
@@ -388,8 +451,18 @@
        { 0x1130, "Phonebook Access",                   NULL, 0 },
        { 0x1131, "Headset HS",                         NULL, 0 },
        { 0x1132, "Message Access Server",              A(mas_attrs) },
-       { 0x1133, "Message Notification Server",        NULL, 0 },
+       { 0x1133, "Message Notification Server",        A(mns_attrs) },
        { 0x1134, "Message Access Profile",             NULL, 0 },
+       { 0x1135, "Global Navigation Satellite System Profile", NULL, 0 },
+       { 0x1136, "Global Navigation Satellite System Server", A(gnss_attrs) },
+       { 0x1137, "3D Display",                         NULL, 0 },
+       { 0x1138, "3D Glasses",                         NULL, 0 },
+       { 0x1139, "3D Synchronization",                 NULL, 0 },
+       { 0x113a, "Multi-Profile Specification Profile",NULL, 0 },
+       { 0x113b, "Multi-Profile Specification Server", A(mps_attrs) },
+       { 0x113c, "Calendar, Tasks & Notes Access",     A(cas_attrs) },
+       { 0x113d, "Calendar, Tasks & Notes Notification",A(cns_attrs) },
+       { 0x113e, "Calendar, Tasks & Notes Profile",    NULL, 0 },
        { 0x1200, "PNP Information",                    A(pnp_attrs) },
        { 0x1201, "Generic Networking",                 NULL, 0 },
        { 0x1202, "Generic File Transfer",              NULL, 0 },
@@ -404,8 +477,10 @@
        { 0x1304, "Video Sink",                         NULL, 0 },
        { 0x1305, "Video Distribution",                 NULL, 0 },
        { 0x1400, "HDP",                                NULL, 0 },
-       { 0x1401, "HDP Source",                         NULL, 0 },
-       { 0x1402, "HDP Sink",                           NULL, 0 },
+       { 0x1401, "HDP Source",                         A(hdp_attrs) },
+       { 0x1402, "HDP Sink",                           A(hdp_attrs) },
+       { 0x1800, "Generic Access Profile",             NULL, 0 },
+       { 0x1801, "Generic Attribute Server",           NULL, 0 },
 };
 #undef A
 
@@ -930,7 +1005,7 @@
                                        (protocol_list[i].print)(data);
 
                                if (data->next != data->end)
-                                       printf(" [additional data ignored]");
+                                       printf(" [additional data]");
 
                                printf("\n");
                                return;
@@ -951,9 +1026,16 @@
        printf("\n");
        sdp_get_alt(data, data);        /* strip [optional] alt header */
 
-       while (sdp_get_seq(data, &seq))
+       while (sdp_get_seq(data, &seq)) {
                while (sdp_get_seq(&seq, &proto))
                        print_protocol_descriptor(&proto);
+
+               if (seq.next != seq.end)
+                       printf("    [additional protocol data]\n");
+       }
+
+       if (data->next != data->end)
+               printf("    [additional data]\n");
 }
 
 static void
@@ -1232,6 +1314,50 @@
 }
 
 static void
+print_wap_addr(sdp_data_t *data)
+{
+       uint32_t v;
+
+       if (!sdp_get_uint32(data, &v))
+               return;
+
+       printf("%d.%d.%d.%d\n",
+           ((v & 0xff000000) >> 24), ((v & 0x00ff0000) >> 16),
+           ((v & 0x0000ff00) >> 8), (v & 0x000000ff));
+}
+
+static void
+print_wap_gateway(sdp_data_t *data)
+{
+       uint8_t v;
+
+       if (!sdp_get_uint8(data, &v))
+               return;
+
+       switch(v) {
+       case 0x01:      printf("Origin Server\n");      break;
+       case 0x02:      printf("Proxy\n");              break;
+       default:        printf("0x%02x\n", v);          break;
+       }
+}
+
+static void
+print_wap_type(sdp_data_t *data)
+{
+       uint8_t v;
+
+       if (!sdp_get_uint8(data, &v))
+               return;
+
+       switch(v) {
+       case 0x01:      printf("Connectionless\n");     break;
+       case 0x02:      printf("Connection Oriented\n");break;
+       case 0x03:      printf("Both\n");               break;
+       default:        printf("0x%02x\n", v);          break;
+       }
+}



Home | Main Index | Thread Index | Old Index