summaryrefslogtreecommitdiff
path: root/tests/wocky-test-sasl-auth-server.h
blob: d24a9fa6777446d3ed614a9a6e6669b4585916c0 (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
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
/*
 * wocky-test-sasl-auth-server.h - Header for TestSaslAuthServer
 * Copyright (C) 2006 Collabora Ltd.
 * @author Sjoerd Simons <sjoerd@luon.net>
 *
 * This library is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Lesser General Public
 * License as published by the Free Software Foundation; either
 * version 2.1 of the License, or (at your option) any later version.
 *
 * This library is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 * Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public
 * License along with this library; if not, write to the Free Software
 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
 */

#ifndef __TEST_SASL_AUTH_SERVER_H__
#define __TEST_SASL_AUTH_SERVER_H__

#include <glib-object.h>

#include <gio/gio.h>

#include <wocky/wocky.h>

G_BEGIN_DECLS

typedef enum {
  SERVER_PROBLEM_NO_PROBLEM,
  SERVER_PROBLEM_NO_SASL,
  SERVER_PROBLEM_NO_MECHANISMS,
  SERVER_PROBLEM_INVALID_USERNAME,
  SERVER_PROBLEM_INVALID_PASSWORD,
  SERVER_PROBLEM_REQUIRE_GOOGLE_JDD,
  SERVER_PROBLEM_DISLIKE_GOOGLE_JDD,
  SERVER_PROBLEM_SPACE_CHALLENGE,
  SERVER_PROBLEM_SLASH_CHALLENGE,
  /* Not actually a problem, but let the server choose to put
   * ``additional data with success'' in a success stanza. */
  SERVER_PROBLEM_FINAL_DATA_IN_SUCCESS,
} ServerProblem;

typedef struct _TestSaslAuthServer TestSaslAuthServer;
typedef struct _TestSaslAuthServerClass TestSaslAuthServerClass;
typedef struct _TestSaslAuthServerPrivate TestSaslAuthServerPrivate;


struct _TestSaslAuthServerClass {
    GObjectClass parent_class;
};

struct _TestSaslAuthServer {
    GObject parent;

    TestSaslAuthServerPrivate *priv;
};

GType test_sasl_auth_server_get_type (void);

/* TYPE MACROS */
#define TEST_TYPE_SASL_AUTH_SERVER \
  (test_sasl_auth_server_get_type ())
#define TEST_SASL_AUTH_SERVER(obj) \
  (G_TYPE_CHECK_INSTANCE_CAST((obj), TEST_TYPE_SASL_AUTH_SERVER, \
   TestSaslAuthServer))
#define TEST_SASL_AUTH_SERVER_CLASS(klass) \
  (G_TYPE_CHECK_CLASS_CAST((klass), TEST_TYPE_SASL_AUTH_SERVER, \
   TestSaslAuthServerClass))
#define TEST_IS_SASL_AUTH_SERVER(obj) \
  (G_TYPE_CHECK_INSTANCE_TYPE((obj), TEST_TYPE_SASL_AUTH_SERVER))
#define TEST_IS_SASL_AUTH_SERVER_CLASS(klass) \
  (G_TYPE_CHECK_CLASS_TYPE((klass), TEST_TYPE_SASL_AUTH_SERVER))
#define TEST_SASL_AUTH_SERVER_GET_CLASS(obj) \
  (G_TYPE_INSTANCE_GET_CLASS ((obj), TEST_TYPE_SASL_AUTH_SERVER, \
   TestSaslAuthServerClass))


void test_sasl_auth_server_auth_async (GObject *obj,
    WockyXmppConnection *conn,
    WockyStanza *auth,
    GAsyncReadyCallback cb,
    GCancellable *cancellable,
    gpointer data);

gboolean
test_sasl_auth_server_auth_finish (TestSaslAuthServer *self, GAsyncResult *res,
    GError **error);

const gchar *test_sasl_auth_server_get_selected_mech (TestSaslAuthServer *self);

TestSaslAuthServer * test_sasl_auth_server_new (GIOStream *stream,
    gchar *mech, const gchar *user, const gchar *password,
    const gchar *servername, ServerProblem problem, gboolean start);

void test_sasl_auth_server_stop (TestSaslAuthServer *self);

gint test_sasl_auth_server_set_mechs (GObject *obj, WockyStanza *feat);

G_END_DECLS

#endif /* #ifndef __TEST_SASL_AUTH_SERVER_H__*/