summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMarcel Holtmann <marcel@holtmann.org>2006-08-29 21:39:07 +0000
committerMarcel Holtmann <marcel@holtmann.org>2006-08-29 21:39:07 +0000
commit453a0cedb6c909047553ffc7145bcef26a3ae94c (patch)
tree2ba826158dcf2d3ac17708d9a1b7dcf9ffb4bd55
parentc8e5a1464ff8edb068e7361a257ef4ae34674cf8 (diff)
Correct prototypes for async functions
-rw-r--r--include/sdp_lib.h27
-rw-r--r--src/sdp.c49
2 files changed, 53 insertions, 23 deletions
diff --git a/include/sdp_lib.h b/include/sdp_lib.h
index 64fe5b52..b1f839bc 100644
--- a/include/sdp_lib.h
+++ b/include/sdp_lib.h
@@ -111,13 +111,26 @@ int sdp_get_socket(const sdp_session_t *session);
uint16_t sdp_gen_tid(sdp_session_t *session);
+typedef enum {
+ /*
+ * Attributes are specified as individual elements
+ */
+ SDP_ATTR_REQ_INDIVIDUAL = 1,
+ /*
+ * Attributes are specified as a range
+ */
+ SDP_ATTR_REQ_RANGE
+} sdp_attrreq_type_t;
/*
* SDP transaction: functions for asynchronous search.
*/
typedef void sdp_callback_t(uint8_t type, uint16_t status, uint8_t *rsp, size_t size, void *udata);
sdp_session_t *sdp_create(int sk, uint32_t flags);
int sdp_set_notify(sdp_session_t *session, sdp_callback_t *func, void *udata);
-int sdp_service_search_async(sdp_session_t *session, const sdp_list_t *search);
+int sdp_service_search_async(sdp_session_t *session, const sdp_list_t *search_list, uint16_t max_rec_num);
+int sdp_service_attr_async(sdp_session_t *session, uint32_t handle, sdp_attrreq_type_t reqtype, const sdp_list_t *attrid_list);
+int sdp_service_search_attr_async(sdp_session_t *session, const sdp_list_t *search, sdp_attrreq_type_t reqtype, const sdp_list_t *attrid_list);
+int sdp_service_search_attr_async(sdp_session_t *session, const sdp_list_t *search_list, sdp_attrreq_type_t reqtype, const sdp_list_t *attrid_list);
int sdp_process(sdp_session_t *session);
/*
@@ -356,18 +369,6 @@ int sdp_service_search_req(sdp_session_t *session, const sdp_list_t *search_list
* -1
* The request completed unsuccessfully due to a timeout
*/
-
-typedef enum {
- /*
- * Attributes are specified as individual elements
- */
- SDP_ATTR_REQ_INDIVIDUAL = 1,
- /*
- * Attributes are specified as a range
- */
- SDP_ATTR_REQ_RANGE
-} sdp_attrreq_type_t;
-
sdp_record_t *sdp_service_attr_req(sdp_session_t *session, uint32_t handle, sdp_attrreq_type_t reqtype, const sdp_list_t *attrid_list);
/*
diff --git a/src/sdp.c b/src/sdp.c
index bc69551a..1d6d65fe 100644
--- a/src/sdp.c
+++ b/src/sdp.c
@@ -3113,6 +3113,18 @@ int sdp_set_notify(sdp_session_t *session, sdp_callback_t *func, void *udata)
return 0;
}
+int sdp_service_search_async(sdp_session_t *session, const sdp_list_t *search_list, uint16_t max_rec_num)
+{
+ /* FIXME: implement! */
+ return 0;
+}
+
+int sdp_service_attr_async(sdp_session_t *session, uint32_t handle, sdp_attrreq_type_t reqtype, const sdp_list_t *attrid_list)
+{
+ /* FIXME: implement! */
+ return 0;
+}
+
/*
* Set the callback function to called when the transaction finishes and send the
* service search attribute request PDU.
@@ -3120,20 +3132,39 @@ int sdp_set_notify(sdp_session_t *session, sdp_callback_t *func, void *udata)
* INPUT:
* sdp_session_t *session
* Current sdp session to be handled
- * sdp_list_t *search
- * UUID pattern to search
+ *
+ * sdp_list_t *search
+ * Singly linked list containing elements of the search
+ * pattern. Each entry in the list is a UUID(DataTypeSDP_UUID16)
+ * of the service to be searched
+ *
+ * AttributeSpecification attrSpec
+ * Attribute identifiers are 16 bit unsigned integers specified
+ * in one of 2 ways described below :
+ * SDP_ATTR_REQ_INDIVIDUAL - 16bit individual identifiers
+ * They are the actual attribute identifiers in ascending order
+ *
+ * SDP_ATTR_REQ_RANGE - 32bit identifier range
+ * The high-order 16bits is the start of range
+ * the low-order 16bits are the end of range
+ * 0x0000 to 0xFFFF gets all attributes
+ *
+ * sdp_list_t *attrids
+ * Singly linked list containing attribute identifiers desired.
+ * Every element is either a uint16_t(attrSpec = SDP_ATTR_REQ_INDIVIDUAL)
+ * or a uint32_t(attrSpec=SDP_ATTR_REQ_RANGE)
+ *
+
* RETURN:
* 0 - if the request has been sent properly
* -1 - On any failure
*/
-int sdp_service_search_async(sdp_session_t *session, const sdp_list_t *search)
+int sdp_service_search_attr_async(sdp_session_t *session, const sdp_list_t *search_list, sdp_attrreq_type_t reqtype, const sdp_list_t *attrid_list)
{
struct sdp_transaction *t;
sdp_pdu_hdr_t *reqhdr;
- sdp_list_t *attrids;
uint8_t *pdata;
int seqlen = 0;
- uint32_t range = 0x0000ffff;
if (!session || !session->priv) {
errno = EINVAL;
@@ -3159,7 +3190,7 @@ int sdp_service_search_async(sdp_session_t *session, const sdp_list_t *search)
t->reqsize = sizeof(sdp_pdu_hdr_t);
// add service class IDs for search
- seqlen = gen_searchseq_pdu(pdata, search);
+ seqlen = gen_searchseq_pdu(pdata, search_list);
SDPDBG("Data seq added : %d\n", seqlen);
@@ -3174,10 +3205,8 @@ int sdp_service_search_async(sdp_session_t *session, const sdp_list_t *search)
SDPDBG("Max attr byte count : %d\n", SDP_MAX_ATTR_LEN);
// get attr seq PDU form
- attrids = sdp_list_append(0, &range);
- seqlen = gen_attridseq_pdu(pdata, attrids, SDP_UINT32);
- sdp_list_free(attrids, 0);
-
+ seqlen = gen_attridseq_pdu(pdata, attrid_list,
+ reqtype == SDP_ATTR_REQ_INDIVIDUAL ? SDP_UINT16 : SDP_UINT32);
if (seqlen == -1) {
errno = EINVAL;
goto end;