[daemon-fix] Fixed sending daemon match rules for kdbus broadcasts
[platform/upstream/dbus.git] / dbus / dbus-auth.h
1 /* -*- mode: C; c-file-style: "gnu"; indent-tabs-mode: nil; -*- */
2 /* dbus-auth.h Authentication
3  *
4  * Copyright (C) 2002  Red Hat Inc.
5  * Copyright (C) 2013  Samsung Electronics
6  *
7  * Licensed under the Academic Free License version 2.1
8  * 
9  * This program is free software; you can redistribute it and/or modify
10  * it under the terms of the GNU General Public License as published by
11  * the Free Software Foundation; either version 2 of the License, or
12  * (at your option) any later version.
13  *
14  * This program is distributed in the hope that it will be useful,
15  * but WITHOUT ANY WARRANTY; without even the implied warranty of
16  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
17  * GNU General Public License for more details.
18  * 
19  * You should have received a copy of the GNU General Public License
20  * along with this program; if not, write to the Free Software
21  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
22  *
23  */
24 #ifndef DBUS_AUTH_H
25 #define DBUS_AUTH_H
26
27 #include <dbus/dbus-macros.h>
28 #include <dbus/dbus-errors.h>
29 #include <dbus/dbus-string.h>
30 #include <dbus/dbus-sysdeps.h>
31
32 DBUS_BEGIN_DECLS
33
34 typedef struct DBusAuth DBusAuth;
35
36 typedef enum
37 {
38   DBUS_AUTH_STATE_WAITING_FOR_INPUT,
39   DBUS_AUTH_STATE_WAITING_FOR_MEMORY,
40   DBUS_AUTH_STATE_HAVE_BYTES_TO_SEND,
41   DBUS_AUTH_STATE_NEED_DISCONNECT,
42   DBUS_AUTH_STATE_AUTHENTICATED
43 } DBusAuthState;
44
45 DBusAuth*     _dbus_auth_server_new          (const DBusString       *guid);
46 DBusAuth*     _dbus_auth_client_new          (void);
47 #ifdef ENABLE_KDBUS_TRANSPORT
48 DBusAuth*         _dbus_auth_client_new_kdbus    (void);
49 #endif
50 DBusAuth*     _dbus_auth_ref                 (DBusAuth               *auth);
51 void          _dbus_auth_unref               (DBusAuth               *auth);
52 dbus_bool_t   _dbus_auth_set_mechanisms      (DBusAuth               *auth,
53                                               const char            **mechanisms);
54 DBusAuthState _dbus_auth_do_work             (DBusAuth               *auth);
55 dbus_bool_t   _dbus_auth_get_bytes_to_send   (DBusAuth               *auth,
56                                               const DBusString      **str);
57 void          _dbus_auth_bytes_sent          (DBusAuth               *auth,
58                                               int                     bytes_sent);
59 void          _dbus_auth_get_buffer          (DBusAuth               *auth,
60                                               DBusString            **buffer);
61 void          _dbus_auth_return_buffer       (DBusAuth               *auth,
62                                               DBusString             *buffer,
63                                               int                     bytes_read);
64 void          _dbus_auth_get_unused_bytes    (DBusAuth               *auth,
65                                               const DBusString      **str);
66 void          _dbus_auth_delete_unused_bytes (DBusAuth               *auth);
67 dbus_bool_t   _dbus_auth_needs_encoding      (DBusAuth               *auth);
68 dbus_bool_t   _dbus_auth_encode_data         (DBusAuth               *auth,
69                                               const DBusString       *plaintext,
70                                               DBusString             *encoded);
71 dbus_bool_t   _dbus_auth_needs_decoding      (DBusAuth               *auth);
72 dbus_bool_t   _dbus_auth_decode_data         (DBusAuth               *auth,
73                                               const DBusString       *encoded,
74                                               DBusString             *plaintext);
75 dbus_bool_t   _dbus_auth_set_credentials     (DBusAuth               *auth,
76                                               DBusCredentials        *credentials);
77 DBusCredentials* _dbus_auth_get_identity     (DBusAuth               *auth);
78 dbus_bool_t   _dbus_auth_set_context         (DBusAuth               *auth,
79                                               const DBusString       *context);
80 const char*   _dbus_auth_get_guid_from_server(DBusAuth               *auth);
81
82 void          _dbus_auth_set_unix_fd_possible(DBusAuth               *auth, dbus_bool_t b);
83 dbus_bool_t   _dbus_auth_get_unix_fd_negotiated(DBusAuth             *auth);
84
85 DBUS_END_DECLS
86
87 #endif /* DBUS_AUTH_H */