Nico Golde:
[apps/madmutt.git] / mutt_sasl.h
1 /*
2  * Copyright (C) 2000-1 Brendan Cully <brendan@kublai.com>
3  * 
4  *     This program is free software; you can redistribute it and/or modify
5  *     it under the terms of the GNU General Public License as published by
6  *     the Free Software Foundation; either version 2 of the License, or
7  *     (at your option) any later version.
8  * 
9  *     This program is distributed in the hope that it will be useful,
10  *     but WITHOUT ANY WARRANTY; without even the implied warranty of
11  *     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12  *     GNU General Public License for more details.
13  * 
14  *     You should have received a copy of the GNU General Public License
15  *     along with this program; if not, write to the Free Software
16  *     Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111, USA.
17  */ 
18
19 /* common SASL helper routines */
20
21 #ifndef _MUTT_SASL_H_
22 #define _MUTT_SASL_H_ 1
23
24 #ifdef USE_SASL2
25 #include <sasl/sasl.h>
26 #else
27 #include <sasl.h>
28 #endif
29
30 #include "mutt_socket.h"
31
32 int mutt_sasl_client_new (CONNECTION*, sasl_conn_t**);
33 sasl_callback_t* mutt_sasl_get_callbacks (ACCOUNT*);
34 int mutt_sasl_interact (sasl_interact_t*);
35 void mutt_sasl_setup_conn (CONNECTION*, sasl_conn_t*);
36
37 typedef struct 
38 {
39   sasl_conn_t* saslconn;
40   const sasl_ssf_t* ssf;
41   const unsigned int* pbufsize;
42
43   /* read buffer */
44 #ifdef USE_SASL2
45   const char *buf;
46 #else
47   char* buf;
48 #endif
49   unsigned int blen;
50   unsigned int bpos;
51
52   /* underlying socket data */
53   void* sockdata;
54   int (*open) (CONNECTION* conn);
55   int (*close) (CONNECTION* conn);
56   int (*read) (CONNECTION* conn, char* buf, size_t len);
57   int (*write) (CONNECTION* conn, const char* buf, size_t count);
58 }
59 SASL_DATA;
60
61 #endif /* _MUTT_SASL_H_ */