diff --git a/daemon/dbus_iface_control.c b/daemon/dbus_iface_control.c index b6d23916..c2aa0658 100644 --- a/daemon/dbus_iface_control.c +++ b/daemon/dbus_iface_control.c @@ -35,7 +35,7 @@ #include "client_dependency.h" #include "appdb.h" -#define INTERFACE_NAME "org.nongnu.LASH.Control" +#define INTERFACE_NAME DBUS_NAME_BASE ".Control" static bool maybe_add_dict_entry_string(DBusMessageIter *dict_iter_ptr, diff --git a/daemon/dbus_iface_server.c b/daemon/dbus_iface_server.c index 41149895..4c0c9f82 100644 --- a/daemon/dbus_iface_server.c +++ b/daemon/dbus_iface_server.c @@ -516,7 +516,7 @@ SIGNALS_END * Interface description. */ -INTERFACE_BEGIN(g_lashd_interface_server, "org.nongnu.LASH.Server") +INTERFACE_BEGIN(g_lashd_interface_server, DBUS_NAME_BASE ".Server") INTERFACE_DEFAULT_HANDLER INTERFACE_EXPOSE_METHODS INTERFACE_EXPOSE_SIGNALS diff --git a/daemon/dbus_service.c b/daemon/dbus_service.c index 18efe655..9664762c 100644 --- a/daemon/dbus_service.c +++ b/daemon/dbus_service.c @@ -45,7 +45,7 @@ lashd_dbus_service_new(void) DBusError err; // TODO: move service name into public header - service = service_new("org.nongnu.LASH", &g_server->quit, + service = service_new(DBUS_NAME_BASE, &g_server->quit, 1, object_path_new("/", NULL, 2, &g_lashd_interface_server, diff --git a/daemon/project.c b/daemon/project.c index 725e66df..9f54ca5f 100644 --- a/daemon/project.c +++ b/daemon/project.c @@ -142,7 +142,7 @@ project_set_modified_status(project_t *project, project->modified_status = new_status; signal_new_valist(g_server->dbus_service, - "/", "org.nongnu.LASH.Control", + "/", DBUS_NAME_BASE ".Control", "ProjectModifiedStatusChanged", DBUS_TYPE_STRING, &project->name, DBUS_TYPE_BOOLEAN, &value, @@ -241,8 +241,8 @@ project_load_file(project_t *project, method_call_new_valist(g_server->dbus_service, NULL, method_default_handler, false, client->dbus_name, - "/org/nongnu/LASH/Client", - "org.nongnu.LASH.Client", + DBUS_BASE_PATH "/Client", + DBUS_NAME_BASE ".Client", "Load", DBUS_TYPE_UINT64, &client->pending_task, DBUS_TYPE_STRING, &client->data_path, @@ -277,8 +277,8 @@ project_load_data_set(project_t *project, NULL, method_default_handler, client->dbus_name, - "/org/nongnu/LASH/Client", - "org.nongnu.LASH.Client", + DBUS_BASE_PATH "/Client", + DBUS_NAME_BASE ".Client", "LoadDataSet")) { lash_error("Failed to initialise LoadDataSet method call"); return; @@ -482,7 +482,7 @@ project_save_clients(project_t *project) lash_debug("Signaling all clients of project '%s' to save (task %llu)", project->name, g_server->task_iter); signal_new_valist(g_server->dbus_service, - "/", "org.nongnu.LASH.Server", "Save", + "/", DBUS_NAME_BASE ".Server", "Save", DBUS_TYPE_STRING, &project->name, DBUS_TYPE_UINT64, &g_server->task_iter, DBUS_TYPE_INVALID); @@ -1061,7 +1061,7 @@ project_unload(project_t *project) project->name); signal_new_single(g_server->dbus_service, - "/", "org.nongnu.LASH.Server", "Quit", + "/", DBUS_NAME_BASE ".Server", "Quit", DBUS_TYPE_STRING, &project->name); list_for_each_safe (node, next, &project->clients) { diff --git a/dbus/error.h b/dbus/error.h index 0eacefcf..99d4c158 100644 --- a/dbus/error.h +++ b/dbus/error.h @@ -24,16 +24,16 @@ #include "types.h" -#define LASH_DBUS_ERROR_UNKNOWN_METHOD "org.nongnu.LASH.Error.UnknownMethod" -#define LASH_DBUS_ERROR_SERVER_NOT_RUNNING "org.nongnu.LASH.Error.ServerNotRunning" -#define LASH_DBUS_ERROR_INVALID_ARGS "org.nongnu.LASH.Error.InvalidArgs" -#define LASH_DBUS_ERROR_GENERIC "org.nongnu.LASH.Error.Generic" -#define LASH_DBUS_ERROR_FATAL "org.nongnu.LASH.Error.Fatal" -#define LASH_DBUS_ERROR_UNKNOWN_PROJECT "org.nongnu.LASH.Error.UnknownProject" -#define LASH_DBUS_ERROR_UNKNOWN_CLIENT "org.nongnu.LASH.Error.UnknownClient" -#define LASH_DBUS_ERROR_INVALID_CLIENT_ID "org.nongnu.LASH.Error.InvalidClientId" -#define LASH_DBUS_ERROR_UNFINISHED_TASK "org.nongnu.LASH.Error.UnfinishedTask" -#define LASH_DBUS_ERROR_INVALID_TASK "org.nongnu.LASH.Error.InvalidTask" +#define LASH_DBUS_ERROR_UNKNOWN_METHOD DBUS_NAME_BASE ".Error.UnknownMethod" +#define LASH_DBUS_ERROR_SERVER_NOT_RUNNING DBUS_NAME_BASE ".Error.ServerNotRunning" +#define LASH_DBUS_ERROR_INVALID_ARGS DBUS_NAME_BASE ".Error.InvalidArgs" +#define LASH_DBUS_ERROR_GENERIC DBUS_NAME_BASE ".Error.Generic" +#define LASH_DBUS_ERROR_FATAL DBUS_NAME_BASE ".Error.Fatal" +#define LASH_DBUS_ERROR_UNKNOWN_PROJECT DBUS_NAME_BASE ".Error.UnknownProject" +#define LASH_DBUS_ERROR_UNKNOWN_CLIENT DBUS_NAME_BASE ".Error.UnknownClient" +#define LASH_DBUS_ERROR_INVALID_CLIENT_ID DBUS_NAME_BASE ".Error.InvalidClientId" +#define LASH_DBUS_ERROR_UNFINISHED_TASK DBUS_NAME_BASE ".Error.UnfinishedTask" +#define LASH_DBUS_ERROR_INVALID_TASK DBUS_NAME_BASE ".Error.InvalidTask" void lash_dbus_error(method_call_t *call_ptr, diff --git a/lash_compat/liblash/dbus_iface_client.c b/lash_compat/liblash/dbus_iface_client.c index 9d0b67cd..ad64caec 100644 --- a/lash_compat/liblash/dbus_iface_client.c +++ b/lash_compat/liblash/dbus_iface_client.c @@ -107,9 +107,9 @@ lash_dbus_try_save(method_call_t *call) NULL, lash_dbus_try_save_handler, true, - "org.nongnu.LASH", + DBUS_NAME_BASE, "/", - "org.nongnu.LASH.Server", + DBUS_NAME_BASE ".Server", "WaitForSave"); retval = true; } else { @@ -136,9 +136,9 @@ report_success_or_failure(lash_client_t *client, /* Send a success or failure report */ method_call_new_valist(client->dbus_service, NULL, method_default_handler, false, - "org.nongnu.LASH", + DBUS_NAME_BASE, "/", - "org.nongnu.LASH.Server", + DBUS_NAME_BASE ".Server", "Progress", DBUS_TYPE_UINT64, &client->pending_task, DBUS_TYPE_BYTE, &x, @@ -319,9 +319,9 @@ lash_new_save_data_set_task(lash_client_t *client, if (!method_call_init(new_call, client->dbus_service, NULL, method_default_handler, - "org.nongnu.LASH", + DBUS_NAME_BASE, "/", - "org.nongnu.LASH.Server", + DBUS_NAME_BASE ".Server", "CommitDataSet")) { lash_error("Failed to initialise CommitDataSet method call"); goto fail; @@ -621,9 +621,9 @@ lash_dbus_try_path_change(method_call_t *call) client_ptr, lash_dbus_path_change_handler, true, - "org.nongnu.LASH", + DBUS_NAME_BASE, "/", - "org.nongnu.LASH.Server", + DBUS_NAME_BASE ".Server", "CommitPathChange"); retval = true; } else { @@ -714,7 +714,7 @@ METHODS_END * Interface description. */ -INTERFACE_BEGIN(g_liblash_interface_client, "org.nongnu.LASH.Client") +INTERFACE_BEGIN(g_liblash_interface_client, DBUS_NAME_BASE ".Client") INTERFACE_DEFAULT_HANDLER INTERFACE_EXPOSE_METHODS INTERFACE_END diff --git a/lash_compat/liblash/dbus_service.c b/lash_compat/liblash/dbus_service.c index 4579fc6a..12098bc1 100644 --- a/lash_compat/liblash/dbus_service.c +++ b/lash_compat/liblash/dbus_service.c @@ -43,7 +43,7 @@ lash_dbus_service_new(lash_client_t *client) return service_new(NULL, &client->quit, 1, - object_path_new("/org/nongnu/LASH/Client", + object_path_new(DBUS_BASE_PATH "/Client", (void *) client, 1, &g_liblash_interface_client, NULL), NULL); @@ -143,9 +143,9 @@ lash_dbus_service_connect(lash_client_t *client) if (!method_call_init(&call, client->dbus_service, (void *) client, lash_dbus_service_connect_handler, - "org.nongnu.LASH", + DBUS_NAME_BASE, "/", - "org.nongnu.LASH.Server", + DBUS_NAME_BASE ".Server", "Connect")) goto fail; diff --git a/lash_compat/liblash/event.c b/lash_compat/liblash/event.c index 6ba1c65b..14bc6c07 100644 --- a/lash_compat/liblash/event.c +++ b/lash_compat/liblash/event.c @@ -144,9 +144,9 @@ _lash_client_name(lash_client_t *client, method_call_new_void(client->dbus_service, &ctx, _lash_id_query_handler, false, - "org.nongnu.LASH", + DBUS_NAME_BASE, "/", - "org.nongnu.LASH.Server", + DBUS_NAME_BASE ".Server", "GetName"); } } @@ -162,9 +162,9 @@ _lash_jack_client_name(lash_client_t *client, method_call_new_void(client->dbus_service, &ctx, _lash_id_query_handler, false, - "org.nongnu.LASH", + DBUS_NAME_BASE, "/", - "org.nongnu.LASH.Server", + DBUS_NAME_BASE ".Server", "GetJackName"); } } @@ -177,9 +177,9 @@ _lash_task_done(lash_client_t *client, const uint8_t x = 255; method_call_new_valist(client->dbus_service, NULL, method_default_handler, false, - "org.nongnu.LASH", + DBUS_NAME_BASE, "/", - "org.nongnu.LASH.Server", + DBUS_NAME_BASE ".Server", "Progress", DBUS_TYPE_UINT64, &client->pending_task, DBUS_TYPE_BYTE, &x, @@ -229,9 +229,9 @@ _lash_save(lash_client_t *client, { method_call_new_void(client->dbus_service, NULL, method_default_handler, false, - "org.nongnu.LASH", + DBUS_NAME_BASE, "/", - "org.nongnu.LASH.Server", + DBUS_NAME_BASE ".Server", "SaveProject"); } @@ -244,9 +244,9 @@ _lash_quit(lash_client_t *client, { method_call_new_void(client->dbus_service, NULL, method_default_handler, false, - "org.nongnu.LASH", + DBUS_NAME_BASE, "/", - "org.nongnu.LASH.Server", + DBUS_NAME_BASE ".Server", "CloseProject"); } diff --git a/lash_compat/liblash/lash.c b/lash_compat/liblash/lash.c index d0c64d9a..206e2468 100644 --- a/lash_compat/liblash/lash.c +++ b/lash_compat/liblash/lash.c @@ -82,7 +82,7 @@ lash_client_new_with_service(void) } /* The client's signal handler function for signals - originating from org.nongnu.LASH.Server */ + originating from DBUS_NAME_BASE.Server */ static void lash_server_signal_handler(lash_client_t *client, const char *member, @@ -301,11 +301,11 @@ lash_dbus_signal_handler(DBusConnection *connection, return DBUS_HANDLER_RESULT_HANDLED; } - if (strcmp(interface, "org.nongnu.LASH.Server") == 0) { + if (strcmp(interface, DBUS_NAME_BASE ".Server") == 0) { lash_debug("Received Server signal '%s'", member); lash_server_signal_handler(client, member, message); - } else if (strcmp(interface, "org.nongnu.LASH.Control") == 0) { + } else if (strcmp(interface, DBUS_NAME_BASE ".Control") == 0) { lash_debug("Received Control signal '%s'", member); /* This arrangement is OK only so far as a normal client @@ -339,9 +339,9 @@ lash_client_register_as_controller(lash_client_t *client) /* Listen to the LASH server's frontend-facing beacon */ dbus_bus_add_match(client->dbus_service->connection, "type='signal'" - ",sender='org.nongnu.LASH'" + ",sender='" DBUS_NAME_BASE "'" ",path='/'" - ",interface='org.nongnu.LASH.Control'", + ",interface='" DBUS_NAME_BASE ".Control'", &err); if (dbus_error_is_set(&err)) { @@ -426,7 +426,7 @@ lash_client_open(const char *class, /* Check whether the server is active */ if (!dbus_bus_name_has_owner(client->dbus_service->connection, // TODO: Move service name into public header - "org.nongnu.LASH", &err)) { + DBUS_NAME_BASE, &err)) { if (dbus_error_is_set(&err)) { lash_error("Failed to query LASH service " "availability: %s", err.message); @@ -453,17 +453,17 @@ lash_client_open(const char *class, /* Listen to the LASH server's client-facing beacon */ dbus_bus_add_match(client->dbus_service->connection, "type='signal'" - ",sender='org.nongnu.LASH'" + ",sender='" DBUS_NAME_BASE "'" ",path='/'" - ",interface='org.nongnu.LASH.Server'", + ",interface='" DBUS_NAME_BASE ".Server'", &err); if (!dbus_error_is_set(&err)) { dbus_bus_add_match(client->dbus_service->connection, "type='signal'" - ",sender='org.nongnu.LASH'" + ",sender='" DBUS_NAME_BASE "'" ",path='/'" - ",interface='org.nongnu.LASH.Control'" + ",interface='" DBUS_NAME_BASE ".Control'" ",member='ProjectNameChanged'", &err); } @@ -725,9 +725,9 @@ lash_notify_progress(lash_client_t *client, method_call_new_valist(client->dbus_service, NULL, method_default_handler, false, - "org.nongnu.LASH", + DBUS_NAME_BASE, "/", - "org.nongnu.LASH.Server", + DBUS_NAME_BASE ".Server", "Progress", DBUS_TYPE_UINT64, &client->pending_task, DBUS_TYPE_BYTE, &percentage, @@ -771,9 +771,9 @@ lash_jack_client_name(lash_client_t *client, method_call_new_single(client->dbus_service, NULL, method_default_handler, false, - "org.nongnu.LASH", + DBUS_NAME_BASE, "/", - "org.nongnu.LASH.Server", + DBUS_NAME_BASE ".Server", "JackName", DBUS_TYPE_STRING, &name); @@ -805,9 +805,9 @@ lash_control_load_project_path(lash_client_t *client, method_call_new_single(client->dbus_service, NULL, method_default_handler, false, - "org.nongnu.LASH", + DBUS_NAME_BASE, "/", - "org.nongnu.LASH.Control", + DBUS_NAME_BASE ".Control", "LoadProjectPath", DBUS_TYPE_STRING, &project_path); @@ -832,9 +832,9 @@ lash_control_name_project(lash_client_t *client, method_call_new_valist(client->dbus_service, NULL, method_default_handler, false, - "org.nongnu.LASH", + DBUS_NAME_BASE, "/", - "org.nongnu.LASH.Control", + DBUS_NAME_BASE ".Control", "ProjectRename", DBUS_TYPE_STRING, &project_name, DBUS_TYPE_STRING, &new_name, @@ -861,9 +861,9 @@ lash_control_move_project(lash_client_t *client, method_call_new_valist(client->dbus_service, NULL, method_default_handler, false, - "org.nongnu.LASH", + DBUS_NAME_BASE, "/", - "org.nongnu.LASH.Control", + DBUS_NAME_BASE ".Control", "ProjectMove", DBUS_TYPE_STRING, &project_name, DBUS_TYPE_STRING, &new_path, @@ -889,9 +889,9 @@ lash_control_save_project(lash_client_t *client, method_call_new_single(client->dbus_service, NULL, method_default_handler, false, - "org.nongnu.LASH", + DBUS_NAME_BASE, "/", - "org.nongnu.LASH.Control", + DBUS_NAME_BASE ".Control", "ProjectSave", DBUS_TYPE_STRING, &project_name); @@ -915,9 +915,9 @@ lash_control_close_project(lash_client_t *client, method_call_new_single(client->dbus_service, NULL, method_default_handler, false, - "org.nongnu.LASH", + DBUS_NAME_BASE, "/", - "org.nongnu.LASH.Control", + DBUS_NAME_BASE ".Control", "ProjectClose", DBUS_TYPE_STRING, &project_name); diff --git a/wscript b/wscript index ac5424a2..909f5d25 100644 --- a/wscript +++ b/wscript @@ -67,6 +67,8 @@ def configure(conf): conf.define('DEFAULT_PROJECT_DIR', "audio-projects") conf.define('PACKAGE_VERSION', VERSION) + conf.define('DBUS_NAME_BASE', DBUS_NAME_BASE) + conf.define('DBUS_BASE_PATH', '/' + DBUS_NAME_BASE.replace('.', '/')) conf.write_config_header('config.h') display_msg(conf)