# Syntax:
# BEGIN	function_name  RPC # 	{CODE | NOCLNTCODE | RETCODE | NOFUNC}
#	CODE:	generate XDR and client code, return status
#		Used for functions that just return a status and nothing else.
#	RETCODE:generate XDR and client code, call return function
#		(generate template return function)
#		Used for functions that returns data.
#	NOCLNTCODE:	generate only XDR and server functions
#		Used for functions that are "different" on the client.
#		Primarily used for envcreate (which is called from
#		the dbenv->set_server method on the client side) and
#		dbcreate, which is called from non-generated code.
#	NOFUNC:	generate a client "unsupported function" with right args
#		Used for unsupported functions.
#
# ARG	{IGNORE | STRING | INT | DBT | LIST | ID}  C-type varname
#	IGNORE:	not passed to server
#	STRING:	string passed to server
#	DBT:	DBT arg passed to server
#	LIST:	opaque list passed to server (NULL-terminated opaque list)
#	INT:	integer passed to server
#	ID:	cl_id from arg passed to server
# FUNCPROT prototype
# FUNCARG functiontype 
#	These two *MUST* go together and FUNCPROT *MUST* be first.  These
#	are for the tricky user-supplied functions to some methods.  They
#	are not supported in RPC, so will be ignored, but the complicated
#	syntax of their argument requires we have a special flag for them
#	that contains the verbatim text to use in the prototype and the
#	c-type, respectively.  The FUNCARG must include the function, and
#	must call it 'func'.
#
# All messages automatically return "status" and return that from
# the call to the function.  RET's are additional things the server
# may return.  RET is like ARG but does not need the IGNORE option.
# RET	{STRING | INT | DBT | LIST | ID} varname [STRING | INT | ID]
#	STRING:	string from server
#	DBT:	DBT arg from server
#	LIST:	opaque list from server (NULL-terminated opaque list)
#	  Must have list type of STRING, ID or INT specified
#	INT:	integer from server
#	ID:	id from server stored in cl_id
# END	function end.

#
# Environment functions
#
BEGIN	envcachesize	1	CODE
ARG	ID	DB_ENV *	dbenv
ARG	INT	u_int32_t	gbytes
ARG	INT	u_int32_t	bytes
ARG	INT	int		ncache
END
BEGIN	envclose	1	RETCODE
ARG	ID	DB_ENV *	dbenv
ARG	INT	u_int32_t	flags
END
BEGIN	envcreate	1	NOCLNTCODE
ARG	INT	long		timeout
RET	ID	long		env
END
BEGIN	envopen		1	RETCODE
ARG	ID	DB_ENV *	dbenv
ARG	STRING	const char *	home
ARG	IGNORE	char * const *	config
ARG	INT	u_int32_t	flags
ARG	INT	int		mode
END
BEGIN	envremove	1	RETCODE
ARG	ID	DB_ENV *	dbenv
ARG	STRING	const char *	home
ARG	IGNORE	char * const *	config	
ARG	INT	u_int32_t	flags
END

#
# Transaction functions
#
BEGIN	txnabort	1	RETCODE
ARG	ID	DB_TXN *	txnp
END
BEGIN	txnbegin	1	RETCODE
ARG	ID	DB_ENV *	envp
ARG	ID	DB_TXN *	parent
ARG	IGNORE	DB_TXN **	txnpp
ARG	INT	u_int32_t	flags
RET	ID	long		txnid
END
BEGIN	txncommit	1	RETCODE
ARG	ID	DB_TXN *	txnp
ARG	INT	u_int32_t	flags
END

#
# Database functions
#
BEGIN	dbbtcompare	1	NOFUNC
ARG	ID	DB *		dbp
FUNCPROT	int (*)(const DBT *, const DBT *)
FUNCARG	int (*func) __P((const DBT *, const DBT *))
END
BEGIN	dbbtmaxkey	1	CODE
ARG	ID	DB *		dbp
ARG	INT	u_int32_t	maxkey
END
BEGIN	dbbtminkey	1	CODE
ARG	ID	DB *		dbp
ARG	INT	u_int32_t	minkey
END
BEGIN	dbbtprefix	1	NOFUNC
ARG	ID	DB *		dbp
FUNCPROT	size_t(*)(const DBT *, const DBT *)
FUNCARG	size_t (*func) __P((const DBT *, const DBT *))
END
BEGIN	dbcachesize	1	NOFUNC
ARG	ID	DB *		dbp
ARG	INT	u_int32_t	gbytes
ARG	INT	u_int32_t	bytes
ARG	INT	int		ncache
END
BEGIN	dbclose	1		RETCODE
ARG	ID	DB *		dbp
ARG	INT	u_int32_t	flags
END
BEGIN	dbcreate	1	NOCLNTCODE
ARG	INT	u_int32_t	flags
ARG	ID	DB_ENV *	envp
RET	ID	long		dbp
END
BEGIN	dbdel	1		CODE
ARG	ID	DB *		dbp
ARG	ID	DB_TXN *	txnp
ARG	DBT	DBT *		key
ARG	INT	u_int32_t	flags
END
BEGIN	dbfd		1	NOFUNC
ARG	ID	DB *		dbp
ARG	IGNORE	int *		fdp
END
BEGIN	dbfeedback	1	NOFUNC
ARG	ID	DB *		dbp
FUNCPROT	void (*)(DB *, int, int)
FUNCARG	void (*func) __P((DB *, int, int))
END
BEGIN	dbflags		1	CODE
ARG	ID	DB *		dbp
ARG	INT	u_int32_t	flags
END
BEGIN	dbget	1		RETCODE
ARG	ID	DB *		dbp
ARG	ID	DB_TXN *	txnp
ARG	DBT	DBT *		key
ARG	DBT	DBT *		data
ARG	INT	u_int32_t	flags
RET	DBT	DBT *		key
RET	DBT	DBT *		data
END
BEGIN	dbhffactor	1	CODE
ARG	ID	DB *		dbp
ARG	INT	u_int32_t	ffactor
END
BEGIN	dbhhash	1		NOFUNC
ARG	ID	DB *		dbp
FUNCPROT	u_int32_t(*)(const void *, u_int32_t)
FUNCARG	u_int32_t (*func) __P((const void *, u_int32_t))
END
BEGIN	dbhnelem	1	CODE
ARG	ID	DB *		dbp
ARG	INT	u_int32_t	nelem
END
BEGIN	dblorder	1	CODE
ARG	ID	DB *		dbp
ARG	INT	int		lorder
END
BEGIN	dbmalloc	1	NOFUNC
ARG	ID	DB *		dbp
FUNCPROT	void *(*)(size_t)
FUNCARG	void *(*func) __P((size_t))
END
# XXX
# The line:
# RET	INT	u_int32_t	dbflags
# should go away when a get_flags method exists.  It is
# needed now because Tcl looks at dbp->flags.
#
BEGIN	dbopen	1		RETCODE
ARG	ID	DB *		dbp
ARG	STRING	const char *	name
ARG	STRING	const char *	subdb
ARG	INT	DBTYPE		type
ARG	INT	u_int32_t	flags
ARG	INT	int		mode
RET	INT	DBTYPE		type
RET	INT	u_int32_t	dbflags
END
BEGIN	dbpagesize	1	CODE
ARG	ID	DB *		dbp
ARG	INT	u_int32_t	pagesize
END
BEGIN	dbpanic		1	NOFUNC
ARG	ID	DB *		dbp
FUNCPROT	void (*)(DB_ENV *, int)
FUNCARG	void (*func) __P((DB_ENV *, int))
END
BEGIN	dbput	1		RETCODE
ARG	ID	DB *		dbp
ARG	ID	DB_TXN *	txnp
ARG	DBT	DBT *		key
ARG	DBT	DBT *		data
ARG	INT	u_int32_t	flags
RET	DBT	DBT *		key
END
BEGIN	dbrealloc	1	NOFUNC
ARG	ID	DB *		dbp
FUNCPROT	void *(*)(void *, size_t)
FUNCARG	void *(*func) __P((void *, size_t))
END
BEGIN	dbredelim	1	CODE
ARG	ID	DB *		dbp
ARG	INT	int		delim
END
BEGIN	dbrelen		1	CODE
ARG	ID	DB *		dbp
ARG	INT	u_int32_t	len
END
BEGIN	dbrepad		1	CODE
ARG	ID	DB *		dbp
ARG	INT	int		pad
END
BEGIN	dbresource	1	NOFUNC
ARG	ID	DB *		dbp
ARG	STRING	const char *	re_source
END
BEGIN	dbremove	1	RETCODE
ARG	ID	DB *		dbp
ARG	STRING	const char *	name
ARG	STRING	const char *	subdb
ARG	INT	u_int32_t	flags
END
BEGIN	dbstat	1		RETCODE
ARG	ID	DB *		dbp
ARG	IGNORE	void *		sp
FUNCPROT	void *(*)(size_t)
FUNCARG	void *(*func) __P((size_t))
ARG	INT	u_int32_t	flags
RET	LIST	u_int32_t *	stats	INT
END
BEGIN	dbswapped	1	CODE
ARG	ID	DB *		dbp
END
BEGIN	dbsync		1	CODE
ARG	ID	DB *		dbp
ARG	INT	u_int32_t	flags
END
BEGIN	dbupgrade	1	NOFUNC
ARG	ID	DB *		dbp
ARG	STRING	const char *	fname
ARG	INT	u_int32_t	flags
END
#
# Cursor functions
#
BEGIN	dbcursor	1	RETCODE
ARG	ID	DB *		dbp
ARG	ID	DB_TXN *	txnp
ARG	IGNORE	DBC **		dbcpp
ARG	INT	u_int32_t	flags
RET	ID	long		dbcid
END
BEGIN	dbjoin		1	RETCODE
ARG	ID	DB *		dbp
ARG	LIST	DBC **		curs	ID
ARG	IGNORE	DBC **		dbcp
ARG	INT	u_int32_t	flags
RET	ID	long		dbcid
END
BEGIN	dbc_close	1	RETCODE
ARG	ID	DBC *		dbc
END
BEGIN	dbc_count	1	RETCODE
ARG	ID	DBC *		dbc
ARG	IGNORE	db_recno_t *	countp
ARG	INT	u_int32_t	flags
RET	INT	db_recno_t	dupcount
END
BEGIN	dbc_del		1	CODE
ARG	ID	DBC *		dbc
ARG	INT	u_int32_t	flags
END
BEGIN	dbc_dup		1	RETCODE
ARG	ID	DBC *		dbc
ARG	IGNORE	DBC **		dbcp
ARG	INT	u_int32_t	flags
RET	ID	long		dbcid
END
BEGIN	dbc_get		1	RETCODE
ARG	ID	DBC *		dbc
ARG	DBT	DBT *		key
ARG	DBT	DBT *		data
ARG	INT	u_int32_t	flags
RET	DBT	DBT *		key
RET	DBT	DBT *		data
END
BEGIN	dbc_put		1	CODE
ARG	ID	DBC *		dbc
ARG	DBT	DBT *		key
ARG	DBT	DBT *		data
ARG	INT	u_int32_t	flags
END
