/*
* This file is part of SkunkDB
* Copyright (c) 2001 Gianni Tedesco
*
*    SkunkDB is free software; you can redistribute it and/or modify
*    it under the terms of the GNU General Public License as published by
*    the Free Software Foundation; either version 2 of the License, or
*    (at your option) any later version.
*
*    SkunkDB 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.  See the
*    GNU General Public License for more details.
*
*    You should have received a copy of the GNU General Public License
*    along with SkunkDB; if not, write to the Free Software
*    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
*/


#ifndef __SKUNK_MAKE_HEADER_INCLUDED__
#define __SKUNK_MAKE_HEADER_INCLUDED__

#include <skunk.h>

typedef struct skunk_head {
	skunk_ofs_t	count;
	p_skunkrec	list;
	p_skunkrec	*table;
}skunk_head_t, *p_skunk_head;

typedef struct skunk_obuf{
	int 		fd;
	u_int8_t 	*buf;
	u_int8_t 	*b;
	size_t 		len;
	size_t		max_len;
}skunk_obuf_t, *p_skunk_obuf;

typedef struct skunkwr{
	skunk_obuf_t	wrbuf;
	skunk_head_t	head[SKUNK_DIRECTORY_MOD];
}skunkwr_t, *p_skunkwr;

/* Supporting functions */
void		head_append(p_skunk_head, p_skunkrec);
int		skunk_resolv(p_skunkwr, p_skunk_head);
void		make_destroy(p_skunk_head);
skunk_ofs_t	make_table1(p_skunkwr);

/* API */
int		make_init(p_skunkwr, int, int);
p_skunkrec	make_add(p_skunkwr, u_int8_t *, u_int8_t *, skunk_ofs_t, skunk_ofs_t);
int		make_write(p_skunkwr);
void		make_close(p_skunkwr);

#endif /* __SKUNK_MAKE_HEADER_INCLUDED__ */
