/**********************************************************************
 
	Copyright (C) 2003 Hirohisa MORI <joshua@nichibun.ac.jp>
 
	This program is free software; you can redistribute it 
	and/or modify it under the terms of the GLOBALBASE 
	Library General Public License (G-LGPL) as published by 

	http://www.globalbase.org/
 
	This program is distributed in the hope that it will be 
	useful, but WITHOUT ANY WARRANTY; without even the 
	implied warranty of MERCHANTABILITY or FITNESS FOR A 
	PARTICULAR PURPOSE.

**********************************************************************/


#ifndef ___SERVER_H___
#define ___SERVER_H___

#include	"stream.h"
#include	"netutils.h"

typedef struct access_list {
	struct access_list *	next;
	int			ip;
	int			mask;
	char *			domain;
	int			type;
#define AP_ALLOW		1
#define AP_DENY			0
} ACCESS_LIST;

typedef struct access_permission {
	ACCESS_LIST *		head;
	ACCESS_LIST *		tail;
} ACCESS_PERMISSION;

typedef struct access_key {
	STREAM *		s;
	int			ip;
	void *			work;
} ACCESS_KEY;

ACCESS_KEY * accept_connection(STREAM *);
STREAM * init_server(int * open_port,int base_port,int limit);

#endif


