]> rtime.felk.cvut.cz Git - sojka/lightdm.git/blob - src/x-authority.h
Load all users only when really needed
[sojka/lightdm.git] / src / x-authority.h
1 /*
2  * Copyright (C) 2010-2011 Robert Ancell.
3  * Author: Robert Ancell <robert.ancell@canonical.com>
4  *
5  * This program is free software: you can redistribute it and/or modify it under
6  * the terms of the GNU General Public License as published by the Free Software
7  * Foundation, either version 3 of the License, or (at your option) any later
8  * version. See http://www.gnu.org/copyleft/gpl.html the full text of the
9  * license.
10  */
11
12 #ifndef X_AUTHORITY_H_
13 #define X_AUTHORITY_H_
14
15 #include <glib-object.h>
16
17 G_BEGIN_DECLS
18
19 #define X_AUTHORITY_TYPE (x_authority_get_type())
20 #define X_AUTHORITY(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), X_AUTHORITY_TYPE, XAuthority));
21
22 typedef struct XAuthorityPrivate XAuthorityPrivate;
23
24 typedef struct
25 {
26     GObject         parent_instance;
27     XAuthorityPrivate *priv;
28 } XAuthority;
29
30 typedef struct
31 {
32     GObjectClass parent_class;
33 } XAuthorityClass;
34
35 #define XAUTH_FAMILY_INTERNET 0
36 #define XAUTH_FAMILY_DECNET 1
37 #define XAUTH_FAMILY_CHAOS 2
38 #define XAUTH_FAMILY_SERVER_INTERPRETED 5
39 #define XAUTH_FAMILY_INTERNET6 6
40 #define XAUTH_FAMILY_LOCALHOST 252
41 #define XAUTH_FAMILY_KRB5_PRINCIPAL 253
42 #define XAUTH_FAMILY_NETNAME 254
43 #define XAUTH_FAMILY_LOCAL 256
44 #define XAUTH_FAMILY_WILD 65535
45
46 typedef enum
47 {
48    XAUTH_WRITE_MODE_REPLACE,
49    XAUTH_WRITE_MODE_REMOVE,
50    XAUTH_WRITE_MODE_SET
51 } XAuthWriteMode;
52
53 GType x_authority_get_type (void);
54
55 XAuthority *x_authority_new (guint16 family, const guint8 *address, gsize address_length, const gchar *number, const gchar *name, const guint8 *data, gsize data_length);
56
57 XAuthority *x_authority_new_cookie (guint16 family, const guint8 *address, gsize address_length, const gchar *number);
58
59 XAuthority *x_authority_new_local_cookie (const gchar *number);
60
61 void x_authority_set_family (XAuthority *auth, guint16 family);
62
63 guint16 x_authority_get_family (XAuthority *auth);
64
65 void x_authority_set_address (XAuthority *auth, const guint8 *address, gsize address_length);
66
67 const guint8 *x_authority_get_address (XAuthority *auth);
68
69 const gsize x_authority_get_address_length (XAuthority *auth);
70
71 void x_authority_set_number (XAuthority *auth, const gchar *number);
72
73 const gchar *x_authority_get_number (XAuthority *auth);
74
75 void x_authority_set_authorization_name (XAuthority *auth, const gchar *name);
76
77 const gchar *x_authority_get_authorization_name (XAuthority *auth);
78
79 void x_authority_set_authorization_data (XAuthority *auth, const guint8 *data, gsize data_length);
80
81 const guint8 *x_authority_get_authorization_data (XAuthority *auth);
82
83 guint8 *x_authority_copy_authorization_data (XAuthority *auth);
84
85 gsize x_authority_get_authorization_data_length (XAuthority *auth);
86
87 gboolean x_authority_write (XAuthority *auth, XAuthWriteMode mode, const gchar *filename, GError **error);
88
89 G_END_DECLS
90
91 #endif /* X_AUTHORITY_H_ */