/*
 * Copyright (c) 2002-2006 Sendmail, Inc. and its suppliers.
 *      All rights reserved.
 *
 * By using this file, you agree to the terms and conditions set
 * forth in the LICENSE file which can be found at the top level of
 * the sendmail distribution.
 *
 *	$Id: dadb.h,v 1.16 2006/02/22 19:07:29 ca Exp $
 */

#ifndef DADB_DADB_H
#define DADB_DADB_H 1

/* XXX CONF -- shared with smtpc! see smtpc.h: REQUEST_TIMEOUT */
#define SM_SESSION_TMO	20

#ifndef DADB_DEBUG
# define DADB_DEBUG	0
#endif

#if DADB_DEBUG
# include "sm/io.h"
# define DADB_DPRINTF(x)	sm_io_fprintf x
#else
# define DADB_DPRINTF(x)
#endif

/* DA status; DA is ... */
#define DADB_ST_NONE	0	/* not yet ready (MUST be 0) */
#define DADB_ST_INIT	1	/* initialized */
#define DADB_ST_STOP	8	/* stopping */
#define DADB_ST_STOPPED	9	/* stopped */
#define DADB_IS_OK(dadb_ctx)	((dadb_ctx)->dadb_state == DADB_ST_INIT)

#define FREE_DADB_ENTRIES(dadb_ctx)					\
	do								\
	{								\
		if (dadb_ctx->dadb_entries != NULL)			\
		{							\
			size_t size;					\
									\
			size = dadb_ctx->dadb_entries_max *		\
				sizeof(*dadb_ctx->dadb_entries);	\
			SM_ASSERT(size > dadb_ctx->dadb_entries_max &&	\
				size > sizeof(*dadb_ctx->dadb_entries)); \
			sm_free_size(dadb_ctx->dadb_entries, size);	\
			dadb_ctx->dadb_entries = NULL;			\
		}							\
	} while (0)

sm_ret_T	 dadb_entry_get(dadb_ctx_P _dadb_ctx, dadb_entry_P *_pdadb_entry, uint *_pidx, thr_lock_T _locktype);

void		dadb_entry_free(dadb_entry_P _dadb_entry);

#if 0
sm_ret_T dadb_entry_new(dadb_ctx_P _dadb_ctx, dadb_entry_P *_pdadb_entry, thr_lock_T _locktype);
sm_ret_T dadb_entry_update(dadb_ctx_P _dadb_ctx, sessta_id_P _sess_id, sessta_id_P _ta_id, dadb_entry_P _dadb_entry);
#endif /* 0 */

#endif /* DADB_DADB_H */


syntax highlighted by Code2HTML, v. 0.9.1