• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C++ dbus_message_get_sender函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C++中dbus_message_get_sender函数的典型用法代码示例。如果您正苦于以下问题:C++ dbus_message_get_sender函数的具体用法?C++ dbus_message_get_sender怎么用?C++ dbus_message_get_sender使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了dbus_message_get_sender函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。

示例1: als_disable_req_dbus_cb

/**
 * D-Bus callback for the ALS disabling method call
 *
 * @param msg The D-Bus message
 * @return TRUE
 */
static gboolean als_disable_req_dbus_cb(DBusMessage *const msg)
{
	const char *sender;

	gssize retval;

	if( !(sender = dbus_message_get_sender(msg)) )
		goto EXIT;

	mce_log(LL_DEBUG, "Received ALS disable request from %s", sender);

	retval = mce_dbus_owner_monitor_remove(sender,
					       &ext_als_enablers);

	if (retval == -1) {
		mce_log(LL_INFO, "Failed to remove name owner monitoring"
			" for `%s'",sender);
		goto EXIT;
	}

	rethink_als_status();

EXIT:
	if( !dbus_message_get_no_reply(msg) ) {
		DBusMessage *reply = dbus_new_method_reply(msg);
		dbus_send_message(reply), reply = 0;
	}

	return TRUE;
}
开发者ID:Vesuri,项目名称:mce,代码行数:36,代码来源:filter-brightness-als.c


示例2: cka_dbus_handle_wakeup_cb

/** D-Bus callback for the MCE_CPU_KEEPALIVE_WAKEUP_REQ method call
 *
 * @param msg  The D-Bus message
 *
 * @return TRUE on success, FALSE on failure
 */
static
gboolean
cka_dbus_handle_wakeup_cb(DBusMessage *const msg)
{
  gboolean success = FALSE;

  const char *sender =  0;

  if( !(sender = dbus_message_get_sender(msg)) )
  {
    goto EXIT;
  }

  mce_log(LL_NOTICE, "got keepalive wakeup from %s",
          mce_dbus_get_name_owner_ident(sender));

  cka_clients_handle_wakeup(sender);

  success = TRUE;

EXIT:
  cka_dbusutil_reply_bool(msg, success);

  return success;
}
开发者ID:spiiroin,项目名称:mce,代码行数:31,代码来源:cpu-keepalive.c


示例3: g_slist_find_custom

static DBusMessage *remove_proxy(DBusConnection *conn,
				DBusMessage *msg, void *data)
{
	struct serial_adapter *adapter = data;
	struct serial_proxy *prx;
	const char *path, *sender;
	GSList *l;

	if (!dbus_message_get_args(msg, NULL,
				DBUS_TYPE_STRING, &path,
				DBUS_TYPE_INVALID))
		return NULL;

	l = g_slist_find_custom(adapter->proxies, path, proxy_pathcmp);
	if (!l)
		return does_not_exist(msg, "Invalid proxy path");

	prx = l->data;

	sender = dbus_message_get_sender(msg);
	if (g_strcmp0(prx->owner, sender) != 0)
		return failed(msg, "Permission denied");

	unregister_proxy(prx);

	return dbus_message_new_method_return(msg);
}
开发者ID:Mcjesus15,项目名称:Zio_Other,代码行数:27,代码来源:proxy.c


示例4: agent_does_not_exist

static DBusMessage *unregister_agent(DBusConnection *conn,
					DBusMessage *msg, void *data)
{
	const char *path, *sender;

	if (!agent)
		return agent_does_not_exist(msg);

	if (!dbus_message_get_args(msg, NULL,
				DBUS_TYPE_OBJECT_PATH, &path,
				DBUS_TYPE_INVALID))
		return invalid_args(msg);

	if (strcmp(agent->path, path) != 0)
		return agent_does_not_exist(msg);

	sender = dbus_message_get_sender(msg);
	if (strcmp(agent->bus_name, sender) != 0)
		return not_authorized(msg);

	g_dbus_remove_watch(conn, agent->watch_id);

	agent_free(agent);
	agent = NULL;

	DBG("Agent unregistered");

	return dbus_message_new_method_return(msg);
}
开发者ID:Fiend90,项目名称:obex,代码行数:29,代码来源:manager.c


示例5: DBG

static DBusMessage *unregister_advertisement(DBusConnection *conn,
						DBusMessage *msg,
						void *user_data)
{
	struct btd_advertising *manager = user_data;
	DBusMessageIter args;
	struct advertisement *ad;
	struct dbus_obj_match match;

	DBG("UnregisterAdvertisement");

	if (!dbus_message_iter_init(msg, &args))
		return btd_error_invalid_args(msg);

	if (dbus_message_iter_get_arg_type(&args) != DBUS_TYPE_OBJECT_PATH)
		return btd_error_invalid_args(msg);

	dbus_message_iter_get_basic(&args, &match.path);

	match.owner = dbus_message_get_sender(msg);

	ad = queue_find(manager->ads, match_advertisement, &match);
	if (!ad)
		return btd_error_does_not_exist(msg);

	advertisement_remove(ad);

	return dbus_message_new_method_return(msg);
}
开发者ID:KlinkOnE,项目名称:android_external_bluetooth_bluez,代码行数:29,代码来源:advertising.c


示例6: btd_error_failed

static DBusMessage *register_server(DBusConnection *conn,
                                    DBusMessage *msg, void *data)
{
    struct network_server *ns = data;
    DBusMessage *reply;
    const char *uuid, *bridge;

    if (!dbus_message_get_args(msg, NULL, DBUS_TYPE_STRING, &uuid,
                               DBUS_TYPE_STRING, &bridge, DBUS_TYPE_INVALID))
        return NULL;

    if (g_strcmp0(uuid, "nap"))
        return btd_error_failed(msg, "Invalid UUID");

    if (ns->record_id)
        return btd_error_already_exists(msg);

    reply = dbus_message_new_method_return(msg);
    if (!reply)
        return NULL;

    ns->record_id = register_server_record(ns);
    if (!ns->record_id)
        return btd_error_failed(msg, "SDP record registration failed");

    g_free(ns->bridge);
    ns->bridge = g_strdup(bridge);

    ns->watch_id = g_dbus_add_disconnect_watch(conn,
                   dbus_message_get_sender(msg),
                   server_disconnect, ns, NULL);

    return reply;
}
开发者ID:heinervdm,项目名称:bluez,代码行数:34,代码来源:server.c


示例7: __connman_session_destroy

int __connman_session_destroy(DBusMessage *msg)
{
	const char *owner, *session_path;
	struct connman_session *session;

	owner = dbus_message_get_sender(msg);

	DBG("owner %s", owner);

	dbus_message_get_args(msg, NULL, DBUS_TYPE_OBJECT_PATH, &session_path,
							DBUS_TYPE_INVALID);
	if (session_path == NULL)
		return -EINVAL;

	session = g_hash_table_lookup(session_hash, session_path);
	if (session == NULL)
		return -EINVAL;

	if (g_strcmp0(owner, session->owner) != 0)
		return -EACCES;

	connman_session_destroy(session);

	return 0;
}
开发者ID:leinomii,项目名称:connman,代码行数:25,代码来源:session.c


示例8: service_introspect

static DBusMessage *
service_introspect (GkdSecretService *self,
                    DBusMessage *message)
{
	GPtrArray *names;
	DBusMessage *reply;
	ServiceClient *client;
	const gchar *caller;
	const gchar *path;
	GHashTableIter iter;

	names = g_ptr_array_new_with_free_func (g_free);
	gkd_secret_objects_foreach_collection (self->objects, message,
	                                       on_each_path_append_to_array,
	                                       names);

	/* Lookup all sessions and prompts for this client */
	caller = dbus_message_get_sender (message);
	if (caller != NULL) {
		client = g_hash_table_lookup (self->clients, caller);
		if (client != NULL) {
			g_hash_table_iter_init (&iter, client->dispatch);
			while (g_hash_table_iter_next (&iter, (gpointer *)&path, NULL))
				g_ptr_array_add (names, g_strdup (path));
		}
	}

	g_ptr_array_add (names, NULL);

	reply = gkd_dbus_introspect_handle (message, gkd_secret_introspect_service,
	                                    (const gchar **)names->pdata);

	g_ptr_array_unref (names);
	return reply;
}
开发者ID:rbeasley,项目名称:gnome-keyring,代码行数:35,代码来源:gkd-secret-service.c


示例9: g_dbus_create_error

static DBusMessage *remove_session(DBusConnection *connection,
				DBusMessage *message, void *user_data)
{
	struct obc_session *session;
	const char *sender, *path;

	if (dbus_message_get_args(message, NULL,
			DBUS_TYPE_OBJECT_PATH, &path,
			DBUS_TYPE_INVALID) == FALSE)
		return g_dbus_create_error(message,
				ERROR_INTERFACE ".InvalidArguments", NULL);

	session = find_session(path);
	if (session == NULL)
		return g_dbus_create_error(message,
				ERROR_INTERFACE ".InvalidArguments", NULL);

	sender = dbus_message_get_sender(message);
	if (g_str_equal(sender, obc_session_get_owner(session)) == FALSE)
		return g_dbus_create_error(message,
				ERROR_INTERFACE ".NotAuthorized",
				"Not Authorized");

	release_session(session);

	return dbus_message_new_method_return(message);
}
开发者ID:AlanApter,项目名称:steamlink-sdk,代码行数:27,代码来源:manager.c


示例10: service_method_change_lock

static DBusMessage*
service_method_change_lock (GkdSecretService *self, DBusMessage *message)
{
	GkdSecretChange *change;
	DBusMessage *reply;
	const char *caller;
	const gchar *path;
	GckObject *collection;

	caller = dbus_message_get_sender (message);
	if (!dbus_message_get_args (message, NULL, DBUS_TYPE_OBJECT_PATH, &path, DBUS_TYPE_INVALID))
		return NULL;

	/* Make sure it exists */
	collection = gkd_secret_objects_lookup_collection (self->objects, caller, path);
	if (!collection)
		return dbus_message_new_error (message, SECRET_ERROR_NO_SUCH_OBJECT,
		                               "The collection does not exist");
	g_object_unref (collection);

	change = gkd_secret_change_new (self, caller, path);
	path = gkd_secret_dispatch_get_object_path (GKD_SECRET_DISPATCH (change));
	gkd_secret_service_publish_dispatch (self, caller,
	                                     GKD_SECRET_DISPATCH (change));

	reply = dbus_message_new_method_return (message);
	dbus_message_append_args (reply, DBUS_TYPE_OBJECT_PATH, &path, DBUS_TYPE_INVALID);

	g_object_unref (change);
	return reply;
}
开发者ID:rbeasley,项目名称:gnome-keyring,代码行数:31,代码来源:gkd-secret-service.c


示例11: service_method_read_alias

static DBusMessage*
service_method_read_alias (GkdSecretService *self, DBusMessage *message)
{
	DBusMessage *reply;
	const char *alias;
	gchar *path = NULL;
	const gchar *identifier;
	GckObject  *collection = NULL;

	if (!dbus_message_get_args (message, NULL, DBUS_TYPE_STRING, &alias, DBUS_TYPE_INVALID))
		return NULL;

	identifier = gkd_secret_service_get_alias (self, alias);
	if (identifier)
		path = gkd_secret_util_build_path (SECRET_COLLECTION_PREFIX, identifier, -1);

	/* Make sure it actually exists */
	if (path)
		collection = gkd_secret_objects_lookup_collection (self->objects,
		                                                   dbus_message_get_sender (message), path);
	if (collection == NULL) {
		g_free (path);
		path = NULL;
	} else {
		g_object_unref (collection);
	}

	reply = dbus_message_new_method_return (message);
	if (path == NULL)
		path = g_strdup ("/");
	dbus_message_append_args (reply, DBUS_TYPE_OBJECT_PATH, &path, DBUS_TYPE_INVALID);
	g_free (path);

	return reply;
}
开发者ID:rbeasley,项目名称:gnome-keyring,代码行数:35,代码来源:gkd-secret-service.c


示例12: dbus_message_get_sender

static DBusMessage *cancel_authorization(DBusConnection *conn,
						DBusMessage *msg, void *data)
{
	DBusMessage *reply;
	struct service_adapter *serv_adapter = data;
	struct pending_auth *auth;
	const gchar *sender;

	sender = dbus_message_get_sender(msg);

	auth = find_pending_by_sender(serv_adapter, sender);
	if (auth == NULL)
		return btd_error_does_not_exist(msg);

	btd_cancel_authorization(auth->id);

	reply = btd_error_not_authorized(auth->msg);
	dbus_message_unref(auth->msg);
	g_dbus_send_message(btd_get_dbus_connection(), reply);

	serv_adapter->pending_list = g_slist_remove(serv_adapter->pending_list,
									auth);
	g_free(auth);

	auth = next_pending(serv_adapter);
	if (auth == NULL)
		goto done;

	auth->id = btd_request_authorization(get_address(serv_adapter),
							&auth->dst, auth->uuid,
							auth_cb, serv_adapter);

done:
	return dbus_message_new_method_return(msg);
}
开发者ID:intgr,项目名称:bluez,代码行数:35,代码来源:service.c


示例13: btd_error_invalid_args

static DBusMessage *add_service_record(DBusConnection *conn,
					DBusMessage *msg, void *data)
{
	struct service_adapter *serv_adapter = data;
	DBusMessage *reply;
	const char *sender, *record;
	dbus_uint32_t handle;
	int err;

	if (dbus_message_get_args(msg, NULL,
			DBUS_TYPE_STRING, &record, DBUS_TYPE_INVALID) == FALSE)
		return btd_error_invalid_args(msg);

	sender = dbus_message_get_sender(msg);
	err = add_xml_record(sender, serv_adapter, record, &handle);
	if (err < 0)
		return btd_error_failed(msg, strerror(-err));

	reply = dbus_message_new_method_return(msg);
	if (!reply)
		return NULL;

	dbus_message_append_args(reply, DBUS_TYPE_UINT32, &handle,
							DBUS_TYPE_INVALID);

	return reply;
}
开发者ID:intgr,项目名称:bluez,代码行数:27,代码来源:service.c


示例14: dbus_message_get_sender

static DBusMessage *register_watcher(DBusConnection *conn, DBusMessage *msg,
								void *data)
{
	struct heartrate_adapter *hradapter = data;
	struct watcher *watcher;
	const char *sender = dbus_message_get_sender(msg);
	char *path;

	if (!dbus_message_get_args(msg, NULL, DBUS_TYPE_OBJECT_PATH, &path,
							DBUS_TYPE_INVALID))
		return btd_error_invalid_args(msg);

	watcher = find_watcher(hradapter->watchers, sender, path);
	if (watcher != NULL)
		return btd_error_already_exists(msg);

	watcher = g_new0(struct watcher, 1);
	watcher->hradapter = hradapter;
	watcher->id = g_dbus_add_disconnect_watch(conn, sender, watcher_exit_cb,
						watcher, destroy_watcher);
	watcher->srv = g_strdup(sender);
	watcher->path = g_strdup(path);

	if (g_slist_length(hradapter->watchers) == 0)
		g_slist_foreach(hradapter->devices, enable_measurement, 0);

	hradapter->watchers = g_slist_prepend(hradapter->watchers, watcher);

	DBG("heartrate watcher [%s] registered", path);

	return dbus_message_new_method_return(msg);
}
开发者ID:LegacySlimXperia,项目名称:android_hardware_semc,代码行数:32,代码来源:heartrate.c


示例15: g_dbus_create_error

static DBusMessage *release_agent(DBusConnection *connection,
				DBusMessage *message, void *user_data)
{
	struct session_data *session = user_data;
	struct agent_data *agent = session->agent;
	const gchar *sender;
	gchar *path;

	if (dbus_message_get_args(message, NULL,
					DBUS_TYPE_OBJECT_PATH, &path,
					DBUS_TYPE_INVALID) == FALSE)
		return g_dbus_create_error(message,
				"org.openobex.Error.InvalidArguments",
				"Invalid arguments in method call");

	sender = dbus_message_get_sender(message);

	if (agent == NULL || g_str_equal(sender, agent->name) == FALSE ||
				g_str_equal(path, agent->path) == FALSE)
		return g_dbus_create_error(message,
				"org.openobex.Error.NotAuthorized",
				"Not Authorized");

	agent_free(session);

	return dbus_message_new_method_return(message);
}
开发者ID:Commers,项目名称:obexd,代码行数:27,代码来源:session.c


示例16: service_method_open_session

static DBusMessage*
service_method_open_session (GkdSecretService *self, DBusMessage *message)
{
	GkdSecretSession *session;
	ServiceClient *client;
	DBusMessage *reply = NULL;
	const gchar *caller;
	const gchar *path;

	if (!dbus_message_has_signature (message, "sv"))
		return NULL;

	caller = dbus_message_get_sender (message);

	/* Now we can create a session with this information */
	session = gkd_secret_session_new (self, caller);
	reply = gkd_secret_session_handle_open (session, message);

	if (dbus_message_get_type (reply) == DBUS_MESSAGE_TYPE_METHOD_RETURN) {
		/* Take ownership of the session */
		client = g_hash_table_lookup (self->clients, caller);
		g_return_val_if_fail (client, NULL);
		path = gkd_secret_dispatch_get_object_path (GKD_SECRET_DISPATCH (session));
		g_return_val_if_fail (!g_hash_table_lookup (client->sessions, path), NULL);
		g_hash_table_replace (client->sessions, (gpointer)path, session);

	} else {
		g_object_unref (session);
	}

	return reply;
}
开发者ID:brianjmurrell,项目名称:mate-keyring,代码行数:32,代码来源:gkd-secret-service.c


示例17: service_method_change_lock

static DBusMessage*
service_method_change_lock (GkdSecretService *self, DBusMessage *message)
{
	GkdSecretChange *change;
	ServiceClient *client;
	DBusMessage *reply;
	const char *caller;
	const gchar *path;
	GP11Object *collection;

	caller = dbus_message_get_sender (message);
	if (!dbus_message_get_args (message, NULL, DBUS_TYPE_OBJECT_PATH, &path, DBUS_TYPE_INVALID))
		return NULL;

	/* Make sure it exists */
	collection = gkd_secret_objects_lookup_collection (self->objects, caller, path);
	if (!collection)
		return dbus_message_new_error (message, SECRET_ERROR_NO_SUCH_OBJECT,
		                               "The collection does not exist");
	g_object_unref (collection);

	change = gkd_secret_change_new (self, caller, path);
	client = g_hash_table_lookup (self->clients, caller);
	g_return_val_if_fail (client, NULL);
	path = gkd_secret_dispatch_get_object_path (GKD_SECRET_DISPATCH (change));
	g_hash_table_replace (client->prompts, (gpointer)path, g_object_ref (change));

	reply = dbus_message_new_method_return (message);
	dbus_message_append_args (reply, DBUS_TYPE_OBJECT_PATH, &path, DBUS_TYPE_INVALID);

	g_object_unref (change);
	return reply;
}
开发者ID:brianjmurrell,项目名称:mate-keyring,代码行数:33,代码来源:gkd-secret-service.c


示例18: agent_already_exists

static DBusMessage *register_agent(DBusConnection *conn,
					DBusMessage *msg, void *data)
{
	const char *path, *sender;

	if (agent)
		return agent_already_exists(msg);

	if (!dbus_message_get_args(msg, NULL,
				DBUS_TYPE_OBJECT_PATH, &path,
				DBUS_TYPE_INVALID))
		return invalid_args(msg);

	sender = dbus_message_get_sender(msg);
	agent = g_new0(struct agent, 1);
	agent->bus_name = g_strdup(sender);
	agent->path = g_strdup(path);

	agent->watch_id = g_dbus_add_disconnect_watch(conn, sender,
					agent_disconnected, NULL, NULL);

	DBG("Agent registered");

	return dbus_message_new_method_return(msg);
}
开发者ID:Fiend90,项目名称:obex,代码行数:25,代码来源:manager.c


示例19: dbus_message_get_sender

static DBusMessage *register_agent(DBusConnection *conn,
					DBusMessage *msg, void *user_data)
{
	struct agent *agent;
	const char *sender, *path, *capability;
	uint8_t cap;

	sender = dbus_message_get_sender(msg);

	agent = g_hash_table_lookup(agent_list, sender);
	if (agent)
		return btd_error_already_exists(msg);

	if (dbus_message_get_args(msg, NULL, DBUS_TYPE_OBJECT_PATH, &path,
						DBUS_TYPE_STRING, &capability,
						DBUS_TYPE_INVALID) == FALSE)
		return btd_error_invalid_args(msg);

	cap = parse_io_capability(capability);
	if (cap == IO_CAPABILITY_INVALID)
		return btd_error_invalid_args(msg);

	agent = agent_create(sender, path, cap);
	if (!agent)
		return btd_error_invalid_args(msg);

	DBG("agent %s", agent->owner);

	g_hash_table_replace(agent_list, agent->owner, agent);

	return dbus_message_new_method_return(msg);
}
开发者ID:ghent360,项目名称:bluez,代码行数:32,代码来源:agent.c


示例20: remove_activity_callback_dbus_cb

/**
 * D-Bus callback for the remove activity callback method call
 *
 * @param msg The D-Bus message
 * @return TRUE on success, FALSE on failure
 */
static gboolean remove_activity_callback_dbus_cb(DBusMessage *const msg)
{
	dbus_bool_t no_reply = dbus_message_get_no_reply(msg);
	const gchar *sender = dbus_message_get_sender(msg);
	gboolean status = FALSE;

	if (sender == NULL) {
		mce_log(LL_ERR,
			"Received invalid remove activity callback request "
			"(sender == NULL)");
		goto EXIT;
	}

	mce_log(LL_DEVEL, "Received remove activity callback request from %s",
		mce_dbus_get_name_owner_ident(sender));

	status = TRUE;

	remove_activity_cb(sender);

EXIT:
	if (no_reply == FALSE) {
		DBusMessage *reply = dbus_new_method_reply(msg);

		status = dbus_send_message(reply);
	} else {
		status = TRUE;
	}

	return status;
}
开发者ID:g7,项目名称:mce,代码行数:37,代码来源:inactivity.c



注:本文中的dbus_message_get_sender函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ dbus_message_get_signature函数代码示例发布时间:2022-05-30
下一篇:
C++ dbus_message_get_path函数代码示例发布时间:2022-05-30
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap