本文整理汇总了C++中sdp_list_append函数的典型用法代码示例。如果您正苦于以下问题:C++ sdp_list_append函数的具体用法?C++ sdp_list_append怎么用?C++ sdp_list_append使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了sdp_list_append函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: DBG
static sdp_list_t *app_to_sdplist(struct mcap_application *app)
{ DBG("");
sdp_data_t *mdepid,
*dtype = NULL,
*role = NULL,
*desc = NULL;
sdp_list_t *f_list = NULL;
mdepid = sdp_data_alloc(SDP_UINT8, &app->id);
if (!mdepid)
return NULL;
dtype = sdp_data_alloc(SDP_UINT16, &app->data_type);
if (!dtype)
goto fail;
role = sdp_data_alloc(SDP_UINT8, &app->role);
if (!role)
goto fail;
if (app->description) {
desc = sdp_data_alloc(SDP_TEXT_STR8, app->description);
if (!desc)
goto fail;
}
f_list = sdp_list_append(NULL, mdepid);
if (!f_list)
goto fail;
if (!sdp_list_append(f_list, dtype))
goto fail;
if (!sdp_list_append(f_list, role))
goto fail;
if (desc)
if (!sdp_list_append(f_list, desc))
goto fail;
return f_list;
fail:
if (f_list)
sdp_list_free(f_list, NULL);
if (mdepid)
sdp_data_free(mdepid);
if (dtype)
sdp_data_free(dtype);
if (role)
sdp_data_free(role);
if (desc)
sdp_data_free(desc);
return NULL;
}
开发者ID:richardxu,项目名称:panda-a4,代码行数:56,代码来源:mcap_utils.c
示例2: sdp_data_alloc
static sdp_list_t *app_to_sdplist(struct hdp_application *app)
{
sdp_data_t *mdepid,
*dtype = NULL,
*role = NULL,
*desc = NULL;
sdp_list_t *f_list = NULL;
mdepid = sdp_data_alloc(SDP_UINT8, &app->id);
if (mdepid == NULL)
return NULL;
dtype = sdp_data_alloc(SDP_UINT16, &app->data_type);
if (dtype == NULL)
goto fail;
role = sdp_data_alloc(SDP_UINT8, &app->role);
if (role == NULL)
goto fail;
if (app->description != NULL) {
desc = sdp_data_alloc(SDP_TEXT_STR8, app->description);
if (desc == NULL)
goto fail;
}
f_list = sdp_list_append(NULL, mdepid);
if (f_list == NULL)
goto fail;
if (sdp_list_append(f_list, dtype) == NULL)
goto fail;
if (sdp_list_append(f_list, role) == NULL)
goto fail;
if (desc != NULL)
if (sdp_list_append(f_list, desc) == NULL)
goto fail;
return f_list;
fail:
if (f_list != NULL)
sdp_list_free(f_list, NULL);
if (mdepid != NULL)
sdp_data_free(mdepid);
if (dtype != NULL)
sdp_data_free(dtype);
if (role != NULL)
sdp_data_free(role);
if (desc != NULL)
sdp_data_free(desc);
return NULL;
}
开发者ID:intgr,项目名称:bluez,代码行数:56,代码来源:hdp_util.c
示例3: connect_watch
static gboolean connect_watch(GIOChannel *chan, GIOCondition cond,
gpointer user_data)
{
struct search_context *ctxt = user_data;
sdp_list_t *search, *attrids;
uint32_t range = 0x0000ffff;
socklen_t len;
int sk, err = 0;
sk = g_io_channel_unix_get_fd(chan);
ctxt->io_id = 0;
len = sizeof(err);
if (getsockopt(sk, SOL_SOCKET, SO_ERROR, &err, &len) < 0) {
err = errno;
goto failed;
}
if (err != 0)
goto failed;
if (sdp_set_notify(ctxt->session, search_completed_cb, ctxt) < 0) {
err = EIO;
goto failed;
}
search = sdp_list_append(NULL, &ctxt->uuid);
attrids = sdp_list_append(NULL, &range);
if (sdp_service_search_attr_async(ctxt->session,
search, SDP_ATTR_REQ_RANGE, attrids) < 0) {
sdp_list_free(attrids, NULL);
sdp_list_free(search, NULL);
err = EIO;
goto failed;
}
sdp_list_free(attrids, NULL);
sdp_list_free(search, NULL);
/* Set callback responsible for update the internal SDP transaction */
ctxt->io_id = g_io_add_watch(chan,
G_IO_IN | G_IO_HUP | G_IO_ERR | G_IO_NVAL,
search_process_cb, ctxt);
return FALSE;
failed:
sdp_close(ctxt->session);
ctxt->session = NULL;
if (ctxt->cb)
ctxt->cb(NULL, -err, ctxt->user_data);
search_context_cleanup(ctxt);
return FALSE;
}
开发者ID:hakssung,项目名称:p920ics_package,代码行数:56,代码来源:sdp-client.c
示例4: service_callback
static gboolean service_callback(GIOChannel *io, GIOCondition cond,
gpointer user_data)
{
struct bluetooth_session *session = user_data;
sdp_list_t *search, *attrid;
uint32_t range = 0x0000ffff;
GError *gerr = NULL;
uuid_t uuid;
if (cond & G_IO_NVAL)
return FALSE;
if (cond & G_IO_ERR)
goto failed;
if (sdp_set_notify(session->sdp, search_callback, session) < 0)
goto failed;
if (bt_string2uuid(&uuid, session->service) < 0)
goto failed;
sdp_uuid128_to_uuid(&uuid);
search = sdp_list_append(NULL, &uuid);
attrid = sdp_list_append(NULL, &range);
if (sdp_service_search_attr_async(session->sdp,
search, SDP_ATTR_REQ_RANGE, attrid) < 0) {
sdp_list_free(attrid, NULL);
sdp_list_free(search, NULL);
goto failed;
}
sdp_list_free(attrid, NULL);
sdp_list_free(search, NULL);
g_io_add_watch(io, G_IO_IN | G_IO_HUP | G_IO_ERR | G_IO_NVAL,
process_callback, session);
return FALSE;
failed:
g_io_channel_shutdown(session->io, TRUE, NULL);
g_io_channel_unref(session->io);
session->io = NULL;
g_set_error(&gerr, OBC_BT_ERROR, -EIO,
"Unable to find service record");
if (session->func)
session->func(session->io, gerr, session->user_data);
g_clear_error(&gerr);
session_destroy(session);
return FALSE;
}
开发者ID:ghent360,项目名称:bluez,代码行数:55,代码来源:bluetooth.c
示例5: sdp_record_alloc
static sdp_record_t *create_sap_record(uint8_t channel)
{
sdp_list_t *apseq, *aproto, *profiles, *proto[2], *root, *svclass_id;
uuid_t sap_uuid, gt_uuid, root_uuid, l2cap, rfcomm;
sdp_profile_desc_t profile;
sdp_record_t *record;
sdp_data_t *ch;
record = sdp_record_alloc();
if (!record)
return NULL;
sdp_uuid16_create(&root_uuid, PUBLIC_BROWSE_GROUP);
root = sdp_list_append(NULL, &root_uuid);
sdp_set_browse_groups(record, root);
sdp_list_free(root, NULL);
sdp_uuid16_create(&sap_uuid, SAP_SVCLASS_ID);
svclass_id = sdp_list_append(NULL, &sap_uuid);
sdp_uuid16_create(>_uuid, GENERIC_TELEPHONY_SVCLASS_ID);
svclass_id = sdp_list_append(svclass_id, >_uuid);
sdp_set_service_classes(record, svclass_id);
sdp_list_free(svclass_id, NULL);
sdp_uuid16_create(&profile.uuid, SAP_PROFILE_ID);
profile.version = SAP_VERSION;
profiles = sdp_list_append(NULL, &profile);
sdp_set_profile_descs(record, profiles);
sdp_list_free(profiles, NULL);
sdp_uuid16_create(&l2cap, L2CAP_UUID);
proto[0] = sdp_list_append(NULL, &l2cap);
apseq = sdp_list_append(NULL, proto[0]);
sdp_uuid16_create(&rfcomm, RFCOMM_UUID);
proto[1] = sdp_list_append(NULL, &rfcomm);
ch = sdp_data_alloc(SDP_UINT8, &channel);
proto[1] = sdp_list_append(proto[1], ch);
apseq = sdp_list_append(apseq, proto[1]);
aproto = sdp_list_append(NULL, apseq);
sdp_set_access_protos(record, aproto);
sdp_set_info_attr(record, "SIM Access Server",
NULL, NULL);
sdp_data_free(ch);
sdp_list_free(proto[0], NULL);
sdp_list_free(proto[1], NULL);
sdp_list_free(apseq, NULL);
sdp_list_free(aproto, NULL);
return record;
}
开发者ID:Kick-Buttowski,项目名称:android_external_bluetooth_bluez,代码行数:55,代码来源:server.c
示例6: sdp_record_alloc
static sdp_record_t *hfp_hs_record(uint8_t ch)
{
sdp_list_t *svclass_id, *pfseq, *apseq, *root;
uuid_t root_uuid, svclass_uuid, ga_svclass_uuid;
uuid_t l2cap_uuid, rfcomm_uuid;
sdp_profile_desc_t profile;
sdp_record_t *record;
sdp_list_t *aproto, *proto[2];
sdp_data_t *channel;
record = sdp_record_alloc();
if (!record)
return NULL;
sdp_uuid16_create(&root_uuid, PUBLIC_BROWSE_GROUP);
root = sdp_list_append(0, &root_uuid);
sdp_set_browse_groups(record, root);
sdp_uuid16_create(&svclass_uuid, HANDSFREE_SVCLASS_ID);
svclass_id = sdp_list_append(0, &svclass_uuid);
sdp_uuid16_create(&ga_svclass_uuid, GENERIC_AUDIO_SVCLASS_ID);
svclass_id = sdp_list_append(svclass_id, &ga_svclass_uuid);
sdp_set_service_classes(record, svclass_id);
sdp_uuid16_create(&profile.uuid, HANDSFREE_PROFILE_ID);
profile.version = 0x0105;
pfseq = sdp_list_append(0, &profile);
sdp_set_profile_descs(record, pfseq);
sdp_uuid16_create(&l2cap_uuid, L2CAP_UUID);
proto[0] = sdp_list_append(0, &l2cap_uuid);
apseq = sdp_list_append(0, proto[0]);
sdp_uuid16_create(&rfcomm_uuid, RFCOMM_UUID);
proto[1] = sdp_list_append(0, &rfcomm_uuid);
channel = sdp_data_alloc(SDP_UINT8, &ch);
proto[1] = sdp_list_append(proto[1], channel);
apseq = sdp_list_append(apseq, proto[1]);
aproto = sdp_list_append(0, apseq);
sdp_set_access_protos(record, aproto);
sdp_set_info_attr(record, "Hands-Free", 0, 0);
sdp_data_free(channel);
sdp_list_free(proto[0], 0);
sdp_list_free(proto[1], 0);
sdp_list_free(apseq, 0);
sdp_list_free(pfseq, 0);
sdp_list_free(aproto, 0);
sdp_list_free(root, 0);
sdp_list_free(svclass_id, 0);
return record;
}
开发者ID:dev-life,项目名称:GT-I9300_Platform,代码行数:55,代码来源:manager.c
示例7: sdp_record_alloc
static sdp_record_t *dun_record(uint8_t ch)
{
sdp_list_t *svclass_id, *pfseq, *apseq, *root, *aproto;
uuid_t root_uuid, dun, gn, l2cap, rfcomm;
sdp_profile_desc_t profile;
sdp_list_t *proto[2];
sdp_record_t *record;
sdp_data_t *channel;
record = sdp_record_alloc();
if (!record)
return NULL;
sdp_uuid16_create(&root_uuid, PUBLIC_BROWSE_GROUP);
root = sdp_list_append(NULL, &root_uuid);
sdp_set_browse_groups(record, root);
sdp_uuid16_create(&dun, DIALUP_NET_SVCLASS_ID);
svclass_id = sdp_list_append(NULL, &dun);
sdp_uuid16_create(&gn, GENERIC_NETWORKING_SVCLASS_ID);
svclass_id = sdp_list_append(svclass_id, &gn);
sdp_set_service_classes(record, svclass_id);
sdp_uuid16_create(&profile.uuid, DIALUP_NET_PROFILE_ID);
profile.version = 0x0100;
pfseq = sdp_list_append(NULL, &profile);
sdp_set_profile_descs(record, pfseq);
sdp_uuid16_create(&l2cap, L2CAP_UUID);
proto[0] = sdp_list_append(NULL, &l2cap);
apseq = sdp_list_append(NULL, proto[0]);
sdp_uuid16_create(&rfcomm, RFCOMM_UUID);
proto[1] = sdp_list_append(NULL, &rfcomm);
channel = sdp_data_alloc(SDP_UINT8, &ch);
proto[1] = sdp_list_append(proto[1], channel);
apseq = sdp_list_append(apseq, proto[1]);
aproto = sdp_list_append(0, apseq);
sdp_set_access_protos(record, aproto);
sdp_set_info_attr(record, "Dial-Up Networking", 0, 0);
sdp_data_free(channel);
sdp_list_free(root, NULL);
sdp_list_free(svclass_id, NULL);
sdp_list_free(proto[0], NULL);
sdp_list_free(proto[1], NULL);
sdp_list_free(pfseq, NULL);
sdp_list_free(apseq, NULL);
sdp_list_free(aproto, NULL);
return record;
}
开发者ID:520lly,项目名称:bluez,代码行数:54,代码来源:pnat.c
示例8: sdp_record_alloc
static sdp_record_t *proxy_record_new(const char *uuid128, uint8_t channel)
{
sdp_list_t *apseq, *aproto, *profiles, *proto[2], *root, *svclass_id;
uuid_t uuid, root_uuid, l2cap, rfcomm;
sdp_profile_desc_t profile;
sdp_record_t *record;
sdp_data_t *ch;
record = sdp_record_alloc();
if (!record)
return NULL;
sdp_uuid16_create(&root_uuid, PUBLIC_BROWSE_GROUP);
root = sdp_list_append(NULL, &root_uuid);
sdp_set_browse_groups(record, root);
sdp_list_free(root, NULL);
bt_string2uuid(&uuid, uuid128);
svclass_id = sdp_list_append(NULL, &uuid);
sdp_set_service_classes(record, svclass_id);
sdp_list_free(svclass_id, NULL);
sdp_uuid16_create(&profile.uuid, SERIAL_PORT_PROFILE_ID);
profile.version = 0x0100;
profiles = sdp_list_append(NULL, &profile);
sdp_set_profile_descs(record, profiles);
sdp_list_free(profiles, NULL);
sdp_uuid16_create(&l2cap, L2CAP_UUID);
proto[0] = sdp_list_append(NULL, &l2cap);
apseq = sdp_list_append(NULL, proto[0]);
sdp_uuid16_create(&rfcomm, RFCOMM_UUID);
proto[1] = sdp_list_append(NULL, &rfcomm);
ch = sdp_data_alloc(SDP_UINT8, &channel);
proto[1] = sdp_list_append(proto[1], ch);
apseq = sdp_list_append(apseq, proto[1]);
aproto = sdp_list_append(NULL, apseq);
sdp_set_access_protos(record, aproto);
add_lang_attr(record);
sdp_set_info_attr(record, "Port Proxy Entity",
NULL, "Port Proxy Entity");
sdp_data_free(ch);
sdp_list_free(proto[0], NULL);
sdp_list_free(proto[1], NULL);
sdp_list_free(apseq, NULL);
sdp_list_free(aproto, NULL);
return record;
}
开发者ID:writefaruq,项目名称:bluez-oob,代码行数:54,代码来源:proxy.c
示例9: sdp_uuid16_create
static sdp_record_t *create_mas_record(uint8_t chan, const char *svc_name)
{
sdp_list_t *seq;
sdp_profile_desc_t profile[1];
uint8_t minst = DEFAULT_MAS_INSTANCE;
uint8_t mtype = DEFAULT_MAS_MSG_TYPE;
sdp_record_t *record;
uuid_t uuid;
sdp_uuid16_create(&uuid, MAP_MSE_SVCLASS_ID);
record = create_rfcomm_record(chan, &uuid, svc_name, true);
if (!record)
return NULL;
sdp_uuid16_create(&profile[0].uuid, MAP_PROFILE_ID);
profile[0].version = 0x0101;
seq = sdp_list_append(NULL, profile);
sdp_set_profile_descs(record, seq);
sdp_attr_add_new(record, SDP_ATTR_MAS_INSTANCE_ID, SDP_UINT8, &minst);
sdp_attr_add_new(record, SDP_ATTR_SUPPORTED_MESSAGE_TYPES, SDP_UINT8,
&mtype);
sdp_list_free(seq, NULL);
return record;
}
开发者ID:Andrewas,项目名称:android_hardware_semc,代码行数:28,代码来源:socket.c
示例10: is_hid_sdp_record_registered
/**
* Lookup for HID service records. This function returns:
* - SDP HID record handle, if there is already a HID SDP record
* 0 if there is no HID SDP record
* <0 if any error occur. In this case, the value returned is the errno.
*
*/
int is_hid_sdp_record_registered() {
int handle;
uuid_t svc_uuid;
int err;
sdp_list_t *response_list = NULL, *search_list, *attrid_list;
sdp_uuid16_create(&svc_uuid, HID_SVCLASS_ID);
search_list = sdp_list_append(NULL, &svc_uuid);
uint32_t range = 0x0000ffff;
attrid_list = sdp_list_append(NULL, &range);
err = sdp_service_search_attr_req(sdp_session, search_list, SDP_ATTR_REQ_RANGE, attrid_list, &response_list);
sdp_list_free(search_list, NULL);
sdp_list_free(attrid_list, NULL);
if (err < 0) {
return err;
}
if (response_list != NULL) {
sdp_record_t *rec = (sdp_record_t *)response_list->data;
int handle = rec->handle;
sdp_list_free(response_list, NULL);
return handle;
} else {
return 0;
}
/*
* code below illustrates how to iterate through records.
*
sdp_list_t *r = response_list;
for (; r; r = r->next) {
sdp_record_t *rec = (sdp_record_t *)r->data;
if (rec != NULL) {
printf("rec: 0x%X\n", rec->handle);
}
sdp_record_free(rec);
}
*/
}
开发者ID:andrecurvello,项目名称:BluetoothHidEmu,代码行数:52,代码来源:hid_emu.c
示例11: service_callback
static gboolean service_callback(GIOChannel *io, GIOCondition cond,
gpointer user_data)
{
struct callback_data *callback = user_data;
sdp_list_t *search, *attrid;
uint32_t range = 0x0000ffff;
GError *gerr = NULL;
if (cond & (G_IO_NVAL | G_IO_ERR))
goto failed;
if (sdp_set_notify(callback->sdp, search_callback, callback) < 0)
goto failed;
search = sdp_list_append(NULL, &callback->session->uuid);
attrid = sdp_list_append(NULL, &range);
if (sdp_service_search_attr_async(callback->sdp,
search, SDP_ATTR_REQ_RANGE, attrid) < 0) {
sdp_list_free(attrid, NULL);
sdp_list_free(search, NULL);
goto failed;
}
sdp_list_free(attrid, NULL);
sdp_list_free(search, NULL);
g_io_add_watch(io, G_IO_IN | G_IO_HUP | G_IO_ERR | G_IO_NVAL,
process_callback, callback);
return FALSE;
failed:
sdp_close(callback->sdp);
g_set_error(&gerr, OBEX_IO_ERROR, -EIO,
"Unable to find service record");
callback->func(callback->session, gerr, callback->data);
g_clear_error(&gerr);
session_unref(callback->session);
g_free(callback);
return FALSE;
}
开发者ID:Commers,项目名称:obexd,代码行数:44,代码来源:session.c
示例12: find_service_channel
/*
* Determine whether the given device supports Serial or Dial-Up Networking,
* and if so what the RFCOMM channel number for the service is.
*/
static int find_service_channel(bdaddr_t *adapter, bdaddr_t *device, int only_gnapplet, uint16_t svclass_id)
{
sdp_session_t *sdp = NULL;
sdp_list_t *search = NULL, *attrs = NULL, *recs = NULL, *tmp;
uuid_t browse_uuid, service_id;
uint32_t range = 0x0000ffff;
int channel = -1;
sdp = sdp_connect(adapter, device, SDP_RETRY_IF_BUSY);
if (!sdp)
goto end;
sdp_uuid16_create(&browse_uuid, PUBLIC_BROWSE_GROUP);
sdp_uuid16_create(&service_id, svclass_id);
search = sdp_list_append(NULL, &browse_uuid);
search = sdp_list_append(search, &service_id);
attrs = sdp_list_append(NULL, &range);
if (sdp_service_search_attr_req(sdp, search,
SDP_ATTR_REQ_RANGE, attrs,
&recs))
goto end;
for (tmp = recs; tmp != NULL; tmp = tmp->next) {
sdp_record_t *rec = tmp->data;
/*
* If this service is better than what we've
* previously seen, try and get the channel number.
*/
channel = get_rfcomm_channel(rec, only_gnapplet);
if (channel > 0)
goto end;
}
end:
sdp_list_free(recs, (sdp_free_func_t)sdp_record_free);
sdp_list_free(search, NULL);
sdp_list_free(attrs, NULL);
sdp_close(sdp);
return channel;
}
开发者ID:pkot,项目名称:gnokii,代码行数:48,代码来源:unixbluetooth.c
示例13: get_channel
static uint8_t get_channel(const char *svr, uint16_t uuid)
{
sdp_session_t *sdp;
sdp_list_t *srch, *attrs, *rsp;
uuid_t svclass;
uint16_t attr;
bdaddr_t dst;
uint8_t channel = 0;
int err;
str2ba(svr, &dst);
sdp = sdp_connect(&bdaddr, &dst, SDP_RETRY_IF_BUSY);
if (!sdp)
return 0;
sdp_uuid16_create(&svclass, uuid);
srch = sdp_list_append(NULL, &svclass);
attr = SDP_ATTR_PROTO_DESC_LIST;
attrs = sdp_list_append(NULL, &attr);
err = sdp_service_search_attr_req(sdp, srch,
SDP_ATTR_REQ_INDIVIDUAL, attrs, &rsp);
if (err)
goto done;
for (; rsp; rsp = rsp->next) {
sdp_record_t *rec = (sdp_record_t *) rsp->data;
sdp_list_t *protos;
if (!sdp_get_access_protos(rec, &protos)) {
channel = sdp_get_proto_port(protos, RFCOMM_UUID);
if (channel > 0)
break;
}
}
done:
sdp_close(sdp);
return channel;
}
开发者ID:AndroidXperia,项目名称:android_external_bluetooth_bluez,代码行数:43,代码来源:rctest.c
示例14: sdp_list_append
/**
* Retrieves SDP record identified by "handle". Session must be already opened.
*/
sdp_record_t *get_sdp_record(sdp_session_t *session, int handle) {
sdp_list_t *attrid;
uint32_t range = 0x0000ffff;
sdp_record_t *rec;
attrid = sdp_list_append(0, &range);
rec = sdp_service_attr_req(session, handle, SDP_ATTR_REQ_RANGE, attrid);
sdp_list_free(attrid,0);
return rec;
}
开发者ID:andrecurvello,项目名称:BluetoothHidEmu,代码行数:14,代码来源:hid_emu.c
示例15: add_lang_attr
static void add_lang_attr(sdp_record_t *r)
{
sdp_lang_attr_t base_lang;
sdp_list_t *langs = 0;
/* UTF-8 MIBenum (http://www.iana.org/assignments/character-sets) */
base_lang.code_ISO639 = (0x65 << 8) | 0x6e;
base_lang.encoding = 106;
base_lang.base_offset = SDP_PRIMARY_LANG_BASE;
langs = sdp_list_append(0, &base_lang);
sdp_set_lang_attr(r, langs);
sdp_list_free(langs, 0);
}
开发者ID:AlexandreTK,项目名称:hidclient,代码行数:12,代码来源:hidclient.c
示例16: search_completed_cb
static void search_completed_cb(uint8_t type, uint16_t status,
uint8_t *rsp, size_t size, void *user_data)
{
struct search_context *ctxt = user_data;
sdp_list_t *recs = NULL;
int scanned, seqlen = 0, bytesleft = size;
uint8_t dataType;
int err = 0;
if (status || type != SDP_SVC_SEARCH_ATTR_RSP) {
err = -EPROTO;
goto done;
}
scanned = sdp_extract_seqtype(rsp, bytesleft, &dataType, &seqlen);
if (!scanned || !seqlen)
goto done;
rsp += scanned;
bytesleft -= scanned;
do {
sdp_record_t *rec;
int recsize;
recsize = 0;
rec = sdp_extract_pdu(rsp, bytesleft, &recsize);
if (!rec)
break;
if (!recsize) {
sdp_record_free(rec);
break;
}
scanned += recsize;
rsp += recsize;
bytesleft -= recsize;
recs = sdp_list_append(recs, rec);
} while (scanned < (ssize_t) size && bytesleft > 0);
done:
cache_sdp_session(&ctxt->src, &ctxt->dst, ctxt->session);
if (ctxt->cb)
ctxt->cb(recs, err, ctxt->user_data);
if (recs)
sdp_list_free(recs, (sdp_free_func_t) sdp_record_free);
search_context_cleanup(ctxt);
}
开发者ID:Xperia-Nicki,项目名称:android_platform_sony_nicki,代码行数:52,代码来源:glib-helper.c
示例17: register_features
static void register_features(void *data, void *user_data)
{
struct mdep_cfg *mdep = data;
sdp_list_t **sup_features = user_data;
sdp_list_t *hdp_feature;
DBG("");
hdp_feature = mdeps_to_sdp_features(mdep);
if (!hdp_feature)
return;
if (!*sup_features) {
*sup_features = sdp_list_append(NULL, hdp_feature);
if (!*sup_features)
sdp_list_free(hdp_feature,
(sdp_free_func_t)sdp_data_free);
} else if (!sdp_list_append(*sup_features, hdp_feature)) {
sdp_list_free(hdp_feature,
(sdp_free_func_t)sdp_data_free);
}
}
开发者ID:ghent360,项目名称:bluez,代码行数:22,代码来源:health.c
示例18: register_server_service
/*
* The SDP server must present its own service record to
* the service repository. This can be accessed by service
* discovery clients. This method constructs a service record
* and stores it in the repository
*/
void register_server_service(void)
{
sdp_list_t *classIDList;
uuid_t classID;
void **versions, **versionDTDs;
uint8_t dtd;
sdp_data_t *pData;
int i;
server = sdp_record_alloc();
server->pattern = NULL;
/* Force the record to be SDP_SERVER_RECORD_HANDLE */
server->handle = SDP_SERVER_RECORD_HANDLE;
sdp_record_add(BDADDR_ANY, server);
sdp_attr_add(server, SDP_ATTR_RECORD_HANDLE,
sdp_data_alloc(SDP_UINT32, &server->handle));
sdp_uuid16_create(&classID, SDP_SERVER_SVCLASS_ID);
classIDList = sdp_list_append(0, &classID);
sdp_set_service_classes(server, classIDList);
sdp_list_free(classIDList, 0);
/*
* Set the version numbers supported, these are passed as arguments
* to the server on command line. Now defaults to 1.0
* Build the version number sequence first
*/
versions = malloc(sdpServerVnumEntries * sizeof(void *));
versionDTDs = malloc(sdpServerVnumEntries * sizeof(void *));
dtd = SDP_UINT16;
for (i = 0; i < sdpServerVnumEntries; i++) {
uint16_t *version = malloc(sizeof(uint16_t));
*version = sdpVnumArray[i].major;
*version = (*version << 8);
*version |= sdpVnumArray[i].minor;
versions[i] = version;
versionDTDs[i] = &dtd;
}
pData = sdp_seq_alloc(versionDTDs, versions, sdpServerVnumEntries);
for (i = 0; i < sdpServerVnumEntries; i++)
free(versions[i]);
free(versions);
free(versionDTDs);
sdp_attr_add(server, SDP_ATTR_VERSION_NUM_LIST, pData);
update_db_timestamp();
}
开发者ID:intgr,项目名称:bluez,代码行数:55,代码来源:sdpd-service.c
示例19: register_features
static gboolean register_features(struct hdp_application *app,
sdp_list_t **sup_features)
{
sdp_list_t *hdp_feature;
hdp_feature = app_to_sdplist(app);
if (hdp_feature == NULL)
goto fail;
if (*sup_features == NULL) {
*sup_features = sdp_list_append(NULL, hdp_feature);
if (*sup_features == NULL)
goto fail;
} else if (sdp_list_append(*sup_features, hdp_feature) == NULL) {
goto fail;
}
return TRUE;
fail:
if (hdp_feature != NULL)
sdp_list_free(hdp_feature, (sdp_free_func_t)sdp_data_free);
return FALSE;
}
开发者ID:DaisyPi,项目名称:sensortag,代码行数:24,代码来源:hdp_util.c
示例20: register_features
static gboolean register_features(struct mcap_application *app,
sdp_list_t **sup_features)
{ DBG("");
sdp_list_t *mcap_feature;
mcap_feature = app_to_sdplist(app);
if (!mcap_feature)
goto fail;
if (!*sup_features) {
*sup_features = sdp_list_append(NULL, mcap_feature);
if (!*sup_features)
goto fail;
} else if (!sdp_list_append(*sup_features, mcap_feature)) {
goto fail;
}
return TRUE;
fail:
if (mcap_feature)
sdp_list_free(mcap_feature, (sdp_free_func_t)sdp_data_free);
return FALSE;
}
开发者ID:richardxu,项目名称:panda-a4,代码行数:24,代码来源:mcap_utils.c
注:本文中的sdp_list_append函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论