• Home
  • Raw
  • Download

Lines Matching refs:ctxt

356 	struct transaction_context *ctxt = udata;  in transaction_context_free()  local
358 if (!ctxt) in transaction_context_free()
361 g_free(ctxt->src); in transaction_context_free()
362 g_free(ctxt->dst); in transaction_context_free()
364 if (ctxt->conn) in transaction_context_free()
365 dbus_connection_unref(ctxt->conn); in transaction_context_free()
367 if (ctxt->rq) in transaction_context_free()
368 dbus_message_unref(ctxt->rq); in transaction_context_free()
370 if (ctxt->session && !ctxt->io) in transaction_context_free()
371 sdp_close(ctxt->session); in transaction_context_free()
373 if (ctxt->session && ctxt->io) { in transaction_context_free()
374 g_source_remove(ctxt->io_id); in transaction_context_free()
377 cache_sdp_session(ctxt->session, ctxt->io); in transaction_context_free()
379 sdp_close(ctxt->session); in transaction_context_free()
381 g_io_channel_unref(ctxt->io); in transaction_context_free()
384 if (ctxt->identifiers) { in transaction_context_free()
385 g_slist_foreach(ctxt->identifiers, (GFunc) g_free, NULL); in transaction_context_free()
386 g_slist_free(ctxt->identifiers); in transaction_context_free()
389 g_free(ctxt); in transaction_context_free()
395 struct transaction_context *ctxt = udata; in search_process_cb() local
399 ctxt->io_id = 0; in search_process_cb()
409 if (sdp_process(ctxt->session) < 0) in search_process_cb()
416 error_failed_errno(ctxt->conn, ctxt->rq, err); in search_process_cb()
417 transaction_context_free(ctxt, FALSE); in search_process_cb()
426 struct transaction_context *ctxt = udata; in remote_svc_rec_completed_cb() local
432 if (!ctxt) in remote_svc_rec_completed_cb()
437 int sdp_err = sdp_get_error(ctxt->session); in remote_svc_rec_completed_cb()
440 error_failed_errno(ctxt->conn, ctxt->rq, EINVAL); in remote_svc_rec_completed_cb()
445 error_failed_errno(ctxt->conn, ctxt->rq, sdp_err); in remote_svc_rec_completed_cb()
450 error_sdp_failed(ctxt->conn, ctxt->rq, err); in remote_svc_rec_completed_cb()
457 error_failed_errno(ctxt->conn, ctxt->rq, EPROTO); in remote_svc_rec_completed_cb()
461 reply = dbus_message_new_method_return(ctxt->rq); in remote_svc_rec_completed_cb()
472 sdp_store_record(ctxt->src, ctxt->dst, rec->handle, rsp, size); in remote_svc_rec_completed_cb()
481 dbus_connection_send(ctxt->conn, reply, NULL); in remote_svc_rec_completed_cb()
485 transaction_context_free(ctxt, TRUE); in remote_svc_rec_completed_cb()
492 struct transaction_context *ctxt = udata; in remote_svc_rec_completed_xml_cb() local
498 if (!ctxt) in remote_svc_rec_completed_xml_cb()
503 int sdp_err = sdp_get_error(ctxt->session); in remote_svc_rec_completed_xml_cb()
506 error_failed_errno(ctxt->conn, ctxt->rq, EINVAL); in remote_svc_rec_completed_xml_cb()
511 error_failed_errno(ctxt->conn, ctxt->rq, sdp_err); in remote_svc_rec_completed_xml_cb()
516 error_sdp_failed(ctxt->conn, ctxt->rq, err); in remote_svc_rec_completed_xml_cb()
523 error_failed_errno(ctxt->conn, ctxt->rq, EPROTO); in remote_svc_rec_completed_xml_cb()
527 reply = dbus_message_new_method_return(ctxt->rq); in remote_svc_rec_completed_xml_cb()
535 sdp_store_record(ctxt->src, ctxt->dst, rec->handle, rsp, size); in remote_svc_rec_completed_xml_cb()
551 dbus_connection_send(ctxt->conn, reply, NULL); in remote_svc_rec_completed_xml_cb()
555 transaction_context_free(ctxt, TRUE); in remote_svc_rec_completed_xml_cb()
561 struct transaction_context *ctxt = udata; in remote_svc_handles_completed_cb() local
567 if (!ctxt) in remote_svc_handles_completed_cb()
572 int sdp_err = sdp_get_error(ctxt->session); in remote_svc_handles_completed_cb()
575 error_failed_errno(ctxt->conn, ctxt->rq, EINVAL); in remote_svc_handles_completed_cb()
580 error_failed_errno(ctxt->conn, ctxt->rq, sdp_err); in remote_svc_handles_completed_cb()
585 error_sdp_failed(ctxt->conn, ctxt->rq, err); in remote_svc_handles_completed_cb()
592 error_failed_errno(ctxt->conn, ctxt->rq, EPROTO); in remote_svc_handles_completed_cb()
596 reply = dbus_message_new_method_return(ctxt->rq); in remote_svc_handles_completed_cb()
626 dbus_connection_send(ctxt->conn, reply, NULL); in remote_svc_handles_completed_cb()
630 transaction_context_free(ctxt, TRUE); in remote_svc_handles_completed_cb()
676 static int service_search_attr(struct transaction_context *ctxt, uint16_t uuid) in service_search_attr() argument
682 sdp_uuid16_create(&ctxt->uuid, uuid); in service_search_attr()
684 search = sdp_list_append(0, &ctxt->uuid); in service_search_attr()
691 if (sdp_service_search_attr_async(ctxt->session, search, in service_search_attr()
693 ret = -sdp_get_error(ctxt->session); in service_search_attr()
704 struct transaction_context *ctxt = udata; in remote_svc_identifiers_completed_cb() local
713 if (!ctxt) in remote_svc_identifiers_completed_cb()
718 int sdp_err = sdp_get_error(ctxt->session); in remote_svc_identifiers_completed_cb()
721 error_failed_errno(ctxt->conn, ctxt->rq, EINVAL); in remote_svc_identifiers_completed_cb()
726 error_failed_errno(ctxt->conn, ctxt->rq, sdp_err); in remote_svc_identifiers_completed_cb()
731 error_sdp_failed(ctxt->conn, ctxt->rq, err); in remote_svc_identifiers_completed_cb()
738 error_failed_errno(ctxt->conn, ctxt->rq, EPROTO); in remote_svc_identifiers_completed_cb()
754 sdp_store_record(ctxt->src, ctxt->dst, rec->handle, rsp, recsize); in remote_svc_identifiers_completed_cb()
768 l = g_slist_find_custom(ctxt->identifiers, in remote_svc_identifiers_completed_cb()
773 ctxt->identifiers = g_slist_append(ctxt->identifiers, in remote_svc_identifiers_completed_cb()
778 if (!ctxt->identifiers && ctxt->uuid.value.uuid16 == PUBLIC_BROWSE_GROUP) in remote_svc_identifiers_completed_cb()
779 if (service_search_attr(ctxt, L2CAP_UUID) == 0) in remote_svc_identifiers_completed_cb()
783 l = g_slist_find_custom(ctxt->identifiers, in remote_svc_identifiers_completed_cb()
785 if (!l && ctxt->uuid.value.uuid16 != PNP_INFO_SVCLASS_ID) in remote_svc_identifiers_completed_cb()
786 if (service_search_attr(ctxt, PNP_INFO_SVCLASS_ID) == 0) in remote_svc_identifiers_completed_cb()
789 reply = dbus_message_new_method_return(ctxt->rq); in remote_svc_identifiers_completed_cb()
791 identifiers = g_new(char *, g_slist_length(ctxt->identifiers)); in remote_svc_identifiers_completed_cb()
793 for (l = ctxt->identifiers, len = 0; l; l = l->next, len++) in remote_svc_identifiers_completed_cb()
801 dbus_connection_send(ctxt->conn, reply, NULL); in remote_svc_identifiers_completed_cb()
805 g_dbus_emit_signal(ctxt->conn, in remote_svc_identifiers_completed_cb()
806 dbus_message_get_path(ctxt->rq), in remote_svc_identifiers_completed_cb()
809 DBUS_TYPE_STRING, &ctxt->dst, in remote_svc_identifiers_completed_cb()
818 transaction_context_free(ctxt, TRUE); in remote_svc_identifiers_completed_cb()
825 struct transaction_context *ctxt = NULL; in sdp_client_connect_cb() local
842 ctxt = g_new0(struct transaction_context, 1); in sdp_client_connect_cb()
843 ctxt->src = g_strdup(c->src); in sdp_client_connect_cb()
844 ctxt->dst = g_strdup(c->dst); in sdp_client_connect_cb()
845 ctxt->conn = dbus_connection_ref(c->conn); in sdp_client_connect_cb()
846 ctxt->rq = dbus_message_ref(c->rq); in sdp_client_connect_cb()
847 ctxt->session = c->session; in sdp_client_connect_cb()
850 sdp_err = c->conn_cb(ctxt); in sdp_client_connect_cb()
858 if (ctxt->io_id) in sdp_client_connect_cb()
859 g_source_remove(ctxt->io_id); in sdp_client_connect_cb()
860 ctxt->io_id = g_io_add_watch(chan, in sdp_client_connect_cb()
862 search_process_cb, ctxt); in sdp_client_connect_cb()
863 ctxt->io = g_io_channel_ref(chan); in sdp_client_connect_cb()
870 if (ctxt) in sdp_client_connect_cb()
871 transaction_context_free(ctxt, FALSE); in sdp_client_connect_cb()
918 static int remote_svc_rec_conn_cb(struct transaction_context *ctxt) in remote_svc_rec_conn_cb() argument
925 if (sdp_set_notify(ctxt->session, remote_svc_rec_completed_cb, ctxt) < 0) in remote_svc_rec_conn_cb()
928 dbus_message_get_args(ctxt->rq, NULL, in remote_svc_rec_conn_cb()
938 if (sdp_service_attr_async(ctxt->session, handle, in remote_svc_rec_conn_cb()
941 return -sdp_get_error(ctxt->session); in remote_svc_rec_conn_cb()
949 static int remote_svc_rec_conn_xml_cb(struct transaction_context *ctxt) in remote_svc_rec_conn_xml_cb() argument
956 if (sdp_set_notify(ctxt->session, remote_svc_rec_completed_xml_cb, ctxt) < 0) in remote_svc_rec_conn_xml_cb()
959 dbus_message_get_args(ctxt->rq, NULL, in remote_svc_rec_conn_xml_cb()
969 if (sdp_service_attr_async(ctxt->session, handle, in remote_svc_rec_conn_xml_cb()
972 return -sdp_get_error(ctxt->session); in remote_svc_rec_conn_xml_cb()
984 struct transaction_context *ctxt = udata; in service_search_channel_completed_cb() local
991 if (!ctxt) in service_search_channel_completed_cb()
996 int sdp_err = sdp_get_error(ctxt->session); in service_search_channel_completed_cb()
999 error_failed_errno(ctxt->conn, ctxt->rq, EINVAL); in service_search_channel_completed_cb()
1004 error_failed_errno(ctxt->conn, ctxt->rq, sdp_err); in service_search_channel_completed_cb()
1009 error_sdp_failed(ctxt->conn, ctxt->rq, err); in service_search_channel_completed_cb()
1016 error_failed_errno(ctxt->conn, ctxt->rq, EPROTO); in service_search_channel_completed_cb()
1035 sdp_store_record(ctxt->src, ctxt->dst, rec->handle, rsp, recsize); in service_search_channel_completed_cb()
1056 if (recv_uuid16 != ctxt->uuid.value.uuid16) { in service_search_channel_completed_cb()
1061 } else if (sdp_uuid16_cmp(&ctxt->uuid, recv_uuid)) { in service_search_channel_completed_cb()
1087 reply = dbus_message_new_method_return(ctxt->rq); in service_search_channel_completed_cb()
1092 dbus_connection_send(ctxt->conn, reply, NULL); in service_search_channel_completed_cb()
1096 transaction_context_free(ctxt, TRUE); in service_search_channel_completed_cb()
1099 static int service_search_channel_cb(struct transaction_context *ctxt) in service_search_channel_cb() argument
1110 dbus_message_get_args(ctxt->rq, NULL, in service_search_channel_cb()
1115 sdp_uuid16_create(&ctxt->uuid, uuid16); in service_search_channel_cb()
1117 search = sdp_list_append(0, &ctxt->uuid); in service_search_channel_cb()
1121 if (sdp_set_notify(ctxt->session, service_search_channel_completed_cb, in service_search_channel_cb()
1122 ctxt) < 0) in service_search_channel_cb()
1128 if (sdp_service_search_attr_async(ctxt->session, search, in service_search_channel_cb()
1130 ret = -sdp_get_error(ctxt->session); in service_search_channel_cb()
1203 static int remote_svc_handles_conn_cb(struct transaction_context *ctxt) in remote_svc_handles_conn_cb() argument
1208 if (sdp_set_notify(ctxt->session, remote_svc_handles_completed_cb, ctxt) < 0) in remote_svc_handles_conn_cb()
1211 dbus_message_get_args(ctxt->rq, NULL, in remote_svc_handles_conn_cb()
1217 bt_string2uuid(&ctxt->uuid, svc); in remote_svc_handles_conn_cb()
1219 sdp_uuid16_create(&ctxt->uuid, PUBLIC_BROWSE_GROUP); in remote_svc_handles_conn_cb()
1221 search = sdp_list_append(0, &ctxt->uuid); in remote_svc_handles_conn_cb()
1224 if (sdp_service_search_async(ctxt->session, search, 64) < 0) { in remote_svc_handles_conn_cb()
1227 return -sdp_get_error(ctxt->session); in remote_svc_handles_conn_cb()
1235 static int remote_svc_identifiers_conn_cb(struct transaction_context *ctxt) in remote_svc_identifiers_conn_cb() argument
1237 if (sdp_set_notify(ctxt->session, in remote_svc_identifiers_conn_cb()
1238 remote_svc_identifiers_completed_cb, ctxt) < 0) in remote_svc_identifiers_conn_cb()
1241 return service_search_attr(ctxt, PUBLIC_BROWSE_GROUP); in remote_svc_identifiers_conn_cb()