2 * @file auth.h Authentication routines
6 * Purple is the legal property of its developers, whose names are too numerous
7 * to list here. Please refer to the COPYRIGHT file distributed with this
10 * This program is free software; you can redistribute it and/or modify
11 * it under the terms of the GNU General Public License as published by
12 * the Free Software Foundation; either version 2 of the License, or
13 * (at your option) any later version.
15 * This program is distributed in the hope that it will be useful,
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 * GNU General Public License for more details.
20 * You should have received a copy of the GNU General Public License
21 * along with this program; if not, write to the Free Software
22 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
24 #ifndef PURPLE_JABBER_AUTH_H_
25 #define PURPLE_JABBER_AUTH_H_
27 typedef struct _JabberSaslMech JabberSaslMech
;
33 JABBER_SASL_STATE_FAIL
= -1, /* Abort, Retry, Fail? */
34 JABBER_SASL_STATE_OK
= 0, /* Hooray! */
35 JABBER_SASL_STATE_CONTINUE
= 1 /* More authentication required */
38 struct _JabberSaslMech
{
39 gint8 priority
; /* Higher priority will be tried before lower priority */
41 JabberSaslState (*start
)(JabberStream
*js
, xmlnode
*mechanisms
, xmlnode
**reply
, char **msg
);
42 JabberSaslState (*handle_challenge
)(JabberStream
*js
, xmlnode
*packet
, xmlnode
**reply
, char **msg
);
43 JabberSaslState (*handle_success
)(JabberStream
*js
, xmlnode
*packet
, char **msg
);
44 JabberSaslState (*handle_failure
)(JabberStream
*js
, xmlnode
*packet
, xmlnode
**reply
, char **msg
);
45 void (*dispose
)(JabberStream
*js
);
48 void jabber_auth_start(JabberStream
*js
, xmlnode
*packet
);
49 void jabber_auth_start_old(JabberStream
*js
);
50 void jabber_auth_handle_challenge(JabberStream
*js
, xmlnode
*packet
);
51 void jabber_auth_handle_success(JabberStream
*js
, xmlnode
*packet
);
52 void jabber_auth_handle_failure(JabberStream
*js
, xmlnode
*packet
);
54 JabberSaslMech
*jabber_auth_get_plain_mech(void);
55 JabberSaslMech
*jabber_auth_get_digest_md5_mech(void);
56 JabberSaslMech
**jabber_auth_get_scram_mechs(gint
*count
);
57 #ifdef HAVE_CYRUS_SASL
58 JabberSaslMech
*jabber_auth_get_cyrus_mech(void);
61 void jabber_auth_add_mech(JabberSaslMech
*);
62 void jabber_auth_remove_mech(JabberSaslMech
*);
64 void jabber_auth_init(void);
65 void jabber_auth_uninit(void);
67 #endif /* PURPLE_JABBER_AUTH_H_ */