3 #ifndef _XSASL_H_INCLUDED_
4 #define _XSASL_H_INCLUDED_
10 /* Postfix SASL plug-in interface
24 * Generic server object. Specific instances extend this with their own
27 typedef struct XSASL_SERVER
{
28 void (*free
) (struct XSASL_SERVER
*);
29 int (*first
) (struct XSASL_SERVER
*, const char *, const char *, VSTRING
*);
30 int (*next
) (struct XSASL_SERVER
*, const char *, VSTRING
*);
31 const char *(*get_mechanism_list
) (struct XSASL_SERVER
*);
32 const char *(*get_username
) (struct XSASL_SERVER
*);
35 #define xsasl_server_free(server) (server)->free(server)
36 #define xsasl_server_first(server, method, init_resp, reply) \
37 (server)->first((server), (method), (init_resp), (reply))
38 #define xsasl_server_next(server, request, reply) \
39 (server)->next((server), (request), (reply))
40 #define xsasl_server_get_mechanism_list(server) \
41 (server)->get_mechanism_list((server))
42 #define xsasl_server_get_username(server) \
43 (server)->get_username((server))
46 * Generic server implementation. Specific instances extend this with their
49 typedef struct XSASL_SERVER_CREATE_ARGS
{
51 const char *server_addr
;
52 const char *client_addr
;
54 const char *user_realm
;
55 const char *security_options
;
57 } XSASL_SERVER_CREATE_ARGS
;
59 typedef struct XSASL_SERVER_IMPL
{
60 XSASL_SERVER
*(*create
) (struct XSASL_SERVER_IMPL
*, XSASL_SERVER_CREATE_ARGS
*);
61 void (*done
) (struct XSASL_SERVER_IMPL
*);
64 extern XSASL_SERVER_IMPL
*xsasl_server_init(const char *, const char *);
65 extern ARGV
*xsasl_server_types(void);
67 #define xsasl_server_create(impl, args) \
68 (impl)->create((impl), (args))
69 #define XSASL_SERVER_CREATE(impl, args, a1, a2, a3, a4, a5, a6, a7) \
70 xsasl_server_create((impl), (((args)->a1), ((args)->a2), ((args)->a3), \
71 ((args)->a4), ((args)->a5), ((args)->a6), ((args)->a7), (args)))
72 #define xsasl_server_done(impl) (impl)->done((impl));
75 * Generic client object. Specific instances extend this with their own
78 typedef struct XSASL_CLIENT
{
79 void (*free
) (struct XSASL_CLIENT
*);
80 int (*first
) (struct XSASL_CLIENT
*, const char *, const char *, const char *, const char **, VSTRING
*);
81 int (*next
) (struct XSASL_CLIENT
*, const char *, VSTRING
*);
84 #define xsasl_client_free(client) (client)->free(client)
85 #define xsasl_client_first(client, server, method, user, pass, init_resp) \
86 (client)->first((client), (server), (method), (user), (pass), (init_resp))
87 #define xsasl_client_next(client, request, reply) \
88 (client)->next((client), (request), (reply))
89 #define xsasl_client_set_password(client, user, pass) \
90 (client)->set_password((client), (user), (pass))
93 * Generic client implementation. Specific instances extend this with their
96 typedef struct XSASL_CLIENT_CREATE_ARGS
{
99 const char *server_name
;
100 const char *security_options
;
101 } XSASL_CLIENT_CREATE_ARGS
;
103 typedef struct XSASL_CLIENT_IMPL
{
104 XSASL_CLIENT
*(*create
) (struct XSASL_CLIENT_IMPL
*, XSASL_CLIENT_CREATE_ARGS
*);
105 void (*done
) (struct XSASL_CLIENT_IMPL
*);
108 extern XSASL_CLIENT_IMPL
*xsasl_client_init(const char *, const char *);
109 extern ARGV
*xsasl_client_types(void);
111 #define xsasl_client_create(impl, args) \
112 (impl)->create((impl), (args))
113 #define XSASL_CLIENT_CREATE(impl, args, a1, a2, a3, a4) \
114 xsasl_client_create((impl), (((args)->a1), ((args)->a2), ((args)->a3), \
115 ((args)->a4), (args)))
116 #define xsasl_client_done(impl) (impl)->done((impl));
121 #define XSASL_AUTH_OK 1 /* Success */
122 #define XSASL_AUTH_MORE 2 /* Need another c/s protocol exchange */
123 #define XSASL_AUTH_DONE 3 /* Authentication completed */
124 #define XSASL_AUTH_FORM 4 /* Cannot decode response */
125 #define XSASL_AUTH_FAIL 5 /* Error */
130 /* The Secure Mailer license must be distributed with this software.
133 /* IBM T.J. Watson Research
135 /* Yorktown Heights, NY 10598, USA