From ed8b41b18ffaee05ed24bc3d29063666852c0659 Mon Sep 17 00:00:00 2001 From: Claudio Takahasi Date: Fri, 7 Mar 2008 14:35:25 +0000 Subject: glib-helper: Extracting the sdp record --- common/glib-helper.c | 35 +++++++++++++++++++++++++++++++++-- 1 file changed, 33 insertions(+), 2 deletions(-) (limited to 'common/glib-helper.c') diff --git a/common/glib-helper.c b/common/glib-helper.c index 5938e654..be3f7a25 100644 --- a/common/glib-helper.c +++ b/common/glib-helper.c @@ -58,10 +58,41 @@ static void search_completed_cb(uint8_t type, uint16_t status, { struct search_context *ctxt = user_data; sdp_list_t *recs = NULL; + int scanned, seqlen = 0; + uint8_t dataType; + int err = 0; + + if (status || type != SDP_SVC_SEARCH_ATTR_RSP) { + err = -EPROTO; + goto done; + } + + scanned = sdp_extract_seqtype(rsp, &dataType, &seqlen); + if (!scanned || !seqlen) + goto done; + + rsp += scanned; + do { + sdp_record_t *rec; + int recsize; + + recsize = 0; + rec = sdp_extract_pdu(rsp, &recsize); + if (!rec) + break; + + if (!recsize) { + sdp_record_free(rec); + break; + } - /* FIXME: Extract the records */ + scanned += recsize; + rsp += recsize; - ctxt->cb(ctxt->user_data, recs, 0); + recs = sdp_list_append(recs, rec); + } while (scanned < size); +done: + ctxt->cb(ctxt->user_data, recs, err); search_context_cleanup(ctxt); } -- cgit