2 * Copyright (C) 2010-2011 Robert Ancell.
3 * Author: Robert Ancell <robert.ancell@canonical.com>
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
12 #ifndef X_AUTHORITY_H_
13 #define X_AUTHORITY_H_
15 #include <glib-object.h>
19 #define X_AUTHORITY_TYPE (x_authority_get_type())
20 #define X_AUTHORITY(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), X_AUTHORITY_TYPE, XAuthority));
22 typedef struct XAuthorityPrivate XAuthorityPrivate;
26 GObject parent_instance;
27 XAuthorityPrivate *priv;
32 GObjectClass parent_class;
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
48 XAUTH_WRITE_MODE_REPLACE,
49 XAUTH_WRITE_MODE_REMOVE,
53 GType x_authority_get_type (void);
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);
57 XAuthority *x_authority_new_cookie (guint16 family, const guint8 *address, gsize address_length, const gchar *number);
59 void x_authority_set_family (XAuthority *auth, guint16 family);
61 guint16 x_authority_get_family (XAuthority *auth);
63 void x_authority_set_address (XAuthority *auth, const guint8 *address, gsize address_length);
65 const guint8 *x_authority_get_address (XAuthority *auth);
67 const gsize x_authority_get_address_length (XAuthority *auth);
69 void x_authority_set_number (XAuthority *auth, const gchar *number);
71 const gchar *x_authority_get_number (XAuthority *auth);
73 void x_authority_set_authorization_name (XAuthority *auth, const gchar *name);
75 const gchar *x_authority_get_authorization_name (XAuthority *auth);
77 void x_authority_set_authorization_data (XAuthority *auth, const guint8 *data, gsize data_length);
79 const guint8 *x_authority_get_authorization_data (XAuthority *auth);
81 guint8 *x_authority_copy_authorization_data (XAuthority *auth);
83 gsize x_authority_get_authorization_data_length (XAuthority *auth);
85 gboolean x_authority_write (XAuthority *auth, XAuthWriteMode mode, const gchar *filename, GError **error);
89 #endif /* X_AUTHORITY_H_ */