Path: blob/master/thirdparty/linuxbsd_headers/dbus/dbus-server.h
9898 views
/* -*- mode: C; c-file-style: "gnu"; indent-tabs-mode: nil; -*- */1/* dbus-server.h DBusServer object2*3* Copyright (C) 2002, 2003 Red Hat Inc.4*5* Licensed under the Academic Free License version 2.16*7* This program is free software; you can redistribute it and/or modify8* it under the terms of the GNU General Public License as published by9* the Free Software Foundation; either version 2 of the License, or10* (at your option) any later version.11*12* This program is distributed in the hope that it will be useful,13* but WITHOUT ANY WARRANTY; without even the implied warranty of14* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the15* GNU General Public License for more details.16*17* You should have received a copy of the GNU General Public License18* along with this program; if not, write to the Free Software19* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA20*21*/22#if !defined (DBUS_INSIDE_DBUS_H) && !defined (DBUS_COMPILATION)23#error "Only <dbus/dbus.h> can be included directly, this file may disappear or change contents."24#endif2526#ifndef DBUS_SERVER_H27#define DBUS_SERVER_H2829#include <dbus/dbus-errors.h>30#include <dbus/dbus-macros.h>31#include <dbus/dbus-message.h>32#include <dbus/dbus-connection.h>33#include <dbus/dbus-protocol.h>3435DBUS_BEGIN_DECLS3637/**38* @addtogroup DBusServer39* @{40*/4142typedef struct DBusServer DBusServer;4344/** Called when a new connection to the server is available. Must reference and save the new45* connection, or close the new connection. Set with dbus_server_set_new_connection_function().46*/47typedef void (* DBusNewConnectionFunction) (DBusServer *server,48DBusConnection *new_connection,49void *data);5051DBUS_EXPORT52DBusServer* dbus_server_listen (const char *address,53DBusError *error);54DBUS_EXPORT55DBusServer* dbus_server_ref (DBusServer *server);56DBUS_EXPORT57void dbus_server_unref (DBusServer *server);58DBUS_EXPORT59void dbus_server_disconnect (DBusServer *server);60DBUS_EXPORT61dbus_bool_t dbus_server_get_is_connected (DBusServer *server);62DBUS_EXPORT63char* dbus_server_get_address (DBusServer *server);64DBUS_EXPORT65char* dbus_server_get_id (DBusServer *server);66DBUS_EXPORT67void dbus_server_set_new_connection_function (DBusServer *server,68DBusNewConnectionFunction function,69void *data,70DBusFreeFunction free_data_function);71DBUS_EXPORT72dbus_bool_t dbus_server_set_watch_functions (DBusServer *server,73DBusAddWatchFunction add_function,74DBusRemoveWatchFunction remove_function,75DBusWatchToggledFunction toggled_function,76void *data,77DBusFreeFunction free_data_function);78DBUS_EXPORT79dbus_bool_t dbus_server_set_timeout_functions (DBusServer *server,80DBusAddTimeoutFunction add_function,81DBusRemoveTimeoutFunction remove_function,82DBusTimeoutToggledFunction toggled_function,83void *data,84DBusFreeFunction free_data_function);85DBUS_EXPORT86dbus_bool_t dbus_server_set_auth_mechanisms (DBusServer *server,87const char **mechanisms);8889DBUS_EXPORT90dbus_bool_t dbus_server_allocate_data_slot (dbus_int32_t *slot_p);91DBUS_EXPORT92void dbus_server_free_data_slot (dbus_int32_t *slot_p);93DBUS_EXPORT94dbus_bool_t dbus_server_set_data (DBusServer *server,95int slot,96void *data,97DBusFreeFunction free_data_func);98DBUS_EXPORT99void* dbus_server_get_data (DBusServer *server,100int slot);101102/**103* Clear a variable or struct member that contains a #DBusServer.104* If it does not contain #NULL, the server that was previously105* there is unreferenced with dbus_server_unref().106*107* This is very similar to dbus_clear_connection(): see that function108* for more details.109*110* @param pointer_to_server A pointer to a variable or struct member.111* pointer_to_server must not be #NULL, but *pointer_to_server112* may be #NULL.113*/114static inline void115dbus_clear_server (DBusServer **pointer_to_server)116{117_dbus_clear_pointer_impl (DBusServer, pointer_to_server, dbus_server_unref);118}119120/** @} */121122DBUS_END_DECLS123124#endif /* DBUS_SERVER_H */125126127