D-Bus 1.10.18

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 *
6 * Licensed under the Academic Free License version 2.1
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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 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 #include <dbus/dbus-sysdeps.h>
30
31 DBUS_BEGIN_DECLS
32
33 typedef struct DBusAuth DBusAuth;
34
35 typedef enum
36 {
37 DBUS_AUTH_STATE_WAITING_FOR_INPUT,
38 DBUS_AUTH_STATE_WAITING_FOR_MEMORY,
39 DBUS_AUTH_STATE_HAVE_BYTES_TO_SEND,
40 DBUS_AUTH_STATE_NEED_DISCONNECT,
41 DBUS_AUTH_STATE_AUTHENTICATED
42 } DBusAuthState;
43
44 DBUS_PRIVATE_EXPORT
45 DBusAuth* _dbus_auth_server_new (const DBusString *guid);
46 DBUS_PRIVATE_EXPORT
47 DBusAuth* _dbus_auth_client_new (void);
48 DBUS_PRIVATE_EXPORT
49 DBusAuth* _dbus_auth_ref (DBusAuth *auth);
50 DBUS_PRIVATE_EXPORT
51 void _dbus_auth_unref (DBusAuth *auth);
52 DBUS_PRIVATE_EXPORT
53 dbus_bool_t _dbus_auth_set_mechanisms (DBusAuth *auth,
54 const char **mechanisms);
55 DBUS_PRIVATE_EXPORT
56 DBusAuthState _dbus_auth_do_work (DBusAuth *auth);
57 DBUS_PRIVATE_EXPORT
58 dbus_bool_t _dbus_auth_get_bytes_to_send (DBusAuth *auth,
59 const DBusString **str);
60 DBUS_PRIVATE_EXPORT
61 void _dbus_auth_bytes_sent (DBusAuth *auth,
62 int bytes_sent);
63 DBUS_PRIVATE_EXPORT
64 void _dbus_auth_get_buffer (DBusAuth *auth,
65 DBusString **buffer);
66 DBUS_PRIVATE_EXPORT
67 void _dbus_auth_return_buffer (DBusAuth *auth,
68 DBusString *buffer);
69 DBUS_PRIVATE_EXPORT
70 void _dbus_auth_get_unused_bytes (DBusAuth *auth,
71 const DBusString **str);
72 DBUS_PRIVATE_EXPORT
73 void _dbus_auth_delete_unused_bytes (DBusAuth *auth);
74 dbus_bool_t _dbus_auth_needs_encoding (DBusAuth *auth);
75 dbus_bool_t _dbus_auth_encode_data (DBusAuth *auth,
76 const DBusString *plaintext,
77 DBusString *encoded);
78 dbus_bool_t _dbus_auth_needs_decoding (DBusAuth *auth);
79 dbus_bool_t _dbus_auth_decode_data (DBusAuth *auth,
80 const DBusString *encoded,
81 DBusString *plaintext);
82 DBUS_PRIVATE_EXPORT
83 dbus_bool_t _dbus_auth_set_credentials (DBusAuth *auth,
84 DBusCredentials *credentials);
85 DBUS_PRIVATE_EXPORT
86 DBusCredentials* _dbus_auth_get_identity (DBusAuth *auth);
87 DBUS_PRIVATE_EXPORT
88 dbus_bool_t _dbus_auth_set_context (DBusAuth *auth,
89 const DBusString *context);
90 const char* _dbus_auth_get_guid_from_server(DBusAuth *auth);
91
92 void _dbus_auth_set_unix_fd_possible(DBusAuth *auth, dbus_bool_t b);
93 dbus_bool_t _dbus_auth_get_unix_fd_negotiated(DBusAuth *auth);
94
95 DBUS_END_DECLS
96
97 #endif /* DBUS_AUTH_H */
_dbus_auth_delete_unused_bytes
DBUS_PRIVATE_EXPORT void _dbus_auth_delete_unused_bytes(DBusAuth *auth)
Gets rid of unused bytes returned by _dbus_auth_get_unused_bytes() after we&#39;ve gotten them and succes...
Definition: dbus-auth.c:2608
DBusCredentials
Definition: dbus-credentials.c:48
_dbus_auth_get_unused_bytes
DBUS_PRIVATE_EXPORT void _dbus_auth_get_unused_bytes(DBusAuth *auth, const DBusString **str)
Returns leftover bytes that were not used as part of the auth conversation.
Definition: dbus-auth.c:2591
DBUS_BEGIN_DECLS
#define DBUS_BEGIN_DECLS
Macro used prior to declaring functions in the D-Bus header files.
_dbus_auth_needs_decoding
dbus_bool_t _dbus_auth_needs_decoding(DBusAuth *auth)
Called post-authentication, indicates whether we need to decode the message stream with _dbus_auth_de...
Definition: dbus-auth.c:2684
_dbus_auth_encode_data
dbus_bool_t _dbus_auth_encode_data(DBusAuth *auth, const DBusString *plaintext, DBusString *encoded)
Called post-authentication, encodes a block of bytes for sending to the peer.
Definition: dbus-auth.c:2652
_dbus_auth_set_context
DBUS_PRIVATE_EXPORT dbus_bool_t _dbus_auth_set_context(DBusAuth *auth, const DBusString *context)
Sets the "authentication context" which scopes cookies with the DBUS_COOKIE_SHA1 auth mechanism for e...
Definition: dbus-auth.c:2808
_dbus_auth_return_buffer
DBUS_PRIVATE_EXPORT void _dbus_auth_return_buffer(DBusAuth *auth, DBusString *buffer)
Returns a buffer with new data read into it.
Definition: dbus-auth.c:2572
_dbus_auth_do_work
DBUS_PRIVATE_EXPORT DBusAuthState _dbus_auth_do_work(DBusAuth *auth)
Analyzes buffered input and moves the auth conversation forward, returning the new state of the auth ...
Definition: dbus-auth.c:2465
_dbus_auth_set_mechanisms
DBUS_PRIVATE_EXPORT dbus_bool_t _dbus_auth_set_mechanisms(DBusAuth *auth, const char **mechanisms)
Sets an array of authentication mechanism names that we are willing to use.
Definition: dbus-auth.c:2430
DBusAuth::context
DBusString context
Cookie scope.
Definition: dbus-auth.c:176
_dbus_auth_get_unix_fd_negotiated
dbus_bool_t _dbus_auth_get_unix_fd_negotiated(DBusAuth *auth)
Queries whether unix fd passing was successfully negotiated.
Definition: dbus-auth.c:2835
_dbus_auth_get_identity
DBUS_PRIVATE_EXPORT DBusCredentials * _dbus_auth_get_identity(DBusAuth *auth)
Gets the identity we authorized the client as.
Definition: dbus-auth.c:2765
_dbus_auth_get_buffer
DBUS_PRIVATE_EXPORT void _dbus_auth_get_buffer(DBusAuth *auth, DBusString **buffer)
Get a buffer to be used for reading bytes from the peer we&#39;re conversing with.
Definition: dbus-auth.c:2554
_dbus_auth_decode_data
dbus_bool_t _dbus_auth_decode_data(DBusAuth *auth, const DBusString *encoded, DBusString *plaintext)
Called post-authentication, decodes a block of bytes received from the peer.
Definition: dbus-auth.c:2715
_dbus_auth_bytes_sent
DBUS_PRIVATE_EXPORT void _dbus_auth_bytes_sent(DBusAuth *auth, int bytes_sent)
Notifies the auth conversation object that the given number of bytes of the outgoing buffer have been...
Definition: dbus-auth.c:2534
DBusString
Definition: dbus-string.h:42
DBusAuth
Internal members of DBusAuth.
Definition: dbus-auth.c:153
dbus_bool_t
dbus_uint32_t dbus_bool_t
A boolean, valid values are TRUE and FALSE.
Definition: dbus-types.h:35
_dbus_auth_server_new
DBUS_PRIVATE_EXPORT DBusAuth * _dbus_auth_server_new(const DBusString *guid)
Creates a new auth conversation object for the server side.
Definition: dbus-auth.c:2281
_dbus_auth_ref
DBUS_PRIVATE_EXPORT DBusAuth * _dbus_auth_ref(DBusAuth *auth)
Increments the refcount of an auth object.
Definition: dbus-auth.c:2365
_dbus_auth_get_guid_from_server
const char * _dbus_auth_get_guid_from_server(DBusAuth *auth)
Gets the GUID from the server if we&#39;ve authenticated; gets NULL otherwise.
Definition: dbus-auth.c:2789
_dbus_auth_set_credentials
DBUS_PRIVATE_EXPORT dbus_bool_t _dbus_auth_set_credentials(DBusAuth *auth, DBusCredentials *credentials)
Sets credentials received via reliable means from the operating system.
Definition: dbus-auth.c:2747
_dbus_auth_set_unix_fd_possible
void _dbus_auth_set_unix_fd_possible(DBusAuth *auth, dbus_bool_t b)
Sets whether unix fd passing is potentially on the transport and hence shall be negotiated.
Definition: dbus-auth.c:2823
_dbus_auth_unref
DBUS_PRIVATE_EXPORT void _dbus_auth_unref(DBusAuth *auth)
Decrements the refcount of an auth object.
Definition: dbus-auth.c:2380
_dbus_auth_get_bytes_to_send
DBUS_PRIVATE_EXPORT dbus_bool_t _dbus_auth_get_bytes_to_send(DBusAuth *auth, const DBusString **str)
Gets bytes that need to be sent to the peer we&#39;re conversing with.
Definition: dbus-auth.c:2509
_dbus_auth_needs_encoding
dbus_bool_t _dbus_auth_needs_encoding(DBusAuth *auth)
Called post-authentication, indicates whether we need to encode the message stream with _dbus_auth_en...
Definition: dbus-auth.c:2625
DBusAuth::credentials
DBusCredentials * credentials
Credentials read from socket.
Definition: dbus-auth.c:169
_dbus_auth_client_new
DBUS_PRIVATE_EXPORT DBusAuth * _dbus_auth_client_new(void)
Creates a new auth conversation object for the client side.
Definition: dbus-auth.c:2327
DBUS_END_DECLS
#define DBUS_END_DECLS
Macro used after declaring functions in the D-Bus header files.