Frameworks/libpurple.framework/Versions/2.10.12r8d2874a79747/Headers/auth.h
branchadium-1.5.11
changeset 6014 fcb71cb71a3d
parent 5941 307f53385811
parent 6013 f8d0dc659e3f
child 6016 325e2ab3406f
equal deleted inserted replaced
5941:307f53385811 6014:fcb71cb71a3d
     1 /**
       
     2  * @file auth.h Authentication routines
       
     3  *
       
     4  * purple
       
     5  *
       
     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
       
     8  * source distribution.
       
     9  *
       
    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.
       
    14  *
       
    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.
       
    19  *
       
    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
       
    23  */
       
    24 #ifndef PURPLE_JABBER_AUTH_H_
       
    25 #define PURPLE_JABBER_AUTH_H_
       
    26 
       
    27 typedef struct _JabberSaslMech JabberSaslMech;
       
    28 
       
    29 #include "jabber.h"
       
    30 #include "xmlnode.h"
       
    31 
       
    32 typedef enum {
       
    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 */
       
    36 } JabberSaslState;
       
    37 
       
    38 struct _JabberSaslMech {
       
    39 	gint8 priority; /* Higher priority will be tried before lower priority */
       
    40 	const gchar *name;
       
    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);
       
    46 };
       
    47 
       
    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);
       
    53 
       
    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);
       
    59 #endif
       
    60 
       
    61 void jabber_auth_add_mech(JabberSaslMech *);
       
    62 void jabber_auth_remove_mech(JabberSaslMech *);
       
    63 
       
    64 void jabber_auth_init(void);
       
    65 void jabber_auth_uninit(void);
       
    66 
       
    67 #endif /* PURPLE_JABBER_AUTH_H_ */