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
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
|
/*
* 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_CONNECTOR_SERVER_H__
#define __TEST_CONNECTOR_SERVER_H__
#include <glib-object.h>
#include <gio/gio.h>
#include "wocky-test-sasl-auth-server.h"
G_BEGIN_DECLS
#define CONNPROBLEM(x) (0x1 << x)
typedef enum
{
XMPP_PROBLEM_NONE = 0,
XMPP_PROBLEM_BAD_XMPP = CONNPROBLEM (0),
XMPP_PROBLEM_NO_TLS = CONNPROBLEM (1),
XMPP_PROBLEM_TLS_REFUSED = CONNPROBLEM (2),
XMPP_PROBLEM_FEATURES = CONNPROBLEM (3),
XMPP_PROBLEM_OLD_SERVER = CONNPROBLEM (4),
XMPP_PROBLEM_WEAK_SSL = CONNPROBLEM (5),
XMPP_PROBLEM_OLD_SSL = CONNPROBLEM (6),
XMPP_PROBLEM_OTHER_HOST = CONNPROBLEM (7),
XMPP_PROBLEM_TLS_LOAD = CONNPROBLEM (8),
XMPP_PROBLEM_NO_SESSION = CONNPROBLEM (10),
XMPP_PROBLEM_CANNOT_BIND = CONNPROBLEM (11),
XMPP_PROBLEM_OLD_AUTH_FEATURE = CONNPROBLEM (12),
} XmppProblem;
typedef enum
{
BIND_PROBLEM_NONE = 0,
BIND_PROBLEM_INVALID = CONNPROBLEM(0),
BIND_PROBLEM_DENIED = CONNPROBLEM(1),
BIND_PROBLEM_CONFLICT = CONNPROBLEM(2),
BIND_PROBLEM_CLASH = CONNPROBLEM(3),
BIND_PROBLEM_REJECTED = CONNPROBLEM(4),
BIND_PROBLEM_FAILED = CONNPROBLEM(5),
BIND_PROBLEM_NO_JID = CONNPROBLEM(6),
BIND_PROBLEM_NONSENSE = CONNPROBLEM(7),
} BindProblem;
typedef enum
{
SESSION_PROBLEM_NONE = 0,
SESSION_PROBLEM_NO_SESSION = CONNPROBLEM(0),
SESSION_PROBLEM_FAILED = CONNPROBLEM(1),
SESSION_PROBLEM_DENIED = CONNPROBLEM(2),
SESSION_PROBLEM_CONFLICT = CONNPROBLEM(3),
SESSION_PROBLEM_REJECTED = CONNPROBLEM(4),
SESSION_PROBLEM_NONSENSE = CONNPROBLEM(5),
} SessionProblem;
typedef enum
{
SERVER_DEATH_NONE = 0,
SERVER_DEATH_SERVER_START = CONNPROBLEM(0),
SERVER_DEATH_CLIENT_OPEN = CONNPROBLEM(1),
SERVER_DEATH_SERVER_OPEN = CONNPROBLEM(2),
SERVER_DEATH_FEATURES = CONNPROBLEM(3),
SERVER_DEATH_TLS_NEG = CONNPROBLEM(4),
} ServerDeath;
typedef enum
{
JABBER_PROBLEM_NONE = 0,
JABBER_PROBLEM_AUTH_REJECT = CONNPROBLEM (0),
JABBER_PROBLEM_AUTH_BIND = CONNPROBLEM (1),
JABBER_PROBLEM_AUTH_PARTIAL = CONNPROBLEM (2),
JABBER_PROBLEM_AUTH_FAILED = CONNPROBLEM (3),
JABBER_PROBLEM_AUTH_STRANGE = CONNPROBLEM (4),
JABBER_PROBLEM_AUTH_NIH = CONNPROBLEM (5),
JABBER_PROBLEM_AUTH_NONSENSE = CONNPROBLEM (6),
} JabberProblem;
typedef enum
{
XEP77_PROBLEM_NONE = 0,
XEP77_PROBLEM_ALREADY = CONNPROBLEM(0),
XEP77_PROBLEM_FAIL_CONFLICT = CONNPROBLEM(1),
XEP77_PROBLEM_FAIL_REJECTED = CONNPROBLEM(2),
XEP77_PROBLEM_NOT_AVAILABLE = CONNPROBLEM(3),
XEP77_PROBLEM_QUERY_NONSENSE = CONNPROBLEM(4),
XEP77_PROBLEM_QUERY_ALREADY = CONNPROBLEM(5),
XEP77_PROBLEM_NO_ARGS = CONNPROBLEM(6),
XEP77_PROBLEM_EMAIL_ARG = CONNPROBLEM(7),
XEP77_PROBLEM_STRANGE_ARG = CONNPROBLEM(8),
XEP77_PROBLEM_CANCEL_REJECTED = CONNPROBLEM(9),
XEP77_PROBLEM_CANCEL_DISABLED = CONNPROBLEM(10),
XEP77_PROBLEM_CANCEL_FAILED = CONNPROBLEM(11),
XEP77_PROBLEM_CANCEL_STREAM = CONNPROBLEM(12),
} XEP77Problem;
typedef enum
{
CERT_STANDARD,
CERT_EXPIRED,
CERT_NOT_YET,
CERT_UNKNOWN,
CERT_SELFSIGN,
CERT_REVOKED,
CERT_NONE,
} CertSet;
typedef struct
{
XmppProblem xmpp;
BindProblem bind;
SessionProblem session;
ServerDeath death;
JabberProblem jabber;
XEP77Problem xep77;
} ConnectorProblem;
typedef struct _TestConnectorServer TestConnectorServer;
typedef struct _TestConnectorServerClass TestConnectorServerClass;
typedef struct _TestConnectorServerPrivate TestConnectorServerPrivate;
struct _TestConnectorServerClass {
GObjectClass parent_class;
};
struct _TestConnectorServer {
GObject parent;
TestConnectorServerPrivate *priv;
};
GType test_connector_server_get_type (void);
/* TYPE MACROS */
#define TEST_TYPE_CONNECTOR_SERVER \
(test_connector_server_get_type ())
#define TEST_CONNECTOR_SERVER(obj) \
(G_TYPE_CHECK_INSTANCE_CAST((obj), TEST_TYPE_CONNECTOR_SERVER, \
TestConnectorServer))
#define TEST_CONNECTOR_SERVER_CLASS(klass) \
(G_TYPE_CHECK_CLASS_CAST((klass), TEST_TYPE_CONNECTOR_SERVER, \
TestConnectorServerClass))
#define TEST_IS_CONNECTOR_SERVER(obj) \
(G_TYPE_CHECK_INSTANCE_TYPE((obj), TEST_TYPE_CONNECTOR_SERVER))
#define TEST_IS_CONNECTOR_SERVER_CLASS(klass) \
(G_TYPE_CHECK_CLASS_TYPE((klass), TEST_TYPE_CONNECTOR_SERVER))
#define TEST_CONNECTOR_SERVER_GET_CLASS(obj) \
(G_TYPE_INSTANCE_GET_CLASS ((obj), TEST_TYPE_CONNECTOR_SERVER, \
TestConnectorServerClass))
TestConnectorServer * test_connector_server_new (GIOStream *stream,
gchar *mech,
const gchar *user,
const gchar *pass,
const gchar *version,
ConnectorProblem *problem,
ServerProblem sasl_problem,
CertSet cert);
void test_connector_server_start (TestConnectorServer *self);
void test_connector_server_teardown (TestConnectorServer *self,
GAsyncReadyCallback callback,
gpointer user_data);
gboolean test_connector_server_teardown_finish (TestConnectorServer *self,
GAsyncResult *result,
GError *error);
const gchar *test_connector_server_get_used_mech (TestConnectorServer *self);
G_END_DECLS
#endif /* #ifndef __TEST_CONNECTOR_SERVER_H__*/
|