summaryrefslogtreecommitdiffstats
path: root/src/lib-sasl/dsasl-client-private.h
blob: 65b86f70b86cde491842ad4db733fabf789682ff (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
#ifndef DSASL_CLIENT_PRIVATE_H
#define DSASL_CLIENT_PRIVATE_H

#include "dsasl-client.h"

enum dsasl_mech_security_flags {
	DSASL_MECH_SEC_ALLOW_NULS	= 0x0001,
};

struct dsasl_client {
	pool_t pool;
	struct dsasl_client_settings set;
	char *password;
	const struct dsasl_client_mech *mech;
};

struct dsasl_client_mech {
	const char *name;
	size_t struct_size;
	enum dsasl_mech_security_flags flags;

	int (*input)(struct dsasl_client *client,
		     const unsigned char *input, size_t input_len,
		     const char **error_r);
	int (*output)(struct dsasl_client *client,
		      const unsigned char **output_r, size_t *output_len_r,
		      const char **error_r);
	int (*set_parameter)(struct dsasl_client *client,
			     const char *key, const char *value,
			     const char **error_r);
	int (*get_result)(struct dsasl_client *client,
			  const char *key, const char **value_r,
			  const char **error_r);
	void (*free)(struct dsasl_client *client);
};

extern const struct dsasl_client_mech dsasl_client_mech_external;
extern const struct dsasl_client_mech dsasl_client_mech_login;
extern const struct dsasl_client_mech dsasl_client_mech_oauthbearer;
extern const struct dsasl_client_mech dsasl_client_mech_xoauth2;

void dsasl_client_mech_register(const struct dsasl_client_mech *mech);
void dsasl_client_mech_unregister(const struct dsasl_client_mech *mech);

#endif