view src/auth/cookie.h @ 10:82b7de533f98 HEAD

s/user_data/context/ and some s/Data/Context/
author Timo Sirainen <tss@iki.fi>
date Thu, 22 Aug 2002 15:48:38 +0300
parents 3b1985cbc908
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