2002-12-25 Havoc Pennington <hp@pobox.com>
[platform/upstream/dbus.git] / dbus / dbus-auth.h
1 /* -*- mode: C; c-file-style: "gnu" -*- */
2 /* dbus-auth.h Authentication
3  *
4  * Copyright (C) 2002  Red Hat Inc.
5  *
6  * Licensed under the Academic Free License version 1.2
7  * 
8  * This program is free software; you can redistribute it and/or modify
9  * it under the terms of the GNU General Public License as published by
10  * the Free Software Foundation; either version 2 of the License, or
11  * (at your option) any later version.
12  *
13  * This program is distributed in the hope that it will be useful,
14  * but WITHOUT ANY WARRANTY; without even the implied warranty of
15  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
16  * GNU General Public License for more details.
17  * 
18  * You should have received a copy of the GNU General Public License
19  * along with this program; if not, write to the Free Software
20  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
21  *
22  */
23 #ifndef DBUS_AUTH_H
24 #define DBUS_AUTH_H
25
26 #include <dbus/dbus-macros.h>
27 #include <dbus/dbus-errors.h>
28 #include <dbus/dbus-string.h>
29
30 DBUS_BEGIN_DECLS;
31
32 typedef struct DBusAuth DBusAuth;
33
34 typedef enum
35 {
36   DBUS_AUTH_STATE_WAITING_FOR_INPUT,
37   DBUS_AUTH_STATE_WAITING_FOR_MEMORY,
38   DBUS_AUTH_STATE_HAVE_BYTES_TO_SEND,
39   DBUS_AUTH_STATE_NEED_DISCONNECT,
40   DBUS_AUTH_STATE_AUTHENTICATED
41 } DBusAuthState;
42
43 DBusAuth*     _dbus_auth_server_new        (void);
44 DBusAuth*     _dbus_auth_client_new        (void);
45 void          _dbus_auth_ref               (DBusAuth         *auth);
46 void          _dbus_auth_unref             (DBusAuth         *auth);
47 DBusAuthState _dbus_auth_do_work           (DBusAuth         *auth);
48 dbus_bool_t   _dbus_auth_get_bytes_to_send (DBusAuth         *auth,
49                                             DBusString       *str);
50 dbus_bool_t   _dbus_auth_bytes_received    (DBusAuth         *auth,
51                                             const DBusString *str);
52 dbus_bool_t   _dbus_auth_get_unused_bytes  (DBusAuth         *auth,
53                                             DBusString       *str);
54 dbus_bool_t   _dbus_auth_needs_encoding    (DBusAuth         *auth);
55 dbus_bool_t   _dbus_auth_encode_data       (DBusAuth         *auth,
56                                             const DBusString *plaintext,
57                                             DBusString       *encoded);
58 dbus_bool_t   _dbus_auth_needs_decoding    (DBusAuth         *auth);
59 dbus_bool_t   _dbus_auth_decode_data       (DBusAuth         *auth,
60                                             const DBusString *encoded,
61                                             DBusString       *plaintext);
62
63
64 DBUS_END_DECLS;
65
66 #endif /* DBUS_AUTH_H */