Rocco Rutte:
[apps/madmutt.git] / mutt_sasl.h
1 /*
2  * Copyright notice from original mutt:
3  * Copyright (C) 2000-5 Brendan Cully <brendan@kublai.com>
4  *
5  * This file is part of mutt-ng, see http://www.muttng.org/.
6  * It's licensed under the GNU General Public License,
7  * please see the file GPL in the top level source directory.
8  */
9
10 /* common SASL helper routines */
11
12 #ifndef _MUTT_SASL_H_
13 #define _MUTT_SASL_H_ 1
14
15 #ifdef USE_SASL2
16 #include <sasl/sasl.h>
17 #else
18 #include <sasl.h>
19 #endif
20
21 #include "mutt_socket.h"
22
23 int mutt_sasl_client_new (CONNECTION *, sasl_conn_t **);
24 sasl_callback_t *mutt_sasl_get_callbacks (ACCOUNT *);
25 int mutt_sasl_interact (sasl_interact_t *);
26 void mutt_sasl_setup_conn (CONNECTION *, sasl_conn_t *);
27 void mutt_sasl_done (void);
28
29 typedef struct {
30   sasl_conn_t *saslconn;
31   const sasl_ssf_t *ssf;
32   const unsigned int *pbufsize;
33
34   /* read buffer */
35 #ifdef USE_SASL2
36   const char *buf;
37 #else
38   char *buf;
39 #endif
40   unsigned int blen;
41   unsigned int bpos;
42
43   /* underlying socket data */
44   void *sockdata;
45   int (*msasl_open) (CONNECTION * conn);
46   int (*msasl_close) (CONNECTION * conn);
47   int (*msasl_read) (CONNECTION * conn, char *buf, size_t len);
48   int (*msasl_write) (CONNECTION * conn, const char *buf, size_t count);
49 } SASL_DATA;
50
51 #endif /* _MUTT_SASL_H_ */