view src/auth/mech.h @ 4414:9017db478693 HEAD

Added mech_generic_auth_internal() and mech_generic_auth_free() functions and used them wherever possible to reduce code duplication. Patch by Andrey Panin.
author Timo Sirainen <tss@iki.fi>
date Sat, 17 Jun 2006 22:15:20 +0300
parents 395bc6e93222
children 2c1cc5bbc260
line wrap: on
line source

#ifndef __MECH_H
#define __MECH_H

#include "auth-client-interface.h"

enum auth_client_result {
	AUTH_CLIENT_RESULT_CONTINUE = 1,
	AUTH_CLIENT_RESULT_SUCCESS,
	AUTH_CLIENT_RESULT_FAILURE
};

struct auth_request;

typedef void mech_callback_t(struct auth_request *request,
			     enum auth_client_result result,
			     const void *reply, size_t reply_size);

#include "auth-request.h"

/* Used only for string sanitization. */
#define MAX_MECH_NAME_LEN 64

struct mech_module {
	const char *mech_name;

        enum mech_security_flags flags;
	unsigned int passdb_need_plain:1;
	unsigned int passdb_need_credentials:1;

	struct auth_request *(*auth_new)(void);
	void (*auth_initial)(struct auth_request *request,
			     const unsigned char *data, size_t data_size);
	void (*auth_continue)(struct auth_request *request,
			      const unsigned char *data, size_t data_size);
	void (*auth_free)(struct auth_request *request);
};

struct mech_module_list {
	struct mech_module_list *next;

	struct mech_module module;
};

void mech_register_module(struct mech_module *module);
void mech_unregister_module(struct mech_module *module);
struct mech_module *mech_module_find(const char *name);

void mech_generic_auth_initial(struct auth_request *request,
			       const unsigned char *data, size_t data_size);
void mech_generic_auth_free(struct auth_request *request);

void mech_init(void);
void mech_deinit(void);

#endif