view src/auth/cookie.h @ 91:dc0891523276 HEAD

bugfix for sync fix
author Timo Sirainen <tss@iki.fi>
date Thu, 29 Aug 2002 01:42:00 +0300
parents 82b7de533f98
children 30f6811f4952
line wrap: on
line source

#ifndef __COOKIE_H
#define __COOKIE_H

#include "auth-interface.h"

typedef struct _CookieData CookieData;

struct _CookieData {
	unsigned char cookie[AUTH_COOKIE_SIZE];

	/* continue authentication */
	void (*auth_continue)(CookieData *cookie,
			      AuthContinuedRequestData *request,
			      const unsigned char *data,
			      AuthCallback callback, void *context);

	/* fills reply from cookie, returns TRUE if successful */
	int (*auth_fill_reply)(CookieData *cookie, AuthCookieReplyData *reply);

	/* Free all data related to cookie */
	void (*free)(CookieData *cookie);

	void *context;
};

typedef void (*CookieFreeFunc)(void *data);

/* data->cookie is filled */
void cookie_add(CookieData *data);
/* Looks up the cookie */
CookieData *cookie_lookup(unsigned char cookie[AUTH_COOKIE_SIZE]);
/* Removes and frees the cookie */
void cookie_remove(unsigned char cookie[AUTH_COOKIE_SIZE]);
/* Looks up the cookie and removes it, you have to free the returned data. */
CookieData *cookie_lookup_and_remove(unsigned char cookie[AUTH_COOKIE_SIZE]);

void cookies_init(void);
void cookies_deinit(void);

#endif