1 #ifndef ISASL_H
2 #define ISASL_H 1
3 
4 #define SASL_CB_LIST_END   0  /* end of list */
5 
6 #define SASL_USERNAME     0 /* pointer to NUL terminated user name */
7 #define ISASL_CONFIG      20 /* Just so we don't have to implement all the auxprop stuff */
8 
9 typedef struct sasl_callback {
10     unsigned long id;
11     int (*proc)(void);
12     void *context;
13 } sasl_callback_t;
14 
15 typedef struct sasl_conn {
16     char *username;
17     char *config;
18 } sasl_conn_t;
19 
20 typedef struct user_db_entry {
21     char *username;
22     char *password;
23     char *config;
24     struct user_db_entry *next;
25 } user_db_entry_t;
26 
27 void sasl_dispose(sasl_conn_t **pconn);
28 
29 int sasl_server_init(const sasl_callback_t *callbacks,
30                      const char *appname);
31 
32 int sasl_server_new(const char *service,
33                     const char *serverFQDN,
34                     const char *user_realm,
35                     const char *iplocalport,
36                     const char *ipremoteport,
37                     const sasl_callback_t *callbacks,
38                     unsigned flags,
39                     sasl_conn_t **pconn);
40 
41 int sasl_listmech(sasl_conn_t *conn,
42                   const char *user,
43                   const char *prefix,
44                   const char *sep,
45                   const char *suffix,
46                   const char **result,
47                   unsigned *plen,
48                   int *pcount);
49 
50 int sasl_server_start(sasl_conn_t *conn,
51                       const char *mech,
52                       const char *clientin,
53                       unsigned clientinlen,
54                       const char **serverout,
55                       unsigned *serveroutlen);
56 
57 int sasl_server_step(sasl_conn_t *conn,
58                      const char *clientin,
59                      unsigned clientinlen,
60                      const char **serverout,
61                      unsigned *serveroutlen);
62 
63 int sasl_getprop(sasl_conn_t *conn, int propnum,
64                  const void **pvalue);
65 
66 #define SASL_OK       0
67 #define SASL_CONTINUE 1
68 #define SASL_FAIL     -1        /* generic failure */
69 #define SASL_NOMEM    -2        /* memory shortage failure */
70 #define SASL_BADPARAM -7        /* invalid parameter supplied */
71 #define SASL_NOUSER   -20       /* user not found */
72 
73 #endif /* ISASL_H */
74