diff options
author | Claudio Takahasi <claudio.takahasi@openbossa.org> | 2008-03-07 14:35:25 +0000 |
---|---|---|
committer | Claudio Takahasi <claudio.takahasi@openbossa.org> | 2008-03-07 14:35:25 +0000 |
commit | ed8b41b18ffaee05ed24bc3d29063666852c0659 (patch) | |
tree | 1bdcd825829b18379591e72efa37a7dd6e34eef5 /common | |
parent | 19e7dbecf4b38bf64458a34ea005a8aca0bc8974 (diff) |
glib-helper: Extracting the sdp record
Diffstat (limited to 'common')
-rw-r--r-- | common/glib-helper.c | 35 |
1 files changed, 33 insertions, 2 deletions
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); } |