more crypt simplifications
[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 #include <sasl/sasl.h>
16
17 #include <lib-sys/mutt_socket.h>
18
19 int mutt_sasl_client_new (CONNECTION *, sasl_conn_t **);
20 int mutt_sasl_interact (sasl_interact_t *);
21 void mutt_sasl_setup_conn (CONNECTION *, sasl_conn_t *);
22 void mutt_sasl_done(void);
23
24 typedef struct {
25     sasl_conn_t *saslconn;
26     const sasl_ssf_t *ssf;
27     const unsigned int *pbufsize;
28
29     /* read buffer */
30     char *buf;
31     unsigned blen;
32     unsigned int bpos;
33
34     /* underlying socket data */
35     void *sockdata;
36     int (*msasl_open) (CONNECTION * conn);
37     int (*msasl_close) (CONNECTION * conn);
38     int (*msasl_read) (CONNECTION * conn, char *buf, ssize_t len);
39     int (*msasl_write) (CONNECTION * conn, const char *buf, ssize_t count);
40 } SASL_DATA;
41
42 #endif /* _MUTT_SASL_H_ */