From 233bd39dee08afc5176b203e6348184da56d7bff Mon Sep 17 00:00:00 2001 From: Marcel Holtmann Date: Sun, 2 May 2004 21:40:30 +0000 Subject: Add sdp_get_add_access_protos() function --- include/sdp_lib.h | 5 +++++ src/sdp.c | 24 ++++++++++++++++++++++++ 2 files changed, 29 insertions(+) diff --git a/include/sdp_lib.h b/include/sdp_lib.h index 715f98cf..0fa7cb7a 100644 --- a/include/sdp_lib.h +++ b/include/sdp_lib.h @@ -453,6 +453,11 @@ int sdp_profile_uuid2strn(const uuid_t *uuid, char *str, size_t n); */ int sdp_get_access_protos(const sdp_record_t *rec, sdp_list_t **protos); +/* + * Get the additional access protocols from the service record + */ +int sdp_get_add_access_protos(const sdp_record_t *rec, sdp_list_t **pap); + /* * Extract the list of browse groups to which the service belongs. * When set, seqp contains elements of GroupID (uint16_t) diff --git a/src/sdp.c b/src/sdp.c index 6740e9d6..75c8edcb 100644 --- a/src/sdp.c +++ b/src/sdp.c @@ -1310,6 +1310,30 @@ int sdp_get_access_protos(const sdp_record_t *rec, sdp_list_t **pap) return 0; } +int sdp_get_add_access_protos(const sdp_record_t *rec, sdp_list_t **pap) +{ + sdp_data_t *pdlist, *curr; + sdp_list_t *ap = 0; + + pdlist = sdp_data_get(rec, SDP_ATTR_ADD_PROTO_DESC_LIST); + if (pdlist == NULL) { + errno = ENODATA; + return -1; + } + SDPDBG("AP type : 0%x\n", pdlist->dtd); + + pdlist = pdlist->val.dataseq; + + for (; pdlist; pdlist = pdlist->next) { + sdp_list_t *pds = 0; + for (curr = pdlist->val.dataseq; curr; curr = curr->next) + pds = sdp_list_append(pds, curr->val.dataseq); + ap = sdp_list_append(ap, pds); + } + *pap = ap; + return 0; +} + int sdp_get_uuidseq_attr(const sdp_record_t *rec, uint16_t attr, sdp_list_t **seqp) { sdp_data_t *sdpdata = sdp_data_get(rec, attr); -- cgit