dbus/bus/services.h
Colin Walters cdac3e058b 2004-11-07 Colin Walters <walters@verbum.org>
* bus/bus.c (load_config): Break into three
	separate functions: process_config_first_time_only,
	process_config_every_time, and process_config_postinit.
	(process_config_every_time): Move call of
	bus_registry_set_service_context_table into
	process_config_postinit.
	(process_config_postinit): New function, does
	any processing that needs to happen late
	in initialization (and also on reload).
	(bus_context_new): Instead of calling load_config,
	open config parser here and call process_config_first_time_only
	and process_config_every_time directly.  Later, after
	we have forked but before changing UID,
	invoke bus_selinux_full_init, and then call
	process_config_postinit.
	(bus_context_reload_config): As in bus_context_new,
	load parse file inside here, and call process_config_every_time
	and process_config_postinit.

	* bus/services.h, bus/services.c
	(bus_registry_set_service_context_table): Rename
	from bus_registry_set_sid_table.  Take string hash from config
	parser, and convert them here into SIDs.

	* bus/config-parser.c (struct BusConfigParser): Have
	config parser only store a mapping of service->context
	string.
	(merge_service_context_hash): New function.
	(merge_included): Merge context string hashes instead
	of using bus_selinux_id_table_union.
	(bus_config_parser_new): Don't use bus_selinux_id_table_new;
	simply create a new string hash.
	(bus_config_parser_unref): Unref it.
	(start_selinux_child): Simply insert strings into hash,
	don't call bus_selinux_id_table_copy_over.

	* bus/selinux.h, bus/selinux.c (bus_selinux_id_table_union)
	(bus_selinux_id_table_copy_over): Delete.
2004-11-07 17:05:19 +00:00

81 lines
4.5 KiB
C

/* -*- mode: C; c-file-style: "gnu" -*- */
/* services.h Service management
*
* Copyright (C) 2003 Red Hat, Inc.
*
* Licensed under the Academic Free License version 2.1
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
*/
#ifndef BUS_SERVICES_H
#define BUS_SERVICES_H
#include <dbus/dbus.h>
#include <dbus/dbus-string.h>
#include <dbus/dbus-hash.h>
#include "connection.h"
#include "bus.h"
typedef void (* BusServiceForeachFunction) (BusService *service,
void *data);
BusRegistry* bus_registry_new (BusContext *context);
BusRegistry* bus_registry_ref (BusRegistry *registry);
void bus_registry_unref (BusRegistry *registry);
BusService* bus_registry_lookup (BusRegistry *registry,
const DBusString *service_name);
BusService* bus_registry_ensure (BusRegistry *registry,
const DBusString *service_name,
DBusConnection *owner_if_created,
BusTransaction *transaction,
DBusError *error);
void bus_registry_foreach (BusRegistry *registry,
BusServiceForeachFunction function,
void *data);
dbus_bool_t bus_registry_list_services (BusRegistry *registry,
char ***listp,
int *array_len);
dbus_bool_t bus_registry_acquire_service (BusRegistry *registry,
DBusConnection *connection,
const DBusString *service_name,
dbus_uint32_t flags,
dbus_uint32_t *result,
BusTransaction *transaction,
DBusError *error);
dbus_bool_t bus_registry_set_service_context_table (BusRegistry *registry,
DBusHashTable *table);
BusService* bus_service_ref (BusService *service);
void bus_service_unref (BusService *service);
dbus_bool_t bus_service_add_owner (BusService *service,
DBusConnection *owner,
BusTransaction *transaction,
DBusError *error);
dbus_bool_t bus_service_remove_owner (BusService *service,
DBusConnection *owner,
BusTransaction *transaction,
DBusError *error);
dbus_bool_t bus_service_has_owner (BusService *service,
DBusConnection *owner);
DBusConnection* bus_service_get_primary_owner (BusService *service);
void bus_service_set_prohibit_replacement (BusService *service,
dbus_bool_t prohibit_replacement);
dbus_bool_t bus_service_get_prohibit_replacement (BusService *service);
const char* bus_service_get_name (BusService *service);
#endif /* BUS_SERVICES_H */