From ee1133de4dc5e181be5d09f084d8823388d5f693 Mon Sep 17 00:00:00 2001 From: Anders Carlsson Date: Mon, 27 Jan 2003 11:20:55 +0000 Subject: 2003-01-27 Anders Carlsson * bus/dispatch.c: (bus_dispatch_message_handler): Dispatch messages sent to services. * bus/driver.c: (bus_driver_send_service_deleted), (bus_driver_send_service_created), (bus_driver_send_service_lost), (bus_driver_send_service_acquired): Add helper functions for sending service related messages. (bus_driver_send_welcome_message): Send HELLO_REPLY instead of WELCOME. (bus_driver_handle_list_services): Send LIST_SERVICES_REPLY instead of SERVICES. (bus_driver_handle_own_service), (bus_driver_handle_service_exists): New message handlers. (bus_driver_handle_message): Invoke new message handlers. (bus_driver_remove_connection): Don't remove any services here since that's done automatically by bus_service_remove_owner now. * bus/driver.h: New function signatures. * bus/services.c: (bus_service_add_owner): Send ServiceAcquired message if we're the only primary owner. (bus_service_remove_owner): Send ServiceAcquired/ServiceLost messages. (bus_service_set_prohibit_replacement), (bus_service_get_prohibit_replacement): Functions for setting prohibit replacement. (bus_service_has_owner): New function that checks if a connection is in the owner queue of a certain service. * bus/services.h: Add new function signatures. * dbus/dbus-list.c: (_dbus_list_test): Add tests for _dbus_list_remove_last and traversing the list backwards. * dbus/dbus-list.h: Fix a typo in _dbus_list_get_prev_link, if we're at the first element we can't go any further, so return NULL then. * dbus/dbus-protocol.h: Add new messages, service flags and service replies. --- dbus/dbus-protocol.h | 31 ++++++++++++++++++++++++------- 1 file changed, 24 insertions(+), 7 deletions(-) (limited to 'dbus/dbus-protocol.h') diff --git a/dbus/dbus-protocol.h b/dbus/dbus-protocol.h index fe397f41..774ccf2c 100644 --- a/dbus/dbus-protocol.h +++ b/dbus/dbus-protocol.h @@ -1,7 +1,7 @@ /* -*- mode: C; c-file-style: "gnu" -*- */ /* dbus-protocol.h D-Bus protocol constants * - * Copyright (C) 2002 CodeFactory AB + * Copyright (C) 2002, 2003 CodeFactory AB * * Licensed under the Academic Free License version 1.2 * @@ -59,14 +59,31 @@ extern "C" { /* Services */ #define DBUS_SERVICE_DBUS "org.freedesktop.DBus" #define DBUS_SERVICE_BROADCAST "org.freedesktop.DBus.Broadcast" + +/* Service owner flags */ +#define DBUS_SERVICE_FLAG_PROHIBIT_REPLACEMENT 0x1 +#define DBUS_SERVICE_FLAG_REPLACE_EXISTING 0x2 + +/* Service replies */ +#define DBUS_SERVICE_REPLY_PRIMARY_OWNER 0x1 +#define DBUS_SERVICE_REPLY_IN_QUEUE 0x2 +#define DBUS_SERVICE_REPLY_SERVICE_EXISTS 0x3 +#define DBUS_SERVICE_REPLY_ALREADY_OWNER 0x4 /* Messages */ -#define DBUS_MESSAGE_HELLO "org.freedesktop.DBus.Hello" -#define DBUS_MESSAGE_LIST_SERVICES "org.freedesktop.DBus.ListServices" -#define DBUS_MESSAGE_SERVICE_CREATED "org.freedesktop.DBus.ServiceCreated" -#define DBUS_MESSAGE_SERVICE_DELETED "org.freedesktop.DBus.ServiceDeleted" -#define DBUS_MESSAGE_SERVICES "org.freedesktop.DBus.Services" -#define DBUS_MESSAGE_WELCOME "org.freedesktop.DBus.Welcome" +#define DBUS_MESSAGE_SERVICE_EXISTS "org.freedesktop.DBus.ServiceExists" +#define DBUS_MESSAGE_SERVICE_EXISTS_REPLY "org.freedesktop.DBus.ServiceExists:Reply" +#define DBUS_MESSAGE_HELLO "org.freedesktop.DBus.Hello" +#define DBUS_MESSAGE_HELLO_REPLY "org.freedesktop.DBus.Hello:Reply" +#define DBUS_MESSAGE_LIST_SERVICES "org.freedesktop.DBus.ListServices" +#define DBUS_MESSAGE_LIST_SERVICES_REPLY "org.freedesktop.DBus.ListServices:Reply" +#define DBUS_MESSAGE_ACQUIRE_SERVICE "org.freedesktop.DBus.OwnService" +#define DBUS_MESSAGE_ACQUIRE_SERVICE_REPLY "org.freedesktop.DBus.OwnService:Reply" +#define DBUS_MESSAGE_SERVICE_ACQUIRED "org.freedesktop.DBus.ServiceAcquired" +#define DBUS_MESSAGE_SERVICE_CREATED "org.freedesktop.DBus.ServiceCreated" +#define DBUS_MESSAGE_SERVICE_DELETED "org.freedesktop.DBus.ServiceDeleted" +#define DBUS_MESSAGE_SERVICE_LOST "org.freedesktop.DBus.ServiceLost" + #ifdef __cplusplus } -- cgit