summaryrefslogtreecommitdiff
path: root/src/xauthority.h
blob: 2a190c09326564fb5db67cb59e2bd39ce9c3818e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
/*
 * Copyright (C) 2010-2011 Robert Ancell.
 * Author: Robert Ancell <robert.ancell@canonical.com>
 * 
 * This program is free software: you can redistribute it and/or modify it under
 * the terms of the GNU General Public License as published by the Free Software
 * Foundation, either version 3 of the License, or (at your option) any later
 * version. See http://www.gnu.org/copyleft/gpl.html the full text of the
 * license.
 */

#ifndef _XAUTHORITY_H_
#define _XAUTHORITY_H_

#include <glib-object.h>
#include <gio/gio.h>

G_BEGIN_DECLS

#define XAUTHORITY_TYPE (xauth_get_type())
#define XAUTHORITY(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), XAUTHORITY_TYPE, XAuthority));

typedef struct XAuthorityPrivate XAuthorityPrivate;

typedef struct
{
    GObject         parent_instance;
    XAuthorityPrivate *priv;
} XAuthority;

typedef struct
{
    GObjectClass parent_class;
} XAuthorityClass;

#define XAUTH_FAMILY_INTERNET 0
#define XAUTH_FAMILY_DECNET 1
#define XAUTH_FAMILY_CHAOS 2
#define XAUTH_FAMILY_SERVER_INTERPRETED 5
#define XAUTH_FAMILY_INTERNET6 6
#define XAUTH_FAMILY_LOCALHOST 252
#define XAUTH_FAMILY_KRB5_PRINCIPAL 253
#define XAUTH_FAMILY_NETNAME 254
#define XAUTH_FAMILY_LOCAL 256
#define XAUTH_FAMILY_WILD 65535

typedef enum
{
   XAUTH_WRITE_MODE_REPLACE,
   XAUTH_WRITE_MODE_REMOVE,
   XAUTH_WRITE_MODE_SET  
} XAuthWriteMode;

GType xauth_get_type (void);

XAuthority *xauth_new (guint16 family, const guint8 *address, gsize address_length, const gchar *number, const gchar *name, const guint8 *data, gsize data_length);

XAuthority *xauth_new_cookie (guint16 family, const guint8 *address, gsize address_length, const gchar *number);

void xauth_set_family (XAuthority *auth, guint16 family);

guint16 xauth_get_family (XAuthority *auth);

void xauth_set_address (XAuthority *auth, const guint8 *address, gsize address_length);

const guint8 *xauth_get_address (XAuthority *auth);

const gsize xauth_get_address_length (XAuthority *auth);

void xauth_set_number (XAuthority *auth, const gchar *number);

const gchar *xauth_get_number (XAuthority *auth);

void xauth_set_authorization_name (XAuthority *auth, const gchar *name);

const gchar *xauth_get_authorization_name (XAuthority *auth);

void xauth_set_authorization_data (XAuthority *auth, const guint8 *data, gsize data_length);

const guint8 *xauth_get_authorization_data (XAuthority *auth);

guint8 *xauth_copy_authorization_data (XAuthority *auth);

gsize xauth_get_authorization_data_length (XAuthority *auth);

gboolean xauth_write (XAuthority *auth, XAuthWriteMode mode, GFile *file, GError **error);

G_END_DECLS

#endif /* _XAUTHORITY_H_ */