diff options
author | jbj <devnull@localhost> | 2002-08-14 16:31:49 +0000 |
---|---|---|
committer | jbj <devnull@localhost> | 2002-08-14 16:31:49 +0000 |
commit | d481ba55c02407124c499c7800ea556786137bc5 (patch) | |
tree | e0d3fdb7906ae3290f019999e0661cfc5b1b3f58 /db/rpc_server | |
parent | 9114d6ffea4ee330874ebc8febe225ce0e891eac (diff) | |
download | librpm-tizen-d481ba55c02407124c499c7800ea556786137bc5.tar.gz librpm-tizen-d481ba55c02407124c499c7800ea556786137bc5.tar.bz2 librpm-tizen-d481ba55c02407124c499c7800ea556786137bc5.zip |
Initial revision
CVS patchset: 5630
CVS date: 2002/08/14 16:31:49
Diffstat (limited to 'db/rpc_server')
123 files changed, 16881 insertions, 0 deletions
diff --git a/db/rpc_server/c/db_server_proc.c b/db/rpc_server/c/db_server_proc.c new file mode 100644 index 000000000..207e160c3 --- /dev/null +++ b/db/rpc_server/c/db_server_proc.c @@ -0,0 +1,2500 @@ +/*- + * See the file LICENSE for redistribution information. + * + * Copyright (c) 2000-2002 + * Sleepycat Software. All rights reserved. + */ + +#include "db_config.h" + +#ifdef HAVE_RPC +#ifndef lint +static const char revid[] = "Id: db_server_proc.c,v 1.92 2002/07/29 15:21:20 sue Exp "; +#endif /* not lint */ + +#ifndef NO_SYSTEM_INCLUDES +#include <sys/types.h> + +#include <rpc/rpc.h> + +#include <string.h> +#endif +#include "dbinc_auto/db_server.h" + +#include "db_int.h" +#include "dbinc/db_server_int.h" +#include "dbinc_auto/rpc_server_ext.h" + +/* BEGIN __env_cachesize_proc */ +/* + * PUBLIC: void __env_cachesize_proc __P((long, u_int32_t, u_int32_t, + * PUBLIC: u_int32_t, __env_cachesize_reply *)); + */ +void +__env_cachesize_proc(dbenvcl_id, gbytes, bytes, + ncache, replyp) + long dbenvcl_id; + u_int32_t gbytes; + u_int32_t bytes; + u_int32_t ncache; + __env_cachesize_reply *replyp; +/* END __env_cachesize_proc */ +{ + DB_ENV *dbenv; + ct_entry *dbenv_ctp; + int ret; + + ACTIVATE_CTP(dbenv_ctp, dbenvcl_id, CT_ENV); + dbenv = (DB_ENV *)dbenv_ctp->ct_anyp; + + ret = dbenv->set_cachesize(dbenv, gbytes, bytes, ncache); + + replyp->status = ret; + return; +} + +/* BEGIN __env_close_proc */ +/* + * PUBLIC: void __env_close_proc __P((long, u_int32_t, __env_close_reply *)); + */ +void +__env_close_proc(dbenvcl_id, flags, replyp) + long dbenvcl_id; + u_int32_t flags; + __env_close_reply *replyp; +/* END __env_close_proc */ +{ + ct_entry *dbenv_ctp; + + ACTIVATE_CTP(dbenv_ctp, dbenvcl_id, CT_ENV); + replyp->status = __dbenv_close_int(dbenvcl_id, flags, 0); + return; +} + +/* BEGIN __env_create_proc */ +/* + * PUBLIC: void __env_create_proc __P((u_int32_t, __env_create_reply *)); + */ +void +__env_create_proc(timeout, replyp) + u_int32_t timeout; + __env_create_reply *replyp; +/* END __env_create_proc */ +{ + DB_ENV *dbenv; + ct_entry *ctp; + int ret; + + ctp = new_ct_ent(&replyp->status); + if (ctp == NULL) + return; + if ((ret = db_env_create(&dbenv, 0)) == 0) { + ctp->ct_envp = dbenv; + ctp->ct_type = CT_ENV; + ctp->ct_parent = NULL; + ctp->ct_envparent = ctp; + __dbsrv_settimeout(ctp, timeout); + __dbsrv_active(ctp); + replyp->envcl_id = ctp->ct_id; + } else + __dbclear_ctp(ctp); + + replyp->status = ret; + return; +} + +/* BEGIN __env_dbremove_proc */ +/* + * PUBLIC: void __env_dbremove_proc __P((long, long, char *, char *, u_int32_t, + * PUBLIC: __env_dbremove_reply *)); + */ +void +__env_dbremove_proc(dbenvcl_id, txnpcl_id, name, + subdb, flags, replyp) + long dbenvcl_id; + long txnpcl_id; + char *name; + char *subdb; + u_int32_t flags; + __env_dbremove_reply *replyp; +/* END __env_dbremove_proc */ +{ + int ret; + DB_ENV * dbenv; + ct_entry *dbenv_ctp; + DB_TXN * txnp; + ct_entry *txnp_ctp; + + ACTIVATE_CTP(dbenv_ctp, dbenvcl_id, CT_ENV); + dbenv = (DB_ENV *)dbenv_ctp->ct_anyp; + + if (txnpcl_id != 0) { + ACTIVATE_CTP(txnp_ctp, txnpcl_id, CT_TXN); + txnp = (DB_TXN *)txnp_ctp->ct_anyp; + } else + txnp = NULL; + + ret = dbenv->dbremove(dbenv, txnp, name, subdb, flags); + + replyp->status = ret; + return; +} + +/* BEGIN __env_dbrename_proc */ +/* + * PUBLIC: void __env_dbrename_proc __P((long, long, char *, char *, char *, + * PUBLIC: u_int32_t, __env_dbrename_reply *)); + */ +void +__env_dbrename_proc(dbenvcl_id, txnpcl_id, name, + subdb, newname, flags, replyp) + long dbenvcl_id; + long txnpcl_id; + char *name; + char *subdb; + char *newname; + u_int32_t flags; + __env_dbrename_reply *replyp; +/* END __env_dbrename_proc */ +{ + int ret; + DB_ENV * dbenv; + ct_entry *dbenv_ctp; + DB_TXN * txnp; + ct_entry *txnp_ctp; + + ACTIVATE_CTP(dbenv_ctp, dbenvcl_id, CT_ENV); + dbenv = (DB_ENV *)dbenv_ctp->ct_anyp; + + if (txnpcl_id != 0) { + ACTIVATE_CTP(txnp_ctp, txnpcl_id, CT_TXN); + txnp = (DB_TXN *)txnp_ctp->ct_anyp; + } else + txnp = NULL; + + ret = dbenv->dbrename(dbenv, txnp, name, subdb, newname, flags); + + replyp->status = ret; + return; +} + +/* BEGIN __env_encrypt_proc */ +/* + * PUBLIC: void __env_encrypt_proc __P((long, char *, u_int32_t, + * PUBLIC: __env_encrypt_reply *)); + */ +void +__env_encrypt_proc(dbenvcl_id, passwd, flags, replyp) + long dbenvcl_id; + char *passwd; + u_int32_t flags; + __env_encrypt_reply *replyp; +/* END __env_encrypt_proc */ +{ + int ret; + DB_ENV * dbenv; + ct_entry *dbenv_ctp; + + ACTIVATE_CTP(dbenv_ctp, dbenvcl_id, CT_ENV); + dbenv = (DB_ENV *)dbenv_ctp->ct_anyp; + + ret = dbenv->set_encrypt(dbenv, passwd, flags); + + replyp->status = ret; + return; +} + +/* BEGIN __env_flags_proc */ +/* + * PUBLIC: void __env_flags_proc __P((long, u_int32_t, u_int32_t, + * PUBLIC: __env_flags_reply *)); + */ +void +__env_flags_proc(dbenvcl_id, flags, onoff, replyp) + long dbenvcl_id; + u_int32_t flags; + u_int32_t onoff; + __env_flags_reply *replyp; +/* END __env_flags_proc */ +{ + DB_ENV *dbenv; + ct_entry *dbenv_ctp; + int ret; + + ACTIVATE_CTP(dbenv_ctp, dbenvcl_id, CT_ENV); + dbenv = (DB_ENV *)dbenv_ctp->ct_anyp; + + ret = dbenv->set_flags(dbenv, flags, onoff); + if (onoff) + dbenv_ctp->ct_envdp.onflags = flags; + else + dbenv_ctp->ct_envdp.offflags = flags; + + replyp->status = ret; + return; +} +/* BEGIN __env_open_proc */ +/* + * PUBLIC: void __env_open_proc __P((long, char *, u_int32_t, u_int32_t, + * PUBLIC: __env_open_reply *)); + */ +void +__env_open_proc(dbenvcl_id, home, flags, + mode, replyp) + long dbenvcl_id; + char *home; + u_int32_t flags; + u_int32_t mode; + __env_open_reply *replyp; +/* END __env_open_proc */ +{ + DB_ENV *dbenv; + ct_entry *dbenv_ctp, *new_ctp; + u_int32_t newflags, shareflags; + int ret; + home_entry *fullhome; + + ACTIVATE_CTP(dbenv_ctp, dbenvcl_id, CT_ENV); + dbenv = (DB_ENV *)dbenv_ctp->ct_anyp; + fullhome = get_home(home); + if (fullhome == NULL) { + ret = DB_NOSERVER_HOME; + goto out; + } + + /* + * If they are using locking do deadlock detection for them, + * internally. + */ + if ((flags & DB_INIT_LOCK) && + (ret = dbenv->set_lk_detect(dbenv, DB_LOCK_DEFAULT)) != 0) + goto out; + + if (__dbsrv_verbose) { + dbenv->set_errfile(dbenv, stderr); + dbenv->set_errpfx(dbenv, fullhome->home); + } + + /* + * Mask off flags we ignore + */ + newflags = (flags & ~DB_SERVER_FLAGMASK); + shareflags = (newflags & DB_SERVER_ENVFLAGS); + /* + * Check now whether we can share a handle for this env. + */ + replyp->envcl_id = dbenvcl_id; + if ((new_ctp = __dbsrv_shareenv(dbenv_ctp, fullhome, shareflags)) + != NULL) { + /* + * We can share, clean up old ID, set new one. + */ + if (__dbsrv_verbose) + printf("Sharing env ID %ld\n", new_ctp->ct_id); + replyp->envcl_id = new_ctp->ct_id; + ret = __dbenv_close_int(dbenvcl_id, 0, 0); + } else { + ret = dbenv->open(dbenv, fullhome->home, newflags, mode); + dbenv_ctp->ct_envdp.home = fullhome; + dbenv_ctp->ct_envdp.envflags = shareflags; + } +out: replyp->status = ret; + return; +} + +/* BEGIN __env_remove_proc */ +/* + * PUBLIC: void __env_remove_proc __P((long, char *, u_int32_t, + * PUBLIC: __env_remove_reply *)); + */ +void +__env_remove_proc(dbenvcl_id, home, flags, replyp) + long dbenvcl_id; + char *home; + u_int32_t flags; + __env_remove_reply *replyp; +/* END __env_remove_proc */ +{ + DB_ENV *dbenv; + ct_entry *dbenv_ctp; + int ret; + home_entry *fullhome; + + ACTIVATE_CTP(dbenv_ctp, dbenvcl_id, CT_ENV); + dbenv = (DB_ENV *)dbenv_ctp->ct_anyp; + + fullhome = get_home(home); + if (fullhome == NULL) { + replyp->status = DB_NOSERVER_HOME; + return; + } + + ret = dbenv->remove(dbenv, fullhome->home, flags); + __dbdel_ctp(dbenv_ctp); + replyp->status = ret; + return; +} + +/* BEGIN __txn_abort_proc */ +/* + * PUBLIC: void __txn_abort_proc __P((long, __txn_abort_reply *)); + */ +void +__txn_abort_proc(txnpcl_id, replyp) + long txnpcl_id; + __txn_abort_reply *replyp; +/* END __txn_abort_proc */ +{ + DB_TXN *txnp; + ct_entry *txnp_ctp; + int ret; + + ACTIVATE_CTP(txnp_ctp, txnpcl_id, CT_TXN); + txnp = (DB_TXN *)txnp_ctp->ct_anyp; + + ret = txnp->abort(txnp); + __dbdel_ctp(txnp_ctp); + replyp->status = ret; + return; +} + +/* BEGIN __txn_begin_proc */ +/* + * PUBLIC: void __txn_begin_proc __P((long, long, u_int32_t, + * PUBLIC: __txn_begin_reply *)); + */ +void +__txn_begin_proc(dbenvcl_id, parentcl_id, + flags, replyp) + long dbenvcl_id; + long parentcl_id; + u_int32_t flags; + __txn_begin_reply *replyp; +/* END __txn_begin_proc */ +{ + DB_ENV *dbenv; + DB_TXN *parent, *txnp; + ct_entry *ctp, *dbenv_ctp, *parent_ctp; + int ret; + + ACTIVATE_CTP(dbenv_ctp, dbenvcl_id, CT_ENV); + dbenv = (DB_ENV *)dbenv_ctp->ct_anyp; + parent_ctp = NULL; + + ctp = new_ct_ent(&replyp->status); + if (ctp == NULL) + return; + + if (parentcl_id != 0) { + ACTIVATE_CTP(parent_ctp, parentcl_id, CT_TXN); + parent = (DB_TXN *)parent_ctp->ct_anyp; + ctp->ct_activep = parent_ctp->ct_activep; + } else + parent = NULL; + + ret = dbenv->txn_begin(dbenv, parent, &txnp, flags); + if (ret == 0) { + ctp->ct_txnp = txnp; + ctp->ct_type = CT_TXN; + ctp->ct_parent = parent_ctp; + ctp->ct_envparent = dbenv_ctp; + replyp->txnidcl_id = ctp->ct_id; + __dbsrv_settimeout(ctp, dbenv_ctp->ct_timeout); + __dbsrv_active(ctp); + } else + __dbclear_ctp(ctp); + + replyp->status = ret; + return; +} + +/* BEGIN __txn_commit_proc */ +/* + * PUBLIC: void __txn_commit_proc __P((long, u_int32_t, + * PUBLIC: __txn_commit_reply *)); + */ +void +__txn_commit_proc(txnpcl_id, flags, replyp) + long txnpcl_id; + u_int32_t flags; + __txn_commit_reply *replyp; +/* END __txn_commit_proc */ +{ + DB_TXN *txnp; + ct_entry *txnp_ctp; + int ret; + + ACTIVATE_CTP(txnp_ctp, txnpcl_id, CT_TXN); + txnp = (DB_TXN *)txnp_ctp->ct_anyp; + + ret = txnp->commit(txnp, flags); + __dbdel_ctp(txnp_ctp); + + replyp->status = ret; + return; +} + +/* BEGIN __txn_discard_proc */ +/* + * PUBLIC: void __txn_discard_proc __P((long, u_int32_t, + * PUBLIC: __txn_discard_reply *)); + */ +void +__txn_discard_proc(txnpcl_id, flags, replyp) + long txnpcl_id; + u_int32_t flags; + __txn_discard_reply *replyp; +/* END __txn_discard_proc */ +{ + DB_TXN *txnp; + ct_entry *txnp_ctp; + int ret; + + ACTIVATE_CTP(txnp_ctp, txnpcl_id, CT_TXN); + txnp = (DB_TXN *)txnp_ctp->ct_anyp; + + ret = txnp->discard(txnp, flags); + __dbdel_ctp(txnp_ctp); + + replyp->status = ret; + return; +} + +/* BEGIN __txn_prepare_proc */ +/* + * PUBLIC: void __txn_prepare_proc __P((long, u_int8_t *, + * PUBLIC: __txn_prepare_reply *)); + */ +void +__txn_prepare_proc(txnpcl_id, gid, replyp) + long txnpcl_id; + u_int8_t *gid; + __txn_prepare_reply *replyp; +/* END __txn_prepare_proc */ +{ + DB_TXN *txnp; + ct_entry *txnp_ctp; + int ret; + + ACTIVATE_CTP(txnp_ctp, txnpcl_id, CT_TXN); + txnp = (DB_TXN *)txnp_ctp->ct_anyp; + + ret = txnp->prepare(txnp, gid); + replyp->status = ret; + return; +} + +/* BEGIN __txn_recover_proc */ +/* + * PUBLIC: void __txn_recover_proc __P((long, u_int32_t, u_int32_t, + * PUBLIC: __txn_recover_reply *, int *)); + */ +void +__txn_recover_proc(dbenvcl_id, count, + flags, replyp, freep) + long dbenvcl_id; + u_int32_t count; + u_int32_t flags; + __txn_recover_reply *replyp; + int * freep; +/* END __txn_recover_proc */ +{ + DB_ENV *dbenv; + DB_PREPLIST *dbprep, *p; + ct_entry *dbenv_ctp, *ctp; + long erri, i, retcount; + u_int32_t *txnidp; + int ret; + u_int8_t *gid; + + ACTIVATE_CTP(dbenv_ctp, dbenvcl_id, CT_ENV); + dbenv = (DB_ENV *)dbenv_ctp->ct_anyp; + dbprep = NULL; + *freep = 0; + + if ((ret = + __os_malloc(dbenv, count * sizeof(DB_PREPLIST), &dbprep)) != 0) + goto out; + if ((ret = + dbenv->txn_recover(dbenv, dbprep, count, &retcount, flags)) != 0) + goto out; + /* + * If there is nothing, success, but it's easy. + */ + replyp->retcount = retcount; + if (retcount == 0) { + replyp->txn.txn_val = NULL; + replyp->txn.txn_len = 0; + replyp->gid.gid_val = NULL; + replyp->gid.gid_len = 0; + } + + /* + * We have our txn list. Now we need to allocate the space for + * the txn ID array and the GID array and set them up. + */ + if ((ret = __os_calloc(dbenv, retcount, sizeof(u_int32_t), + &replyp->txn.txn_val)) != 0) + goto out; + replyp->txn.txn_len = retcount * sizeof(u_int32_t); + if ((ret = __os_calloc(dbenv, retcount, DB_XIDDATASIZE, + &replyp->gid.gid_val)) != 0) { + __os_free(dbenv, replyp->txn.txn_val); + goto out; + } + replyp->gid.gid_len = retcount * DB_XIDDATASIZE; + + /* + * Now walk through our results, creating parallel arrays + * to send back. For each entry we need to create a new + * txn ctp and then fill in the array info. + */ + i = 0; + p = dbprep; + gid = replyp->gid.gid_val; + txnidp = replyp->txn.txn_val; + while (i++ < retcount) { + ctp = new_ct_ent(&ret); + if (ret != 0) { + i--; + goto out2; + } + ctp->ct_txnp = p->txn; + ctp->ct_type = CT_TXN; + ctp->ct_parent = NULL; + ctp->ct_envparent = dbenv_ctp; + __dbsrv_settimeout(ctp, dbenv_ctp->ct_timeout); + __dbsrv_active(ctp); + + *txnidp = ctp->ct_id; + memcpy(gid, p->gid, DB_XIDDATASIZE); + + p++; + txnidp++; + gid += DB_XIDDATASIZE; + } + /* + * If we get here, we have success and we have to set freep + * so it'll get properly freed next time. + */ + *freep = 1; +out: + if (dbprep != NULL) + __os_free(dbenv, dbprep); + replyp->status = ret; + return; +out2: + /* + * We had an error in the middle of creating our new txn + * ct entries. We have to unwind all that we have done. Ugh. + */ + for (txnidp = replyp->txn.txn_val, erri = 0; + erri < i; erri++, txnidp++) { + ctp = get_tableent(*txnidp); + __dbclear_ctp(ctp); + } + __os_free(dbenv, replyp->txn.txn_val); + __os_free(dbenv, replyp->gid.gid_val); + __os_free(dbenv, dbprep); + replyp->status = ret; + return; +} + +/* BEGIN __db_bt_maxkey_proc */ +/* + * PUBLIC: void __db_bt_maxkey_proc __P((long, u_int32_t, + * PUBLIC: __db_bt_maxkey_reply *)); + */ +void +__db_bt_maxkey_proc(dbpcl_id, maxkey, replyp) + long dbpcl_id; + u_int32_t maxkey; + __db_bt_maxkey_reply *replyp; +/* END __db_bt_maxkey_proc */ +{ + DB *dbp; + ct_entry *dbp_ctp; + int ret; + + ACTIVATE_CTP(dbp_ctp, dbpcl_id, CT_DB); + dbp = (DB *)dbp_ctp->ct_anyp; + + ret = dbp->set_bt_maxkey(dbp, maxkey); + + replyp->status = ret; + return; +} + +/* BEGIN __db_associate_proc */ +/* + * PUBLIC: void __db_associate_proc __P((long, long, long, u_int32_t, + * PUBLIC: __db_associate_reply *)); + */ +void +__db_associate_proc(dbpcl_id, txnpcl_id, sdbpcl_id, + flags, replyp) + long dbpcl_id; + long txnpcl_id; + long sdbpcl_id; + u_int32_t flags; + __db_associate_reply *replyp; +/* END __db_associate_proc */ +{ + DB *dbp, *sdbp; + DB_TXN *txnp; + ct_entry *dbp_ctp, *sdbp_ctp, *txnp_ctp; + int ret; + + ACTIVATE_CTP(dbp_ctp, dbpcl_id, CT_DB); + dbp = (DB *)dbp_ctp->ct_anyp; + ACTIVATE_CTP(sdbp_ctp, sdbpcl_id, CT_DB); + sdbp = (DB *)sdbp_ctp->ct_anyp; + if (txnpcl_id != 0) { + ACTIVATE_CTP(txnp_ctp, txnpcl_id, CT_TXN); + txnp = (DB_TXN *)txnp_ctp->ct_anyp; + } else + txnp = NULL; + + + /* + * We do not support DB_CREATE for associate. Users + * can only access secondary indices on a read-only basis, + * so whatever they are looking for needs to be there already. + */ + if (flags != 0) + ret = EINVAL; + else + ret = dbp->associate(dbp, txnp, sdbp, NULL, flags); + + replyp->status = ret; + return; +} + +/* BEGIN __db_bt_minkey_proc */ +/* + * PUBLIC: void __db_bt_minkey_proc __P((long, u_int32_t, + * PUBLIC: __db_bt_minkey_reply *)); + */ +void +__db_bt_minkey_proc(dbpcl_id, minkey, replyp) + long dbpcl_id; + u_int32_t minkey; + __db_bt_minkey_reply *replyp; +/* END __db_bt_minkey_proc */ +{ + DB *dbp; + ct_entry *dbp_ctp; + int ret; + + ACTIVATE_CTP(dbp_ctp, dbpcl_id, CT_DB); + dbp = (DB *)dbp_ctp->ct_anyp; + + ret = dbp->set_bt_minkey(dbp, minkey); + + replyp->status = ret; + return; +} + +/* BEGIN __db_close_proc */ +/* + * PUBLIC: void __db_close_proc __P((long, u_int32_t, __db_close_reply *)); + */ +void +__db_close_proc(dbpcl_id, flags, replyp) + long dbpcl_id; + u_int32_t flags; + __db_close_reply *replyp; +/* END __db_close_proc */ +{ + ct_entry *dbp_ctp; + + ACTIVATE_CTP(dbp_ctp, dbpcl_id, CT_DB); + replyp->status = __db_close_int(dbpcl_id, flags); + return; +} + +/* BEGIN __db_create_proc */ +/* + * PUBLIC: void __db_create_proc __P((long, u_int32_t, __db_create_reply *)); + */ +void +__db_create_proc(dbenvcl_id, flags, replyp) + long dbenvcl_id; + u_int32_t flags; + __db_create_reply *replyp; +/* END __db_create_proc */ +{ + DB *dbp; + DB_ENV *dbenv; + ct_entry *dbenv_ctp, *dbp_ctp; + int ret; + + ACTIVATE_CTP(dbenv_ctp, dbenvcl_id, CT_ENV); + dbenv = (DB_ENV *)dbenv_ctp->ct_anyp; + + dbp_ctp = new_ct_ent(&replyp->status); + if (dbp_ctp == NULL) + return ; + /* + * We actually require env's for databases. The client should + * have caught it, but just in case. + */ + DB_ASSERT(dbenv != NULL); + if ((ret = db_create(&dbp, dbenv, flags)) == 0) { + dbp_ctp->ct_dbp = dbp; + dbp_ctp->ct_type = CT_DB; + dbp_ctp->ct_parent = dbenv_ctp; + dbp_ctp->ct_envparent = dbenv_ctp; + replyp->dbcl_id = dbp_ctp->ct_id; + } else + __dbclear_ctp(dbp_ctp); + replyp->status = ret; + return; +} + +/* BEGIN __db_del_proc */ +/* + * PUBLIC: void __db_del_proc __P((long, long, u_int32_t, u_int32_t, u_int32_t, + * PUBLIC: u_int32_t, void *, u_int32_t, u_int32_t, __db_del_reply *)); + */ +void +__db_del_proc(dbpcl_id, txnpcl_id, keydlen, + keydoff, keyulen, keyflags, keydata, + keysize, flags, replyp) + long dbpcl_id; + long txnpcl_id; + u_int32_t keydlen; + u_int32_t keydoff; + u_int32_t keyulen; + u_int32_t keyflags; + void *keydata; + u_int32_t keysize; + u_int32_t flags; + __db_del_reply *replyp; +/* END __db_del_proc */ +{ + DB *dbp; + DBT key; + DB_TXN *txnp; + ct_entry *dbp_ctp, *txnp_ctp; + int ret; + + ACTIVATE_CTP(dbp_ctp, dbpcl_id, CT_DB); + dbp = (DB *)dbp_ctp->ct_anyp; + if (txnpcl_id != 0) { + ACTIVATE_CTP(txnp_ctp, txnpcl_id, CT_TXN); + txnp = (DB_TXN *)txnp_ctp->ct_anyp; + } else + txnp = NULL; + + memset(&key, 0, sizeof(key)); + + /* Set up key DBT */ + key.dlen = keydlen; + key.ulen = keyulen; + key.doff = keydoff; + key.flags = keyflags; + key.size = keysize; + key.data = keydata; + + ret = dbp->del(dbp, txnp, &key, flags); + + replyp->status = ret; + return; +} + +/* BEGIN __db_encrypt_proc */ +/* + * PUBLIC: void __db_encrypt_proc __P((long, char *, u_int32_t, + * PUBLIC: __db_encrypt_reply *)); + */ +void +__db_encrypt_proc(dbpcl_id, passwd, flags, replyp) + long dbpcl_id; + char *passwd; + u_int32_t flags; + __db_encrypt_reply *replyp; +/* END __db_encrypt_proc */ +{ + int ret; + DB * dbp; + ct_entry *dbp_ctp; + + ACTIVATE_CTP(dbp_ctp, dbpcl_id, CT_DB); + dbp = (DB *)dbp_ctp->ct_anyp; + + ret = dbp->set_encrypt(dbp, passwd, flags); + replyp->status = ret; + return; +} + +/* BEGIN __db_extentsize_proc */ +/* + * PUBLIC: void __db_extentsize_proc __P((long, u_int32_t, + * PUBLIC: __db_extentsize_reply *)); + */ +void +__db_extentsize_proc(dbpcl_id, extentsize, replyp) + long dbpcl_id; + u_int32_t extentsize; + __db_extentsize_reply *replyp; +/* END __db_extentsize_proc */ +{ + DB *dbp; + ct_entry *dbp_ctp; + int ret; + + ACTIVATE_CTP(dbp_ctp, dbpcl_id, CT_DB); + dbp = (DB *)dbp_ctp->ct_anyp; + + ret = dbp->set_q_extentsize(dbp, extentsize); + + replyp->status = ret; + return; +} + +/* BEGIN __db_flags_proc */ +/* + * PUBLIC: void __db_flags_proc __P((long, u_int32_t, __db_flags_reply *)); + */ +void +__db_flags_proc(dbpcl_id, flags, replyp) + long dbpcl_id; + u_int32_t flags; + __db_flags_reply *replyp; +/* END __db_flags_proc */ +{ + DB *dbp; + ct_entry *dbp_ctp; + int ret; + + ACTIVATE_CTP(dbp_ctp, dbpcl_id, CT_DB); + dbp = (DB *)dbp_ctp->ct_anyp; + + ret = dbp->set_flags(dbp, flags); + dbp_ctp->ct_dbdp.setflags |= flags; + + replyp->status = ret; + return; +} + +/* BEGIN __db_get_proc */ +/* + * PUBLIC: void __db_get_proc __P((long, long, u_int32_t, u_int32_t, u_int32_t, + * PUBLIC: u_int32_t, void *, u_int32_t, u_int32_t, u_int32_t, u_int32_t, u_int32_t, void *, + * PUBLIC: u_int32_t, u_int32_t, __db_get_reply *, int *)); + */ +void +__db_get_proc(dbpcl_id, txnpcl_id, keydlen, + keydoff, keyulen, keyflags, keydata, + keysize, datadlen, datadoff, dataulen, + dataflags, datadata, datasize, flags, replyp, freep) + long dbpcl_id; + long txnpcl_id; + u_int32_t keydlen; + u_int32_t keydoff; + u_int32_t keyulen; + u_int32_t keyflags; + void *keydata; + u_int32_t keysize; + u_int32_t datadlen; + u_int32_t datadoff; + u_int32_t dataulen; + u_int32_t dataflags; + void *datadata; + u_int32_t datasize; + u_int32_t flags; + __db_get_reply *replyp; + int * freep; +/* END __db_get_proc */ +{ + DB *dbp; + DBT key, data; + DB_TXN *txnp; + ct_entry *dbp_ctp, *txnp_ctp; + int key_alloc, bulk_alloc, ret; + + ACTIVATE_CTP(dbp_ctp, dbpcl_id, CT_DB); + dbp = (DB *)dbp_ctp->ct_anyp; + if (txnpcl_id != 0) { + ACTIVATE_CTP(txnp_ctp, txnpcl_id, CT_TXN); + txnp = (DB_TXN *)txnp_ctp->ct_anyp; + } else + txnp = NULL; + + *freep = 0; + bulk_alloc = 0; + memset(&key, 0, sizeof(key)); + memset(&data, 0, sizeof(data)); + + /* Set up key and data DBT */ + key.dlen = keydlen; + key.doff = keydoff; + /* + * Ignore memory related flags on server. + */ + key.flags = DB_DBT_MALLOC; + if (keyflags & DB_DBT_PARTIAL) + key.flags |= DB_DBT_PARTIAL; + key.size = keysize; + key.ulen = keyulen; + key.data = keydata; + + data.dlen = datadlen; + data.doff = datadoff; + data.ulen = dataulen; + /* + * Ignore memory related flags on server. + */ + data.size = datasize; + data.data = datadata; + if (flags & DB_MULTIPLE) { + if (data.data == 0) { + ret = __os_umalloc(dbp->dbenv, + data.ulen, &data.data); + if (ret != 0) + goto err; + bulk_alloc = 1; + } + data.flags |= DB_DBT_USERMEM; + } else + data.flags |= DB_DBT_MALLOC; + if (dataflags & DB_DBT_PARTIAL) + data.flags |= DB_DBT_PARTIAL; + + /* Got all our stuff, now do the get */ + ret = dbp->get(dbp, txnp, &key, &data, flags); + /* + * Otherwise just status. + */ + if (ret == 0) { + /* + * XXX + * We need to xdr_free whatever we are returning, next time. + * However, DB does not allocate a new key if one was given + * and we'd be free'ing up space allocated in the request. + * So, allocate a new key/data pointer if it is the same one + * as in the request. + */ + *freep = 1; + /* + * Key + */ + key_alloc = 0; + if (key.data == keydata) { + ret = __os_umalloc(dbp->dbenv, + key.size, &replyp->keydata.keydata_val); + if (ret != 0) { + __os_ufree(dbp->dbenv, key.data); + __os_ufree(dbp->dbenv, data.data); + goto err; + } + key_alloc = 1; + memcpy(replyp->keydata.keydata_val, key.data, key.size); + } else + replyp->keydata.keydata_val = key.data; + + replyp->keydata.keydata_len = key.size; + + /* + * Data + */ + if (data.data == datadata) { + ret = __os_umalloc(dbp->dbenv, + data.size, &replyp->datadata.datadata_val); + if (ret != 0) { + __os_ufree(dbp->dbenv, key.data); + __os_ufree(dbp->dbenv, data.data); + if (key_alloc) + __os_ufree(dbp->dbenv, + replyp->keydata.keydata_val); + goto err; + } + memcpy(replyp->datadata.datadata_val, data.data, + data.size); + } else + replyp->datadata.datadata_val = data.data; + replyp->datadata.datadata_len = data.size; + } else { +err: replyp->keydata.keydata_val = NULL; + replyp->keydata.keydata_len = 0; + replyp->datadata.datadata_val = NULL; + replyp->datadata.datadata_len = 0; + *freep = 0; + if (bulk_alloc) + __os_ufree(dbp->dbenv, data.data); + } + replyp->status = ret; + return; +} + +/* BEGIN __db_h_ffactor_proc */ +/* + * PUBLIC: void __db_h_ffactor_proc __P((long, u_int32_t, + * PUBLIC: __db_h_ffactor_reply *)); + */ +void +__db_h_ffactor_proc(dbpcl_id, ffactor, replyp) + long dbpcl_id; + u_int32_t ffactor; + __db_h_ffactor_reply *replyp; +/* END __db_h_ffactor_proc */ +{ + DB *dbp; + ct_entry *dbp_ctp; + int ret; + + ACTIVATE_CTP(dbp_ctp, dbpcl_id, CT_DB); + dbp = (DB *)dbp_ctp->ct_anyp; + + ret = dbp->set_h_ffactor(dbp, ffactor); + + replyp->status = ret; + return; +} + +/* BEGIN __db_h_nelem_proc */ +/* + * PUBLIC: void __db_h_nelem_proc __P((long, u_int32_t, + * PUBLIC: __db_h_nelem_reply *)); + */ +void +__db_h_nelem_proc(dbpcl_id, nelem, replyp) + long dbpcl_id; + u_int32_t nelem; + __db_h_nelem_reply *replyp; +/* END __db_h_nelem_proc */ +{ + DB *dbp; + ct_entry *dbp_ctp; + int ret; + + ACTIVATE_CTP(dbp_ctp, dbpcl_id, CT_DB); + dbp = (DB *)dbp_ctp->ct_anyp; + + ret = dbp->set_h_nelem(dbp, nelem); + + replyp->status = ret; + return; +} + +/* BEGIN __db_key_range_proc */ +/* + * PUBLIC: void __db_key_range_proc __P((long, long, u_int32_t, u_int32_t, + * PUBLIC: u_int32_t, u_int32_t, void *, u_int32_t, u_int32_t, __db_key_range_reply *)); + */ +void +__db_key_range_proc(dbpcl_id, txnpcl_id, keydlen, + keydoff, keyulen, keyflags, keydata, + keysize, flags, replyp) + long dbpcl_id; + long txnpcl_id; + u_int32_t keydlen; + u_int32_t keydoff; + u_int32_t keyulen; + u_int32_t keyflags; + void *keydata; + u_int32_t keysize; + u_int32_t flags; + __db_key_range_reply *replyp; +/* END __db_key_range_proc */ +{ + DB *dbp; + DBT key; + DB_KEY_RANGE range; + DB_TXN *txnp; + ct_entry *dbp_ctp, *txnp_ctp; + int ret; + + ACTIVATE_CTP(dbp_ctp, dbpcl_id, CT_DB); + dbp = (DB *)dbp_ctp->ct_anyp; + if (txnpcl_id != 0) { + ACTIVATE_CTP(txnp_ctp, txnpcl_id, CT_TXN); + txnp = (DB_TXN *)txnp_ctp->ct_anyp; + } else + txnp = NULL; + + memset(&key, 0, sizeof(key)); + /* Set up key and data DBT */ + key.dlen = keydlen; + key.ulen = keyulen; + key.doff = keydoff; + key.size = keysize; + key.data = keydata; + key.flags = keyflags; + + ret = dbp->key_range(dbp, txnp, &key, &range, flags); + + replyp->status = ret; + replyp->less = range.less; + replyp->equal = range.equal; + replyp->greater = range.greater; + return; +} + +/* BEGIN __db_lorder_proc */ +/* + * PUBLIC: void __db_lorder_proc __P((long, u_int32_t, __db_lorder_reply *)); + */ +void +__db_lorder_proc(dbpcl_id, lorder, replyp) + long dbpcl_id; + u_int32_t lorder; + __db_lorder_reply *replyp; +/* END __db_lorder_proc */ +{ + DB *dbp; + ct_entry *dbp_ctp; + int ret; + + ACTIVATE_CTP(dbp_ctp, dbpcl_id, CT_DB); + dbp = (DB *)dbp_ctp->ct_anyp; + + ret = dbp->set_lorder(dbp, lorder); + + replyp->status = ret; + return; +} + +/* BEGIN __db_open_proc */ +/* + * PUBLIC: void __db_open_proc __P((long, long, char *, char *, u_int32_t, + * PUBLIC: u_int32_t, u_int32_t, __db_open_reply *)); + */ +void +__db_open_proc(dbpcl_id, txnpcl_id, name, + subdb, type, flags, mode, replyp) + long dbpcl_id; + long txnpcl_id; + char *name; + char *subdb; + u_int32_t type; + u_int32_t flags; + u_int32_t mode; + __db_open_reply *replyp; +/* END __db_open_proc */ +{ + DB *dbp; + DB_TXN *txnp; + DBTYPE dbtype; + ct_entry *dbp_ctp, *new_ctp, *txnp_ctp; + int isswapped, ret; + + ACTIVATE_CTP(dbp_ctp, dbpcl_id, CT_DB); + dbp = (DB *)dbp_ctp->ct_anyp; + + if (txnpcl_id != 0) { + ACTIVATE_CTP(txnp_ctp, txnpcl_id, CT_TXN); + txnp = (DB_TXN *)txnp_ctp->ct_anyp; + } else + txnp = NULL; + + replyp->dbcl_id = dbpcl_id; + if ((new_ctp = __dbsrv_sharedb(dbp_ctp, name, subdb, type, flags)) + != NULL) { + /* + * We can share, clean up old ID, set new one. + */ + if (__dbsrv_verbose) + printf("Sharing db ID %ld\n", new_ctp->ct_id); + replyp->dbcl_id = new_ctp->ct_id; + ret = __db_close_int(dbpcl_id, 0); + goto out; + } + ret = dbp->open(dbp, txnp, name, subdb, (DBTYPE)type, flags, mode); + if (ret == 0) { + (void)dbp->get_type(dbp, &dbtype); + replyp->type = dbtype; + /* XXX + * Tcl needs to peek at dbp->flags for DB_AM_DUP. Send + * this dbp's flags back. + */ + replyp->dbflags = (int) dbp->flags; + /* + * We need to determine the byte order of the database + * and send it back to the client. Determine it by + * the server's native order and the swapped value of + * the DB itself. + */ + (void)dbp->get_byteswapped(dbp, &isswapped); + if (__db_byteorder(NULL, 1234) == 0) { + if (isswapped == 0) + replyp->lorder = 1234; + else + replyp->lorder = 4321; + } else { + if (isswapped == 0) + replyp->lorder = 4321; + else + replyp->lorder = 1234; + } + dbp_ctp->ct_dbdp.type = dbtype; + dbp_ctp->ct_dbdp.dbflags = LF_ISSET(DB_SERVER_DBFLAGS); + if (name == NULL) + dbp_ctp->ct_dbdp.db = NULL; + else if ((ret = __os_strdup(dbp->dbenv, name, + &dbp_ctp->ct_dbdp.db)) != 0) + goto out; + if (subdb == NULL) + dbp_ctp->ct_dbdp.subdb = NULL; + else if ((ret = __os_strdup(dbp->dbenv, subdb, + &dbp_ctp->ct_dbdp.subdb)) != 0) + goto out; + } +out: + replyp->status = ret; + return; +} + +/* BEGIN __db_pagesize_proc */ +/* + * PUBLIC: void __db_pagesize_proc __P((long, u_int32_t, + * PUBLIC: __db_pagesize_reply *)); + */ +void +__db_pagesize_proc(dbpcl_id, pagesize, replyp) + long dbpcl_id; + u_int32_t pagesize; + __db_pagesize_reply *replyp; +/* END __db_pagesize_proc */ +{ + DB *dbp; + ct_entry *dbp_ctp; + int ret; + + ACTIVATE_CTP(dbp_ctp, dbpcl_id, CT_DB); + dbp = (DB *)dbp_ctp->ct_anyp; + + ret = dbp->set_pagesize(dbp, pagesize); + + replyp->status = ret; + return; +} + +/* BEGIN __db_pget_proc */ +/* + * PUBLIC: void __db_pget_proc __P((long, long, u_int32_t, u_int32_t, + * PUBLIC: u_int32_t, u_int32_t, void *, u_int32_t, u_int32_t, u_int32_t, u_int32_t, + * PUBLIC: u_int32_t, void *, u_int32_t, u_int32_t, u_int32_t, u_int32_t, u_int32_t, void *, + * PUBLIC: u_int32_t, u_int32_t, __db_pget_reply *, int *)); + */ +void +__db_pget_proc(dbpcl_id, txnpcl_id, skeydlen, + skeydoff, skeyulen, skeyflags, skeydata, + skeysize, pkeydlen, pkeydoff, pkeyulen, + pkeyflags, pkeydata, pkeysize, datadlen, + datadoff, dataulen, dataflags, datadata, + datasize, flags, replyp, freep) + long dbpcl_id; + long txnpcl_id; + u_int32_t skeydlen; + u_int32_t skeydoff; + u_int32_t skeyulen; + u_int32_t skeyflags; + void *skeydata; + u_int32_t skeysize; + u_int32_t pkeydlen; + u_int32_t pkeydoff; + u_int32_t pkeyulen; + u_int32_t pkeyflags; + void *pkeydata; + u_int32_t pkeysize; + u_int32_t datadlen; + u_int32_t datadoff; + u_int32_t dataulen; + u_int32_t dataflags; + void *datadata; + u_int32_t datasize; + u_int32_t flags; + __db_pget_reply *replyp; + int * freep; +/* END __db_pget_proc */ +{ + DB *dbp; + DBT skey, pkey, data; + DB_TXN *txnp; + ct_entry *dbp_ctp, *txnp_ctp; + int key_alloc, ret; + + ACTIVATE_CTP(dbp_ctp, dbpcl_id, CT_DB); + dbp = (DB *)dbp_ctp->ct_anyp; + if (txnpcl_id != 0) { + ACTIVATE_CTP(txnp_ctp, txnpcl_id, CT_TXN); + txnp = (DB_TXN *)txnp_ctp->ct_anyp; + } else + txnp = NULL; + + *freep = 0; + memset(&skey, 0, sizeof(skey)); + memset(&pkey, 0, sizeof(pkey)); + memset(&data, 0, sizeof(data)); + + /* + * Ignore memory related flags on server. + */ + /* Set up key and data DBT */ + skey.flags = DB_DBT_MALLOC; + skey.dlen = skeydlen; + skey.ulen = skeyulen; + skey.doff = skeydoff; + if (skeyflags & DB_DBT_PARTIAL) + skey.flags |= DB_DBT_PARTIAL; + skey.size = skeysize; + skey.data = skeydata; + + pkey.flags = DB_DBT_MALLOC; + pkey.dlen = pkeydlen; + pkey.ulen = pkeyulen; + pkey.doff = pkeydoff; + if (pkeyflags & DB_DBT_PARTIAL) + pkey.flags |= DB_DBT_PARTIAL; + pkey.size = pkeysize; + pkey.data = pkeydata; + + data.flags = DB_DBT_MALLOC; + data.dlen = datadlen; + data.ulen = dataulen; + data.doff = datadoff; + if (dataflags & DB_DBT_PARTIAL) + data.flags |= DB_DBT_PARTIAL; + data.size = datasize; + data.data = datadata; + + /* Got all our stuff, now do the get */ + ret = dbp->pget(dbp, txnp, &skey, &pkey, &data, flags); + /* + * Otherwise just status. + */ + if (ret == 0) { + /* + * XXX + * We need to xdr_free whatever we are returning, next time. + * However, DB does not allocate a new key if one was given + * and we'd be free'ing up space allocated in the request. + * So, allocate a new key/data pointer if it is the same one + * as in the request. + */ + *freep = 1; + /* + * Key + */ + key_alloc = 0; + if (skey.data == skeydata) { + ret = __os_umalloc(dbp->dbenv, + skey.size, &replyp->skeydata.skeydata_val); + if (ret != 0) { + __os_ufree(dbp->dbenv, skey.data); + __os_ufree(dbp->dbenv, pkey.data); + __os_ufree(dbp->dbenv, data.data); + goto err; + } + key_alloc = 1; + memcpy(replyp->skeydata.skeydata_val, skey.data, + skey.size); + } else + replyp->skeydata.skeydata_val = skey.data; + + replyp->skeydata.skeydata_len = skey.size; + + /* + * Primary key + */ + if (pkey.data == pkeydata) { + ret = __os_umalloc(dbp->dbenv, + pkey.size, &replyp->pkeydata.pkeydata_val); + if (ret != 0) { + __os_ufree(dbp->dbenv, skey.data); + __os_ufree(dbp->dbenv, pkey.data); + __os_ufree(dbp->dbenv, data.data); + if (key_alloc) + __os_ufree(dbp->dbenv, + replyp->skeydata.skeydata_val); + goto err; + } + /* + * We can set it to 2, because they cannot send the + * pkey over without sending the skey over too. + * So if they did send a pkey, they must have sent + * the skey as well. + */ + key_alloc = 2; + memcpy(replyp->pkeydata.pkeydata_val, pkey.data, + pkey.size); + } else + replyp->pkeydata.pkeydata_val = pkey.data; + replyp->pkeydata.pkeydata_len = pkey.size; + + /* + * Data + */ + if (data.data == datadata) { + ret = __os_umalloc(dbp->dbenv, + data.size, &replyp->datadata.datadata_val); + if (ret != 0) { + __os_ufree(dbp->dbenv, skey.data); + __os_ufree(dbp->dbenv, pkey.data); + __os_ufree(dbp->dbenv, data.data); + /* + * If key_alloc is 1, just skey needs to be + * freed, if key_alloc is 2, both skey and pkey + * need to be freed. + */ + if (key_alloc--) + __os_ufree(dbp->dbenv, + replyp->skeydata.skeydata_val); + if (key_alloc) + __os_ufree(dbp->dbenv, + replyp->pkeydata.pkeydata_val); + goto err; + } + memcpy(replyp->datadata.datadata_val, data.data, + data.size); + } else + replyp->datadata.datadata_val = data.data; + replyp->datadata.datadata_len = data.size; + } else { +err: replyp->skeydata.skeydata_val = NULL; + replyp->skeydata.skeydata_len = 0; + replyp->pkeydata.pkeydata_val = NULL; + replyp->pkeydata.pkeydata_len = 0; + replyp->datadata.datadata_val = NULL; + replyp->datadata.datadata_len = 0; + *freep = 0; + } + replyp->status = ret; + return; +} + +/* BEGIN __db_put_proc */ +/* + * PUBLIC: void __db_put_proc __P((long, long, u_int32_t, u_int32_t, u_int32_t, + * PUBLIC: u_int32_t, void *, u_int32_t, u_int32_t, u_int32_t, u_int32_t, u_int32_t, void *, + * PUBLIC: u_int32_t, u_int32_t, __db_put_reply *, int *)); + */ +void +__db_put_proc(dbpcl_id, txnpcl_id, keydlen, + keydoff, keyulen, keyflags, keydata, + keysize, datadlen, datadoff, dataulen, + dataflags, datadata, datasize, flags, replyp, freep) + long dbpcl_id; + long txnpcl_id; + u_int32_t keydlen; + u_int32_t keydoff; + u_int32_t keyulen; + u_int32_t keyflags; + void *keydata; + u_int32_t keysize; + u_int32_t datadlen; + u_int32_t datadoff; + u_int32_t dataulen; + u_int32_t dataflags; + void *datadata; + u_int32_t datasize; + u_int32_t flags; + __db_put_reply *replyp; + int * freep; +/* END __db_put_proc */ +{ + DB *dbp; + DBT key, data; + DB_TXN *txnp; + ct_entry *dbp_ctp, *txnp_ctp; + int ret; + + ACTIVATE_CTP(dbp_ctp, dbpcl_id, CT_DB); + dbp = (DB *)dbp_ctp->ct_anyp; + if (txnpcl_id != 0) { + ACTIVATE_CTP(txnp_ctp, txnpcl_id, CT_TXN); + txnp = (DB_TXN *)txnp_ctp->ct_anyp; + } else + txnp = NULL; + + *freep = 0; + memset(&key, 0, sizeof(key)); + memset(&data, 0, sizeof(data)); + + /* Set up key and data DBT */ + key.dlen = keydlen; + key.ulen = keyulen; + key.doff = keydoff; + /* + * Ignore memory related flags on server. + */ + key.flags = DB_DBT_MALLOC; + if (keyflags & DB_DBT_PARTIAL) + key.flags |= DB_DBT_PARTIAL; + key.size = keysize; + key.data = keydata; + + data.dlen = datadlen; + data.ulen = dataulen; + data.doff = datadoff; + data.flags = dataflags; + data.size = datasize; + data.data = datadata; + + /* Got all our stuff, now do the put */ + ret = dbp->put(dbp, txnp, &key, &data, flags); + /* + * If the client did a DB_APPEND, set up key in reply. + * Otherwise just status. + */ + if (ret == 0 && (flags == DB_APPEND)) { + /* + * XXX + * We need to xdr_free whatever we are returning, next time. + * However, DB does not allocate a new key if one was given + * and we'd be free'ing up space allocated in the request. + * So, allocate a new key/data pointer if it is the same one + * as in the request. + */ + *freep = 1; + /* + * Key + */ + if (key.data == keydata) { + ret = __os_umalloc(dbp->dbenv, + key.size, &replyp->keydata.keydata_val); + if (ret != 0) { + __os_ufree(dbp->dbenv, key.data); + goto err; + } + memcpy(replyp->keydata.keydata_val, key.data, key.size); + } else + replyp->keydata.keydata_val = key.data; + + replyp->keydata.keydata_len = key.size; + } else { +err: replyp->keydata.keydata_val = NULL; + replyp->keydata.keydata_len = 0; + *freep = 0; + } + replyp->status = ret; + return; +} + +/* BEGIN __db_re_delim_proc */ +/* + * PUBLIC: void __db_re_delim_proc __P((long, u_int32_t, + * PUBLIC: __db_re_delim_reply *)); + */ +void +__db_re_delim_proc(dbpcl_id, delim, replyp) + long dbpcl_id; + u_int32_t delim; + __db_re_delim_reply *replyp; +/* END __db_re_delim_proc */ +{ + DB *dbp; + ct_entry *dbp_ctp; + int ret; + + ACTIVATE_CTP(dbp_ctp, dbpcl_id, CT_DB); + dbp = (DB *)dbp_ctp->ct_anyp; + + ret = dbp->set_re_delim(dbp, delim); + + replyp->status = ret; + return; +} + +/* BEGIN __db_re_len_proc */ +/* + * PUBLIC: void __db_re_len_proc __P((long, u_int32_t, __db_re_len_reply *)); + */ +void +__db_re_len_proc(dbpcl_id, len, replyp) + long dbpcl_id; + u_int32_t len; + __db_re_len_reply *replyp; +/* END __db_re_len_proc */ +{ + DB *dbp; + ct_entry *dbp_ctp; + int ret; + + ACTIVATE_CTP(dbp_ctp, dbpcl_id, CT_DB); + dbp = (DB *)dbp_ctp->ct_anyp; + + ret = dbp->set_re_len(dbp, len); + + replyp->status = ret; + return; +} + +/* BEGIN __db_re_pad_proc */ +/* + * PUBLIC: void __db_re_pad_proc __P((long, u_int32_t, __db_re_pad_reply *)); + */ +void +__db_re_pad_proc(dbpcl_id, pad, replyp) + long dbpcl_id; + u_int32_t pad; + __db_re_pad_reply *replyp; +/* END __db_re_pad_proc */ +{ + DB *dbp; + ct_entry *dbp_ctp; + int ret; + + ACTIVATE_CTP(dbp_ctp, dbpcl_id, CT_DB); + dbp = (DB *)dbp_ctp->ct_anyp; + + ret = dbp->set_re_pad(dbp, pad); + + replyp->status = ret; + return; +} + +/* BEGIN __db_remove_proc */ +/* + * PUBLIC: void __db_remove_proc __P((long, char *, char *, u_int32_t, + * PUBLIC: __db_remove_reply *)); + */ +void +__db_remove_proc(dbpcl_id, name, subdb, + flags, replyp) + long dbpcl_id; + char *name; + char *subdb; + u_int32_t flags; + __db_remove_reply *replyp; +/* END __db_remove_proc */ +{ + DB *dbp; + ct_entry *dbp_ctp; + int ret; + + ACTIVATE_CTP(dbp_ctp, dbpcl_id, CT_DB); + dbp = (DB *)dbp_ctp->ct_anyp; + + ret = dbp->remove(dbp, name, subdb, flags); + __dbdel_ctp(dbp_ctp); + + replyp->status = ret; + return; +} + +/* BEGIN __db_rename_proc */ +/* + * PUBLIC: void __db_rename_proc __P((long, char *, char *, char *, u_int32_t, + * PUBLIC: __db_rename_reply *)); + */ +void +__db_rename_proc(dbpcl_id, name, subdb, + newname, flags, replyp) + long dbpcl_id; + char *name; + char *subdb; + char *newname; + u_int32_t flags; + __db_rename_reply *replyp; +/* END __db_rename_proc */ +{ + DB *dbp; + ct_entry *dbp_ctp; + int ret; + + ACTIVATE_CTP(dbp_ctp, dbpcl_id, CT_DB); + dbp = (DB *)dbp_ctp->ct_anyp; + + ret = dbp->rename(dbp, name, subdb, newname, flags); + __dbdel_ctp(dbp_ctp); + + replyp->status = ret; + return; +} + +/* BEGIN __db_stat_proc */ +/* + * PUBLIC: void __db_stat_proc __P((long, u_int32_t, __db_stat_reply *, + * PUBLIC: int *)); + */ +void +__db_stat_proc(dbpcl_id, flags, replyp, freep) + long dbpcl_id; + u_int32_t flags; + __db_stat_reply *replyp; + int * freep; +/* END __db_stat_proc */ +{ + DB *dbp; + DBTYPE type; + ct_entry *dbp_ctp; + u_int32_t *q, *p, *retsp; + int i, len, ret; + void *sp; + + ACTIVATE_CTP(dbp_ctp, dbpcl_id, CT_DB); + dbp = (DB *)dbp_ctp->ct_anyp; + + ret = dbp->stat(dbp, &sp, flags); + replyp->status = ret; + if (ret != 0) + return; + /* + * We get here, we have success. Allocate an array so that + * we can use the list generator. Generate the reply, free + * up the space. + */ + /* + * XXX This assumes that all elements of all stat structures + * are u_int32_t fields. They are, currently. + */ + (void)dbp->get_type(dbp, &type); + if (type == DB_HASH) + len = sizeof(DB_HASH_STAT); + else if (type == DB_QUEUE) + len = sizeof(DB_QUEUE_STAT); + else /* BTREE or RECNO are same stats */ + len = sizeof(DB_BTREE_STAT); + replyp->stats.stats_len = len / sizeof(u_int32_t); + + if ((ret = __os_umalloc(dbp->dbenv, len * replyp->stats.stats_len, + &retsp)) != 0) + goto out; + for (i = 0, q = retsp, p = sp; i < len; + i++, q++, p++) + *q = *p; + replyp->stats.stats_val = retsp; + __os_ufree(dbp->dbenv, sp); + if (ret == 0) + *freep = 1; +out: + replyp->status = ret; + return; +} + +/* BEGIN __db_sync_proc */ +/* + * PUBLIC: void __db_sync_proc __P((long, u_int32_t, __db_sync_reply *)); + */ +void +__db_sync_proc(dbpcl_id, flags, replyp) + long dbpcl_id; + u_int32_t flags; + __db_sync_reply *replyp; +/* END __db_sync_proc */ +{ + DB *dbp; + ct_entry *dbp_ctp; + int ret; + + ACTIVATE_CTP(dbp_ctp, dbpcl_id, CT_DB); + dbp = (DB *)dbp_ctp->ct_anyp; + + ret = dbp->sync(dbp, flags); + + replyp->status = ret; + return; +} + +/* BEGIN __db_truncate_proc */ +/* + * PUBLIC: void __db_truncate_proc __P((long, long, u_int32_t, + * PUBLIC: __db_truncate_reply *)); + */ +void +__db_truncate_proc(dbpcl_id, txnpcl_id, + flags, replyp) + long dbpcl_id; + long txnpcl_id; + u_int32_t flags; + __db_truncate_reply *replyp; +/* END __db_truncate_proc */ +{ + DB *dbp; + DB_TXN *txnp; + ct_entry *dbp_ctp, *txnp_ctp; + u_int32_t count; + int ret; + + ACTIVATE_CTP(dbp_ctp, dbpcl_id, CT_DB); + dbp = (DB *)dbp_ctp->ct_anyp; + if (txnpcl_id != 0) { + ACTIVATE_CTP(txnp_ctp, txnpcl_id, CT_TXN); + txnp = (DB_TXN *)txnp_ctp->ct_anyp; + } else + txnp = NULL; + + ret = dbp->truncate(dbp, txnp, &count, flags); + replyp->status = ret; + if (ret == 0) + replyp->count = count; + return; +} + +/* BEGIN __db_cursor_proc */ +/* + * PUBLIC: void __db_cursor_proc __P((long, long, u_int32_t, + * PUBLIC: __db_cursor_reply *)); + */ +void +__db_cursor_proc(dbpcl_id, txnpcl_id, + flags, replyp) + long dbpcl_id; + long txnpcl_id; + u_int32_t flags; + __db_cursor_reply *replyp; +/* END __db_cursor_proc */ +{ + DB *dbp; + DBC *dbc; + DB_TXN *txnp; + ct_entry *dbc_ctp, *env_ctp, *dbp_ctp, *txnp_ctp; + int ret; + + ACTIVATE_CTP(dbp_ctp, dbpcl_id, CT_DB); + dbp = (DB *)dbp_ctp->ct_anyp; + dbc_ctp = new_ct_ent(&replyp->status); + if (dbc_ctp == NULL) + return; + + if (txnpcl_id != 0) { + ACTIVATE_CTP(txnp_ctp, txnpcl_id, CT_TXN); + txnp = (DB_TXN *)txnp_ctp->ct_anyp; + dbc_ctp->ct_activep = txnp_ctp->ct_activep; + } else + txnp = NULL; + + if ((ret = dbp->cursor(dbp, txnp, &dbc, flags)) == 0) { + dbc_ctp->ct_dbc = dbc; + dbc_ctp->ct_type = CT_CURSOR; + dbc_ctp->ct_parent = dbp_ctp; + env_ctp = dbp_ctp->ct_envparent; + dbc_ctp->ct_envparent = env_ctp; + __dbsrv_settimeout(dbc_ctp, env_ctp->ct_timeout); + __dbsrv_active(dbc_ctp); + replyp->dbcidcl_id = dbc_ctp->ct_id; + } else + __dbclear_ctp(dbc_ctp); + + replyp->status = ret; + return; +} + +/* BEGIN __db_join_proc */ +/* + * PUBLIC: void __db_join_proc __P((long, u_int32_t *, u_int32_t, u_int32_t, + * PUBLIC: __db_join_reply *)); + */ +void +__db_join_proc(dbpcl_id, curs, curslen, + flags, replyp) + long dbpcl_id; + u_int32_t * curs; + u_int32_t curslen; + u_int32_t flags; + __db_join_reply *replyp; +/* END __db_join_proc */ +{ + DB *dbp; + DBC **jcurs, **c; + DBC *dbc; + ct_entry *dbc_ctp, *ctp, *dbp_ctp; + size_t size; + u_int32_t *cl, i; + int ret; + + ACTIVATE_CTP(dbp_ctp, dbpcl_id, CT_DB); + dbp = (DB *)dbp_ctp->ct_anyp; + + dbc_ctp = new_ct_ent(&replyp->status); + if (dbc_ctp == NULL) + return; + + size = (curslen + 1) * sizeof(DBC *); + if ((ret = __os_calloc(dbp->dbenv, + curslen + 1, sizeof(DBC *), &jcurs)) != 0) { + replyp->status = ret; + __dbclear_ctp(dbc_ctp); + return; + } + /* + * If our curslist has a parent txn, we need to use it too + * for the activity timeout. All cursors must be part of + * the same transaction, so just check the first. + */ + ctp = get_tableent(*curs); + DB_ASSERT(ctp->ct_type == CT_CURSOR); + /* + * If we are using a transaction, set the join activity timer + * to point to the parent transaction. + */ + if (ctp->ct_activep != &ctp->ct_active) + dbc_ctp->ct_activep = ctp->ct_activep; + for (i = 0, cl = curs, c = jcurs; i < curslen; i++, cl++, c++) { + ctp = get_tableent(*cl); + if (ctp == NULL) { + replyp->status = DB_NOSERVER_ID; + goto out; + } + /* + * If we are using a txn, the join cursor points to the + * transaction timeout. If we are not using a transaction, + * then all the curslist cursors must point to the join + * cursor's timeout so that we do not timeout any of the + * curlist cursors while the join cursor is active. + * Change the type of the curslist ctps to CT_JOIN so that + * we know they are part of a join list and we can distinguish + * them and later restore them when the join cursor is closed. + */ + DB_ASSERT(ctp->ct_type == CT_CURSOR); + ctp->ct_type |= CT_JOIN; + ctp->ct_origp = ctp->ct_activep; + /* + * Setting this to the ct_active field of the dbc_ctp is + * really just a way to distinguish which join dbc this + * cursor is part of. The ct_activep of this cursor is + * not used at all during its lifetime as part of a join + * cursor. + */ + ctp->ct_activep = &dbc_ctp->ct_active; + *c = ctp->ct_dbc; + } + *c = NULL; + if ((ret = dbp->join(dbp, jcurs, &dbc, flags)) == 0) { + dbc_ctp->ct_dbc = dbc; + dbc_ctp->ct_type = (CT_JOINCUR | CT_CURSOR); + dbc_ctp->ct_parent = dbp_ctp; + dbc_ctp->ct_envparent = dbp_ctp->ct_envparent; + __dbsrv_settimeout(dbc_ctp, dbp_ctp->ct_envparent->ct_timeout); + __dbsrv_active(dbc_ctp); + replyp->dbcidcl_id = dbc_ctp->ct_id; + } else { + __dbclear_ctp(dbc_ctp); + /* + * If we get an error, undo what we did above to any cursors. + */ + for (cl = curs; *cl != 0; cl++) { + ctp = get_tableent(*cl); + ctp->ct_type = CT_CURSOR; + ctp->ct_activep = ctp->ct_origp; + } + } + + replyp->status = ret; +out: + __os_free(dbp->dbenv, jcurs); + return; +} + +/* BEGIN __dbc_close_proc */ +/* + * PUBLIC: void __dbc_close_proc __P((long, __dbc_close_reply *)); + */ +void +__dbc_close_proc(dbccl_id, replyp) + long dbccl_id; + __dbc_close_reply *replyp; +/* END __dbc_close_proc */ +{ + ct_entry *dbc_ctp; + + ACTIVATE_CTP(dbc_ctp, dbccl_id, CT_CURSOR); + replyp->status = __dbc_close_int(dbc_ctp); + return; +} + +/* BEGIN __dbc_count_proc */ +/* + * PUBLIC: void __dbc_count_proc __P((long, u_int32_t, __dbc_count_reply *)); + */ +void +__dbc_count_proc(dbccl_id, flags, replyp) + long dbccl_id; + u_int32_t flags; + __dbc_count_reply *replyp; +/* END __dbc_count_proc */ +{ + DBC *dbc; + ct_entry *dbc_ctp; + db_recno_t num; + int ret; + + ACTIVATE_CTP(dbc_ctp, dbccl_id, CT_CURSOR); + dbc = (DBC *)dbc_ctp->ct_anyp; + + ret = dbc->c_count(dbc, &num, flags); + replyp->status = ret; + if (ret == 0) + replyp->dupcount = num; + return; +} + +/* BEGIN __dbc_del_proc */ +/* + * PUBLIC: void __dbc_del_proc __P((long, u_int32_t, __dbc_del_reply *)); + */ +void +__dbc_del_proc(dbccl_id, flags, replyp) + long dbccl_id; + u_int32_t flags; + __dbc_del_reply *replyp; +/* END __dbc_del_proc */ +{ + DBC *dbc; + ct_entry *dbc_ctp; + int ret; + + ACTIVATE_CTP(dbc_ctp, dbccl_id, CT_CURSOR); + dbc = (DBC *)dbc_ctp->ct_anyp; + + ret = dbc->c_del(dbc, flags); + + replyp->status = ret; + return; +} + +/* BEGIN __dbc_dup_proc */ +/* + * PUBLIC: void __dbc_dup_proc __P((long, u_int32_t, __dbc_dup_reply *)); + */ +void +__dbc_dup_proc(dbccl_id, flags, replyp) + long dbccl_id; + u_int32_t flags; + __dbc_dup_reply *replyp; +/* END __dbc_dup_proc */ +{ + DBC *dbc, *newdbc; + ct_entry *dbc_ctp, *new_ctp; + int ret; + + ACTIVATE_CTP(dbc_ctp, dbccl_id, CT_CURSOR); + dbc = (DBC *)dbc_ctp->ct_anyp; + + new_ctp = new_ct_ent(&replyp->status); + if (new_ctp == NULL) + return; + + if ((ret = dbc->c_dup(dbc, &newdbc, flags)) == 0) { + new_ctp->ct_dbc = newdbc; + new_ctp->ct_type = CT_CURSOR; + new_ctp->ct_parent = dbc_ctp->ct_parent; + new_ctp->ct_envparent = dbc_ctp->ct_envparent; + /* + * If our cursor has a parent txn, we need to use it too. + */ + if (dbc_ctp->ct_activep != &dbc_ctp->ct_active) + new_ctp->ct_activep = dbc_ctp->ct_activep; + __dbsrv_settimeout(new_ctp, dbc_ctp->ct_timeout); + __dbsrv_active(new_ctp); + replyp->dbcidcl_id = new_ctp->ct_id; + } else + __dbclear_ctp(new_ctp); + + replyp->status = ret; + return; +} + +/* BEGIN __dbc_get_proc */ +/* + * PUBLIC: void __dbc_get_proc __P((long, u_int32_t, u_int32_t, u_int32_t, + * PUBLIC: u_int32_t, void *, u_int32_t, u_int32_t, u_int32_t, u_int32_t, u_int32_t, void *, + * PUBLIC: u_int32_t, u_int32_t, __dbc_get_reply *, int *)); + */ +void +__dbc_get_proc(dbccl_id, keydlen, keydoff, + keyulen, keyflags, keydata, keysize, + datadlen, datadoff, dataulen, dataflags, + datadata, datasize, flags, replyp, freep) + long dbccl_id; + u_int32_t keydlen; + u_int32_t keydoff; + u_int32_t keyulen; + u_int32_t keyflags; + void *keydata; + u_int32_t keysize; + u_int32_t datadlen; + u_int32_t datadoff; + u_int32_t dataulen; + u_int32_t dataflags; + void *datadata; + u_int32_t datasize; + u_int32_t flags; + __dbc_get_reply *replyp; + int * freep; +/* END __dbc_get_proc */ +{ + DBC *dbc; + DBT key, data; + DB_ENV *dbenv; + ct_entry *dbc_ctp; + int key_alloc, bulk_alloc, ret; + + ACTIVATE_CTP(dbc_ctp, dbccl_id, CT_CURSOR); + dbc = (DBC *)dbc_ctp->ct_anyp; + dbenv = dbc->dbp->dbenv; + + *freep = 0; + bulk_alloc = 0; + memset(&key, 0, sizeof(key)); + memset(&data, 0, sizeof(data)); + + /* Set up key and data DBT */ + key.dlen = keydlen; + key.ulen = keyulen; + key.doff = keydoff; + /* + * Ignore memory related flags on server. + */ + key.flags = DB_DBT_MALLOC; + if (keyflags & DB_DBT_PARTIAL) + key.flags |= DB_DBT_PARTIAL; + key.size = keysize; + key.data = keydata; + + data.dlen = datadlen; + data.ulen = dataulen; + data.doff = datadoff; + data.size = datasize; + data.data = datadata; + if (flags & DB_MULTIPLE || flags & DB_MULTIPLE_KEY) { + if (data.data == 0) { + ret = __os_umalloc(dbenv, data.ulen, &data.data); + if (ret != 0) + goto err; + bulk_alloc = 1; + } + data.flags |= DB_DBT_USERMEM; + } else + data.flags |= DB_DBT_MALLOC; + if (dataflags & DB_DBT_PARTIAL) + data.flags |= DB_DBT_PARTIAL; + + /* Got all our stuff, now do the get */ + ret = dbc->c_get(dbc, &key, &data, flags); + + /* + * Otherwise just status. + */ + if (ret == 0) { + /* + * XXX + * We need to xdr_free whatever we are returning, next time. + * However, DB does not allocate a new key if one was given + * and we'd be free'ing up space allocated in the request. + * So, allocate a new key/data pointer if it is the same one + * as in the request. + */ + *freep = 1; + /* + * Key + */ + key_alloc = 0; + if (key.data == keydata) { + ret = __os_umalloc(dbenv, key.size, + &replyp->keydata.keydata_val); + if (ret != 0) { + __os_ufree(dbenv, key.data); + __os_ufree(dbenv, data.data); + goto err; + } + key_alloc = 1; + memcpy(replyp->keydata.keydata_val, key.data, key.size); + } else + replyp->keydata.keydata_val = key.data; + + replyp->keydata.keydata_len = key.size; + + /* + * Data + */ + if (data.data == datadata) { + ret = __os_umalloc(dbenv, data.size, + &replyp->datadata.datadata_val); + if (ret != 0) { + __os_ufree(dbenv, key.data); + __os_ufree(dbenv, data.data); + if (key_alloc) + __os_ufree(dbenv, replyp->keydata.keydata_val); + goto err; + } + memcpy(replyp->datadata.datadata_val, data.data, + data.size); + } else + replyp->datadata.datadata_val = data.data; + replyp->datadata.datadata_len = data.size; + } else { +err: replyp->keydata.keydata_val = NULL; + replyp->keydata.keydata_len = 0; + replyp->datadata.datadata_val = NULL; + replyp->datadata.datadata_len = 0; + *freep = 0; + if (bulk_alloc) + __os_ufree(dbenv, data.data); + } + replyp->status = ret; + return; +} + +/* BEGIN __dbc_pget_proc */ +/* + * PUBLIC: void __dbc_pget_proc __P((long, u_int32_t, u_int32_t, u_int32_t, + * PUBLIC: u_int32_t, void *, u_int32_t, u_int32_t, u_int32_t, u_int32_t, u_int32_t, void *, + * PUBLIC: u_int32_t, u_int32_t, u_int32_t, u_int32_t, u_int32_t, void *, u_int32_t, + * PUBLIC: u_int32_t, __dbc_pget_reply *, int *)); + */ +void +__dbc_pget_proc(dbccl_id, skeydlen, skeydoff, + skeyulen, skeyflags, skeydata, skeysize, + pkeydlen, pkeydoff, pkeyulen, pkeyflags, + pkeydata, pkeysize, datadlen, datadoff, + dataulen, dataflags, datadata, datasize, + flags, replyp, freep) + long dbccl_id; + u_int32_t skeydlen; + u_int32_t skeydoff; + u_int32_t skeyulen; + u_int32_t skeyflags; + void *skeydata; + u_int32_t skeysize; + u_int32_t pkeydlen; + u_int32_t pkeydoff; + u_int32_t pkeyulen; + u_int32_t pkeyflags; + void *pkeydata; + u_int32_t pkeysize; + u_int32_t datadlen; + u_int32_t datadoff; + u_int32_t dataulen; + u_int32_t dataflags; + void *datadata; + u_int32_t datasize; + u_int32_t flags; + __dbc_pget_reply *replyp; + int * freep; +/* END __dbc_pget_proc */ +{ + DBC *dbc; + DBT skey, pkey, data; + DB_ENV *dbenv; + ct_entry *dbc_ctp; + int key_alloc, ret; + + ACTIVATE_CTP(dbc_ctp, dbccl_id, CT_CURSOR); + dbc = (DBC *)dbc_ctp->ct_anyp; + dbenv = dbc->dbp->dbenv; + + *freep = 0; + memset(&skey, 0, sizeof(skey)); + memset(&pkey, 0, sizeof(pkey)); + memset(&data, 0, sizeof(data)); + + /* + * Ignore memory related flags on server. + */ + /* Set up key and data DBT */ + skey.flags = DB_DBT_MALLOC; + skey.dlen = skeydlen; + skey.ulen = skeyulen; + skey.doff = skeydoff; + if (skeyflags & DB_DBT_PARTIAL) + skey.flags |= DB_DBT_PARTIAL; + skey.size = skeysize; + skey.data = skeydata; + + pkey.flags = DB_DBT_MALLOC; + pkey.dlen = pkeydlen; + pkey.ulen = pkeyulen; + pkey.doff = pkeydoff; + if (pkeyflags & DB_DBT_PARTIAL) + pkey.flags |= DB_DBT_PARTIAL; + pkey.size = pkeysize; + pkey.data = pkeydata; + + data.flags = DB_DBT_MALLOC; + data.dlen = datadlen; + data.ulen = dataulen; + data.doff = datadoff; + if (dataflags & DB_DBT_PARTIAL) + data.flags |= DB_DBT_PARTIAL; + data.size = datasize; + data.data = datadata; + + /* Got all our stuff, now do the get */ + ret = dbc->c_pget(dbc, &skey, &pkey, &data, flags); + /* + * Otherwise just status. + */ + if (ret == 0) { + /* + * XXX + * We need to xdr_free whatever we are returning, next time. + * However, DB does not allocate a new key if one was given + * and we'd be free'ing up space allocated in the request. + * So, allocate a new key/data pointer if it is the same one + * as in the request. + */ + *freep = 1; + /* + * Key + */ + key_alloc = 0; + if (skey.data == skeydata) { + ret = __os_umalloc(dbenv, + skey.size, &replyp->skeydata.skeydata_val); + if (ret != 0) { + __os_ufree(dbenv, skey.data); + __os_ufree(dbenv, pkey.data); + __os_ufree(dbenv, data.data); + goto err; + } + key_alloc = 1; + memcpy(replyp->skeydata.skeydata_val, skey.data, + skey.size); + } else + replyp->skeydata.skeydata_val = skey.data; + replyp->skeydata.skeydata_len = skey.size; + + /* + * Primary key + */ + if (pkey.data == pkeydata) { + ret = __os_umalloc(dbenv, + pkey.size, &replyp->pkeydata.pkeydata_val); + if (ret != 0) { + __os_ufree(dbenv, skey.data); + __os_ufree(dbenv, pkey.data); + __os_ufree(dbenv, data.data); + if (key_alloc) + __os_ufree(dbenv, + replyp->skeydata.skeydata_val); + goto err; + } + /* + * We can set it to 2, because they cannot send the + * pkey over without sending the skey over too. + * So if they did send a pkey, they must have sent + * the skey as well. + */ + key_alloc = 2; + memcpy(replyp->pkeydata.pkeydata_val, pkey.data, + pkey.size); + } else + replyp->pkeydata.pkeydata_val = pkey.data; + replyp->pkeydata.pkeydata_len = pkey.size; + + /* + * Data + */ + if (data.data == datadata) { + ret = __os_umalloc(dbenv, + data.size, &replyp->datadata.datadata_val); + if (ret != 0) { + __os_ufree(dbenv, skey.data); + __os_ufree(dbenv, pkey.data); + __os_ufree(dbenv, data.data); + /* + * If key_alloc is 1, just skey needs to be + * freed, if key_alloc is 2, both skey and pkey + * need to be freed. + */ + if (key_alloc--) + __os_ufree(dbenv, + replyp->skeydata.skeydata_val); + if (key_alloc) + __os_ufree(dbenv, + replyp->pkeydata.pkeydata_val); + goto err; + } + memcpy(replyp->datadata.datadata_val, data.data, + data.size); + } else + replyp->datadata.datadata_val = data.data; + replyp->datadata.datadata_len = data.size; + } else { +err: replyp->skeydata.skeydata_val = NULL; + replyp->skeydata.skeydata_len = 0; + replyp->pkeydata.pkeydata_val = NULL; + replyp->pkeydata.pkeydata_len = 0; + replyp->datadata.datadata_val = NULL; + replyp->datadata.datadata_len = 0; + *freep = 0; + } + replyp->status = ret; + return; +} + +/* BEGIN __dbc_put_proc */ +/* + * PUBLIC: void __dbc_put_proc __P((long, u_int32_t, u_int32_t, u_int32_t, + * PUBLIC: u_int32_t, void *, u_int32_t, u_int32_t, u_int32_t, u_int32_t, u_int32_t, void *, + * PUBLIC: u_int32_t, u_int32_t, __dbc_put_reply *, int *)); + */ +void +__dbc_put_proc(dbccl_id, keydlen, keydoff, + keyulen, keyflags, keydata, keysize, + datadlen, datadoff, dataulen, dataflags, + datadata, datasize, flags, replyp, freep) + long dbccl_id; + u_int32_t keydlen; + u_int32_t keydoff; + u_int32_t keyulen; + u_int32_t keyflags; + void *keydata; + u_int32_t keysize; + u_int32_t datadlen; + u_int32_t datadoff; + u_int32_t dataulen; + u_int32_t dataflags; + void *datadata; + u_int32_t datasize; + u_int32_t flags; + __dbc_put_reply *replyp; + int * freep; +/* END __dbc_put_proc */ +{ + DB *dbp; + DBC *dbc; + DBT key, data; + ct_entry *dbc_ctp; + int ret; + + ACTIVATE_CTP(dbc_ctp, dbccl_id, CT_CURSOR); + dbc = (DBC *)dbc_ctp->ct_anyp; + dbp = (DB *)dbc_ctp->ct_parent->ct_anyp; + + memset(&key, 0, sizeof(key)); + memset(&data, 0, sizeof(data)); + + /* Set up key and data DBT */ + key.dlen = keydlen; + key.ulen = keyulen; + key.doff = keydoff; + /* + * Ignore memory related flags on server. + */ + key.flags = 0; + if (keyflags & DB_DBT_PARTIAL) + key.flags |= DB_DBT_PARTIAL; + key.size = keysize; + key.data = keydata; + + data.dlen = datadlen; + data.ulen = dataulen; + data.doff = datadoff; + data.flags = dataflags; + data.size = datasize; + data.data = datadata; + + /* Got all our stuff, now do the put */ + ret = dbc->c_put(dbc, &key, &data, flags); + + *freep = 0; + if (ret == 0 && (flags == DB_AFTER || flags == DB_BEFORE) && + dbp->type == DB_RECNO) { + /* + * We need to xdr_free whatever we are returning, next time. + */ + replyp->keydata.keydata_val = key.data; + replyp->keydata.keydata_len = key.size; + } else { + replyp->keydata.keydata_val = NULL; + replyp->keydata.keydata_len = 0; + } + replyp->status = ret; + return; +} +#endif /* HAVE_RPC */ diff --git a/db/rpc_server/c/db_server_proc.sed b/db/rpc_server/c/db_server_proc.sed new file mode 100644 index 000000000..e11b2c33c --- /dev/null +++ b/db/rpc_server/c/db_server_proc.sed @@ -0,0 +1,772 @@ +/^\/\* BEGIN __env_cachesize_proc/,/^\/\* END __env_cachesize_proc/c\ +/* BEGIN __env_cachesize_proc */\ +/*\ +\ * PUBLIC: void __env_cachesize_proc __P((long, u_int32_t, u_int32_t,\ +\ * PUBLIC: u_int32_t, __env_cachesize_reply *));\ +\ */\ +void\ +__env_cachesize_proc(dbenvcl_id, gbytes, bytes,\ +\ \ ncache, replyp)\ +\ long dbenvcl_id;\ +\ u_int32_t gbytes;\ +\ u_int32_t bytes;\ +\ u_int32_t ncache;\ +\ __env_cachesize_reply *replyp;\ +/* END __env_cachesize_proc */ +/^\/\* BEGIN __env_close_proc/,/^\/\* END __env_close_proc/c\ +/* BEGIN __env_close_proc */\ +/*\ +\ * PUBLIC: void __env_close_proc __P((long, u_int32_t, __env_close_reply *));\ +\ */\ +void\ +__env_close_proc(dbenvcl_id, flags, replyp)\ +\ long dbenvcl_id;\ +\ u_int32_t flags;\ +\ __env_close_reply *replyp;\ +/* END __env_close_proc */ +/^\/\* BEGIN __env_create_proc/,/^\/\* END __env_create_proc/c\ +/* BEGIN __env_create_proc */\ +/*\ +\ * PUBLIC: void __env_create_proc __P((u_int32_t, __env_create_reply *));\ +\ */\ +void\ +__env_create_proc(timeout, replyp)\ +\ u_int32_t timeout;\ +\ __env_create_reply *replyp;\ +/* END __env_create_proc */ +/^\/\* BEGIN __env_dbremove_proc/,/^\/\* END __env_dbremove_proc/c\ +/* BEGIN __env_dbremove_proc */\ +/*\ +\ * PUBLIC: void __env_dbremove_proc __P((long, long, char *, char *, u_int32_t,\ +\ * PUBLIC: __env_dbremove_reply *));\ +\ */\ +void\ +__env_dbremove_proc(dbenvcl_id, txnpcl_id, name,\ +\ \ subdb, flags, replyp)\ +\ long dbenvcl_id;\ +\ long txnpcl_id;\ +\ char *name;\ +\ char *subdb;\ +\ u_int32_t flags;\ +\ __env_dbremove_reply *replyp;\ +/* END __env_dbremove_proc */ +/^\/\* BEGIN __env_dbrename_proc/,/^\/\* END __env_dbrename_proc/c\ +/* BEGIN __env_dbrename_proc */\ +/*\ +\ * PUBLIC: void __env_dbrename_proc __P((long, long, char *, char *, char *,\ +\ * PUBLIC: u_int32_t, __env_dbrename_reply *));\ +\ */\ +void\ +__env_dbrename_proc(dbenvcl_id, txnpcl_id, name,\ +\ \ subdb, newname, flags, replyp)\ +\ long dbenvcl_id;\ +\ long txnpcl_id;\ +\ char *name;\ +\ char *subdb;\ +\ char *newname;\ +\ u_int32_t flags;\ +\ __env_dbrename_reply *replyp;\ +/* END __env_dbrename_proc */ +/^\/\* BEGIN __env_encrypt_proc/,/^\/\* END __env_encrypt_proc/c\ +/* BEGIN __env_encrypt_proc */\ +/*\ +\ * PUBLIC: void __env_encrypt_proc __P((long, char *, u_int32_t,\ +\ * PUBLIC: __env_encrypt_reply *));\ +\ */\ +void\ +__env_encrypt_proc(dbenvcl_id, passwd, flags, replyp)\ +\ long dbenvcl_id;\ +\ char *passwd;\ +\ u_int32_t flags;\ +\ __env_encrypt_reply *replyp;\ +/* END __env_encrypt_proc */ +/^\/\* BEGIN __env_flags_proc/,/^\/\* END __env_flags_proc/c\ +/* BEGIN __env_flags_proc */\ +/*\ +\ * PUBLIC: void __env_flags_proc __P((long, u_int32_t, u_int32_t,\ +\ * PUBLIC: __env_flags_reply *));\ +\ */\ +void\ +__env_flags_proc(dbenvcl_id, flags, onoff, replyp)\ +\ long dbenvcl_id;\ +\ u_int32_t flags;\ +\ u_int32_t onoff;\ +\ __env_flags_reply *replyp;\ +/* END __env_flags_proc */ +/^\/\* BEGIN __env_open_proc/,/^\/\* END __env_open_proc/c\ +/* BEGIN __env_open_proc */\ +/*\ +\ * PUBLIC: void __env_open_proc __P((long, char *, u_int32_t, u_int32_t,\ +\ * PUBLIC: __env_open_reply *));\ +\ */\ +void\ +__env_open_proc(dbenvcl_id, home, flags,\ +\ \ mode, replyp)\ +\ long dbenvcl_id;\ +\ char *home;\ +\ u_int32_t flags;\ +\ u_int32_t mode;\ +\ __env_open_reply *replyp;\ +/* END __env_open_proc */ +/^\/\* BEGIN __env_remove_proc/,/^\/\* END __env_remove_proc/c\ +/* BEGIN __env_remove_proc */\ +/*\ +\ * PUBLIC: void __env_remove_proc __P((long, char *, u_int32_t,\ +\ * PUBLIC: __env_remove_reply *));\ +\ */\ +void\ +__env_remove_proc(dbenvcl_id, home, flags, replyp)\ +\ long dbenvcl_id;\ +\ char *home;\ +\ u_int32_t flags;\ +\ __env_remove_reply *replyp;\ +/* END __env_remove_proc */ +/^\/\* BEGIN __txn_abort_proc/,/^\/\* END __txn_abort_proc/c\ +/* BEGIN __txn_abort_proc */\ +/*\ +\ * PUBLIC: void __txn_abort_proc __P((long, __txn_abort_reply *));\ +\ */\ +void\ +__txn_abort_proc(txnpcl_id, replyp)\ +\ long txnpcl_id;\ +\ __txn_abort_reply *replyp;\ +/* END __txn_abort_proc */ +/^\/\* BEGIN __txn_begin_proc/,/^\/\* END __txn_begin_proc/c\ +/* BEGIN __txn_begin_proc */\ +/*\ +\ * PUBLIC: void __txn_begin_proc __P((long, long, u_int32_t,\ +\ * PUBLIC: __txn_begin_reply *));\ +\ */\ +void\ +__txn_begin_proc(dbenvcl_id, parentcl_id,\ +\ \ flags, replyp)\ +\ long dbenvcl_id;\ +\ long parentcl_id;\ +\ u_int32_t flags;\ +\ __txn_begin_reply *replyp;\ +/* END __txn_begin_proc */ +/^\/\* BEGIN __txn_commit_proc/,/^\/\* END __txn_commit_proc/c\ +/* BEGIN __txn_commit_proc */\ +/*\ +\ * PUBLIC: void __txn_commit_proc __P((long, u_int32_t,\ +\ * PUBLIC: __txn_commit_reply *));\ +\ */\ +void\ +__txn_commit_proc(txnpcl_id, flags, replyp)\ +\ long txnpcl_id;\ +\ u_int32_t flags;\ +\ __txn_commit_reply *replyp;\ +/* END __txn_commit_proc */ +/^\/\* BEGIN __txn_discard_proc/,/^\/\* END __txn_discard_proc/c\ +/* BEGIN __txn_discard_proc */\ +/*\ +\ * PUBLIC: void __txn_discard_proc __P((long, u_int32_t,\ +\ * PUBLIC: __txn_discard_reply *));\ +\ */\ +void\ +__txn_discard_proc(txnpcl_id, flags, replyp)\ +\ long txnpcl_id;\ +\ u_int32_t flags;\ +\ __txn_discard_reply *replyp;\ +/* END __txn_discard_proc */ +/^\/\* BEGIN __txn_prepare_proc/,/^\/\* END __txn_prepare_proc/c\ +/* BEGIN __txn_prepare_proc */\ +/*\ +\ * PUBLIC: void __txn_prepare_proc __P((long, u_int8_t *,\ +\ * PUBLIC: __txn_prepare_reply *));\ +\ */\ +void\ +__txn_prepare_proc(txnpcl_id, gid, replyp)\ +\ long txnpcl_id;\ +\ u_int8_t *gid;\ +\ __txn_prepare_reply *replyp;\ +/* END __txn_prepare_proc */ +/^\/\* BEGIN __txn_recover_proc/,/^\/\* END __txn_recover_proc/c\ +/* BEGIN __txn_recover_proc */\ +/*\ +\ * PUBLIC: void __txn_recover_proc __P((long, u_int32_t, u_int32_t,\ +\ * PUBLIC: __txn_recover_reply *, int *));\ +\ */\ +void\ +__txn_recover_proc(dbenvcl_id, count,\ +\ \ flags, replyp, freep)\ +\ long dbenvcl_id;\ +\ u_int32_t count;\ +\ u_int32_t flags;\ +\ __txn_recover_reply *replyp;\ +\ int * freep;\ +/* END __txn_recover_proc */ +/^\/\* BEGIN __db_associate_proc/,/^\/\* END __db_associate_proc/c\ +/* BEGIN __db_associate_proc */\ +/*\ +\ * PUBLIC: void __db_associate_proc __P((long, long, long, u_int32_t,\ +\ * PUBLIC: __db_associate_reply *));\ +\ */\ +void\ +__db_associate_proc(dbpcl_id, txnpcl_id, sdbpcl_id,\ +\ \ flags, replyp)\ +\ long dbpcl_id;\ +\ long txnpcl_id;\ +\ long sdbpcl_id;\ +\ u_int32_t flags;\ +\ __db_associate_reply *replyp;\ +/* END __db_associate_proc */ +/^\/\* BEGIN __db_bt_maxkey_proc/,/^\/\* END __db_bt_maxkey_proc/c\ +/* BEGIN __db_bt_maxkey_proc */\ +/*\ +\ * PUBLIC: void __db_bt_maxkey_proc __P((long, u_int32_t,\ +\ * PUBLIC: __db_bt_maxkey_reply *));\ +\ */\ +void\ +__db_bt_maxkey_proc(dbpcl_id, maxkey, replyp)\ +\ long dbpcl_id;\ +\ u_int32_t maxkey;\ +\ __db_bt_maxkey_reply *replyp;\ +/* END __db_bt_maxkey_proc */ +/^\/\* BEGIN __db_bt_minkey_proc/,/^\/\* END __db_bt_minkey_proc/c\ +/* BEGIN __db_bt_minkey_proc */\ +/*\ +\ * PUBLIC: void __db_bt_minkey_proc __P((long, u_int32_t,\ +\ * PUBLIC: __db_bt_minkey_reply *));\ +\ */\ +void\ +__db_bt_minkey_proc(dbpcl_id, minkey, replyp)\ +\ long dbpcl_id;\ +\ u_int32_t minkey;\ +\ __db_bt_minkey_reply *replyp;\ +/* END __db_bt_minkey_proc */ +/^\/\* BEGIN __db_close_proc/,/^\/\* END __db_close_proc/c\ +/* BEGIN __db_close_proc */\ +/*\ +\ * PUBLIC: void __db_close_proc __P((long, u_int32_t, __db_close_reply *));\ +\ */\ +void\ +__db_close_proc(dbpcl_id, flags, replyp)\ +\ long dbpcl_id;\ +\ u_int32_t flags;\ +\ __db_close_reply *replyp;\ +/* END __db_close_proc */ +/^\/\* BEGIN __db_create_proc/,/^\/\* END __db_create_proc/c\ +/* BEGIN __db_create_proc */\ +/*\ +\ * PUBLIC: void __db_create_proc __P((long, u_int32_t, __db_create_reply *));\ +\ */\ +void\ +__db_create_proc(dbenvcl_id, flags, replyp)\ +\ long dbenvcl_id;\ +\ u_int32_t flags;\ +\ __db_create_reply *replyp;\ +/* END __db_create_proc */ +/^\/\* BEGIN __db_del_proc/,/^\/\* END __db_del_proc/c\ +/* BEGIN __db_del_proc */\ +/*\ +\ * PUBLIC: void __db_del_proc __P((long, long, u_int32_t, u_int32_t, u_int32_t,\ +\ * PUBLIC: u_int32_t, void *, u_int32_t, u_int32_t, __db_del_reply *));\ +\ */\ +void\ +__db_del_proc(dbpcl_id, txnpcl_id, keydlen,\ +\ \ keydoff, keyulen, keyflags, keydata,\ +\ \ keysize, flags, replyp)\ +\ long dbpcl_id;\ +\ long txnpcl_id;\ +\ u_int32_t keydlen;\ +\ u_int32_t keydoff;\ +\ u_int32_t keyulen;\ +\ u_int32_t keyflags;\ +\ void *keydata;\ +\ u_int32_t keysize;\ +\ u_int32_t flags;\ +\ __db_del_reply *replyp;\ +/* END __db_del_proc */ +/^\/\* BEGIN __db_encrypt_proc/,/^\/\* END __db_encrypt_proc/c\ +/* BEGIN __db_encrypt_proc */\ +/*\ +\ * PUBLIC: void __db_encrypt_proc __P((long, char *, u_int32_t,\ +\ * PUBLIC: __db_encrypt_reply *));\ +\ */\ +void\ +__db_encrypt_proc(dbpcl_id, passwd, flags, replyp)\ +\ long dbpcl_id;\ +\ char *passwd;\ +\ u_int32_t flags;\ +\ __db_encrypt_reply *replyp;\ +/* END __db_encrypt_proc */ +/^\/\* BEGIN __db_extentsize_proc/,/^\/\* END __db_extentsize_proc/c\ +/* BEGIN __db_extentsize_proc */\ +/*\ +\ * PUBLIC: void __db_extentsize_proc __P((long, u_int32_t,\ +\ * PUBLIC: __db_extentsize_reply *));\ +\ */\ +void\ +__db_extentsize_proc(dbpcl_id, extentsize, replyp)\ +\ long dbpcl_id;\ +\ u_int32_t extentsize;\ +\ __db_extentsize_reply *replyp;\ +/* END __db_extentsize_proc */ +/^\/\* BEGIN __db_flags_proc/,/^\/\* END __db_flags_proc/c\ +/* BEGIN __db_flags_proc */\ +/*\ +\ * PUBLIC: void __db_flags_proc __P((long, u_int32_t, __db_flags_reply *));\ +\ */\ +void\ +__db_flags_proc(dbpcl_id, flags, replyp)\ +\ long dbpcl_id;\ +\ u_int32_t flags;\ +\ __db_flags_reply *replyp;\ +/* END __db_flags_proc */ +/^\/\* BEGIN __db_get_proc/,/^\/\* END __db_get_proc/c\ +/* BEGIN __db_get_proc */\ +/*\ +\ * PUBLIC: void __db_get_proc __P((long, long, u_int32_t, u_int32_t, u_int32_t,\ +\ * PUBLIC: u_int32_t, void *, u_int32_t, u_int32_t, u_int32_t, u_int32_t, u_int32_t, void *,\ +\ * PUBLIC: u_int32_t, u_int32_t, __db_get_reply *, int *));\ +\ */\ +void\ +__db_get_proc(dbpcl_id, txnpcl_id, keydlen,\ +\ \ keydoff, keyulen, keyflags, keydata,\ +\ \ keysize, datadlen, datadoff, dataulen,\ +\ \ dataflags, datadata, datasize, flags, replyp, freep)\ +\ long dbpcl_id;\ +\ long txnpcl_id;\ +\ u_int32_t keydlen;\ +\ u_int32_t keydoff;\ +\ u_int32_t keyulen;\ +\ u_int32_t keyflags;\ +\ void *keydata;\ +\ u_int32_t keysize;\ +\ u_int32_t datadlen;\ +\ u_int32_t datadoff;\ +\ u_int32_t dataulen;\ +\ u_int32_t dataflags;\ +\ void *datadata;\ +\ u_int32_t datasize;\ +\ u_int32_t flags;\ +\ __db_get_reply *replyp;\ +\ int * freep;\ +/* END __db_get_proc */ +/^\/\* BEGIN __db_h_ffactor_proc/,/^\/\* END __db_h_ffactor_proc/c\ +/* BEGIN __db_h_ffactor_proc */\ +/*\ +\ * PUBLIC: void __db_h_ffactor_proc __P((long, u_int32_t,\ +\ * PUBLIC: __db_h_ffactor_reply *));\ +\ */\ +void\ +__db_h_ffactor_proc(dbpcl_id, ffactor, replyp)\ +\ long dbpcl_id;\ +\ u_int32_t ffactor;\ +\ __db_h_ffactor_reply *replyp;\ +/* END __db_h_ffactor_proc */ +/^\/\* BEGIN __db_h_nelem_proc/,/^\/\* END __db_h_nelem_proc/c\ +/* BEGIN __db_h_nelem_proc */\ +/*\ +\ * PUBLIC: void __db_h_nelem_proc __P((long, u_int32_t,\ +\ * PUBLIC: __db_h_nelem_reply *));\ +\ */\ +void\ +__db_h_nelem_proc(dbpcl_id, nelem, replyp)\ +\ long dbpcl_id;\ +\ u_int32_t nelem;\ +\ __db_h_nelem_reply *replyp;\ +/* END __db_h_nelem_proc */ +/^\/\* BEGIN __db_key_range_proc/,/^\/\* END __db_key_range_proc/c\ +/* BEGIN __db_key_range_proc */\ +/*\ +\ * PUBLIC: void __db_key_range_proc __P((long, long, u_int32_t, u_int32_t,\ +\ * PUBLIC: u_int32_t, u_int32_t, void *, u_int32_t, u_int32_t, __db_key_range_reply *));\ +\ */\ +void\ +__db_key_range_proc(dbpcl_id, txnpcl_id, keydlen,\ +\ \ keydoff, keyulen, keyflags, keydata,\ +\ \ keysize, flags, replyp)\ +\ long dbpcl_id;\ +\ long txnpcl_id;\ +\ u_int32_t keydlen;\ +\ u_int32_t keydoff;\ +\ u_int32_t keyulen;\ +\ u_int32_t keyflags;\ +\ void *keydata;\ +\ u_int32_t keysize;\ +\ u_int32_t flags;\ +\ __db_key_range_reply *replyp;\ +/* END __db_key_range_proc */ +/^\/\* BEGIN __db_lorder_proc/,/^\/\* END __db_lorder_proc/c\ +/* BEGIN __db_lorder_proc */\ +/*\ +\ * PUBLIC: void __db_lorder_proc __P((long, u_int32_t, __db_lorder_reply *));\ +\ */\ +void\ +__db_lorder_proc(dbpcl_id, lorder, replyp)\ +\ long dbpcl_id;\ +\ u_int32_t lorder;\ +\ __db_lorder_reply *replyp;\ +/* END __db_lorder_proc */ +/^\/\* BEGIN __db_open_proc/,/^\/\* END __db_open_proc/c\ +/* BEGIN __db_open_proc */\ +/*\ +\ * PUBLIC: void __db_open_proc __P((long, long, char *, char *, u_int32_t,\ +\ * PUBLIC: u_int32_t, u_int32_t, __db_open_reply *));\ +\ */\ +void\ +__db_open_proc(dbpcl_id, txnpcl_id, name,\ +\ \ subdb, type, flags, mode, replyp)\ +\ long dbpcl_id;\ +\ long txnpcl_id;\ +\ char *name;\ +\ char *subdb;\ +\ u_int32_t type;\ +\ u_int32_t flags;\ +\ u_int32_t mode;\ +\ __db_open_reply *replyp;\ +/* END __db_open_proc */ +/^\/\* BEGIN __db_pagesize_proc/,/^\/\* END __db_pagesize_proc/c\ +/* BEGIN __db_pagesize_proc */\ +/*\ +\ * PUBLIC: void __db_pagesize_proc __P((long, u_int32_t,\ +\ * PUBLIC: __db_pagesize_reply *));\ +\ */\ +void\ +__db_pagesize_proc(dbpcl_id, pagesize, replyp)\ +\ long dbpcl_id;\ +\ u_int32_t pagesize;\ +\ __db_pagesize_reply *replyp;\ +/* END __db_pagesize_proc */ +/^\/\* BEGIN __db_pget_proc/,/^\/\* END __db_pget_proc/c\ +/* BEGIN __db_pget_proc */\ +/*\ +\ * PUBLIC: void __db_pget_proc __P((long, long, u_int32_t, u_int32_t,\ +\ * PUBLIC: u_int32_t, u_int32_t, void *, u_int32_t, u_int32_t, u_int32_t, u_int32_t,\ +\ * PUBLIC: u_int32_t, void *, u_int32_t, u_int32_t, u_int32_t, u_int32_t, u_int32_t, void *,\ +\ * PUBLIC: u_int32_t, u_int32_t, __db_pget_reply *, int *));\ +\ */\ +void\ +__db_pget_proc(dbpcl_id, txnpcl_id, skeydlen,\ +\ \ skeydoff, skeyulen, skeyflags, skeydata,\ +\ \ skeysize, pkeydlen, pkeydoff, pkeyulen,\ +\ \ pkeyflags, pkeydata, pkeysize, datadlen,\ +\ \ datadoff, dataulen, dataflags, datadata,\ +\ \ datasize, flags, replyp, freep)\ +\ long dbpcl_id;\ +\ long txnpcl_id;\ +\ u_int32_t skeydlen;\ +\ u_int32_t skeydoff;\ +\ u_int32_t skeyulen;\ +\ u_int32_t skeyflags;\ +\ void *skeydata;\ +\ u_int32_t skeysize;\ +\ u_int32_t pkeydlen;\ +\ u_int32_t pkeydoff;\ +\ u_int32_t pkeyulen;\ +\ u_int32_t pkeyflags;\ +\ void *pkeydata;\ +\ u_int32_t pkeysize;\ +\ u_int32_t datadlen;\ +\ u_int32_t datadoff;\ +\ u_int32_t dataulen;\ +\ u_int32_t dataflags;\ +\ void *datadata;\ +\ u_int32_t datasize;\ +\ u_int32_t flags;\ +\ __db_pget_reply *replyp;\ +\ int * freep;\ +/* END __db_pget_proc */ +/^\/\* BEGIN __db_put_proc/,/^\/\* END __db_put_proc/c\ +/* BEGIN __db_put_proc */\ +/*\ +\ * PUBLIC: void __db_put_proc __P((long, long, u_int32_t, u_int32_t, u_int32_t,\ +\ * PUBLIC: u_int32_t, void *, u_int32_t, u_int32_t, u_int32_t, u_int32_t, u_int32_t, void *,\ +\ * PUBLIC: u_int32_t, u_int32_t, __db_put_reply *, int *));\ +\ */\ +void\ +__db_put_proc(dbpcl_id, txnpcl_id, keydlen,\ +\ \ keydoff, keyulen, keyflags, keydata,\ +\ \ keysize, datadlen, datadoff, dataulen,\ +\ \ dataflags, datadata, datasize, flags, replyp, freep)\ +\ long dbpcl_id;\ +\ long txnpcl_id;\ +\ u_int32_t keydlen;\ +\ u_int32_t keydoff;\ +\ u_int32_t keyulen;\ +\ u_int32_t keyflags;\ +\ void *keydata;\ +\ u_int32_t keysize;\ +\ u_int32_t datadlen;\ +\ u_int32_t datadoff;\ +\ u_int32_t dataulen;\ +\ u_int32_t dataflags;\ +\ void *datadata;\ +\ u_int32_t datasize;\ +\ u_int32_t flags;\ +\ __db_put_reply *replyp;\ +\ int * freep;\ +/* END __db_put_proc */ +/^\/\* BEGIN __db_re_delim_proc/,/^\/\* END __db_re_delim_proc/c\ +/* BEGIN __db_re_delim_proc */\ +/*\ +\ * PUBLIC: void __db_re_delim_proc __P((long, u_int32_t,\ +\ * PUBLIC: __db_re_delim_reply *));\ +\ */\ +void\ +__db_re_delim_proc(dbpcl_id, delim, replyp)\ +\ long dbpcl_id;\ +\ u_int32_t delim;\ +\ __db_re_delim_reply *replyp;\ +/* END __db_re_delim_proc */ +/^\/\* BEGIN __db_re_len_proc/,/^\/\* END __db_re_len_proc/c\ +/* BEGIN __db_re_len_proc */\ +/*\ +\ * PUBLIC: void __db_re_len_proc __P((long, u_int32_t, __db_re_len_reply *));\ +\ */\ +void\ +__db_re_len_proc(dbpcl_id, len, replyp)\ +\ long dbpcl_id;\ +\ u_int32_t len;\ +\ __db_re_len_reply *replyp;\ +/* END __db_re_len_proc */ +/^\/\* BEGIN __db_re_pad_proc/,/^\/\* END __db_re_pad_proc/c\ +/* BEGIN __db_re_pad_proc */\ +/*\ +\ * PUBLIC: void __db_re_pad_proc __P((long, u_int32_t, __db_re_pad_reply *));\ +\ */\ +void\ +__db_re_pad_proc(dbpcl_id, pad, replyp)\ +\ long dbpcl_id;\ +\ u_int32_t pad;\ +\ __db_re_pad_reply *replyp;\ +/* END __db_re_pad_proc */ +/^\/\* BEGIN __db_remove_proc/,/^\/\* END __db_remove_proc/c\ +/* BEGIN __db_remove_proc */\ +/*\ +\ * PUBLIC: void __db_remove_proc __P((long, char *, char *, u_int32_t,\ +\ * PUBLIC: __db_remove_reply *));\ +\ */\ +void\ +__db_remove_proc(dbpcl_id, name, subdb,\ +\ \ flags, replyp)\ +\ long dbpcl_id;\ +\ char *name;\ +\ char *subdb;\ +\ u_int32_t flags;\ +\ __db_remove_reply *replyp;\ +/* END __db_remove_proc */ +/^\/\* BEGIN __db_rename_proc/,/^\/\* END __db_rename_proc/c\ +/* BEGIN __db_rename_proc */\ +/*\ +\ * PUBLIC: void __db_rename_proc __P((long, char *, char *, char *, u_int32_t,\ +\ * PUBLIC: __db_rename_reply *));\ +\ */\ +void\ +__db_rename_proc(dbpcl_id, name, subdb,\ +\ \ newname, flags, replyp)\ +\ long dbpcl_id;\ +\ char *name;\ +\ char *subdb;\ +\ char *newname;\ +\ u_int32_t flags;\ +\ __db_rename_reply *replyp;\ +/* END __db_rename_proc */ +/^\/\* BEGIN __db_stat_proc/,/^\/\* END __db_stat_proc/c\ +/* BEGIN __db_stat_proc */\ +/*\ +\ * PUBLIC: void __db_stat_proc __P((long, u_int32_t, __db_stat_reply *,\ +\ * PUBLIC: int *));\ +\ */\ +void\ +__db_stat_proc(dbpcl_id, flags, replyp, freep)\ +\ long dbpcl_id;\ +\ u_int32_t flags;\ +\ __db_stat_reply *replyp;\ +\ int * freep;\ +/* END __db_stat_proc */ +/^\/\* BEGIN __db_sync_proc/,/^\/\* END __db_sync_proc/c\ +/* BEGIN __db_sync_proc */\ +/*\ +\ * PUBLIC: void __db_sync_proc __P((long, u_int32_t, __db_sync_reply *));\ +\ */\ +void\ +__db_sync_proc(dbpcl_id, flags, replyp)\ +\ long dbpcl_id;\ +\ u_int32_t flags;\ +\ __db_sync_reply *replyp;\ +/* END __db_sync_proc */ +/^\/\* BEGIN __db_truncate_proc/,/^\/\* END __db_truncate_proc/c\ +/* BEGIN __db_truncate_proc */\ +/*\ +\ * PUBLIC: void __db_truncate_proc __P((long, long, u_int32_t,\ +\ * PUBLIC: __db_truncate_reply *));\ +\ */\ +void\ +__db_truncate_proc(dbpcl_id, txnpcl_id,\ +\ \ flags, replyp)\ +\ long dbpcl_id;\ +\ long txnpcl_id;\ +\ u_int32_t flags;\ +\ __db_truncate_reply *replyp;\ +/* END __db_truncate_proc */ +/^\/\* BEGIN __db_cursor_proc/,/^\/\* END __db_cursor_proc/c\ +/* BEGIN __db_cursor_proc */\ +/*\ +\ * PUBLIC: void __db_cursor_proc __P((long, long, u_int32_t,\ +\ * PUBLIC: __db_cursor_reply *));\ +\ */\ +void\ +__db_cursor_proc(dbpcl_id, txnpcl_id,\ +\ \ flags, replyp)\ +\ long dbpcl_id;\ +\ long txnpcl_id;\ +\ u_int32_t flags;\ +\ __db_cursor_reply *replyp;\ +/* END __db_cursor_proc */ +/^\/\* BEGIN __db_join_proc/,/^\/\* END __db_join_proc/c\ +/* BEGIN __db_join_proc */\ +/*\ +\ * PUBLIC: void __db_join_proc __P((long, u_int32_t *, u_int32_t, u_int32_t,\ +\ * PUBLIC: __db_join_reply *));\ +\ */\ +void\ +__db_join_proc(dbpcl_id, curs, curslen,\ +\ \ flags, replyp)\ +\ long dbpcl_id;\ +\ u_int32_t * curs;\ +\ u_int32_t curslen;\ +\ u_int32_t flags;\ +\ __db_join_reply *replyp;\ +/* END __db_join_proc */ +/^\/\* BEGIN __dbc_close_proc/,/^\/\* END __dbc_close_proc/c\ +/* BEGIN __dbc_close_proc */\ +/*\ +\ * PUBLIC: void __dbc_close_proc __P((long, __dbc_close_reply *));\ +\ */\ +void\ +__dbc_close_proc(dbccl_id, replyp)\ +\ long dbccl_id;\ +\ __dbc_close_reply *replyp;\ +/* END __dbc_close_proc */ +/^\/\* BEGIN __dbc_count_proc/,/^\/\* END __dbc_count_proc/c\ +/* BEGIN __dbc_count_proc */\ +/*\ +\ * PUBLIC: void __dbc_count_proc __P((long, u_int32_t, __dbc_count_reply *));\ +\ */\ +void\ +__dbc_count_proc(dbccl_id, flags, replyp)\ +\ long dbccl_id;\ +\ u_int32_t flags;\ +\ __dbc_count_reply *replyp;\ +/* END __dbc_count_proc */ +/^\/\* BEGIN __dbc_del_proc/,/^\/\* END __dbc_del_proc/c\ +/* BEGIN __dbc_del_proc */\ +/*\ +\ * PUBLIC: void __dbc_del_proc __P((long, u_int32_t, __dbc_del_reply *));\ +\ */\ +void\ +__dbc_del_proc(dbccl_id, flags, replyp)\ +\ long dbccl_id;\ +\ u_int32_t flags;\ +\ __dbc_del_reply *replyp;\ +/* END __dbc_del_proc */ +/^\/\* BEGIN __dbc_dup_proc/,/^\/\* END __dbc_dup_proc/c\ +/* BEGIN __dbc_dup_proc */\ +/*\ +\ * PUBLIC: void __dbc_dup_proc __P((long, u_int32_t, __dbc_dup_reply *));\ +\ */\ +void\ +__dbc_dup_proc(dbccl_id, flags, replyp)\ +\ long dbccl_id;\ +\ u_int32_t flags;\ +\ __dbc_dup_reply *replyp;\ +/* END __dbc_dup_proc */ +/^\/\* BEGIN __dbc_get_proc/,/^\/\* END __dbc_get_proc/c\ +/* BEGIN __dbc_get_proc */\ +/*\ +\ * PUBLIC: void __dbc_get_proc __P((long, u_int32_t, u_int32_t, u_int32_t,\ +\ * PUBLIC: u_int32_t, void *, u_int32_t, u_int32_t, u_int32_t, u_int32_t, u_int32_t, void *,\ +\ * PUBLIC: u_int32_t, u_int32_t, __dbc_get_reply *, int *));\ +\ */\ +void\ +__dbc_get_proc(dbccl_id, keydlen, keydoff,\ +\ \ keyulen, keyflags, keydata, keysize,\ +\ \ datadlen, datadoff, dataulen, dataflags,\ +\ \ datadata, datasize, flags, replyp, freep)\ +\ long dbccl_id;\ +\ u_int32_t keydlen;\ +\ u_int32_t keydoff;\ +\ u_int32_t keyulen;\ +\ u_int32_t keyflags;\ +\ void *keydata;\ +\ u_int32_t keysize;\ +\ u_int32_t datadlen;\ +\ u_int32_t datadoff;\ +\ u_int32_t dataulen;\ +\ u_int32_t dataflags;\ +\ void *datadata;\ +\ u_int32_t datasize;\ +\ u_int32_t flags;\ +\ __dbc_get_reply *replyp;\ +\ int * freep;\ +/* END __dbc_get_proc */ +/^\/\* BEGIN __dbc_pget_proc/,/^\/\* END __dbc_pget_proc/c\ +/* BEGIN __dbc_pget_proc */\ +/*\ +\ * PUBLIC: void __dbc_pget_proc __P((long, u_int32_t, u_int32_t, u_int32_t,\ +\ * PUBLIC: u_int32_t, void *, u_int32_t, u_int32_t, u_int32_t, u_int32_t, u_int32_t, void *,\ +\ * PUBLIC: u_int32_t, u_int32_t, u_int32_t, u_int32_t, u_int32_t, void *, u_int32_t,\ +\ * PUBLIC: u_int32_t, __dbc_pget_reply *, int *));\ +\ */\ +void\ +__dbc_pget_proc(dbccl_id, skeydlen, skeydoff,\ +\ \ skeyulen, skeyflags, skeydata, skeysize,\ +\ \ pkeydlen, pkeydoff, pkeyulen, pkeyflags,\ +\ \ pkeydata, pkeysize, datadlen, datadoff,\ +\ \ dataulen, dataflags, datadata, datasize,\ +\ \ flags, replyp, freep)\ +\ long dbccl_id;\ +\ u_int32_t skeydlen;\ +\ u_int32_t skeydoff;\ +\ u_int32_t skeyulen;\ +\ u_int32_t skeyflags;\ +\ void *skeydata;\ +\ u_int32_t skeysize;\ +\ u_int32_t pkeydlen;\ +\ u_int32_t pkeydoff;\ +\ u_int32_t pkeyulen;\ +\ u_int32_t pkeyflags;\ +\ void *pkeydata;\ +\ u_int32_t pkeysize;\ +\ u_int32_t datadlen;\ +\ u_int32_t datadoff;\ +\ u_int32_t dataulen;\ +\ u_int32_t dataflags;\ +\ void *datadata;\ +\ u_int32_t datasize;\ +\ u_int32_t flags;\ +\ __dbc_pget_reply *replyp;\ +\ int * freep;\ +/* END __dbc_pget_proc */ +/^\/\* BEGIN __dbc_put_proc/,/^\/\* END __dbc_put_proc/c\ +/* BEGIN __dbc_put_proc */\ +/*\ +\ * PUBLIC: void __dbc_put_proc __P((long, u_int32_t, u_int32_t, u_int32_t,\ +\ * PUBLIC: u_int32_t, void *, u_int32_t, u_int32_t, u_int32_t, u_int32_t, u_int32_t, void *,\ +\ * PUBLIC: u_int32_t, u_int32_t, __dbc_put_reply *, int *));\ +\ */\ +void\ +__dbc_put_proc(dbccl_id, keydlen, keydoff,\ +\ \ keyulen, keyflags, keydata, keysize,\ +\ \ datadlen, datadoff, dataulen, dataflags,\ +\ \ datadata, datasize, flags, replyp, freep)\ +\ long dbccl_id;\ +\ u_int32_t keydlen;\ +\ u_int32_t keydoff;\ +\ u_int32_t keyulen;\ +\ u_int32_t keyflags;\ +\ void *keydata;\ +\ u_int32_t keysize;\ +\ u_int32_t datadlen;\ +\ u_int32_t datadoff;\ +\ u_int32_t dataulen;\ +\ u_int32_t dataflags;\ +\ void *datadata;\ +\ u_int32_t datasize;\ +\ u_int32_t flags;\ +\ __dbc_put_reply *replyp;\ +\ int * freep;\ +/* END __dbc_put_proc */ diff --git a/db/rpc_server/c/db_server_svc.c b/db/rpc_server/c/db_server_svc.c new file mode 100644 index 000000000..96dd959ec --- /dev/null +++ b/db/rpc_server/c/db_server_svc.c @@ -0,0 +1,435 @@ +/* + * Please do not edit this file. + * It was generated using rpcgen. + */ + +#include "db_config.h" + +#ifndef NO_SYSTEM_INCLUDES +#include <rpc/rpc.h> +#include <rpc/pmap_clnt.h> +#include <stdio.h> +#include <stdlib.h> /* getenv, exit */ +#include <memory.h> +#include <sys/socket.h> +#include <netinet/in.h> +#endif + +#include "db_int.h" +#include "dbinc_auto/db_server.h" +#include "dbinc/db_server_int.h" +#include "dbinc_auto/rpc_server_ext.h" + +#ifdef DEBUG +#define RPC_SVC_FG +#endif + +static void +db_rpc_serverprog_4001(rqstp, transp) + struct svc_req *rqstp; + register SVCXPRT *transp; +{ + union { + __env_cachesize_msg __db_env_cachesize_4001_arg; + __env_close_msg __db_env_close_4001_arg; + __env_create_msg __db_env_create_4001_arg; + __env_dbremove_msg __db_env_dbremove_4001_arg; + __env_dbrename_msg __db_env_dbrename_4001_arg; + __env_encrypt_msg __db_env_encrypt_4001_arg; + __env_flags_msg __db_env_flags_4001_arg; + __env_open_msg __db_env_open_4001_arg; + __env_remove_msg __db_env_remove_4001_arg; + __txn_abort_msg __db_txn_abort_4001_arg; + __txn_begin_msg __db_txn_begin_4001_arg; + __txn_commit_msg __db_txn_commit_4001_arg; + __txn_discard_msg __db_txn_discard_4001_arg; + __txn_prepare_msg __db_txn_prepare_4001_arg; + __txn_recover_msg __db_txn_recover_4001_arg; + __db_associate_msg __db_db_associate_4001_arg; + __db_bt_maxkey_msg __db_db_bt_maxkey_4001_arg; + __db_bt_minkey_msg __db_db_bt_minkey_4001_arg; + __db_close_msg __db_db_close_4001_arg; + __db_create_msg __db_db_create_4001_arg; + __db_del_msg __db_db_del_4001_arg; + __db_encrypt_msg __db_db_encrypt_4001_arg; + __db_extentsize_msg __db_db_extentsize_4001_arg; + __db_flags_msg __db_db_flags_4001_arg; + __db_get_msg __db_db_get_4001_arg; + __db_h_ffactor_msg __db_db_h_ffactor_4001_arg; + __db_h_nelem_msg __db_db_h_nelem_4001_arg; + __db_key_range_msg __db_db_key_range_4001_arg; + __db_lorder_msg __db_db_lorder_4001_arg; + __db_open_msg __db_db_open_4001_arg; + __db_pagesize_msg __db_db_pagesize_4001_arg; + __db_pget_msg __db_db_pget_4001_arg; + __db_put_msg __db_db_put_4001_arg; + __db_re_delim_msg __db_db_re_delim_4001_arg; + __db_re_len_msg __db_db_re_len_4001_arg; + __db_re_pad_msg __db_db_re_pad_4001_arg; + __db_remove_msg __db_db_remove_4001_arg; + __db_rename_msg __db_db_rename_4001_arg; + __db_stat_msg __db_db_stat_4001_arg; + __db_sync_msg __db_db_sync_4001_arg; + __db_truncate_msg __db_db_truncate_4001_arg; + __db_cursor_msg __db_db_cursor_4001_arg; + __db_join_msg __db_db_join_4001_arg; + __dbc_close_msg __db_dbc_close_4001_arg; + __dbc_count_msg __db_dbc_count_4001_arg; + __dbc_del_msg __db_dbc_del_4001_arg; + __dbc_dup_msg __db_dbc_dup_4001_arg; + __dbc_get_msg __db_dbc_get_4001_arg; + __dbc_pget_msg __db_dbc_pget_4001_arg; + __dbc_put_msg __db_dbc_put_4001_arg; + } argument; + char *result; + bool_t (*xdr_argument)(), (*xdr_result)(); + char *(*local)(); + + switch (rqstp->rq_proc) { + case NULLPROC: + (void) svc_sendreply(transp, (xdrproc_t)xdr_void, + (char *)NULL); + return; + + case __DB_env_cachesize: + xdr_argument = xdr___env_cachesize_msg; + xdr_result = xdr___env_cachesize_reply; + local = (char *(*)()) __db_env_cachesize_4001; + break; + + case __DB_env_close: + xdr_argument = xdr___env_close_msg; + xdr_result = xdr___env_close_reply; + local = (char *(*)()) __db_env_close_4001; + break; + + case __DB_env_create: + xdr_argument = xdr___env_create_msg; + xdr_result = xdr___env_create_reply; + local = (char *(*)()) __db_env_create_4001; + break; + + case __DB_env_dbremove: + xdr_argument = xdr___env_dbremove_msg; + xdr_result = xdr___env_dbremove_reply; + local = (char *(*)()) __db_env_dbremove_4001; + break; + + case __DB_env_dbrename: + xdr_argument = xdr___env_dbrename_msg; + xdr_result = xdr___env_dbrename_reply; + local = (char *(*)()) __db_env_dbrename_4001; + break; + + case __DB_env_encrypt: + xdr_argument = xdr___env_encrypt_msg; + xdr_result = xdr___env_encrypt_reply; + local = (char *(*)()) __db_env_encrypt_4001; + break; + + case __DB_env_flags: + xdr_argument = xdr___env_flags_msg; + xdr_result = xdr___env_flags_reply; + local = (char *(*)()) __db_env_flags_4001; + break; + + case __DB_env_open: + xdr_argument = xdr___env_open_msg; + xdr_result = xdr___env_open_reply; + local = (char *(*)()) __db_env_open_4001; + break; + + case __DB_env_remove: + xdr_argument = xdr___env_remove_msg; + xdr_result = xdr___env_remove_reply; + local = (char *(*)()) __db_env_remove_4001; + break; + + case __DB_txn_abort: + xdr_argument = xdr___txn_abort_msg; + xdr_result = xdr___txn_abort_reply; + local = (char *(*)()) __db_txn_abort_4001; + break; + + case __DB_txn_begin: + xdr_argument = xdr___txn_begin_msg; + xdr_result = xdr___txn_begin_reply; + local = (char *(*)()) __db_txn_begin_4001; + break; + + case __DB_txn_commit: + xdr_argument = xdr___txn_commit_msg; + xdr_result = xdr___txn_commit_reply; + local = (char *(*)()) __db_txn_commit_4001; + break; + + case __DB_txn_discard: + xdr_argument = xdr___txn_discard_msg; + xdr_result = xdr___txn_discard_reply; + local = (char *(*)()) __db_txn_discard_4001; + break; + + case __DB_txn_prepare: + xdr_argument = xdr___txn_prepare_msg; + xdr_result = xdr___txn_prepare_reply; + local = (char *(*)()) __db_txn_prepare_4001; + break; + + case __DB_txn_recover: + xdr_argument = xdr___txn_recover_msg; + xdr_result = xdr___txn_recover_reply; + local = (char *(*)()) __db_txn_recover_4001; + break; + + case __DB_db_associate: + xdr_argument = xdr___db_associate_msg; + xdr_result = xdr___db_associate_reply; + local = (char *(*)()) __db_db_associate_4001; + break; + + case __DB_db_bt_maxkey: + xdr_argument = xdr___db_bt_maxkey_msg; + xdr_result = xdr___db_bt_maxkey_reply; + local = (char *(*)()) __db_db_bt_maxkey_4001; + break; + + case __DB_db_bt_minkey: + xdr_argument = xdr___db_bt_minkey_msg; + xdr_result = xdr___db_bt_minkey_reply; + local = (char *(*)()) __db_db_bt_minkey_4001; + break; + + case __DB_db_close: + xdr_argument = xdr___db_close_msg; + xdr_result = xdr___db_close_reply; + local = (char *(*)()) __db_db_close_4001; + break; + + case __DB_db_create: + xdr_argument = xdr___db_create_msg; + xdr_result = xdr___db_create_reply; + local = (char *(*)()) __db_db_create_4001; + break; + + case __DB_db_del: + xdr_argument = xdr___db_del_msg; + xdr_result = xdr___db_del_reply; + local = (char *(*)()) __db_db_del_4001; + break; + + case __DB_db_encrypt: + xdr_argument = xdr___db_encrypt_msg; + xdr_result = xdr___db_encrypt_reply; + local = (char *(*)()) __db_db_encrypt_4001; + break; + + case __DB_db_extentsize: + xdr_argument = xdr___db_extentsize_msg; + xdr_result = xdr___db_extentsize_reply; + local = (char *(*)()) __db_db_extentsize_4001; + break; + + case __DB_db_flags: + xdr_argument = xdr___db_flags_msg; + xdr_result = xdr___db_flags_reply; + local = (char *(*)()) __db_db_flags_4001; + break; + + case __DB_db_get: + xdr_argument = xdr___db_get_msg; + xdr_result = xdr___db_get_reply; + local = (char *(*)()) __db_db_get_4001; + break; + + case __DB_db_h_ffactor: + xdr_argument = xdr___db_h_ffactor_msg; + xdr_result = xdr___db_h_ffactor_reply; + local = (char *(*)()) __db_db_h_ffactor_4001; + break; + + case __DB_db_h_nelem: + xdr_argument = xdr___db_h_nelem_msg; + xdr_result = xdr___db_h_nelem_reply; + local = (char *(*)()) __db_db_h_nelem_4001; + break; + + case __DB_db_key_range: + xdr_argument = xdr___db_key_range_msg; + xdr_result = xdr___db_key_range_reply; + local = (char *(*)()) __db_db_key_range_4001; + break; + + case __DB_db_lorder: + xdr_argument = xdr___db_lorder_msg; + xdr_result = xdr___db_lorder_reply; + local = (char *(*)()) __db_db_lorder_4001; + break; + + case __DB_db_open: + xdr_argument = xdr___db_open_msg; + xdr_result = xdr___db_open_reply; + local = (char *(*)()) __db_db_open_4001; + break; + + case __DB_db_pagesize: + xdr_argument = xdr___db_pagesize_msg; + xdr_result = xdr___db_pagesize_reply; + local = (char *(*)()) __db_db_pagesize_4001; + break; + + case __DB_db_pget: + xdr_argument = xdr___db_pget_msg; + xdr_result = xdr___db_pget_reply; + local = (char *(*)()) __db_db_pget_4001; + break; + + case __DB_db_put: + xdr_argument = xdr___db_put_msg; + xdr_result = xdr___db_put_reply; + local = (char *(*)()) __db_db_put_4001; + break; + + case __DB_db_re_delim: + xdr_argument = xdr___db_re_delim_msg; + xdr_result = xdr___db_re_delim_reply; + local = (char *(*)()) __db_db_re_delim_4001; + break; + + case __DB_db_re_len: + xdr_argument = xdr___db_re_len_msg; + xdr_result = xdr___db_re_len_reply; + local = (char *(*)()) __db_db_re_len_4001; + break; + + case __DB_db_re_pad: + xdr_argument = xdr___db_re_pad_msg; + xdr_result = xdr___db_re_pad_reply; + local = (char *(*)()) __db_db_re_pad_4001; + break; + + case __DB_db_remove: + xdr_argument = xdr___db_remove_msg; + xdr_result = xdr___db_remove_reply; + local = (char *(*)()) __db_db_remove_4001; + break; + + case __DB_db_rename: + xdr_argument = xdr___db_rename_msg; + xdr_result = xdr___db_rename_reply; + local = (char *(*)()) __db_db_rename_4001; + break; + + case __DB_db_stat: + xdr_argument = xdr___db_stat_msg; + xdr_result = xdr___db_stat_reply; + local = (char *(*)()) __db_db_stat_4001; + break; + + case __DB_db_sync: + xdr_argument = xdr___db_sync_msg; + xdr_result = xdr___db_sync_reply; + local = (char *(*)()) __db_db_sync_4001; + break; + + case __DB_db_truncate: + xdr_argument = xdr___db_truncate_msg; + xdr_result = xdr___db_truncate_reply; + local = (char *(*)()) __db_db_truncate_4001; + break; + + case __DB_db_cursor: + xdr_argument = xdr___db_cursor_msg; + xdr_result = xdr___db_cursor_reply; + local = (char *(*)()) __db_db_cursor_4001; + break; + + case __DB_db_join: + xdr_argument = xdr___db_join_msg; + xdr_result = xdr___db_join_reply; + local = (char *(*)()) __db_db_join_4001; + break; + + case __DB_dbc_close: + xdr_argument = xdr___dbc_close_msg; + xdr_result = xdr___dbc_close_reply; + local = (char *(*)()) __db_dbc_close_4001; + break; + + case __DB_dbc_count: + xdr_argument = xdr___dbc_count_msg; + xdr_result = xdr___dbc_count_reply; + local = (char *(*)()) __db_dbc_count_4001; + break; + + case __DB_dbc_del: + xdr_argument = xdr___dbc_del_msg; + xdr_result = xdr___dbc_del_reply; + local = (char *(*)()) __db_dbc_del_4001; + break; + + case __DB_dbc_dup: + xdr_argument = xdr___dbc_dup_msg; + xdr_result = xdr___dbc_dup_reply; + local = (char *(*)()) __db_dbc_dup_4001; + break; + + case __DB_dbc_get: + xdr_argument = xdr___dbc_get_msg; + xdr_result = xdr___dbc_get_reply; + local = (char *(*)()) __db_dbc_get_4001; + break; + + case __DB_dbc_pget: + xdr_argument = xdr___dbc_pget_msg; + xdr_result = xdr___dbc_pget_reply; + local = (char *(*)()) __db_dbc_pget_4001; + break; + + case __DB_dbc_put: + xdr_argument = xdr___dbc_put_msg; + xdr_result = xdr___dbc_put_reply; + local = (char *(*)()) __db_dbc_put_4001; + break; + + default: + svcerr_noproc(transp); + return; + } + (void) memset((char *)&argument, 0, sizeof (argument)); + if (!svc_getargs(transp, (xdrproc_t)xdr_argument, (char *)&argument)) { + svcerr_decode(transp); + return; + } + result = (*local)(&argument, rqstp); + if (result != NULL && !svc_sendreply(transp, (xdrproc_t)xdr_result, result)) { + svcerr_systemerr(transp); + } + if (!svc_freeargs(transp, (xdrproc_t)xdr_argument, (char *)&argument)) { + fprintf(stderr, "unable to free arguments"); + exit(1); + } + __dbsrv_timeout(0); + return; +} + +void __dbsrv_main() +{ + register SVCXPRT *transp; + + (void) pmap_unset(DB_RPC_SERVERPROG, DB_RPC_SERVERVERS); + + transp = svctcp_create(RPC_ANYSOCK, 0, 0); + if (transp == NULL) { + fprintf(stderr, "cannot create tcp service."); + exit(1); + } + if (!svc_register(transp, DB_RPC_SERVERPROG, DB_RPC_SERVERVERS, db_rpc_serverprog_4001, IPPROTO_TCP)) { + fprintf(stderr, "unable to register (DB_RPC_SERVERPROG, DB_RPC_SERVERVERS, tcp)."); + exit(1); + } + + svc_run(); + fprintf(stderr, "svc_run returned"); + exit(1); + /* NOTREACHED */ +} diff --git a/db/rpc_server/c/db_server_util.c b/db/rpc_server/c/db_server_util.c new file mode 100644 index 000000000..859a6b0d9 --- /dev/null +++ b/db/rpc_server/c/db_server_util.c @@ -0,0 +1,815 @@ +/*- + * See the file LICENSE for redistribution information. + * + * Copyright (c) 2000-2002 + * Sleepycat Software. All rights reserved. + */ + +#include "db_config.h" + +#ifndef lint +static const char revid[] = "Id: db_server_util.c,v 1.59 2002/03/27 04:32:50 bostic Exp "; +#endif /* not lint */ + +#ifndef NO_SYSTEM_INCLUDES +#include <sys/types.h> + +#if TIME_WITH_SYS_TIME +#include <sys/time.h> +#include <time.h> +#else +#if HAVE_SYS_TIME_H +#include <sys/time.h> +#else +#include <time.h> +#endif +#endif + +#include <rpc/rpc.h> + +#include <limits.h> +#include <signal.h> +#include <stdio.h> +#include <stdlib.h> +#include <string.h> +#include <unistd.h> +#endif +#include "dbinc_auto/db_server.h" + +#include "db_int.h" +#include "dbinc_auto/clib_ext.h" +#include "dbinc/db_server_int.h" +#include "dbinc_auto/rpc_server_ext.h" +#include "dbinc_auto/common_ext.h" + +extern int __dbsrv_main __P((void)); +static int add_home __P((char *)); +static int add_passwd __P((char *)); +static int env_recover __P((char *)); +static void __dbclear_child __P((ct_entry *)); + +static LIST_HEAD(cthead, ct_entry) __dbsrv_head; +static LIST_HEAD(homehead, home_entry) __dbsrv_home; +static long __dbsrv_defto = DB_SERVER_TIMEOUT; +static long __dbsrv_maxto = DB_SERVER_MAXTIMEOUT; +static long __dbsrv_idleto = DB_SERVER_IDLETIMEOUT; +static char *logfile = NULL; +static char *prog; + +static void usage __P((char *)); +static void version_check __P((void)); + +int __dbsrv_verbose = 0; + +int +main(argc, argv) + int argc; + char **argv; +{ + extern char *optarg; + CLIENT *cl; + int ch, ret; + char *passwd; + + prog = argv[0]; + + version_check(); + + ret = 0; + /* + * Check whether another server is running or not. There + * is a race condition where two servers could be racing to + * register with the portmapper. The goal of this check is to + * forbid running additional servers (like those started from + * the test suite) if the user is already running one. + * + * XXX + * This does not solve nor prevent two servers from being + * started at the same time and running recovery at the same + * time on the same environments. + */ + if ((cl = clnt_create("localhost", + DB_RPC_SERVERPROG, DB_RPC_SERVERVERS, "tcp")) != NULL) { + fprintf(stderr, + "%s: Berkeley DB RPC server already running.\n", prog); + clnt_destroy(cl); + return (EXIT_FAILURE); + } + + LIST_INIT(&__dbsrv_home); + while ((ch = getopt(argc, argv, "h:I:L:P:t:T:Vv")) != EOF) + switch (ch) { + case 'h': + (void)add_home(optarg); + break; + case 'I': + if (__db_getlong(NULL, prog, + optarg, 1, LONG_MAX, &__dbsrv_idleto)) + return (EXIT_FAILURE); + break; + case 'L': + logfile = optarg; + break; + case 'P': + passwd = strdup(optarg); + memset(optarg, 0, strlen(optarg)); + if (passwd == NULL) { + fprintf(stderr, "%s: strdup: %s\n", + prog, strerror(errno)); + return (EXIT_FAILURE); + } + if ((ret = add_passwd(passwd)) != 0) { + fprintf(stderr, "%s: strdup: %s\n", + prog, strerror(ret)); + return (EXIT_FAILURE); + } + break; + case 't': + if (__db_getlong(NULL, prog, + optarg, 1, LONG_MAX, &__dbsrv_defto)) + return (EXIT_FAILURE); + break; + case 'T': + if (__db_getlong(NULL, prog, + optarg, 1, LONG_MAX, &__dbsrv_maxto)) + return (EXIT_FAILURE); + break; + case 'V': + printf("%s\n", db_version(NULL, NULL, NULL)); + return (EXIT_SUCCESS); + case 'v': + __dbsrv_verbose = 1; + break; + default: + usage(prog); + } + /* + * Check default timeout against maximum timeout + */ + if (__dbsrv_defto > __dbsrv_maxto) + __dbsrv_defto = __dbsrv_maxto; + + /* + * Check default timeout against idle timeout + * It would be bad to timeout environments sooner than txns. + */ + if (__dbsrv_defto > __dbsrv_idleto) + fprintf(stderr, + "%s: WARNING: Idle timeout %ld is less than resource timeout %ld\n", + prog, __dbsrv_idleto, __dbsrv_defto); + + LIST_INIT(&__dbsrv_head); + + /* + * If a client crashes during an RPC, our reply to it + * generates a SIGPIPE. Ignore SIGPIPE so we don't exit unnecessarily. + */ +#ifdef SIGPIPE + signal(SIGPIPE, SIG_IGN); +#endif + + if (logfile != NULL && __db_util_logset("berkeley_db_svc", logfile)) + return (EXIT_FAILURE); + + /* + * Now that we are ready to start, run recovery on all the + * environments specified. + */ + if (env_recover(prog) != 0) + return (EXIT_FAILURE); + + /* + * We've done our setup, now call the generated server loop + */ + if (__dbsrv_verbose) + printf("%s: Ready to receive requests\n", prog); + __dbsrv_main(); + + /* NOTREACHED */ + abort(); +} + +static void +usage(prog) + char *prog; +{ + fprintf(stderr, "usage: %s %s\n\t%s\n", prog, + "[-Vv] [-h home] [-P passwd]", + "[-I idletimeout] [-L logfile] [-t def_timeout] [-T maxtimeout]"); + exit(EXIT_FAILURE); +} + +static void +version_check() +{ + int v_major, v_minor, v_patch; + + /* Make sure we're loaded with the right version of the DB library. */ + (void)db_version(&v_major, &v_minor, &v_patch); + if (v_major != DB_VERSION_MAJOR || + v_minor != DB_VERSION_MINOR || v_patch != DB_VERSION_PATCH) { + fprintf(stderr, + "%s: version %d.%d.%d doesn't match library version %d.%d.%d\n", + prog, DB_VERSION_MAJOR, DB_VERSION_MINOR, + DB_VERSION_PATCH, v_major, v_minor, v_patch); + exit(EXIT_FAILURE); + } +} + +/* + * PUBLIC: void __dbsrv_settimeout __P((ct_entry *, u_int32_t)); + */ +void +__dbsrv_settimeout(ctp, to) + ct_entry *ctp; + u_int32_t to; +{ + if (to > (u_int32_t)__dbsrv_maxto) + ctp->ct_timeout = __dbsrv_maxto; + else if (to <= 0) + ctp->ct_timeout = __dbsrv_defto; + else + ctp->ct_timeout = to; +} + +/* + * PUBLIC: void __dbsrv_timeout __P((int)); + */ +void +__dbsrv_timeout(force) + int force; +{ + static long to_hint = -1; + time_t t; + long to; + ct_entry *ctp, *nextctp; + + if ((t = time(NULL)) == -1) + return; + + /* + * Check hint. If hint is further in the future + * than now, no work to do. + */ + if (!force && to_hint > 0 && t < to_hint) + return; + to_hint = -1; + /* + * Timeout transactions or cursors holding DB resources. + * Do this before timing out envs to properly release resources. + * + * !!! + * We can just loop through this list looking for cursors and txns. + * We do not need to verify txn and cursor relationships at this + * point because we maintain the list in LIFO order *and* we + * maintain activity in the ultimate txn parent of any cursor + * so either everything in a txn is timing out, or nothing. + * So, since we are LIFO, we will correctly close/abort all the + * appropriate handles, in the correct order. + */ + for (ctp = LIST_FIRST(&__dbsrv_head); ctp != NULL; ctp = nextctp) { + nextctp = LIST_NEXT(ctp, entries); + switch (ctp->ct_type) { + case CT_TXN: + to = *(ctp->ct_activep) + ctp->ct_timeout; + /* TIMEOUT */ + if (to < t) { + if (__dbsrv_verbose) + printf("Timing out txn id %ld\n", + ctp->ct_id); + (void)((DB_TXN *)ctp->ct_anyp)-> + abort((DB_TXN *)ctp->ct_anyp); + __dbdel_ctp(ctp); + /* + * If we timed out an txn, we may have closed + * all sorts of ctp's. + * So start over with a guaranteed good ctp. + */ + nextctp = LIST_FIRST(&__dbsrv_head); + } else if ((to_hint > 0 && to_hint > to) || + to_hint == -1) + to_hint = to; + break; + case CT_CURSOR: + case (CT_JOINCUR | CT_CURSOR): + to = *(ctp->ct_activep) + ctp->ct_timeout; + /* TIMEOUT */ + if (to < t) { + if (__dbsrv_verbose) + printf("Timing out cursor %ld\n", + ctp->ct_id); + (void)__dbc_close_int(ctp); + /* + * Start over with a guaranteed good ctp. + */ + nextctp = LIST_FIRST(&__dbsrv_head); + } else if ((to_hint > 0 && to_hint > to) || + to_hint == -1) + to_hint = to; + break; + default: + break; + } + } + /* + * Timeout idle handles. + * If we are forcing a timeout, we'll close all env handles. + */ + for (ctp = LIST_FIRST(&__dbsrv_head); ctp != NULL; ctp = nextctp) { + nextctp = LIST_NEXT(ctp, entries); + if (ctp->ct_type != CT_ENV) + continue; + to = *(ctp->ct_activep) + ctp->ct_idle; + /* TIMEOUT */ + if (to < t || force) { + if (__dbsrv_verbose) + printf("Timing out env id %ld\n", ctp->ct_id); + (void)__dbenv_close_int(ctp->ct_id, 0, 1); + /* + * If we timed out an env, we may have closed + * all sorts of ctp's (maybe even all of them. + * So start over with a guaranteed good ctp. + */ + nextctp = LIST_FIRST(&__dbsrv_head); + } + } +} + +/* + * RECURSIVE FUNCTION. We need to clear/free any number of levels of nested + * layers. + */ +static void +__dbclear_child(parent) + ct_entry *parent; +{ + ct_entry *ctp, *nextctp; + + for (ctp = LIST_FIRST(&__dbsrv_head); ctp != NULL; + ctp = nextctp) { + nextctp = LIST_NEXT(ctp, entries); + if (ctp->ct_type == 0) + continue; + if (ctp->ct_parent == parent) { + __dbclear_child(ctp); + /* + * Need to do this here because le_next may + * have changed with the recursive call and we + * don't want to point to a removed entry. + */ + nextctp = LIST_NEXT(ctp, entries); + __dbclear_ctp(ctp); + } + } +} + +/* + * PUBLIC: void __dbclear_ctp __P((ct_entry *)); + */ +void +__dbclear_ctp(ctp) + ct_entry *ctp; +{ + LIST_REMOVE(ctp, entries); + __os_free(NULL, ctp); +} + +/* + * PUBLIC: void __dbdel_ctp __P((ct_entry *)); + */ +void +__dbdel_ctp(parent) + ct_entry *parent; +{ + __dbclear_child(parent); + __dbclear_ctp(parent); +} + +/* + * PUBLIC: ct_entry *new_ct_ent __P((int *)); + */ +ct_entry * +new_ct_ent(errp) + int *errp; +{ + time_t t; + ct_entry *ctp, *octp; + int ret; + + if ((ret = __os_malloc(NULL, sizeof(ct_entry), &ctp)) != 0) { + *errp = ret; + return (NULL); + } + memset(ctp, 0, sizeof(ct_entry)); + /* + * Get the time as ID. We may service more than one request per + * second however. If we are, then increment id value until we + * find an unused one. We insert entries in LRU fashion at the + * head of the list. So, if the first entry doesn't match, then + * we know for certain that we can use our entry. + */ + if ((t = time(NULL)) == -1) { + *errp = __os_get_errno(); + __os_free(NULL, ctp); + return (NULL); + } + octp = LIST_FIRST(&__dbsrv_head); + if (octp != NULL && octp->ct_id >= t) + t = octp->ct_id + 1; + ctp->ct_id = t; + ctp->ct_idle = __dbsrv_idleto; + ctp->ct_activep = &ctp->ct_active; + ctp->ct_origp = NULL; + ctp->ct_refcount = 1; + + LIST_INSERT_HEAD(&__dbsrv_head, ctp, entries); + return (ctp); +} + +/* + * PUBLIC: ct_entry *get_tableent __P((long)); + */ +ct_entry * +get_tableent(id) + long id; +{ + ct_entry *ctp; + + for (ctp = LIST_FIRST(&__dbsrv_head); ctp != NULL; + ctp = LIST_NEXT(ctp, entries)) + if (ctp->ct_id == id) + return (ctp); + return (NULL); +} + +/* + * PUBLIC: ct_entry *__dbsrv_sharedb __P((ct_entry *, const char *, + * PUBLIC: const char *, DBTYPE, u_int32_t)); + */ +ct_entry * +__dbsrv_sharedb(db_ctp, name, subdb, type, flags) + ct_entry *db_ctp; + const char *name, *subdb; + DBTYPE type; + u_int32_t flags; +{ + ct_entry *ctp; + + /* + * Check if we can share a db handle. Criteria for sharing are: + * If any of the non-sharable flags are set, we cannot share. + * Must be a db ctp, obviously. + * Must share the same env parent. + * Must be the same type, or current one DB_UNKNOWN. + * Must be same byteorder, or current one must not care. + * All flags must match. + * Must be same name, but don't share in-memory databases. + * Must be same subdb name. + */ + if (flags & DB_SERVER_DBNOSHARE) + return (NULL); + for (ctp = LIST_FIRST(&__dbsrv_head); ctp != NULL; + ctp = LIST_NEXT(ctp, entries)) { + /* + * Skip ourselves. + */ + if (ctp == db_ctp) + continue; + if (ctp->ct_type != CT_DB) + continue; + if (ctp->ct_envparent != db_ctp->ct_envparent) + continue; + if (type != DB_UNKNOWN && ctp->ct_dbdp.type != type) + continue; + if (ctp->ct_dbdp.dbflags != LF_ISSET(DB_SERVER_DBFLAGS)) + continue; + if (db_ctp->ct_dbdp.setflags != 0 && + ctp->ct_dbdp.setflags != db_ctp->ct_dbdp.setflags) + continue; + if (name == NULL || ctp->ct_dbdp.db == NULL || + strcmp(name, ctp->ct_dbdp.db) != 0) + continue; + if (subdb != ctp->ct_dbdp.subdb && + (subdb == NULL || ctp->ct_dbdp.subdb == NULL || + strcmp(subdb, ctp->ct_dbdp.subdb) != 0)) + continue; + /* + * If we get here, then we match. + */ + ctp->ct_refcount++; + return (ctp); + } + + return (NULL); +} + +/* + * PUBLIC: ct_entry *__dbsrv_shareenv __P((ct_entry *, home_entry *, u_int32_t)); + */ +ct_entry * +__dbsrv_shareenv(env_ctp, home, flags) + ct_entry *env_ctp; + home_entry *home; + u_int32_t flags; +{ + ct_entry *ctp; + + /* + * Check if we can share an env. Criteria for sharing are: + * Must be an env ctp, obviously. + * Must share the same home env. + * All flags must match. + */ + for (ctp = LIST_FIRST(&__dbsrv_head); ctp != NULL; + ctp = LIST_NEXT(ctp, entries)) { + /* + * Skip ourselves. + */ + if (ctp == env_ctp) + continue; + if (ctp->ct_type != CT_ENV) + continue; + if (ctp->ct_envdp.home != home) + continue; + if (ctp->ct_envdp.envflags != flags) + continue; + if (ctp->ct_envdp.onflags != env_ctp->ct_envdp.onflags) + continue; + if (ctp->ct_envdp.offflags != env_ctp->ct_envdp.offflags) + continue; + /* + * If we get here, then we match. The only thing left to + * check is the timeout. Since the server timeout set by + * the client is a hint, for sharing we'll give them the + * benefit of the doubt and grant them the longer timeout. + */ + if (ctp->ct_timeout < env_ctp->ct_timeout) + ctp->ct_timeout = env_ctp->ct_timeout; + ctp->ct_refcount++; + return (ctp); + } + + return (NULL); +} + +/* + * PUBLIC: void __dbsrv_active __P((ct_entry *)); + */ +void +__dbsrv_active(ctp) + ct_entry *ctp; +{ + time_t t; + ct_entry *envctp; + + if (ctp == NULL) + return; + if ((t = time(NULL)) == -1) + return; + *(ctp->ct_activep) = t; + if ((envctp = ctp->ct_envparent) == NULL) + return; + *(envctp->ct_activep) = t; + return; +} + +/* + * PUBLIC: int __db_close_int __P((long, u_int32_t)); + */ +int +__db_close_int(id, flags) + long id; + u_int32_t flags; +{ + DB *dbp; + int ret; + ct_entry *ctp; + + ret = 0; + ctp = get_tableent(id); + if (ctp == NULL) + return (DB_NOSERVER_ID); + DB_ASSERT(ctp->ct_type == CT_DB); + if (__dbsrv_verbose && ctp->ct_refcount != 1) + printf("Deref'ing dbp id %ld, refcount %d\n", + id, ctp->ct_refcount); + if (--ctp->ct_refcount != 0) + return (ret); + dbp = ctp->ct_dbp; + if (__dbsrv_verbose) + printf("Closing dbp id %ld\n", id); + + ret = dbp->close(dbp, flags); + __dbdel_ctp(ctp); + return (ret); +} + +/* + * PUBLIC: int __dbc_close_int __P((ct_entry *)); + */ +int +__dbc_close_int(dbc_ctp) + ct_entry *dbc_ctp; +{ + DBC *dbc; + int ret; + ct_entry *ctp; + + dbc = (DBC *)dbc_ctp->ct_anyp; + + ret = dbc->c_close(dbc); + /* + * If this cursor is a join cursor then we need to fix up the + * cursors that it was joined from so that they are independent again. + */ + if (dbc_ctp->ct_type & CT_JOINCUR) + for (ctp = LIST_FIRST(&__dbsrv_head); ctp != NULL; + ctp = LIST_NEXT(ctp, entries)) { + /* + * Test if it is a join cursor, and if it is part + * of this one. + */ + if ((ctp->ct_type & CT_JOIN) && + ctp->ct_activep == &dbc_ctp->ct_active) { + ctp->ct_type &= ~CT_JOIN; + ctp->ct_activep = ctp->ct_origp; + __dbsrv_active(ctp); + } + } + __dbclear_ctp(dbc_ctp); + return (ret); + +} + +/* + * PUBLIC: int __dbenv_close_int __P((long, u_int32_t, int)); + */ +int +__dbenv_close_int(id, flags, force) + long id; + u_int32_t flags; + int force; +{ + DB_ENV *dbenv; + int ret; + ct_entry *ctp; + + ret = 0; + ctp = get_tableent(id); + if (ctp == NULL) + return (DB_NOSERVER_ID); + DB_ASSERT(ctp->ct_type == CT_ENV); + if (__dbsrv_verbose && ctp->ct_refcount != 1) + printf("Deref'ing env id %ld, refcount %d\n", + id, ctp->ct_refcount); + /* + * If we are timing out, we need to force the close, no matter + * what the refcount. + */ + if (--ctp->ct_refcount != 0 && !force) + return (ret); + dbenv = ctp->ct_envp; + if (__dbsrv_verbose) + printf("Closing env id %ld\n", id); + + ret = dbenv->close(dbenv, flags); + __dbdel_ctp(ctp); + return (ret); +} + +static int +add_home(home) + char *home; +{ + home_entry *hp, *homep; + int ret; + + if ((ret = __os_malloc(NULL, sizeof(home_entry), &hp)) != 0) + return (ret); + if ((ret = __os_malloc(NULL, strlen(home)+1, &hp->home)) != 0) + return (ret); + memcpy(hp->home, home, strlen(home)+1); + hp->dir = home; + hp->passwd = NULL; + /* + * This loop is to remove any trailing path separators, + * to assure hp->name points to the last component. + */ + hp->name = __db_rpath(home); + *(hp->name) = '\0'; + hp->name++; + while (*(hp->name) == '\0') { + hp->name = __db_rpath(home); + *(hp->name) = '\0'; + hp->name++; + } + /* + * Now we have successfully added it. Make sure there are no + * identical names. + */ + for (homep = LIST_FIRST(&__dbsrv_home); homep != NULL; + homep = LIST_NEXT(homep, entries)) + if (strcmp(homep->name, hp->name) == 0) { + printf("Already added home name %s, at directory %s\n", + hp->name, homep->dir); + __os_free(NULL, hp->home); + __os_free(NULL, hp); + return (-1); + } + LIST_INSERT_HEAD(&__dbsrv_home, hp, entries); + if (__dbsrv_verbose) + printf("Added home %s in dir %s\n", hp->name, hp->dir); + return (0); +} + +static int +add_passwd(passwd) + char *passwd; +{ + home_entry *hp; + + /* + * We add the passwd to the last given home dir. If there + * isn't a home dir, or the most recent one already has a + * passwd, then there is a user error. + */ + hp = LIST_FIRST(&__dbsrv_home); + if (hp == NULL || hp->passwd != NULL) + return (EINVAL); + /* + * We've already strdup'ed the passwd above, so we don't need + * to malloc new space, just point to it. + */ + hp->passwd = passwd; + return (0); +} + +/* + * PUBLIC: home_entry *get_home __P((char *)); + */ +home_entry * +get_home(name) + char *name; +{ + home_entry *hp; + + for (hp = LIST_FIRST(&__dbsrv_home); hp != NULL; + hp = LIST_NEXT(hp, entries)) + if (strcmp(name, hp->name) == 0) + return (hp); + return (NULL); +} + +static int +env_recover(progname) + char *progname; +{ + DB_ENV *dbenv; + home_entry *hp; + u_int32_t flags; + int exitval, ret; + + for (hp = LIST_FIRST(&__dbsrv_home); hp != NULL; + hp = LIST_NEXT(hp, entries)) { + exitval = 0; + if ((ret = db_env_create(&dbenv, 0)) != 0) { + fprintf(stderr, "%s: db_env_create: %s\n", + progname, db_strerror(ret)); + exit(EXIT_FAILURE); + } + if (__dbsrv_verbose == 1) { + (void)dbenv->set_verbose(dbenv, DB_VERB_RECOVERY, 1); + (void)dbenv->set_verbose(dbenv, DB_VERB_CHKPOINT, 1); + } + dbenv->set_errfile(dbenv, stderr); + dbenv->set_errpfx(dbenv, progname); + if (hp->passwd != NULL) + (void)dbenv->set_encrypt(dbenv, hp->passwd, + DB_ENCRYPT_AES); + + /* + * Initialize the env with DB_RECOVER. That is all we + * have to do to run recovery. + */ + if (__dbsrv_verbose) + printf("Running recovery on %s\n", hp->home); + flags = DB_CREATE | DB_INIT_LOCK | DB_INIT_LOG | DB_INIT_MPOOL | + DB_INIT_TXN | DB_USE_ENVIRON | DB_RECOVER; + if ((ret = dbenv->open(dbenv, hp->home, flags, 0)) != 0) { + dbenv->err(dbenv, ret, "DB_ENV->open"); + goto error; + } + + if (0) { +error: exitval = 1; + } + if ((ret = dbenv->close(dbenv, 0)) != 0) { + exitval = 1; + fprintf(stderr, "%s: dbenv->close: %s\n", + progname, db_strerror(ret)); + } + if (exitval) + return (exitval); + } + return (0); +} diff --git a/db/rpc_server/c/db_server_xdr.c b/db/rpc_server/c/db_server_xdr.c new file mode 100644 index 000000000..3c89ed092 --- /dev/null +++ b/db/rpc_server/c/db_server_xdr.c @@ -0,0 +1,1510 @@ +#include "db_config.h" + +#ifdef HAVE_RPC +/* + * Please do not edit this file. + * It was generated using rpcgen. + */ + +#ifndef NO_SYSTEM_INCLUDES +#include <rpc/rpc.h> +#endif + +#include "db_int.h" +#include "dbinc_auto/db_server.h" + +bool_t +xdr___env_cachesize_msg(xdrs, objp) + register XDR *xdrs; + __env_cachesize_msg *objp; +{ + + if (!xdr_u_int(xdrs, &objp->dbenvcl_id)) + return (FALSE); + if (!xdr_u_int(xdrs, &objp->gbytes)) + return (FALSE); + if (!xdr_u_int(xdrs, &objp->bytes)) + return (FALSE); + if (!xdr_u_int(xdrs, &objp->ncache)) + return (FALSE); + return (TRUE); +} + +bool_t +xdr___env_cachesize_reply(xdrs, objp) + register XDR *xdrs; + __env_cachesize_reply *objp; +{ + + if (!xdr_int(xdrs, &objp->status)) + return (FALSE); + return (TRUE); +} + +bool_t +xdr___env_close_msg(xdrs, objp) + register XDR *xdrs; + __env_close_msg *objp; +{ + + if (!xdr_u_int(xdrs, &objp->dbenvcl_id)) + return (FALSE); + if (!xdr_u_int(xdrs, &objp->flags)) + return (FALSE); + return (TRUE); +} + +bool_t +xdr___env_close_reply(xdrs, objp) + register XDR *xdrs; + __env_close_reply *objp; +{ + + if (!xdr_int(xdrs, &objp->status)) + return (FALSE); + return (TRUE); +} + +bool_t +xdr___env_create_msg(xdrs, objp) + register XDR *xdrs; + __env_create_msg *objp; +{ + + if (!xdr_u_int(xdrs, &objp->timeout)) + return (FALSE); + return (TRUE); +} + +bool_t +xdr___env_create_reply(xdrs, objp) + register XDR *xdrs; + __env_create_reply *objp; +{ + + if (!xdr_int(xdrs, &objp->status)) + return (FALSE); + if (!xdr_u_int(xdrs, &objp->envcl_id)) + return (FALSE); + return (TRUE); +} + +bool_t +xdr___env_dbremove_msg(xdrs, objp) + register XDR *xdrs; + __env_dbremove_msg *objp; +{ + + if (!xdr_u_int(xdrs, &objp->dbenvcl_id)) + return (FALSE); + if (!xdr_u_int(xdrs, &objp->txnpcl_id)) + return (FALSE); + if (!xdr_string(xdrs, &objp->name, ~0)) + return (FALSE); + if (!xdr_string(xdrs, &objp->subdb, ~0)) + return (FALSE); + if (!xdr_u_int(xdrs, &objp->flags)) + return (FALSE); + return (TRUE); +} + +bool_t +xdr___env_dbremove_reply(xdrs, objp) + register XDR *xdrs; + __env_dbremove_reply *objp; +{ + + if (!xdr_int(xdrs, &objp->status)) + return (FALSE); + return (TRUE); +} + +bool_t +xdr___env_dbrename_msg(xdrs, objp) + register XDR *xdrs; + __env_dbrename_msg *objp; +{ + + if (!xdr_u_int(xdrs, &objp->dbenvcl_id)) + return (FALSE); + if (!xdr_u_int(xdrs, &objp->txnpcl_id)) + return (FALSE); + if (!xdr_string(xdrs, &objp->name, ~0)) + return (FALSE); + if (!xdr_string(xdrs, &objp->subdb, ~0)) + return (FALSE); + if (!xdr_string(xdrs, &objp->newname, ~0)) + return (FALSE); + if (!xdr_u_int(xdrs, &objp->flags)) + return (FALSE); + return (TRUE); +} + +bool_t +xdr___env_dbrename_reply(xdrs, objp) + register XDR *xdrs; + __env_dbrename_reply *objp; +{ + + if (!xdr_int(xdrs, &objp->status)) + return (FALSE); + return (TRUE); +} + +bool_t +xdr___env_encrypt_msg(xdrs, objp) + register XDR *xdrs; + __env_encrypt_msg *objp; +{ + + if (!xdr_u_int(xdrs, &objp->dbenvcl_id)) + return (FALSE); + if (!xdr_string(xdrs, &objp->passwd, ~0)) + return (FALSE); + if (!xdr_u_int(xdrs, &objp->flags)) + return (FALSE); + return (TRUE); +} + +bool_t +xdr___env_encrypt_reply(xdrs, objp) + register XDR *xdrs; + __env_encrypt_reply *objp; +{ + + if (!xdr_int(xdrs, &objp->status)) + return (FALSE); + return (TRUE); +} + +bool_t +xdr___env_flags_msg(xdrs, objp) + register XDR *xdrs; + __env_flags_msg *objp; +{ + + if (!xdr_u_int(xdrs, &objp->dbenvcl_id)) + return (FALSE); + if (!xdr_u_int(xdrs, &objp->flags)) + return (FALSE); + if (!xdr_u_int(xdrs, &objp->onoff)) + return (FALSE); + return (TRUE); +} + +bool_t +xdr___env_flags_reply(xdrs, objp) + register XDR *xdrs; + __env_flags_reply *objp; +{ + + if (!xdr_int(xdrs, &objp->status)) + return (FALSE); + return (TRUE); +} + +bool_t +xdr___env_open_msg(xdrs, objp) + register XDR *xdrs; + __env_open_msg *objp; +{ + + if (!xdr_u_int(xdrs, &objp->dbenvcl_id)) + return (FALSE); + if (!xdr_string(xdrs, &objp->home, ~0)) + return (FALSE); + if (!xdr_u_int(xdrs, &objp->flags)) + return (FALSE); + if (!xdr_u_int(xdrs, &objp->mode)) + return (FALSE); + return (TRUE); +} + +bool_t +xdr___env_open_reply(xdrs, objp) + register XDR *xdrs; + __env_open_reply *objp; +{ + + if (!xdr_int(xdrs, &objp->status)) + return (FALSE); + if (!xdr_u_int(xdrs, &objp->envcl_id)) + return (FALSE); + return (TRUE); +} + +bool_t +xdr___env_remove_msg(xdrs, objp) + register XDR *xdrs; + __env_remove_msg *objp; +{ + + if (!xdr_u_int(xdrs, &objp->dbenvcl_id)) + return (FALSE); + if (!xdr_string(xdrs, &objp->home, ~0)) + return (FALSE); + if (!xdr_u_int(xdrs, &objp->flags)) + return (FALSE); + return (TRUE); +} + +bool_t +xdr___env_remove_reply(xdrs, objp) + register XDR *xdrs; + __env_remove_reply *objp; +{ + + if (!xdr_int(xdrs, &objp->status)) + return (FALSE); + return (TRUE); +} + +bool_t +xdr___txn_abort_msg(xdrs, objp) + register XDR *xdrs; + __txn_abort_msg *objp; +{ + + if (!xdr_u_int(xdrs, &objp->txnpcl_id)) + return (FALSE); + return (TRUE); +} + +bool_t +xdr___txn_abort_reply(xdrs, objp) + register XDR *xdrs; + __txn_abort_reply *objp; +{ + + if (!xdr_int(xdrs, &objp->status)) + return (FALSE); + return (TRUE); +} + +bool_t +xdr___txn_begin_msg(xdrs, objp) + register XDR *xdrs; + __txn_begin_msg *objp; +{ + + if (!xdr_u_int(xdrs, &objp->dbenvcl_id)) + return (FALSE); + if (!xdr_u_int(xdrs, &objp->parentcl_id)) + return (FALSE); + if (!xdr_u_int(xdrs, &objp->flags)) + return (FALSE); + return (TRUE); +} + +bool_t +xdr___txn_begin_reply(xdrs, objp) + register XDR *xdrs; + __txn_begin_reply *objp; +{ + + if (!xdr_int(xdrs, &objp->status)) + return (FALSE); + if (!xdr_u_int(xdrs, &objp->txnidcl_id)) + return (FALSE); + return (TRUE); +} + +bool_t +xdr___txn_commit_msg(xdrs, objp) + register XDR *xdrs; + __txn_commit_msg *objp; +{ + + if (!xdr_u_int(xdrs, &objp->txnpcl_id)) + return (FALSE); + if (!xdr_u_int(xdrs, &objp->flags)) + return (FALSE); + return (TRUE); +} + +bool_t +xdr___txn_commit_reply(xdrs, objp) + register XDR *xdrs; + __txn_commit_reply *objp; +{ + + if (!xdr_int(xdrs, &objp->status)) + return (FALSE); + return (TRUE); +} + +bool_t +xdr___txn_discard_msg(xdrs, objp) + register XDR *xdrs; + __txn_discard_msg *objp; +{ + + if (!xdr_u_int(xdrs, &objp->txnpcl_id)) + return (FALSE); + if (!xdr_u_int(xdrs, &objp->flags)) + return (FALSE); + return (TRUE); +} + +bool_t +xdr___txn_discard_reply(xdrs, objp) + register XDR *xdrs; + __txn_discard_reply *objp; +{ + + if (!xdr_int(xdrs, &objp->status)) + return (FALSE); + return (TRUE); +} + +bool_t +xdr___txn_prepare_msg(xdrs, objp) + register XDR *xdrs; + __txn_prepare_msg *objp; +{ + + if (!xdr_u_int(xdrs, &objp->txnpcl_id)) + return (FALSE); + if (!xdr_opaque(xdrs, objp->gid, 128)) + return (FALSE); + return (TRUE); +} + +bool_t +xdr___txn_prepare_reply(xdrs, objp) + register XDR *xdrs; + __txn_prepare_reply *objp; +{ + + if (!xdr_int(xdrs, &objp->status)) + return (FALSE); + return (TRUE); +} + +bool_t +xdr___txn_recover_msg(xdrs, objp) + register XDR *xdrs; + __txn_recover_msg *objp; +{ + + if (!xdr_u_int(xdrs, &objp->dbenvcl_id)) + return (FALSE); + if (!xdr_u_int(xdrs, &objp->count)) + return (FALSE); + if (!xdr_u_int(xdrs, &objp->flags)) + return (FALSE); + return (TRUE); +} + +bool_t +xdr___txn_recover_reply(xdrs, objp) + register XDR *xdrs; + __txn_recover_reply *objp; +{ + + if (!xdr_int(xdrs, &objp->status)) + return (FALSE); + if (!xdr_array(xdrs, (char **)&objp->txn.txn_val, (u_int *) &objp->txn.txn_len, ~0, + sizeof (u_int), (xdrproc_t) xdr_u_int)) + return (FALSE); + if (!xdr_bytes(xdrs, (char **)&objp->gid.gid_val, (u_int *) &objp->gid.gid_len, ~0)) + return (FALSE); + if (!xdr_u_int(xdrs, &objp->retcount)) + return (FALSE); + return (TRUE); +} + +bool_t +xdr___db_associate_msg(xdrs, objp) + register XDR *xdrs; + __db_associate_msg *objp; +{ + + if (!xdr_u_int(xdrs, &objp->dbpcl_id)) + return (FALSE); + if (!xdr_u_int(xdrs, &objp->txnpcl_id)) + return (FALSE); + if (!xdr_u_int(xdrs, &objp->sdbpcl_id)) + return (FALSE); + if (!xdr_u_int(xdrs, &objp->flags)) + return (FALSE); + return (TRUE); +} + +bool_t +xdr___db_associate_reply(xdrs, objp) + register XDR *xdrs; + __db_associate_reply *objp; +{ + + if (!xdr_int(xdrs, &objp->status)) + return (FALSE); + return (TRUE); +} + +bool_t +xdr___db_bt_maxkey_msg(xdrs, objp) + register XDR *xdrs; + __db_bt_maxkey_msg *objp; +{ + + if (!xdr_u_int(xdrs, &objp->dbpcl_id)) + return (FALSE); + if (!xdr_u_int(xdrs, &objp->maxkey)) + return (FALSE); + return (TRUE); +} + +bool_t +xdr___db_bt_maxkey_reply(xdrs, objp) + register XDR *xdrs; + __db_bt_maxkey_reply *objp; +{ + + if (!xdr_int(xdrs, &objp->status)) + return (FALSE); + return (TRUE); +} + +bool_t +xdr___db_bt_minkey_msg(xdrs, objp) + register XDR *xdrs; + __db_bt_minkey_msg *objp; +{ + + if (!xdr_u_int(xdrs, &objp->dbpcl_id)) + return (FALSE); + if (!xdr_u_int(xdrs, &objp->minkey)) + return (FALSE); + return (TRUE); +} + +bool_t +xdr___db_bt_minkey_reply(xdrs, objp) + register XDR *xdrs; + __db_bt_minkey_reply *objp; +{ + + if (!xdr_int(xdrs, &objp->status)) + return (FALSE); + return (TRUE); +} + +bool_t +xdr___db_close_msg(xdrs, objp) + register XDR *xdrs; + __db_close_msg *objp; +{ + + if (!xdr_u_int(xdrs, &objp->dbpcl_id)) + return (FALSE); + if (!xdr_u_int(xdrs, &objp->flags)) + return (FALSE); + return (TRUE); +} + +bool_t +xdr___db_close_reply(xdrs, objp) + register XDR *xdrs; + __db_close_reply *objp; +{ + + if (!xdr_int(xdrs, &objp->status)) + return (FALSE); + return (TRUE); +} + +bool_t +xdr___db_create_msg(xdrs, objp) + register XDR *xdrs; + __db_create_msg *objp; +{ + + if (!xdr_u_int(xdrs, &objp->dbenvcl_id)) + return (FALSE); + if (!xdr_u_int(xdrs, &objp->flags)) + return (FALSE); + return (TRUE); +} + +bool_t +xdr___db_create_reply(xdrs, objp) + register XDR *xdrs; + __db_create_reply *objp; +{ + + if (!xdr_int(xdrs, &objp->status)) + return (FALSE); + if (!xdr_u_int(xdrs, &objp->dbcl_id)) + return (FALSE); + return (TRUE); +} + +bool_t +xdr___db_del_msg(xdrs, objp) + register XDR *xdrs; + __db_del_msg *objp; +{ + + if (!xdr_u_int(xdrs, &objp->dbpcl_id)) + return (FALSE); + if (!xdr_u_int(xdrs, &objp->txnpcl_id)) + return (FALSE); + if (!xdr_u_int(xdrs, &objp->keydlen)) + return (FALSE); + if (!xdr_u_int(xdrs, &objp->keydoff)) + return (FALSE); + if (!xdr_u_int(xdrs, &objp->keyulen)) + return (FALSE); + if (!xdr_u_int(xdrs, &objp->keyflags)) + return (FALSE); + if (!xdr_bytes(xdrs, (char **)&objp->keydata.keydata_val, (u_int *) &objp->keydata.keydata_len, ~0)) + return (FALSE); + if (!xdr_u_int(xdrs, &objp->flags)) + return (FALSE); + return (TRUE); +} + +bool_t +xdr___db_del_reply(xdrs, objp) + register XDR *xdrs; + __db_del_reply *objp; +{ + + if (!xdr_int(xdrs, &objp->status)) + return (FALSE); + return (TRUE); +} + +bool_t +xdr___db_encrypt_msg(xdrs, objp) + register XDR *xdrs; + __db_encrypt_msg *objp; +{ + + if (!xdr_u_int(xdrs, &objp->dbpcl_id)) + return (FALSE); + if (!xdr_string(xdrs, &objp->passwd, ~0)) + return (FALSE); + if (!xdr_u_int(xdrs, &objp->flags)) + return (FALSE); + return (TRUE); +} + +bool_t +xdr___db_encrypt_reply(xdrs, objp) + register XDR *xdrs; + __db_encrypt_reply *objp; +{ + + if (!xdr_int(xdrs, &objp->status)) + return (FALSE); + return (TRUE); +} + +bool_t +xdr___db_extentsize_msg(xdrs, objp) + register XDR *xdrs; + __db_extentsize_msg *objp; +{ + + if (!xdr_u_int(xdrs, &objp->dbpcl_id)) + return (FALSE); + if (!xdr_u_int(xdrs, &objp->extentsize)) + return (FALSE); + return (TRUE); +} + +bool_t +xdr___db_extentsize_reply(xdrs, objp) + register XDR *xdrs; + __db_extentsize_reply *objp; +{ + + if (!xdr_int(xdrs, &objp->status)) + return (FALSE); + return (TRUE); +} + +bool_t +xdr___db_flags_msg(xdrs, objp) + register XDR *xdrs; + __db_flags_msg *objp; +{ + + if (!xdr_u_int(xdrs, &objp->dbpcl_id)) + return (FALSE); + if (!xdr_u_int(xdrs, &objp->flags)) + return (FALSE); + return (TRUE); +} + +bool_t +xdr___db_flags_reply(xdrs, objp) + register XDR *xdrs; + __db_flags_reply *objp; +{ + + if (!xdr_int(xdrs, &objp->status)) + return (FALSE); + return (TRUE); +} + +bool_t +xdr___db_get_msg(xdrs, objp) + register XDR *xdrs; + __db_get_msg *objp; +{ + + if (!xdr_u_int(xdrs, &objp->dbpcl_id)) + return (FALSE); + if (!xdr_u_int(xdrs, &objp->txnpcl_id)) + return (FALSE); + if (!xdr_u_int(xdrs, &objp->keydlen)) + return (FALSE); + if (!xdr_u_int(xdrs, &objp->keydoff)) + return (FALSE); + if (!xdr_u_int(xdrs, &objp->keyulen)) + return (FALSE); + if (!xdr_u_int(xdrs, &objp->keyflags)) + return (FALSE); + if (!xdr_bytes(xdrs, (char **)&objp->keydata.keydata_val, (u_int *) &objp->keydata.keydata_len, ~0)) + return (FALSE); + if (!xdr_u_int(xdrs, &objp->datadlen)) + return (FALSE); + if (!xdr_u_int(xdrs, &objp->datadoff)) + return (FALSE); + if (!xdr_u_int(xdrs, &objp->dataulen)) + return (FALSE); + if (!xdr_u_int(xdrs, &objp->dataflags)) + return (FALSE); + if (!xdr_bytes(xdrs, (char **)&objp->datadata.datadata_val, (u_int *) &objp->datadata.datadata_len, ~0)) + return (FALSE); + if (!xdr_u_int(xdrs, &objp->flags)) + return (FALSE); + return (TRUE); +} + +bool_t +xdr___db_get_reply(xdrs, objp) + register XDR *xdrs; + __db_get_reply *objp; +{ + + if (!xdr_int(xdrs, &objp->status)) + return (FALSE); + if (!xdr_bytes(xdrs, (char **)&objp->keydata.keydata_val, (u_int *) &objp->keydata.keydata_len, ~0)) + return (FALSE); + if (!xdr_bytes(xdrs, (char **)&objp->datadata.datadata_val, (u_int *) &objp->datadata.datadata_len, ~0)) + return (FALSE); + return (TRUE); +} + +bool_t +xdr___db_h_ffactor_msg(xdrs, objp) + register XDR *xdrs; + __db_h_ffactor_msg *objp; +{ + + if (!xdr_u_int(xdrs, &objp->dbpcl_id)) + return (FALSE); + if (!xdr_u_int(xdrs, &objp->ffactor)) + return (FALSE); + return (TRUE); +} + +bool_t +xdr___db_h_ffactor_reply(xdrs, objp) + register XDR *xdrs; + __db_h_ffactor_reply *objp; +{ + + if (!xdr_int(xdrs, &objp->status)) + return (FALSE); + return (TRUE); +} + +bool_t +xdr___db_h_nelem_msg(xdrs, objp) + register XDR *xdrs; + __db_h_nelem_msg *objp; +{ + + if (!xdr_u_int(xdrs, &objp->dbpcl_id)) + return (FALSE); + if (!xdr_u_int(xdrs, &objp->nelem)) + return (FALSE); + return (TRUE); +} + +bool_t +xdr___db_h_nelem_reply(xdrs, objp) + register XDR *xdrs; + __db_h_nelem_reply *objp; +{ + + if (!xdr_int(xdrs, &objp->status)) + return (FALSE); + return (TRUE); +} + +bool_t +xdr___db_key_range_msg(xdrs, objp) + register XDR *xdrs; + __db_key_range_msg *objp; +{ + + if (!xdr_u_int(xdrs, &objp->dbpcl_id)) + return (FALSE); + if (!xdr_u_int(xdrs, &objp->txnpcl_id)) + return (FALSE); + if (!xdr_u_int(xdrs, &objp->keydlen)) + return (FALSE); + if (!xdr_u_int(xdrs, &objp->keydoff)) + return (FALSE); + if (!xdr_u_int(xdrs, &objp->keyulen)) + return (FALSE); + if (!xdr_u_int(xdrs, &objp->keyflags)) + return (FALSE); + if (!xdr_bytes(xdrs, (char **)&objp->keydata.keydata_val, (u_int *) &objp->keydata.keydata_len, ~0)) + return (FALSE); + if (!xdr_u_int(xdrs, &objp->flags)) + return (FALSE); + return (TRUE); +} + +bool_t +xdr___db_key_range_reply(xdrs, objp) + register XDR *xdrs; + __db_key_range_reply *objp; +{ + + if (!xdr_int(xdrs, &objp->status)) + return (FALSE); + if (!xdr_double(xdrs, &objp->less)) + return (FALSE); + if (!xdr_double(xdrs, &objp->equal)) + return (FALSE); + if (!xdr_double(xdrs, &objp->greater)) + return (FALSE); + return (TRUE); +} + +bool_t +xdr___db_lorder_msg(xdrs, objp) + register XDR *xdrs; + __db_lorder_msg *objp; +{ + + if (!xdr_u_int(xdrs, &objp->dbpcl_id)) + return (FALSE); + if (!xdr_u_int(xdrs, &objp->lorder)) + return (FALSE); + return (TRUE); +} + +bool_t +xdr___db_lorder_reply(xdrs, objp) + register XDR *xdrs; + __db_lorder_reply *objp; +{ + + if (!xdr_int(xdrs, &objp->status)) + return (FALSE); + return (TRUE); +} + +bool_t +xdr___db_open_msg(xdrs, objp) + register XDR *xdrs; + __db_open_msg *objp; +{ + + if (!xdr_u_int(xdrs, &objp->dbpcl_id)) + return (FALSE); + if (!xdr_u_int(xdrs, &objp->txnpcl_id)) + return (FALSE); + if (!xdr_string(xdrs, &objp->name, ~0)) + return (FALSE); + if (!xdr_string(xdrs, &objp->subdb, ~0)) + return (FALSE); + if (!xdr_u_int(xdrs, &objp->type)) + return (FALSE); + if (!xdr_u_int(xdrs, &objp->flags)) + return (FALSE); + if (!xdr_u_int(xdrs, &objp->mode)) + return (FALSE); + return (TRUE); +} + +bool_t +xdr___db_open_reply(xdrs, objp) + register XDR *xdrs; + __db_open_reply *objp; +{ + + if (!xdr_int(xdrs, &objp->status)) + return (FALSE); + if (!xdr_u_int(xdrs, &objp->dbcl_id)) + return (FALSE); + if (!xdr_u_int(xdrs, &objp->type)) + return (FALSE); + if (!xdr_u_int(xdrs, &objp->dbflags)) + return (FALSE); + if (!xdr_u_int(xdrs, &objp->lorder)) + return (FALSE); + return (TRUE); +} + +bool_t +xdr___db_pagesize_msg(xdrs, objp) + register XDR *xdrs; + __db_pagesize_msg *objp; +{ + + if (!xdr_u_int(xdrs, &objp->dbpcl_id)) + return (FALSE); + if (!xdr_u_int(xdrs, &objp->pagesize)) + return (FALSE); + return (TRUE); +} + +bool_t +xdr___db_pagesize_reply(xdrs, objp) + register XDR *xdrs; + __db_pagesize_reply *objp; +{ + + if (!xdr_int(xdrs, &objp->status)) + return (FALSE); + return (TRUE); +} + +bool_t +xdr___db_pget_msg(xdrs, objp) + register XDR *xdrs; + __db_pget_msg *objp; +{ + + if (!xdr_u_int(xdrs, &objp->dbpcl_id)) + return (FALSE); + if (!xdr_u_int(xdrs, &objp->txnpcl_id)) + return (FALSE); + if (!xdr_u_int(xdrs, &objp->skeydlen)) + return (FALSE); + if (!xdr_u_int(xdrs, &objp->skeydoff)) + return (FALSE); + if (!xdr_u_int(xdrs, &objp->skeyulen)) + return (FALSE); + if (!xdr_u_int(xdrs, &objp->skeyflags)) + return (FALSE); + if (!xdr_bytes(xdrs, (char **)&objp->skeydata.skeydata_val, (u_int *) &objp->skeydata.skeydata_len, ~0)) + return (FALSE); + if (!xdr_u_int(xdrs, &objp->pkeydlen)) + return (FALSE); + if (!xdr_u_int(xdrs, &objp->pkeydoff)) + return (FALSE); + if (!xdr_u_int(xdrs, &objp->pkeyulen)) + return (FALSE); + if (!xdr_u_int(xdrs, &objp->pkeyflags)) + return (FALSE); + if (!xdr_bytes(xdrs, (char **)&objp->pkeydata.pkeydata_val, (u_int *) &objp->pkeydata.pkeydata_len, ~0)) + return (FALSE); + if (!xdr_u_int(xdrs, &objp->datadlen)) + return (FALSE); + if (!xdr_u_int(xdrs, &objp->datadoff)) + return (FALSE); + if (!xdr_u_int(xdrs, &objp->dataulen)) + return (FALSE); + if (!xdr_u_int(xdrs, &objp->dataflags)) + return (FALSE); + if (!xdr_bytes(xdrs, (char **)&objp->datadata.datadata_val, (u_int *) &objp->datadata.datadata_len, ~0)) + return (FALSE); + if (!xdr_u_int(xdrs, &objp->flags)) + return (FALSE); + return (TRUE); +} + +bool_t +xdr___db_pget_reply(xdrs, objp) + register XDR *xdrs; + __db_pget_reply *objp; +{ + + if (!xdr_int(xdrs, &objp->status)) + return (FALSE); + if (!xdr_bytes(xdrs, (char **)&objp->skeydata.skeydata_val, (u_int *) &objp->skeydata.skeydata_len, ~0)) + return (FALSE); + if (!xdr_bytes(xdrs, (char **)&objp->pkeydata.pkeydata_val, (u_int *) &objp->pkeydata.pkeydata_len, ~0)) + return (FALSE); + if (!xdr_bytes(xdrs, (char **)&objp->datadata.datadata_val, (u_int *) &objp->datadata.datadata_len, ~0)) + return (FALSE); + return (TRUE); +} + +bool_t +xdr___db_put_msg(xdrs, objp) + register XDR *xdrs; + __db_put_msg *objp; +{ + + if (!xdr_u_int(xdrs, &objp->dbpcl_id)) + return (FALSE); + if (!xdr_u_int(xdrs, &objp->txnpcl_id)) + return (FALSE); + if (!xdr_u_int(xdrs, &objp->keydlen)) + return (FALSE); + if (!xdr_u_int(xdrs, &objp->keydoff)) + return (FALSE); + if (!xdr_u_int(xdrs, &objp->keyulen)) + return (FALSE); + if (!xdr_u_int(xdrs, &objp->keyflags)) + return (FALSE); + if (!xdr_bytes(xdrs, (char **)&objp->keydata.keydata_val, (u_int *) &objp->keydata.keydata_len, ~0)) + return (FALSE); + if (!xdr_u_int(xdrs, &objp->datadlen)) + return (FALSE); + if (!xdr_u_int(xdrs, &objp->datadoff)) + return (FALSE); + if (!xdr_u_int(xdrs, &objp->dataulen)) + return (FALSE); + if (!xdr_u_int(xdrs, &objp->dataflags)) + return (FALSE); + if (!xdr_bytes(xdrs, (char **)&objp->datadata.datadata_val, (u_int *) &objp->datadata.datadata_len, ~0)) + return (FALSE); + if (!xdr_u_int(xdrs, &objp->flags)) + return (FALSE); + return (TRUE); +} + +bool_t +xdr___db_put_reply(xdrs, objp) + register XDR *xdrs; + __db_put_reply *objp; +{ + + if (!xdr_int(xdrs, &objp->status)) + return (FALSE); + if (!xdr_bytes(xdrs, (char **)&objp->keydata.keydata_val, (u_int *) &objp->keydata.keydata_len, ~0)) + return (FALSE); + return (TRUE); +} + +bool_t +xdr___db_re_delim_msg(xdrs, objp) + register XDR *xdrs; + __db_re_delim_msg *objp; +{ + + if (!xdr_u_int(xdrs, &objp->dbpcl_id)) + return (FALSE); + if (!xdr_u_int(xdrs, &objp->delim)) + return (FALSE); + return (TRUE); +} + +bool_t +xdr___db_re_delim_reply(xdrs, objp) + register XDR *xdrs; + __db_re_delim_reply *objp; +{ + + if (!xdr_int(xdrs, &objp->status)) + return (FALSE); + return (TRUE); +} + +bool_t +xdr___db_re_len_msg(xdrs, objp) + register XDR *xdrs; + __db_re_len_msg *objp; +{ + + if (!xdr_u_int(xdrs, &objp->dbpcl_id)) + return (FALSE); + if (!xdr_u_int(xdrs, &objp->len)) + return (FALSE); + return (TRUE); +} + +bool_t +xdr___db_re_len_reply(xdrs, objp) + register XDR *xdrs; + __db_re_len_reply *objp; +{ + + if (!xdr_int(xdrs, &objp->status)) + return (FALSE); + return (TRUE); +} + +bool_t +xdr___db_re_pad_msg(xdrs, objp) + register XDR *xdrs; + __db_re_pad_msg *objp; +{ + + if (!xdr_u_int(xdrs, &objp->dbpcl_id)) + return (FALSE); + if (!xdr_u_int(xdrs, &objp->pad)) + return (FALSE); + return (TRUE); +} + +bool_t +xdr___db_re_pad_reply(xdrs, objp) + register XDR *xdrs; + __db_re_pad_reply *objp; +{ + + if (!xdr_int(xdrs, &objp->status)) + return (FALSE); + return (TRUE); +} + +bool_t +xdr___db_remove_msg(xdrs, objp) + register XDR *xdrs; + __db_remove_msg *objp; +{ + + if (!xdr_u_int(xdrs, &objp->dbpcl_id)) + return (FALSE); + if (!xdr_string(xdrs, &objp->name, ~0)) + return (FALSE); + if (!xdr_string(xdrs, &objp->subdb, ~0)) + return (FALSE); + if (!xdr_u_int(xdrs, &objp->flags)) + return (FALSE); + return (TRUE); +} + +bool_t +xdr___db_remove_reply(xdrs, objp) + register XDR *xdrs; + __db_remove_reply *objp; +{ + + if (!xdr_int(xdrs, &objp->status)) + return (FALSE); + return (TRUE); +} + +bool_t +xdr___db_rename_msg(xdrs, objp) + register XDR *xdrs; + __db_rename_msg *objp; +{ + + if (!xdr_u_int(xdrs, &objp->dbpcl_id)) + return (FALSE); + if (!xdr_string(xdrs, &objp->name, ~0)) + return (FALSE); + if (!xdr_string(xdrs, &objp->subdb, ~0)) + return (FALSE); + if (!xdr_string(xdrs, &objp->newname, ~0)) + return (FALSE); + if (!xdr_u_int(xdrs, &objp->flags)) + return (FALSE); + return (TRUE); +} + +bool_t +xdr___db_rename_reply(xdrs, objp) + register XDR *xdrs; + __db_rename_reply *objp; +{ + + if (!xdr_int(xdrs, &objp->status)) + return (FALSE); + return (TRUE); +} + +bool_t +xdr___db_stat_msg(xdrs, objp) + register XDR *xdrs; + __db_stat_msg *objp; +{ + + if (!xdr_u_int(xdrs, &objp->dbpcl_id)) + return (FALSE); + if (!xdr_u_int(xdrs, &objp->flags)) + return (FALSE); + return (TRUE); +} + +bool_t +xdr___db_stat_reply(xdrs, objp) + register XDR *xdrs; + __db_stat_reply *objp; +{ + + if (!xdr_int(xdrs, &objp->status)) + return (FALSE); + if (!xdr_array(xdrs, (char **)&objp->stats.stats_val, (u_int *) &objp->stats.stats_len, ~0, + sizeof (u_int), (xdrproc_t) xdr_u_int)) + return (FALSE); + return (TRUE); +} + +bool_t +xdr___db_sync_msg(xdrs, objp) + register XDR *xdrs; + __db_sync_msg *objp; +{ + + if (!xdr_u_int(xdrs, &objp->dbpcl_id)) + return (FALSE); + if (!xdr_u_int(xdrs, &objp->flags)) + return (FALSE); + return (TRUE); +} + +bool_t +xdr___db_sync_reply(xdrs, objp) + register XDR *xdrs; + __db_sync_reply *objp; +{ + + if (!xdr_int(xdrs, &objp->status)) + return (FALSE); + return (TRUE); +} + +bool_t +xdr___db_truncate_msg(xdrs, objp) + register XDR *xdrs; + __db_truncate_msg *objp; +{ + + if (!xdr_u_int(xdrs, &objp->dbpcl_id)) + return (FALSE); + if (!xdr_u_int(xdrs, &objp->txnpcl_id)) + return (FALSE); + if (!xdr_u_int(xdrs, &objp->flags)) + return (FALSE); + return (TRUE); +} + +bool_t +xdr___db_truncate_reply(xdrs, objp) + register XDR *xdrs; + __db_truncate_reply *objp; +{ + + if (!xdr_int(xdrs, &objp->status)) + return (FALSE); + if (!xdr_u_int(xdrs, &objp->count)) + return (FALSE); + return (TRUE); +} + +bool_t +xdr___db_cursor_msg(xdrs, objp) + register XDR *xdrs; + __db_cursor_msg *objp; +{ + + if (!xdr_u_int(xdrs, &objp->dbpcl_id)) + return (FALSE); + if (!xdr_u_int(xdrs, &objp->txnpcl_id)) + return (FALSE); + if (!xdr_u_int(xdrs, &objp->flags)) + return (FALSE); + return (TRUE); +} + +bool_t +xdr___db_cursor_reply(xdrs, objp) + register XDR *xdrs; + __db_cursor_reply *objp; +{ + + if (!xdr_int(xdrs, &objp->status)) + return (FALSE); + if (!xdr_u_int(xdrs, &objp->dbcidcl_id)) + return (FALSE); + return (TRUE); +} + +bool_t +xdr___db_join_msg(xdrs, objp) + register XDR *xdrs; + __db_join_msg *objp; +{ + + if (!xdr_u_int(xdrs, &objp->dbpcl_id)) + return (FALSE); + if (!xdr_array(xdrs, (char **)&objp->curs.curs_val, (u_int *) &objp->curs.curs_len, ~0, + sizeof (u_int), (xdrproc_t) xdr_u_int)) + return (FALSE); + if (!xdr_u_int(xdrs, &objp->flags)) + return (FALSE); + return (TRUE); +} + +bool_t +xdr___db_join_reply(xdrs, objp) + register XDR *xdrs; + __db_join_reply *objp; +{ + + if (!xdr_int(xdrs, &objp->status)) + return (FALSE); + if (!xdr_u_int(xdrs, &objp->dbcidcl_id)) + return (FALSE); + return (TRUE); +} + +bool_t +xdr___dbc_close_msg(xdrs, objp) + register XDR *xdrs; + __dbc_close_msg *objp; +{ + + if (!xdr_u_int(xdrs, &objp->dbccl_id)) + return (FALSE); + return (TRUE); +} + +bool_t +xdr___dbc_close_reply(xdrs, objp) + register XDR *xdrs; + __dbc_close_reply *objp; +{ + + if (!xdr_int(xdrs, &objp->status)) + return (FALSE); + return (TRUE); +} + +bool_t +xdr___dbc_count_msg(xdrs, objp) + register XDR *xdrs; + __dbc_count_msg *objp; +{ + + if (!xdr_u_int(xdrs, &objp->dbccl_id)) + return (FALSE); + if (!xdr_u_int(xdrs, &objp->flags)) + return (FALSE); + return (TRUE); +} + +bool_t +xdr___dbc_count_reply(xdrs, objp) + register XDR *xdrs; + __dbc_count_reply *objp; +{ + + if (!xdr_int(xdrs, &objp->status)) + return (FALSE); + if (!xdr_u_int(xdrs, &objp->dupcount)) + return (FALSE); + return (TRUE); +} + +bool_t +xdr___dbc_del_msg(xdrs, objp) + register XDR *xdrs; + __dbc_del_msg *objp; +{ + + if (!xdr_u_int(xdrs, &objp->dbccl_id)) + return (FALSE); + if (!xdr_u_int(xdrs, &objp->flags)) + return (FALSE); + return (TRUE); +} + +bool_t +xdr___dbc_del_reply(xdrs, objp) + register XDR *xdrs; + __dbc_del_reply *objp; +{ + + if (!xdr_int(xdrs, &objp->status)) + return (FALSE); + return (TRUE); +} + +bool_t +xdr___dbc_dup_msg(xdrs, objp) + register XDR *xdrs; + __dbc_dup_msg *objp; +{ + + if (!xdr_u_int(xdrs, &objp->dbccl_id)) + return (FALSE); + if (!xdr_u_int(xdrs, &objp->flags)) + return (FALSE); + return (TRUE); +} + +bool_t +xdr___dbc_dup_reply(xdrs, objp) + register XDR *xdrs; + __dbc_dup_reply *objp; +{ + + if (!xdr_int(xdrs, &objp->status)) + return (FALSE); + if (!xdr_u_int(xdrs, &objp->dbcidcl_id)) + return (FALSE); + return (TRUE); +} + +bool_t +xdr___dbc_get_msg(xdrs, objp) + register XDR *xdrs; + __dbc_get_msg *objp; +{ + + if (!xdr_u_int(xdrs, &objp->dbccl_id)) + return (FALSE); + if (!xdr_u_int(xdrs, &objp->keydlen)) + return (FALSE); + if (!xdr_u_int(xdrs, &objp->keydoff)) + return (FALSE); + if (!xdr_u_int(xdrs, &objp->keyulen)) + return (FALSE); + if (!xdr_u_int(xdrs, &objp->keyflags)) + return (FALSE); + if (!xdr_bytes(xdrs, (char **)&objp->keydata.keydata_val, (u_int *) &objp->keydata.keydata_len, ~0)) + return (FALSE); + if (!xdr_u_int(xdrs, &objp->datadlen)) + return (FALSE); + if (!xdr_u_int(xdrs, &objp->datadoff)) + return (FALSE); + if (!xdr_u_int(xdrs, &objp->dataulen)) + return (FALSE); + if (!xdr_u_int(xdrs, &objp->dataflags)) + return (FALSE); + if (!xdr_bytes(xdrs, (char **)&objp->datadata.datadata_val, (u_int *) &objp->datadata.datadata_len, ~0)) + return (FALSE); + if (!xdr_u_int(xdrs, &objp->flags)) + return (FALSE); + return (TRUE); +} + +bool_t +xdr___dbc_get_reply(xdrs, objp) + register XDR *xdrs; + __dbc_get_reply *objp; +{ + + if (!xdr_int(xdrs, &objp->status)) + return (FALSE); + if (!xdr_bytes(xdrs, (char **)&objp->keydata.keydata_val, (u_int *) &objp->keydata.keydata_len, ~0)) + return (FALSE); + if (!xdr_bytes(xdrs, (char **)&objp->datadata.datadata_val, (u_int *) &objp->datadata.datadata_len, ~0)) + return (FALSE); + return (TRUE); +} + +bool_t +xdr___dbc_pget_msg(xdrs, objp) + register XDR *xdrs; + __dbc_pget_msg *objp; +{ + + if (!xdr_u_int(xdrs, &objp->dbccl_id)) + return (FALSE); + if (!xdr_u_int(xdrs, &objp->skeydlen)) + return (FALSE); + if (!xdr_u_int(xdrs, &objp->skeydoff)) + return (FALSE); + if (!xdr_u_int(xdrs, &objp->skeyulen)) + return (FALSE); + if (!xdr_u_int(xdrs, &objp->skeyflags)) + return (FALSE); + if (!xdr_bytes(xdrs, (char **)&objp->skeydata.skeydata_val, (u_int *) &objp->skeydata.skeydata_len, ~0)) + return (FALSE); + if (!xdr_u_int(xdrs, &objp->pkeydlen)) + return (FALSE); + if (!xdr_u_int(xdrs, &objp->pkeydoff)) + return (FALSE); + if (!xdr_u_int(xdrs, &objp->pkeyulen)) + return (FALSE); + if (!xdr_u_int(xdrs, &objp->pkeyflags)) + return (FALSE); + if (!xdr_bytes(xdrs, (char **)&objp->pkeydata.pkeydata_val, (u_int *) &objp->pkeydata.pkeydata_len, ~0)) + return (FALSE); + if (!xdr_u_int(xdrs, &objp->datadlen)) + return (FALSE); + if (!xdr_u_int(xdrs, &objp->datadoff)) + return (FALSE); + if (!xdr_u_int(xdrs, &objp->dataulen)) + return (FALSE); + if (!xdr_u_int(xdrs, &objp->dataflags)) + return (FALSE); + if (!xdr_bytes(xdrs, (char **)&objp->datadata.datadata_val, (u_int *) &objp->datadata.datadata_len, ~0)) + return (FALSE); + if (!xdr_u_int(xdrs, &objp->flags)) + return (FALSE); + return (TRUE); +} + +bool_t +xdr___dbc_pget_reply(xdrs, objp) + register XDR *xdrs; + __dbc_pget_reply *objp; +{ + + if (!xdr_int(xdrs, &objp->status)) + return (FALSE); + if (!xdr_bytes(xdrs, (char **)&objp->skeydata.skeydata_val, (u_int *) &objp->skeydata.skeydata_len, ~0)) + return (FALSE); + if (!xdr_bytes(xdrs, (char **)&objp->pkeydata.pkeydata_val, (u_int *) &objp->pkeydata.pkeydata_len, ~0)) + return (FALSE); + if (!xdr_bytes(xdrs, (char **)&objp->datadata.datadata_val, (u_int *) &objp->datadata.datadata_len, ~0)) + return (FALSE); + return (TRUE); +} + +bool_t +xdr___dbc_put_msg(xdrs, objp) + register XDR *xdrs; + __dbc_put_msg *objp; +{ + + if (!xdr_u_int(xdrs, &objp->dbccl_id)) + return (FALSE); + if (!xdr_u_int(xdrs, &objp->keydlen)) + return (FALSE); + if (!xdr_u_int(xdrs, &objp->keydoff)) + return (FALSE); + if (!xdr_u_int(xdrs, &objp->keyulen)) + return (FALSE); + if (!xdr_u_int(xdrs, &objp->keyflags)) + return (FALSE); + if (!xdr_bytes(xdrs, (char **)&objp->keydata.keydata_val, (u_int *) &objp->keydata.keydata_len, ~0)) + return (FALSE); + if (!xdr_u_int(xdrs, &objp->datadlen)) + return (FALSE); + if (!xdr_u_int(xdrs, &objp->datadoff)) + return (FALSE); + if (!xdr_u_int(xdrs, &objp->dataulen)) + return (FALSE); + if (!xdr_u_int(xdrs, &objp->dataflags)) + return (FALSE); + if (!xdr_bytes(xdrs, (char **)&objp->datadata.datadata_val, (u_int *) &objp->datadata.datadata_len, ~0)) + return (FALSE); + if (!xdr_u_int(xdrs, &objp->flags)) + return (FALSE); + return (TRUE); +} + +bool_t +xdr___dbc_put_reply(xdrs, objp) + register XDR *xdrs; + __dbc_put_reply *objp; +{ + + if (!xdr_int(xdrs, &objp->status)) + return (FALSE); + if (!xdr_bytes(xdrs, (char **)&objp->keydata.keydata_val, (u_int *) &objp->keydata.keydata_len, ~0)) + return (FALSE); + return (TRUE); +} +#endif /* HAVE_RPC */ diff --git a/db/rpc_server/c/gen_db_server.c b/db/rpc_server/c/gen_db_server.c new file mode 100644 index 000000000..0181fb06d --- /dev/null +++ b/db/rpc_server/c/gen_db_server.c @@ -0,0 +1,1169 @@ +/* Do not edit: automatically built by gen_rpc.awk. */ +#include "db_config.h" + +#ifndef NO_SYSTEM_INCLUDES +#include <sys/types.h> + +#include <rpc/rpc.h> +#include <rpc/xdr.h> + +#include <string.h> +#endif + +#include "db_int.h" +#include "dbinc_auto/db_server.h" +#include "dbinc/db_server_int.h" +#include "dbinc_auto/rpc_server_ext.h" + +/* + * PUBLIC: __env_cachesize_reply *__db_env_cachesize_4001 + * PUBLIC: __P((__env_cachesize_msg *, struct svc_req *)); + */ +__env_cachesize_reply * +__db_env_cachesize_4001(msg, req) + __env_cachesize_msg *msg; + struct svc_req *req; +{ + static __env_cachesize_reply reply; /* must be static */ + COMPQUIET(req, NULL); + + __env_cachesize_proc(msg->dbenvcl_id, + msg->gbytes, + msg->bytes, + msg->ncache, + &reply); + + return (&reply); +} + +/* + * PUBLIC: __env_close_reply *__db_env_close_4001 __P((__env_close_msg *, + * PUBLIC: struct svc_req *)); + */ +__env_close_reply * +__db_env_close_4001(msg, req) + __env_close_msg *msg; + struct svc_req *req; +{ + static __env_close_reply reply; /* must be static */ + COMPQUIET(req, NULL); + + __env_close_proc(msg->dbenvcl_id, + msg->flags, + &reply); + + return (&reply); +} + +/* + * PUBLIC: __env_create_reply *__db_env_create_4001 __P((__env_create_msg *, + * PUBLIC: struct svc_req *)); + */ +__env_create_reply * +__db_env_create_4001(msg, req) + __env_create_msg *msg; + struct svc_req *req; +{ + static __env_create_reply reply; /* must be static */ + COMPQUIET(req, NULL); + + __env_create_proc(msg->timeout, + &reply); + + return (&reply); +} + +/* + * PUBLIC: __env_dbremove_reply *__db_env_dbremove_4001 + * PUBLIC: __P((__env_dbremove_msg *, struct svc_req *)); + */ +__env_dbremove_reply * +__db_env_dbremove_4001(msg, req) + __env_dbremove_msg *msg; + struct svc_req *req; +{ + static __env_dbremove_reply reply; /* must be static */ + COMPQUIET(req, NULL); + + __env_dbremove_proc(msg->dbenvcl_id, + msg->txnpcl_id, + (*msg->name == '\0') ? NULL : msg->name, + (*msg->subdb == '\0') ? NULL : msg->subdb, + msg->flags, + &reply); + + return (&reply); +} + +/* + * PUBLIC: __env_dbrename_reply *__db_env_dbrename_4001 + * PUBLIC: __P((__env_dbrename_msg *, struct svc_req *)); + */ +__env_dbrename_reply * +__db_env_dbrename_4001(msg, req) + __env_dbrename_msg *msg; + struct svc_req *req; +{ + static __env_dbrename_reply reply; /* must be static */ + COMPQUIET(req, NULL); + + __env_dbrename_proc(msg->dbenvcl_id, + msg->txnpcl_id, + (*msg->name == '\0') ? NULL : msg->name, + (*msg->subdb == '\0') ? NULL : msg->subdb, + (*msg->newname == '\0') ? NULL : msg->newname, + msg->flags, + &reply); + + return (&reply); +} + +/* + * PUBLIC: __env_encrypt_reply *__db_env_encrypt_4001 + * PUBLIC: __P((__env_encrypt_msg *, struct svc_req *)); + */ +__env_encrypt_reply * +__db_env_encrypt_4001(msg, req) + __env_encrypt_msg *msg; + struct svc_req *req; +{ + static __env_encrypt_reply reply; /* must be static */ + COMPQUIET(req, NULL); + + __env_encrypt_proc(msg->dbenvcl_id, + (*msg->passwd == '\0') ? NULL : msg->passwd, + msg->flags, + &reply); + + return (&reply); +} + +/* + * PUBLIC: __env_flags_reply *__db_env_flags_4001 __P((__env_flags_msg *, + * PUBLIC: struct svc_req *)); + */ +__env_flags_reply * +__db_env_flags_4001(msg, req) + __env_flags_msg *msg; + struct svc_req *req; +{ + static __env_flags_reply reply; /* must be static */ + COMPQUIET(req, NULL); + + __env_flags_proc(msg->dbenvcl_id, + msg->flags, + msg->onoff, + &reply); + + return (&reply); +} + +/* + * PUBLIC: __env_open_reply *__db_env_open_4001 __P((__env_open_msg *, + * PUBLIC: struct svc_req *)); + */ +__env_open_reply * +__db_env_open_4001(msg, req) + __env_open_msg *msg; + struct svc_req *req; +{ + static __env_open_reply reply; /* must be static */ + COMPQUIET(req, NULL); + + __env_open_proc(msg->dbenvcl_id, + (*msg->home == '\0') ? NULL : msg->home, + msg->flags, + msg->mode, + &reply); + + return (&reply); +} + +/* + * PUBLIC: __env_remove_reply *__db_env_remove_4001 __P((__env_remove_msg *, + * PUBLIC: struct svc_req *)); + */ +__env_remove_reply * +__db_env_remove_4001(msg, req) + __env_remove_msg *msg; + struct svc_req *req; +{ + static __env_remove_reply reply; /* must be static */ + COMPQUIET(req, NULL); + + __env_remove_proc(msg->dbenvcl_id, + (*msg->home == '\0') ? NULL : msg->home, + msg->flags, + &reply); + + return (&reply); +} + +/* + * PUBLIC: __txn_abort_reply *__db_txn_abort_4001 __P((__txn_abort_msg *, + * PUBLIC: struct svc_req *)); + */ +__txn_abort_reply * +__db_txn_abort_4001(msg, req) + __txn_abort_msg *msg; + struct svc_req *req; +{ + static __txn_abort_reply reply; /* must be static */ + COMPQUIET(req, NULL); + + __txn_abort_proc(msg->txnpcl_id, + &reply); + + return (&reply); +} + +/* + * PUBLIC: __txn_begin_reply *__db_txn_begin_4001 __P((__txn_begin_msg *, + * PUBLIC: struct svc_req *)); + */ +__txn_begin_reply * +__db_txn_begin_4001(msg, req) + __txn_begin_msg *msg; + struct svc_req *req; +{ + static __txn_begin_reply reply; /* must be static */ + COMPQUIET(req, NULL); + + __txn_begin_proc(msg->dbenvcl_id, + msg->parentcl_id, + msg->flags, + &reply); + + return (&reply); +} + +/* + * PUBLIC: __txn_commit_reply *__db_txn_commit_4001 __P((__txn_commit_msg *, + * PUBLIC: struct svc_req *)); + */ +__txn_commit_reply * +__db_txn_commit_4001(msg, req) + __txn_commit_msg *msg; + struct svc_req *req; +{ + static __txn_commit_reply reply; /* must be static */ + COMPQUIET(req, NULL); + + __txn_commit_proc(msg->txnpcl_id, + msg->flags, + &reply); + + return (&reply); +} + +/* + * PUBLIC: __txn_discard_reply *__db_txn_discard_4001 + * PUBLIC: __P((__txn_discard_msg *, struct svc_req *)); + */ +__txn_discard_reply * +__db_txn_discard_4001(msg, req) + __txn_discard_msg *msg; + struct svc_req *req; +{ + static __txn_discard_reply reply; /* must be static */ + COMPQUIET(req, NULL); + + __txn_discard_proc(msg->txnpcl_id, + msg->flags, + &reply); + + return (&reply); +} + +/* + * PUBLIC: __txn_prepare_reply *__db_txn_prepare_4001 + * PUBLIC: __P((__txn_prepare_msg *, struct svc_req *)); + */ +__txn_prepare_reply * +__db_txn_prepare_4001(msg, req) + __txn_prepare_msg *msg; + struct svc_req *req; +{ + static __txn_prepare_reply reply; /* must be static */ + COMPQUIET(req, NULL); + + __txn_prepare_proc(msg->txnpcl_id, + msg->gid, + &reply); + + return (&reply); +} + +/* + * PUBLIC: __txn_recover_reply *__db_txn_recover_4001 + * PUBLIC: __P((__txn_recover_msg *, struct svc_req *)); + */ +__txn_recover_reply * +__db_txn_recover_4001(msg, req) + __txn_recover_msg *msg; + struct svc_req *req; +{ + static __txn_recover_reply reply; /* must be static */ + static int __txn_recover_free = 0; /* must be static */ + + COMPQUIET(req, NULL); + if (__txn_recover_free) + xdr_free((xdrproc_t)xdr___txn_recover_reply, (void *)&reply); + __txn_recover_free = 0; + + /* Reinitialize allocated fields */ + reply.txn.txn_val = NULL; + reply.gid.gid_val = NULL; + + __txn_recover_proc(msg->dbenvcl_id, + msg->count, + msg->flags, + &reply, + &__txn_recover_free); + return (&reply); +} + +/* + * PUBLIC: __db_associate_reply *__db_db_associate_4001 + * PUBLIC: __P((__db_associate_msg *, struct svc_req *)); + */ +__db_associate_reply * +__db_db_associate_4001(msg, req) + __db_associate_msg *msg; + struct svc_req *req; +{ + static __db_associate_reply reply; /* must be static */ + COMPQUIET(req, NULL); + + __db_associate_proc(msg->dbpcl_id, + msg->txnpcl_id, + msg->sdbpcl_id, + msg->flags, + &reply); + + return (&reply); +} + +/* + * PUBLIC: __db_bt_maxkey_reply *__db_db_bt_maxkey_4001 + * PUBLIC: __P((__db_bt_maxkey_msg *, struct svc_req *)); + */ +__db_bt_maxkey_reply * +__db_db_bt_maxkey_4001(msg, req) + __db_bt_maxkey_msg *msg; + struct svc_req *req; +{ + static __db_bt_maxkey_reply reply; /* must be static */ + COMPQUIET(req, NULL); + + __db_bt_maxkey_proc(msg->dbpcl_id, + msg->maxkey, + &reply); + + return (&reply); +} + +/* + * PUBLIC: __db_bt_minkey_reply *__db_db_bt_minkey_4001 + * PUBLIC: __P((__db_bt_minkey_msg *, struct svc_req *)); + */ +__db_bt_minkey_reply * +__db_db_bt_minkey_4001(msg, req) + __db_bt_minkey_msg *msg; + struct svc_req *req; +{ + static __db_bt_minkey_reply reply; /* must be static */ + COMPQUIET(req, NULL); + + __db_bt_minkey_proc(msg->dbpcl_id, + msg->minkey, + &reply); + + return (&reply); +} + +/* + * PUBLIC: __db_close_reply *__db_db_close_4001 __P((__db_close_msg *, + * PUBLIC: struct svc_req *)); + */ +__db_close_reply * +__db_db_close_4001(msg, req) + __db_close_msg *msg; + struct svc_req *req; +{ + static __db_close_reply reply; /* must be static */ + COMPQUIET(req, NULL); + + __db_close_proc(msg->dbpcl_id, + msg->flags, + &reply); + + return (&reply); +} + +/* + * PUBLIC: __db_create_reply *__db_db_create_4001 __P((__db_create_msg *, + * PUBLIC: struct svc_req *)); + */ +__db_create_reply * +__db_db_create_4001(msg, req) + __db_create_msg *msg; + struct svc_req *req; +{ + static __db_create_reply reply; /* must be static */ + COMPQUIET(req, NULL); + + __db_create_proc(msg->dbenvcl_id, + msg->flags, + &reply); + + return (&reply); +} + +/* + * PUBLIC: __db_del_reply *__db_db_del_4001 __P((__db_del_msg *, + * PUBLIC: struct svc_req *)); + */ +__db_del_reply * +__db_db_del_4001(msg, req) + __db_del_msg *msg; + struct svc_req *req; +{ + static __db_del_reply reply; /* must be static */ + COMPQUIET(req, NULL); + + __db_del_proc(msg->dbpcl_id, + msg->txnpcl_id, + msg->keydlen, + msg->keydoff, + msg->keyulen, + msg->keyflags, + msg->keydata.keydata_val, + msg->keydata.keydata_len, + msg->flags, + &reply); + + return (&reply); +} + +/* + * PUBLIC: __db_encrypt_reply *__db_db_encrypt_4001 __P((__db_encrypt_msg *, + * PUBLIC: struct svc_req *)); + */ +__db_encrypt_reply * +__db_db_encrypt_4001(msg, req) + __db_encrypt_msg *msg; + struct svc_req *req; +{ + static __db_encrypt_reply reply; /* must be static */ + COMPQUIET(req, NULL); + + __db_encrypt_proc(msg->dbpcl_id, + (*msg->passwd == '\0') ? NULL : msg->passwd, + msg->flags, + &reply); + + return (&reply); +} + +/* + * PUBLIC: __db_extentsize_reply *__db_db_extentsize_4001 + * PUBLIC: __P((__db_extentsize_msg *, struct svc_req *)); + */ +__db_extentsize_reply * +__db_db_extentsize_4001(msg, req) + __db_extentsize_msg *msg; + struct svc_req *req; +{ + static __db_extentsize_reply reply; /* must be static */ + COMPQUIET(req, NULL); + + __db_extentsize_proc(msg->dbpcl_id, + msg->extentsize, + &reply); + + return (&reply); +} + +/* + * PUBLIC: __db_flags_reply *__db_db_flags_4001 __P((__db_flags_msg *, + * PUBLIC: struct svc_req *)); + */ +__db_flags_reply * +__db_db_flags_4001(msg, req) + __db_flags_msg *msg; + struct svc_req *req; +{ + static __db_flags_reply reply; /* must be static */ + COMPQUIET(req, NULL); + + __db_flags_proc(msg->dbpcl_id, + msg->flags, + &reply); + + return (&reply); +} + +/* + * PUBLIC: __db_get_reply *__db_db_get_4001 __P((__db_get_msg *, + * PUBLIC: struct svc_req *)); + */ +__db_get_reply * +__db_db_get_4001(msg, req) + __db_get_msg *msg; + struct svc_req *req; +{ + static __db_get_reply reply; /* must be static */ + static int __db_get_free = 0; /* must be static */ + + COMPQUIET(req, NULL); + if (__db_get_free) + xdr_free((xdrproc_t)xdr___db_get_reply, (void *)&reply); + __db_get_free = 0; + + /* Reinitialize allocated fields */ + reply.keydata.keydata_val = NULL; + reply.datadata.datadata_val = NULL; + + __db_get_proc(msg->dbpcl_id, + msg->txnpcl_id, + msg->keydlen, + msg->keydoff, + msg->keyulen, + msg->keyflags, + msg->keydata.keydata_val, + msg->keydata.keydata_len, + msg->datadlen, + msg->datadoff, + msg->dataulen, + msg->dataflags, + msg->datadata.datadata_val, + msg->datadata.datadata_len, + msg->flags, + &reply, + &__db_get_free); + return (&reply); +} + +/* + * PUBLIC: __db_h_ffactor_reply *__db_db_h_ffactor_4001 + * PUBLIC: __P((__db_h_ffactor_msg *, struct svc_req *)); + */ +__db_h_ffactor_reply * +__db_db_h_ffactor_4001(msg, req) + __db_h_ffactor_msg *msg; + struct svc_req *req; +{ + static __db_h_ffactor_reply reply; /* must be static */ + COMPQUIET(req, NULL); + + __db_h_ffactor_proc(msg->dbpcl_id, + msg->ffactor, + &reply); + + return (&reply); +} + +/* + * PUBLIC: __db_h_nelem_reply *__db_db_h_nelem_4001 __P((__db_h_nelem_msg *, + * PUBLIC: struct svc_req *)); + */ +__db_h_nelem_reply * +__db_db_h_nelem_4001(msg, req) + __db_h_nelem_msg *msg; + struct svc_req *req; +{ + static __db_h_nelem_reply reply; /* must be static */ + COMPQUIET(req, NULL); + + __db_h_nelem_proc(msg->dbpcl_id, + msg->nelem, + &reply); + + return (&reply); +} + +/* + * PUBLIC: __db_key_range_reply *__db_db_key_range_4001 + * PUBLIC: __P((__db_key_range_msg *, struct svc_req *)); + */ +__db_key_range_reply * +__db_db_key_range_4001(msg, req) + __db_key_range_msg *msg; + struct svc_req *req; +{ + static __db_key_range_reply reply; /* must be static */ + COMPQUIET(req, NULL); + + __db_key_range_proc(msg->dbpcl_id, + msg->txnpcl_id, + msg->keydlen, + msg->keydoff, + msg->keyulen, + msg->keyflags, + msg->keydata.keydata_val, + msg->keydata.keydata_len, + msg->flags, + &reply); + + return (&reply); +} + +/* + * PUBLIC: __db_lorder_reply *__db_db_lorder_4001 __P((__db_lorder_msg *, + * PUBLIC: struct svc_req *)); + */ +__db_lorder_reply * +__db_db_lorder_4001(msg, req) + __db_lorder_msg *msg; + struct svc_req *req; +{ + static __db_lorder_reply reply; /* must be static */ + COMPQUIET(req, NULL); + + __db_lorder_proc(msg->dbpcl_id, + msg->lorder, + &reply); + + return (&reply); +} + +/* + * PUBLIC: __db_open_reply *__db_db_open_4001 __P((__db_open_msg *, + * PUBLIC: struct svc_req *)); + */ +__db_open_reply * +__db_db_open_4001(msg, req) + __db_open_msg *msg; + struct svc_req *req; +{ + static __db_open_reply reply; /* must be static */ + COMPQUIET(req, NULL); + + __db_open_proc(msg->dbpcl_id, + msg->txnpcl_id, + (*msg->name == '\0') ? NULL : msg->name, + (*msg->subdb == '\0') ? NULL : msg->subdb, + msg->type, + msg->flags, + msg->mode, + &reply); + + return (&reply); +} + +/* + * PUBLIC: __db_pagesize_reply *__db_db_pagesize_4001 + * PUBLIC: __P((__db_pagesize_msg *, struct svc_req *)); + */ +__db_pagesize_reply * +__db_db_pagesize_4001(msg, req) + __db_pagesize_msg *msg; + struct svc_req *req; +{ + static __db_pagesize_reply reply; /* must be static */ + COMPQUIET(req, NULL); + + __db_pagesize_proc(msg->dbpcl_id, + msg->pagesize, + &reply); + + return (&reply); +} + +/* + * PUBLIC: __db_pget_reply *__db_db_pget_4001 __P((__db_pget_msg *, + * PUBLIC: struct svc_req *)); + */ +__db_pget_reply * +__db_db_pget_4001(msg, req) + __db_pget_msg *msg; + struct svc_req *req; +{ + static __db_pget_reply reply; /* must be static */ + static int __db_pget_free = 0; /* must be static */ + + COMPQUIET(req, NULL); + if (__db_pget_free) + xdr_free((xdrproc_t)xdr___db_pget_reply, (void *)&reply); + __db_pget_free = 0; + + /* Reinitialize allocated fields */ + reply.skeydata.skeydata_val = NULL; + reply.pkeydata.pkeydata_val = NULL; + reply.datadata.datadata_val = NULL; + + __db_pget_proc(msg->dbpcl_id, + msg->txnpcl_id, + msg->skeydlen, + msg->skeydoff, + msg->skeyulen, + msg->skeyflags, + msg->skeydata.skeydata_val, + msg->skeydata.skeydata_len, + msg->pkeydlen, + msg->pkeydoff, + msg->pkeyulen, + msg->pkeyflags, + msg->pkeydata.pkeydata_val, + msg->pkeydata.pkeydata_len, + msg->datadlen, + msg->datadoff, + msg->dataulen, + msg->dataflags, + msg->datadata.datadata_val, + msg->datadata.datadata_len, + msg->flags, + &reply, + &__db_pget_free); + return (&reply); +} + +/* + * PUBLIC: __db_put_reply *__db_db_put_4001 __P((__db_put_msg *, + * PUBLIC: struct svc_req *)); + */ +__db_put_reply * +__db_db_put_4001(msg, req) + __db_put_msg *msg; + struct svc_req *req; +{ + static __db_put_reply reply; /* must be static */ + static int __db_put_free = 0; /* must be static */ + + COMPQUIET(req, NULL); + if (__db_put_free) + xdr_free((xdrproc_t)xdr___db_put_reply, (void *)&reply); + __db_put_free = 0; + + /* Reinitialize allocated fields */ + reply.keydata.keydata_val = NULL; + + __db_put_proc(msg->dbpcl_id, + msg->txnpcl_id, + msg->keydlen, + msg->keydoff, + msg->keyulen, + msg->keyflags, + msg->keydata.keydata_val, + msg->keydata.keydata_len, + msg->datadlen, + msg->datadoff, + msg->dataulen, + msg->dataflags, + msg->datadata.datadata_val, + msg->datadata.datadata_len, + msg->flags, + &reply, + &__db_put_free); + return (&reply); +} + +/* + * PUBLIC: __db_re_delim_reply *__db_db_re_delim_4001 + * PUBLIC: __P((__db_re_delim_msg *, struct svc_req *)); + */ +__db_re_delim_reply * +__db_db_re_delim_4001(msg, req) + __db_re_delim_msg *msg; + struct svc_req *req; +{ + static __db_re_delim_reply reply; /* must be static */ + COMPQUIET(req, NULL); + + __db_re_delim_proc(msg->dbpcl_id, + msg->delim, + &reply); + + return (&reply); +} + +/* + * PUBLIC: __db_re_len_reply *__db_db_re_len_4001 __P((__db_re_len_msg *, + * PUBLIC: struct svc_req *)); + */ +__db_re_len_reply * +__db_db_re_len_4001(msg, req) + __db_re_len_msg *msg; + struct svc_req *req; +{ + static __db_re_len_reply reply; /* must be static */ + COMPQUIET(req, NULL); + + __db_re_len_proc(msg->dbpcl_id, + msg->len, + &reply); + + return (&reply); +} + +/* + * PUBLIC: __db_re_pad_reply *__db_db_re_pad_4001 __P((__db_re_pad_msg *, + * PUBLIC: struct svc_req *)); + */ +__db_re_pad_reply * +__db_db_re_pad_4001(msg, req) + __db_re_pad_msg *msg; + struct svc_req *req; +{ + static __db_re_pad_reply reply; /* must be static */ + COMPQUIET(req, NULL); + + __db_re_pad_proc(msg->dbpcl_id, + msg->pad, + &reply); + + return (&reply); +} + +/* + * PUBLIC: __db_remove_reply *__db_db_remove_4001 __P((__db_remove_msg *, + * PUBLIC: struct svc_req *)); + */ +__db_remove_reply * +__db_db_remove_4001(msg, req) + __db_remove_msg *msg; + struct svc_req *req; +{ + static __db_remove_reply reply; /* must be static */ + COMPQUIET(req, NULL); + + __db_remove_proc(msg->dbpcl_id, + (*msg->name == '\0') ? NULL : msg->name, + (*msg->subdb == '\0') ? NULL : msg->subdb, + msg->flags, + &reply); + + return (&reply); +} + +/* + * PUBLIC: __db_rename_reply *__db_db_rename_4001 __P((__db_rename_msg *, + * PUBLIC: struct svc_req *)); + */ +__db_rename_reply * +__db_db_rename_4001(msg, req) + __db_rename_msg *msg; + struct svc_req *req; +{ + static __db_rename_reply reply; /* must be static */ + COMPQUIET(req, NULL); + + __db_rename_proc(msg->dbpcl_id, + (*msg->name == '\0') ? NULL : msg->name, + (*msg->subdb == '\0') ? NULL : msg->subdb, + (*msg->newname == '\0') ? NULL : msg->newname, + msg->flags, + &reply); + + return (&reply); +} + +/* + * PUBLIC: __db_stat_reply *__db_db_stat_4001 __P((__db_stat_msg *, + * PUBLIC: struct svc_req *)); + */ +__db_stat_reply * +__db_db_stat_4001(msg, req) + __db_stat_msg *msg; + struct svc_req *req; +{ + static __db_stat_reply reply; /* must be static */ + static int __db_stat_free = 0; /* must be static */ + + COMPQUIET(req, NULL); + if (__db_stat_free) + xdr_free((xdrproc_t)xdr___db_stat_reply, (void *)&reply); + __db_stat_free = 0; + + /* Reinitialize allocated fields */ + reply.stats.stats_val = NULL; + + __db_stat_proc(msg->dbpcl_id, + msg->flags, + &reply, + &__db_stat_free); + return (&reply); +} + +/* + * PUBLIC: __db_sync_reply *__db_db_sync_4001 __P((__db_sync_msg *, + * PUBLIC: struct svc_req *)); + */ +__db_sync_reply * +__db_db_sync_4001(msg, req) + __db_sync_msg *msg; + struct svc_req *req; +{ + static __db_sync_reply reply; /* must be static */ + COMPQUIET(req, NULL); + + __db_sync_proc(msg->dbpcl_id, + msg->flags, + &reply); + + return (&reply); +} + +/* + * PUBLIC: __db_truncate_reply *__db_db_truncate_4001 + * PUBLIC: __P((__db_truncate_msg *, struct svc_req *)); + */ +__db_truncate_reply * +__db_db_truncate_4001(msg, req) + __db_truncate_msg *msg; + struct svc_req *req; +{ + static __db_truncate_reply reply; /* must be static */ + COMPQUIET(req, NULL); + + __db_truncate_proc(msg->dbpcl_id, + msg->txnpcl_id, + msg->flags, + &reply); + + return (&reply); +} + +/* + * PUBLIC: __db_cursor_reply *__db_db_cursor_4001 __P((__db_cursor_msg *, + * PUBLIC: struct svc_req *)); + */ +__db_cursor_reply * +__db_db_cursor_4001(msg, req) + __db_cursor_msg *msg; + struct svc_req *req; +{ + static __db_cursor_reply reply; /* must be static */ + COMPQUIET(req, NULL); + + __db_cursor_proc(msg->dbpcl_id, + msg->txnpcl_id, + msg->flags, + &reply); + + return (&reply); +} + +/* + * PUBLIC: __db_join_reply *__db_db_join_4001 __P((__db_join_msg *, + * PUBLIC: struct svc_req *)); + */ +__db_join_reply * +__db_db_join_4001(msg, req) + __db_join_msg *msg; + struct svc_req *req; +{ + static __db_join_reply reply; /* must be static */ + COMPQUIET(req, NULL); + + __db_join_proc(msg->dbpcl_id, + msg->curs.curs_val, + msg->curs.curs_len, + msg->flags, + &reply); + + return (&reply); +} + +/* + * PUBLIC: __dbc_close_reply *__db_dbc_close_4001 __P((__dbc_close_msg *, + * PUBLIC: struct svc_req *)); + */ +__dbc_close_reply * +__db_dbc_close_4001(msg, req) + __dbc_close_msg *msg; + struct svc_req *req; +{ + static __dbc_close_reply reply; /* must be static */ + COMPQUIET(req, NULL); + + __dbc_close_proc(msg->dbccl_id, + &reply); + + return (&reply); +} + +/* + * PUBLIC: __dbc_count_reply *__db_dbc_count_4001 __P((__dbc_count_msg *, + * PUBLIC: struct svc_req *)); + */ +__dbc_count_reply * +__db_dbc_count_4001(msg, req) + __dbc_count_msg *msg; + struct svc_req *req; +{ + static __dbc_count_reply reply; /* must be static */ + COMPQUIET(req, NULL); + + __dbc_count_proc(msg->dbccl_id, + msg->flags, + &reply); + + return (&reply); +} + +/* + * PUBLIC: __dbc_del_reply *__db_dbc_del_4001 __P((__dbc_del_msg *, + * PUBLIC: struct svc_req *)); + */ +__dbc_del_reply * +__db_dbc_del_4001(msg, req) + __dbc_del_msg *msg; + struct svc_req *req; +{ + static __dbc_del_reply reply; /* must be static */ + COMPQUIET(req, NULL); + + __dbc_del_proc(msg->dbccl_id, + msg->flags, + &reply); + + return (&reply); +} + +/* + * PUBLIC: __dbc_dup_reply *__db_dbc_dup_4001 __P((__dbc_dup_msg *, + * PUBLIC: struct svc_req *)); + */ +__dbc_dup_reply * +__db_dbc_dup_4001(msg, req) + __dbc_dup_msg *msg; + struct svc_req *req; +{ + static __dbc_dup_reply reply; /* must be static */ + COMPQUIET(req, NULL); + + __dbc_dup_proc(msg->dbccl_id, + msg->flags, + &reply); + + return (&reply); +} + +/* + * PUBLIC: __dbc_get_reply *__db_dbc_get_4001 __P((__dbc_get_msg *, + * PUBLIC: struct svc_req *)); + */ +__dbc_get_reply * +__db_dbc_get_4001(msg, req) + __dbc_get_msg *msg; + struct svc_req *req; +{ + static __dbc_get_reply reply; /* must be static */ + static int __dbc_get_free = 0; /* must be static */ + + COMPQUIET(req, NULL); + if (__dbc_get_free) + xdr_free((xdrproc_t)xdr___dbc_get_reply, (void *)&reply); + __dbc_get_free = 0; + + /* Reinitialize allocated fields */ + reply.keydata.keydata_val = NULL; + reply.datadata.datadata_val = NULL; + + __dbc_get_proc(msg->dbccl_id, + msg->keydlen, + msg->keydoff, + msg->keyulen, + msg->keyflags, + msg->keydata.keydata_val, + msg->keydata.keydata_len, + msg->datadlen, + msg->datadoff, + msg->dataulen, + msg->dataflags, + msg->datadata.datadata_val, + msg->datadata.datadata_len, + msg->flags, + &reply, + &__dbc_get_free); + return (&reply); +} + +/* + * PUBLIC: __dbc_pget_reply *__db_dbc_pget_4001 __P((__dbc_pget_msg *, + * PUBLIC: struct svc_req *)); + */ +__dbc_pget_reply * +__db_dbc_pget_4001(msg, req) + __dbc_pget_msg *msg; + struct svc_req *req; +{ + static __dbc_pget_reply reply; /* must be static */ + static int __dbc_pget_free = 0; /* must be static */ + + COMPQUIET(req, NULL); + if (__dbc_pget_free) + xdr_free((xdrproc_t)xdr___dbc_pget_reply, (void *)&reply); + __dbc_pget_free = 0; + + /* Reinitialize allocated fields */ + reply.skeydata.skeydata_val = NULL; + reply.pkeydata.pkeydata_val = NULL; + reply.datadata.datadata_val = NULL; + + __dbc_pget_proc(msg->dbccl_id, + msg->skeydlen, + msg->skeydoff, + msg->skeyulen, + msg->skeyflags, + msg->skeydata.skeydata_val, + msg->skeydata.skeydata_len, + msg->pkeydlen, + msg->pkeydoff, + msg->pkeyulen, + msg->pkeyflags, + msg->pkeydata.pkeydata_val, + msg->pkeydata.pkeydata_len, + msg->datadlen, + msg->datadoff, + msg->dataulen, + msg->dataflags, + msg->datadata.datadata_val, + msg->datadata.datadata_len, + msg->flags, + &reply, + &__dbc_pget_free); + return (&reply); +} + +/* + * PUBLIC: __dbc_put_reply *__db_dbc_put_4001 __P((__dbc_put_msg *, + * PUBLIC: struct svc_req *)); + */ +__dbc_put_reply * +__db_dbc_put_4001(msg, req) + __dbc_put_msg *msg; + struct svc_req *req; +{ + static __dbc_put_reply reply; /* must be static */ + static int __dbc_put_free = 0; /* must be static */ + + COMPQUIET(req, NULL); + if (__dbc_put_free) + xdr_free((xdrproc_t)xdr___dbc_put_reply, (void *)&reply); + __dbc_put_free = 0; + + /* Reinitialize allocated fields */ + reply.keydata.keydata_val = NULL; + + __dbc_put_proc(msg->dbccl_id, + msg->keydlen, + msg->keydoff, + msg->keyulen, + msg->keyflags, + msg->keydata.keydata_val, + msg->keydata.keydata_len, + msg->datadlen, + msg->datadoff, + msg->dataulen, + msg->dataflags, + msg->datadata.datadata_val, + msg->datadata.datadata_len, + msg->flags, + &reply, + &__dbc_put_free); + return (&reply); +} + diff --git a/db/rpc_server/cxx/db_server_cxxproc.cpp b/db/rpc_server/cxx/db_server_cxxproc.cpp new file mode 100644 index 000000000..0ba1fd50c --- /dev/null +++ b/db/rpc_server/cxx/db_server_cxxproc.cpp @@ -0,0 +1,2200 @@ +/*- + * See the file LICENSE for redistribution information. + * + * Copyright (c) 2001-2002 + * Sleepycat Software. All rights reserved. + */ + +#include "db_config.h" + +#ifdef HAVE_RPC +#ifndef lint +static const char revid[] = "Id: db_server_cxxproc.cpp,v 1.12 2002/08/09 01:56:08 bostic Exp "; +#endif /* not lint */ + +#ifndef NO_SYSTEM_INCLUDES +#include <sys/types.h> + +#include <rpc/rpc.h> + +#include <string.h> +#endif +#include "dbinc_auto/db_server.h" + +#include "db_int.h" +#include "db_cxx.h" + +extern "C" { +#include "dbinc/db_server_int.h" +#include "dbinc_auto/rpc_server_ext.h" +} + +/* BEGIN __env_cachesize_proc */ +extern "C" void +__env_cachesize_proc( + long dbenvcl_id, + u_int32_t gbytes, + u_int32_t bytes, + u_int32_t ncache, + __env_cachesize_reply *replyp) +/* END __env_cachesize_proc */ +{ + DbEnv *dbenv; + ct_entry *dbenv_ctp; + int ret; + + ACTIVATE_CTP(dbenv_ctp, dbenvcl_id, CT_ENV); + dbenv = (DbEnv *)dbenv_ctp->ct_anyp; + + ret = dbenv->set_cachesize(gbytes, bytes, ncache); + + replyp->status = ret; + return; +} + +/* BEGIN __env_close_proc */ +extern "C" void +__env_close_proc( + long dbenvcl_id, + u_int32_t flags, + __env_close_reply *replyp) +/* END __env_close_proc */ +{ + ct_entry *dbenv_ctp; + + ACTIVATE_CTP(dbenv_ctp, dbenvcl_id, CT_ENV); + replyp->status = __dbenv_close_int(dbenvcl_id, flags, 0); + return; +} + +/* BEGIN __env_create_proc */ +extern "C" void +__env_create_proc( + u_int32_t timeout, + __env_create_reply *replyp) +/* END __env_create_proc */ +{ + DbEnv *dbenv; + ct_entry *ctp; + + ctp = new_ct_ent(&replyp->status); + if (ctp == NULL) + return; + + dbenv = new DbEnv(DB_CXX_NO_EXCEPTIONS); + ctp->ct_envp = dbenv; + ctp->ct_type = CT_ENV; + ctp->ct_parent = NULL; + ctp->ct_envparent = ctp; + __dbsrv_settimeout(ctp, timeout); + __dbsrv_active(ctp); + replyp->envcl_id = ctp->ct_id; + + replyp->status = 0; + return; +} + +/* BEGIN __env_dbremove_proc */ +extern "C" void +__env_dbremove_proc( + long dbenvcl_id, + long txnpcl_id, + char *name, + char *subdb, + u_int32_t flags, + __env_dbremove_reply *replyp) +/* END __env_dbremove_proc */ +{ + int ret; + DbEnv *dbenv; + DbTxn *txnp; + ct_entry *dbenv_ctp, *txnp_ctp; + + ACTIVATE_CTP(dbenv_ctp, dbenvcl_id, CT_ENV); + dbenv = (DbEnv *)dbenv_ctp->ct_anyp; + + if (txnpcl_id != 0) { + ACTIVATE_CTP(txnp_ctp, txnpcl_id, CT_TXN); + txnp = (DbTxn *)txnp_ctp->ct_anyp; + } else + txnp = NULL; + + ret = dbenv->dbremove(txnp, name, subdb, flags); + + replyp->status = ret; + return; +} + +/* BEGIN __env_dbrename_proc */ +void +__env_dbrename_proc( + long dbenvcl_id, + long txnpcl_id, + char *name, + char *subdb, + char *newname, + u_int32_t flags, + __env_dbrename_reply *replyp) +/* END __env_dbrename_proc */ +{ + int ret; + DbEnv *dbenv; + DbTxn *txnp; + ct_entry *dbenv_ctp, *txnp_ctp; + + ACTIVATE_CTP(dbenv_ctp, dbenvcl_id, CT_ENV); + dbenv = (DbEnv *)dbenv_ctp->ct_anyp; + + if (txnpcl_id != 0) { + ACTIVATE_CTP(txnp_ctp, txnpcl_id, CT_TXN); + txnp = (DbTxn *)txnp_ctp->ct_anyp; + } else + txnp = NULL; + + ret = dbenv->dbrename(txnp, name, subdb, newname, flags); + + replyp->status = ret; + return; +} + +/* BEGIN __env_encrypt_proc */ +extern "C" void +__env_encrypt_proc( + long dbenvcl_id, + char *passwd, + u_int32_t flags, + __env_encrypt_reply *replyp) +/* END __env_encrypt_proc */ +{ + DbEnv *dbenv; + ct_entry *dbenv_ctp; + int ret; + + ACTIVATE_CTP(dbenv_ctp, dbenvcl_id, CT_ENV); + dbenv = (DbEnv *)dbenv_ctp->ct_anyp; + + ret = dbenv->set_encrypt(passwd, flags); + + replyp->status = ret; + return; +} + +/* BEGIN __env_flags_proc */ +extern "C" void +__env_flags_proc( + long dbenvcl_id, + u_int32_t flags, + u_int32_t onoff, + __env_flags_reply *replyp) +/* END __env_flags_proc */ +{ + DbEnv *dbenv; + ct_entry *dbenv_ctp; + int ret; + + ACTIVATE_CTP(dbenv_ctp, dbenvcl_id, CT_ENV); + dbenv = (DbEnv *)dbenv_ctp->ct_anyp; + + ret = dbenv->set_flags(flags, onoff); + if (onoff) + dbenv_ctp->ct_envdp.onflags = flags; + else + dbenv_ctp->ct_envdp.offflags = flags; + + replyp->status = ret; + return; +} +/* BEGIN __env_open_proc */ +extern "C" void +__env_open_proc( + long dbenvcl_id, + char *home, + u_int32_t flags, + u_int32_t mode, + __env_open_reply *replyp) +/* END __env_open_proc */ +{ + DbEnv *dbenv; + ct_entry *dbenv_ctp, *new_ctp; + u_int32_t newflags, shareflags; + int ret; + home_entry *fullhome; + + ACTIVATE_CTP(dbenv_ctp, dbenvcl_id, CT_ENV); + dbenv = (DbEnv *)dbenv_ctp->ct_anyp; + fullhome = get_home(home); + if (fullhome == NULL) { + ret = DB_NOSERVER_HOME; + goto out; + } + + /* + * If they are using locking do deadlock detection for them, + * internally. + */ + if ((flags & DB_INIT_LOCK) && + (ret = dbenv->set_lk_detect(DB_LOCK_DEFAULT)) != 0) + goto out; + + if (__dbsrv_verbose) { + dbenv->set_errfile(stderr); + dbenv->set_errpfx(fullhome->home); + } + + /* + * Mask off flags we ignore + */ + newflags = (flags & ~DB_SERVER_FLAGMASK); + shareflags = (newflags & DB_SERVER_ENVFLAGS); + /* + * Check now whether we can share a handle for this env. + */ + replyp->envcl_id = dbenvcl_id; + if ((new_ctp = __dbsrv_shareenv(dbenv_ctp, fullhome, shareflags)) + != NULL) { + /* + * We can share, clean up old ID, set new one. + */ + if (__dbsrv_verbose) + printf("Sharing env ID %ld\n", new_ctp->ct_id); + replyp->envcl_id = new_ctp->ct_id; + ret = __dbenv_close_int(dbenvcl_id, 0, 0); + } else { + ret = dbenv->open(fullhome->home, newflags, mode); + dbenv_ctp->ct_envdp.home = fullhome; + dbenv_ctp->ct_envdp.envflags = shareflags; + } +out: replyp->status = ret; + return; +} + +/* BEGIN __env_remove_proc */ +extern "C" void +__env_remove_proc( + long dbenvcl_id, + char *home, + u_int32_t flags, + __env_remove_reply *replyp) +/* END __env_remove_proc */ +{ + DbEnv *dbenv; + ct_entry *dbenv_ctp; + int ret; + home_entry *fullhome; + + ACTIVATE_CTP(dbenv_ctp, dbenvcl_id, CT_ENV); + dbenv = (DbEnv *)dbenv_ctp->ct_anyp; + fullhome = get_home(home); + if (fullhome == NULL) { + replyp->status = DB_NOSERVER_HOME; + return; + } + + ret = dbenv->remove(fullhome->home, flags); + __dbdel_ctp(dbenv_ctp); + replyp->status = ret; + return; +} + +/* BEGIN __txn_abort_proc */ +extern "C" void +__txn_abort_proc( + long txnpcl_id, + __txn_abort_reply *replyp) +/* END __txn_abort_proc */ +{ + DbTxn *txnp; + ct_entry *txnp_ctp; + int ret; + + ACTIVATE_CTP(txnp_ctp, txnpcl_id, CT_TXN); + txnp = (DbTxn *)txnp_ctp->ct_anyp; + + ret = txnp->abort(); + __dbdel_ctp(txnp_ctp); + replyp->status = ret; + return; +} + +/* BEGIN __txn_begin_proc */ +extern "C" void +__txn_begin_proc( + long dbenvcl_id, + long parentcl_id, + u_int32_t flags, + __txn_begin_reply *replyp) +/* END __txn_begin_proc */ +{ + DbEnv *dbenv; + DbTxn *parent, *txnp; + ct_entry *ctp, *dbenv_ctp, *parent_ctp; + int ret; + + ACTIVATE_CTP(dbenv_ctp, dbenvcl_id, CT_ENV); + dbenv = (DbEnv *)dbenv_ctp->ct_anyp; + parent_ctp = NULL; + + ctp = new_ct_ent(&replyp->status); + if (ctp == NULL) + return; + + if (parentcl_id != 0) { + ACTIVATE_CTP(parent_ctp, parentcl_id, CT_TXN); + parent = (DbTxn *)parent_ctp->ct_anyp; + ctp->ct_activep = parent_ctp->ct_activep; + } else + parent = NULL; + + ret = dbenv->txn_begin(parent, &txnp, flags); + if (ret == 0) { + ctp->ct_txnp = txnp; + ctp->ct_type = CT_TXN; + ctp->ct_parent = parent_ctp; + ctp->ct_envparent = dbenv_ctp; + replyp->txnidcl_id = ctp->ct_id; + __dbsrv_settimeout(ctp, dbenv_ctp->ct_timeout); + __dbsrv_active(ctp); + } else + __dbclear_ctp(ctp); + + replyp->status = ret; + return; +} + +/* BEGIN __txn_commit_proc */ +extern "C" void +__txn_commit_proc( + long txnpcl_id, + u_int32_t flags, + __txn_commit_reply *replyp) +/* END __txn_commit_proc */ +{ + DbTxn *txnp; + ct_entry *txnp_ctp; + int ret; + + ACTIVATE_CTP(txnp_ctp, txnpcl_id, CT_TXN); + txnp = (DbTxn *)txnp_ctp->ct_anyp; + + ret = txnp->commit(flags); + __dbdel_ctp(txnp_ctp); + + replyp->status = ret; + return; +} + +/* BEGIN __txn_discard_proc */ +extern "C" void +__txn_discard_proc( + long txnpcl_id, + u_int32_t flags, + __txn_discard_reply *replyp) +/* END __txn_discard_proc */ +{ + DbTxn *txnp; + ct_entry *txnp_ctp; + int ret; + + ACTIVATE_CTP(txnp_ctp, txnpcl_id, CT_TXN); + txnp = (DbTxn *)txnp_ctp->ct_anyp; + + ret = txnp->discard(flags); + __dbdel_ctp(txnp_ctp); + + replyp->status = ret; + return; +} + +/* BEGIN __txn_prepare_proc */ +extern "C" void +__txn_prepare_proc( + long txnpcl_id, + u_int8_t *gid, + __txn_prepare_reply *replyp) +/* END __txn_prepare_proc */ +{ + DbTxn *txnp; + ct_entry *txnp_ctp; + int ret; + + ACTIVATE_CTP(txnp_ctp, txnpcl_id, CT_TXN); + txnp = (DbTxn *)txnp_ctp->ct_anyp; + + ret = txnp->prepare(gid); + replyp->status = ret; + return; +} + +/* BEGIN __txn_recover_proc */ +extern "C" void +__txn_recover_proc( + long dbenvcl_id, + u_int32_t count, + u_int32_t flags, + __txn_recover_reply *replyp, + int * freep) +/* END __txn_recover_proc */ +{ + DbEnv *dbenv; + DbPreplist *dbprep, *p; + ct_entry *dbenv_ctp, *ctp; + long erri, i, retcount; + u_int32_t *txnidp; + int ret; + char *gid; + + ACTIVATE_CTP(dbenv_ctp, dbenvcl_id, CT_ENV); + dbenv = (DbEnv *)dbenv_ctp->ct_anyp; + *freep = 0; + + if ((ret = + __os_malloc(dbenv->get_DB_ENV(), count * sizeof(DbPreplist), &dbprep)) != 0) + goto out; + if ((ret = + dbenv->txn_recover(dbprep, count, &retcount, flags)) != 0) + goto out; + /* + * If there is nothing, success, but it's easy. + */ + replyp->retcount = retcount; // TODO: fix C++ txn_recover + if (retcount == 0) { + replyp->txn.txn_val = NULL; + replyp->txn.txn_len = 0; + replyp->gid.gid_val = NULL; + replyp->gid.gid_len = 0; + } + + /* + * We have our txn list. Now we need to allocate the space for + * the txn ID array and the GID array and set them up. + */ + if ((ret = __os_calloc(dbenv->get_DB_ENV(), retcount, sizeof(u_int32_t), + &replyp->txn.txn_val)) != 0) + goto out; + replyp->txn.txn_len = retcount * sizeof(u_int32_t); + if ((ret = __os_calloc(dbenv->get_DB_ENV(), retcount, DB_XIDDATASIZE, + &replyp->gid.gid_val)) != 0) { + __os_free(dbenv->get_DB_ENV(), replyp->txn.txn_val); + goto out; + } + replyp->gid.gid_len = retcount * DB_XIDDATASIZE; + + /* + * Now walk through our results, creating parallel arrays + * to send back. For each entry we need to create a new + * txn ctp and then fill in the array info. + */ + i = 0; + p = dbprep; + gid = replyp->gid.gid_val; + txnidp = replyp->txn.txn_val; + while (i++ < retcount) { + ctp = new_ct_ent(&ret); + if (ret != 0) { + i--; + goto out2; + } + ctp->ct_txnp = p->txn; + ctp->ct_type = CT_TXN; + ctp->ct_parent = NULL; + ctp->ct_envparent = dbenv_ctp; + __dbsrv_settimeout(ctp, dbenv_ctp->ct_timeout); + __dbsrv_active(ctp); + + *txnidp = ctp->ct_id; + memcpy(gid, p->gid, DB_XIDDATASIZE); + + p++; + txnidp++; + gid += DB_XIDDATASIZE; + } + /* + * If we get here, we have success and we have to set freep + * so it'll get properly freed next time. + */ + *freep = 1; +out: + if (dbprep != NULL) + __os_free(dbenv->get_DB_ENV(), dbprep); + replyp->status = ret; + return; +out2: + /* + * We had an error in the middle of creating our new txn + * ct entries. We have to unwind all that we have done. Ugh. + */ + for (txnidp = replyp->txn.txn_val, erri = 0; + erri < i; erri++, txnidp++) { + ctp = get_tableent(*txnidp); + __dbclear_ctp(ctp); + } + __os_free(dbenv->get_DB_ENV(), replyp->txn.txn_val); + __os_free(dbenv->get_DB_ENV(), replyp->gid.gid_val); + __os_free(dbenv->get_DB_ENV(), dbprep); + replyp->status = ret; + return; +} + +/* BEGIN __db_bt_maxkey_proc */ +extern "C" void +__db_bt_maxkey_proc( + long dbpcl_id, + u_int32_t maxkey, + __db_bt_maxkey_reply *replyp) +/* END __db_bt_maxkey_proc */ +{ + Db *dbp; + ct_entry *dbp_ctp; + int ret; + + ACTIVATE_CTP(dbp_ctp, dbpcl_id, CT_DB); + dbp = (Db *)dbp_ctp->ct_anyp; + + ret = dbp->set_bt_maxkey(maxkey); + + replyp->status = ret; + return; +} + +/* BEGIN __db_associate_proc */ +extern "C" void +__db_associate_proc( + long dbpcl_id, + long txnpcl_id, + long sdbpcl_id, + u_int32_t flags, + __db_associate_reply *replyp) +/* END __db_associate_proc */ +{ + Db *dbp, *sdbp; + DbTxn *txnp; + ct_entry *dbp_ctp, *sdbp_ctp, *txnp_ctp; + int ret; + + ACTIVATE_CTP(dbp_ctp, dbpcl_id, CT_DB); + dbp = (Db *)dbp_ctp->ct_anyp; + ACTIVATE_CTP(sdbp_ctp, sdbpcl_id, CT_DB); + sdbp = (Db *)sdbp_ctp->ct_anyp; + if (txnpcl_id != 0) { + ACTIVATE_CTP(txnp_ctp, txnpcl_id, CT_TXN); + txnp = (DbTxn *)txnp_ctp->ct_anyp; + } else + txnp = NULL; + + /* + * We do not support DB_CREATE for associate. Users + * can only access secondary indices on a read-only basis, + * so whatever they are looking for needs to be there already. + */ + if (flags != 0) + ret = EINVAL; + else + ret = dbp->associate(txnp, sdbp, NULL, flags); + + replyp->status = ret; + return; +} + +/* BEGIN __db_bt_minkey_proc */ +extern "C" void +__db_bt_minkey_proc( + long dbpcl_id, + u_int32_t minkey, + __db_bt_minkey_reply *replyp) +/* END __db_bt_minkey_proc */ +{ + Db *dbp; + ct_entry *dbp_ctp; + int ret; + + ACTIVATE_CTP(dbp_ctp, dbpcl_id, CT_DB); + dbp = (Db *)dbp_ctp->ct_anyp; + + ret = dbp->set_bt_minkey(minkey); + + replyp->status = ret; + return; +} + +/* BEGIN __db_close_proc */ +extern "C" void +__db_close_proc( + long dbpcl_id, + u_int32_t flags, + __db_close_reply *replyp) +/* END __db_close_proc */ +{ + ct_entry *dbp_ctp; + + ACTIVATE_CTP(dbp_ctp, dbpcl_id, CT_DB); + replyp->status = __db_close_int(dbpcl_id, flags); + return; +} + +/* BEGIN __db_create_proc */ +extern "C" void +__db_create_proc( + long dbenvcl_id, + u_int32_t flags, + __db_create_reply *replyp) +/* END __db_create_proc */ +{ + Db *dbp; + DbEnv *dbenv; + ct_entry *dbenv_ctp, *dbp_ctp; + + ACTIVATE_CTP(dbenv_ctp, dbenvcl_id, CT_ENV); + dbenv = (DbEnv *)dbenv_ctp->ct_anyp; + + dbp_ctp = new_ct_ent(&replyp->status); + if (dbp_ctp == NULL) + return ; + /* + * We actually require env's for databases. The client should + * have caught it, but just in case. + */ + DB_ASSERT(dbenv != NULL); + dbp = new Db(dbenv, flags); + dbp_ctp->ct_dbp = dbp; + dbp_ctp->ct_type = CT_DB; + dbp_ctp->ct_parent = dbenv_ctp; + dbp_ctp->ct_envparent = dbenv_ctp; + replyp->dbcl_id = dbp_ctp->ct_id; + replyp->status = 0; + return; +} + +/* BEGIN __db_del_proc */ +extern "C" void +__db_del_proc( + long dbpcl_id, + long txnpcl_id, + u_int32_t keydlen, + u_int32_t keydoff, + u_int32_t keyulen, + u_int32_t keyflags, + void *keydata, + u_int32_t keysize, + u_int32_t flags, + __db_del_reply *replyp) +/* END __db_del_proc */ +{ + Db *dbp; + DbTxn *txnp; + ct_entry *dbp_ctp, *txnp_ctp; + int ret; + + ACTIVATE_CTP(dbp_ctp, dbpcl_id, CT_DB); + dbp = (Db *)dbp_ctp->ct_anyp; + if (txnpcl_id != 0) { + ACTIVATE_CTP(txnp_ctp, txnpcl_id, CT_TXN); + txnp = (DbTxn *)txnp_ctp->ct_anyp; + } else + txnp = NULL; + + /* Set up key */ + Dbt key(keydata, keysize); + key.set_dlen(keydlen); + key.set_ulen(keyulen); + key.set_doff(keydoff); + key.set_flags(keyflags); + + ret = dbp->del(txnp, &key, flags); + + replyp->status = ret; + return; +} + +/* BEGIN __db_encrypt_proc */ +extern "C" void +__db_encrypt_proc( + long dbpcl_id, + char *passwd, + u_int32_t flags, + __db_encrypt_reply *replyp) +/* END __db_encrypt_proc */ +{ + Db *dbp; + ct_entry *dbp_ctp; + int ret; + + ACTIVATE_CTP(dbp_ctp, dbpcl_id, CT_DB); + dbp = (Db *)dbp_ctp->ct_anyp; + + ret = dbp->set_encrypt(passwd, flags); + replyp->status = ret; + return; +} + +/* BEGIN __db_extentsize_proc */ +extern "C" void +__db_extentsize_proc( + long dbpcl_id, + u_int32_t extentsize, + __db_extentsize_reply *replyp) +/* END __db_extentsize_proc */ +{ + Db *dbp; + ct_entry *dbp_ctp; + int ret; + + ACTIVATE_CTP(dbp_ctp, dbpcl_id, CT_DB); + dbp = (Db *)dbp_ctp->ct_anyp; + + ret = dbp->set_q_extentsize(extentsize); + + replyp->status = ret; + return; +} + +/* BEGIN __db_flags_proc */ +extern "C" void +__db_flags_proc( + long dbpcl_id, + u_int32_t flags, + __db_flags_reply *replyp) +/* END __db_flags_proc */ +{ + Db *dbp; + ct_entry *dbp_ctp; + int ret; + + ACTIVATE_CTP(dbp_ctp, dbpcl_id, CT_DB); + dbp = (Db *)dbp_ctp->ct_anyp; + + ret = dbp->set_flags(flags); + dbp_ctp->ct_dbdp.setflags = flags; + + replyp->status = ret; + return; +} + +/* BEGIN __db_get_proc */ +extern "C" void +__db_get_proc( + long dbpcl_id, + long txnpcl_id, + u_int32_t keydlen, + u_int32_t keydoff, + u_int32_t keyulen, + u_int32_t keyflags, + void *keydata, + u_int32_t keysize, + u_int32_t datadlen, + u_int32_t datadoff, + u_int32_t dataulen, + u_int32_t dataflags, + void *datadata, + u_int32_t datasize, + u_int32_t flags, + __db_get_reply *replyp, + int * freep) +/* END __db_get_proc */ +{ + Db *dbp; + DbTxn *txnp; + ct_entry *dbp_ctp, *txnp_ctp; + int key_alloc, bulk_alloc, ret; + void *tmpdata; + + ACTIVATE_CTP(dbp_ctp, dbpcl_id, CT_DB); + dbp = (Db *)dbp_ctp->ct_anyp; + if (txnpcl_id != 0) { + ACTIVATE_CTP(txnp_ctp, txnpcl_id, CT_TXN); + txnp = (DbTxn *)txnp_ctp->ct_anyp; + } else + txnp = NULL; + + *freep = 0; + bulk_alloc = 0; + + /* Set up key and data */ + Dbt key(keydata, keysize); + key.set_dlen(keydlen); + key.set_ulen(keyulen); + key.set_doff(keydoff); + /* + * Ignore memory related flags on server. + */ + key.set_flags(DB_DBT_MALLOC | (keyflags & DB_DBT_PARTIAL)); + + Dbt data(datadata, datasize); + data.set_dlen(datadlen); + data.set_ulen(dataulen); + data.set_doff(datadoff); + /* + * Ignore memory related flags on server. + */ + dataflags &= DB_DBT_PARTIAL; + if (flags & DB_MULTIPLE) { + if (data.get_data() == 0) { + ret = __os_umalloc(dbp->get_DB()->dbenv, + dataulen, &tmpdata); + if (ret != 0) + goto err; + data.set_data(tmpdata); + bulk_alloc = 1; + } + dataflags |= DB_DBT_USERMEM; + } else + dataflags |= DB_DBT_MALLOC; + data.set_flags(dataflags); + + /* Got all our stuff, now do the get */ + ret = dbp->get(txnp, &key, &data, flags); + /* + * Otherwise just status. + */ + if (ret == 0) { + /* + * XXX + * We need to xdr_free whatever we are returning, next time. + * However, DB does not allocate a new key if one was given + * and we'd be free'ing up space allocated in the request. + * So, allocate a new key/data pointer if it is the same one + * as in the request. + */ + *freep = 1; + /* + * Key + */ + key_alloc = 0; + if (key.get_data() == keydata) { + ret = __os_umalloc(dbp->get_DB()->dbenv, + key.get_size(), &replyp->keydata.keydata_val); + if (ret != 0) { + __os_ufree(dbp->get_DB()->dbenv, key.get_data()); + __os_ufree(dbp->get_DB()->dbenv, data.get_data()); + goto err; + } + key_alloc = 1; + memcpy(replyp->keydata.keydata_val, key.get_data(), key.get_size()); + } else + replyp->keydata.keydata_val = (char *)key.get_data(); + + replyp->keydata.keydata_len = key.get_size(); + + /* + * Data + */ + if (data.get_data() == datadata) { + ret = __os_umalloc(dbp->get_DB()->dbenv, + data.get_size(), &replyp->datadata.datadata_val); + if (ret != 0) { + __os_ufree(dbp->get_DB()->dbenv, key.get_data()); + __os_ufree(dbp->get_DB()->dbenv, data.get_data()); + if (key_alloc) + __os_ufree(dbp->get_DB()->dbenv, + replyp->keydata.keydata_val); + goto err; + } + memcpy(replyp->datadata.datadata_val, data.get_data(), + data.get_size()); + } else + replyp->datadata.datadata_val = (char *)data.get_data(); + replyp->datadata.datadata_len = data.get_size(); + } else { +err: replyp->keydata.keydata_val = NULL; + replyp->keydata.keydata_len = 0; + replyp->datadata.datadata_val = NULL; + replyp->datadata.datadata_len = 0; + *freep = 0; + if (bulk_alloc) + __os_ufree(dbp->get_DB()->dbenv, data.get_data()); + } + replyp->status = ret; + return; +} + +/* BEGIN __db_h_ffactor_proc */ +extern "C" void +__db_h_ffactor_proc( + long dbpcl_id, + u_int32_t ffactor, + __db_h_ffactor_reply *replyp) +/* END __db_h_ffactor_proc */ +{ + Db *dbp; + ct_entry *dbp_ctp; + int ret; + + ACTIVATE_CTP(dbp_ctp, dbpcl_id, CT_DB); + dbp = (Db *)dbp_ctp->ct_anyp; + + ret = dbp->set_h_ffactor(ffactor); + + replyp->status = ret; + return; +} + +/* BEGIN __db_h_nelem_proc */ +extern "C" void +__db_h_nelem_proc( + long dbpcl_id, + u_int32_t nelem, + __db_h_nelem_reply *replyp) +/* END __db_h_nelem_proc */ +{ + Db *dbp; + ct_entry *dbp_ctp; + int ret; + + ACTIVATE_CTP(dbp_ctp, dbpcl_id, CT_DB); + dbp = (Db *)dbp_ctp->ct_anyp; + + ret = dbp->set_h_nelem(nelem); + + replyp->status = ret; + return; +} + +/* BEGIN __db_key_range_proc */ +extern "C" void +__db_key_range_proc( + long dbpcl_id, + long txnpcl_id, + u_int32_t keydlen, + u_int32_t keydoff, + u_int32_t keyulen, + u_int32_t keyflags, + void *keydata, + u_int32_t keysize, + u_int32_t flags, + __db_key_range_reply *replyp) +/* END __db_key_range_proc */ +{ + Db *dbp; + DB_KEY_RANGE range; + DbTxn *txnp; + ct_entry *dbp_ctp, *txnp_ctp; + int ret; + + ACTIVATE_CTP(dbp_ctp, dbpcl_id, CT_DB); + dbp = (Db *)dbp_ctp->ct_anyp; + if (txnpcl_id != 0) { + ACTIVATE_CTP(txnp_ctp, txnpcl_id, CT_TXN); + txnp = (DbTxn *)txnp_ctp->ct_anyp; + } else + txnp = NULL; + + /* Set up key */ + Dbt key(keydata, keysize); + key.set_dlen(keydlen); + key.set_ulen(keyulen); + key.set_doff(keydoff); + key.set_flags(keyflags); + + ret = dbp->key_range(txnp, &key, &range, flags); + + replyp->status = ret; + replyp->less = range.less; + replyp->equal = range.equal; + replyp->greater = range.greater; + return; +} + +/* BEGIN __db_lorder_proc */ +extern "C" void +__db_lorder_proc( + long dbpcl_id, + u_int32_t lorder, + __db_lorder_reply *replyp) +/* END __db_lorder_proc */ +{ + Db *dbp; + ct_entry *dbp_ctp; + int ret; + + ACTIVATE_CTP(dbp_ctp, dbpcl_id, CT_DB); + dbp = (Db *)dbp_ctp->ct_anyp; + + ret = dbp->set_lorder(lorder); + + replyp->status = ret; + return; +} + +/* BEGIN __db_open_proc */ +extern "C" void +__db_open_proc( + long dbpcl_id, + long txnpcl_id, + char *name, + char *subdb, + u_int32_t type, + u_int32_t flags, + u_int32_t mode, + __db_open_reply *replyp) +/* END __db_open_proc */ +{ + Db *dbp; + DbTxn *txnp; + DBTYPE dbtype; + ct_entry *dbp_ctp, *new_ctp, *txnp_ctp; + int isswapped, ret; + + ACTIVATE_CTP(dbp_ctp, dbpcl_id, CT_DB); + dbp = (Db *)dbp_ctp->ct_anyp; + if (txnpcl_id != 0) { + ACTIVATE_CTP(txnp_ctp, txnpcl_id, CT_TXN); + txnp = (DbTxn *)txnp_ctp->ct_anyp; + } else + txnp = NULL; + + replyp->dbcl_id = dbpcl_id; + if ((new_ctp = __dbsrv_sharedb(dbp_ctp, name, subdb, (DBTYPE)type, flags)) + != NULL) { + /* + * We can share, clean up old ID, set new one. + */ + if (__dbsrv_verbose) + printf("Sharing db ID %ld\n", new_ctp->ct_id); + replyp->dbcl_id = new_ctp->ct_id; + ret = __db_close_int(dbpcl_id, 0); + goto out; + } + ret = dbp->open(txnp, name, subdb, (DBTYPE)type, flags, mode); + if (ret == 0) { + (void)dbp->get_type(&dbtype); + replyp->type = dbtype; + /* XXX + * Tcl needs to peek at dbp->flags for DB_AM_DUP. Send + * this dbp's flags back. + */ + replyp->dbflags = (int) dbp->get_DB()->flags; + /* + * We need to determine the byte order of the database + * and send it back to the client. Determine it by + * the server's native order and the swapped value of + * the DB itself. + */ + (void)dbp->get_byteswapped(&isswapped); + if (__db_byteorder(NULL, 1234) == 0) { + if (isswapped == 0) + replyp->lorder = 1234; + else + replyp->lorder = 4321; + } else { + if (isswapped == 0) + replyp->lorder = 4321; + else + replyp->lorder = 1234; + } + dbp_ctp->ct_dbdp.type = dbtype; + dbp_ctp->ct_dbdp.dbflags = LF_ISSET(DB_SERVER_DBFLAGS); + if (name == NULL) + dbp_ctp->ct_dbdp.db = NULL; + else if ((ret = __os_strdup(dbp->get_DB()->dbenv, name, + &dbp_ctp->ct_dbdp.db)) != 0) + goto out; + if (subdb == NULL) + dbp_ctp->ct_dbdp.subdb = NULL; + else if ((ret = __os_strdup(dbp->get_DB()->dbenv, subdb, + &dbp_ctp->ct_dbdp.subdb)) != 0) + goto out; + } +out: + replyp->status = ret; + return; +} + +/* BEGIN __db_pagesize_proc */ +extern "C" void +__db_pagesize_proc( + long dbpcl_id, + u_int32_t pagesize, + __db_pagesize_reply *replyp) +/* END __db_pagesize_proc */ +{ + Db *dbp; + ct_entry *dbp_ctp; + int ret; + + ACTIVATE_CTP(dbp_ctp, dbpcl_id, CT_DB); + dbp = (Db *)dbp_ctp->ct_anyp; + + ret = dbp->set_pagesize(pagesize); + + replyp->status = ret; + return; +} + +/* BEGIN __db_pget_proc */ +extern "C" void +__db_pget_proc( + long dbpcl_id, + long txnpcl_id, + u_int32_t skeydlen, + u_int32_t skeydoff, + u_int32_t skeyulen, + u_int32_t skeyflags, + void *skeydata, + u_int32_t skeysize, + u_int32_t pkeydlen, + u_int32_t pkeydoff, + u_int32_t pkeyulen, + u_int32_t pkeyflags, + void *pkeydata, + u_int32_t pkeysize, + u_int32_t datadlen, + u_int32_t datadoff, + u_int32_t dataulen, + u_int32_t dataflags, + void *datadata, + u_int32_t datasize, + u_int32_t flags, + __db_pget_reply *replyp, + int * freep) +/* END __db_pget_proc */ +{ + Db *dbp; + DbTxn *txnp; + ct_entry *dbp_ctp, *txnp_ctp; + int key_alloc, ret; + + ACTIVATE_CTP(dbp_ctp, dbpcl_id, CT_DB); + dbp = (Db *)dbp_ctp->ct_anyp; + if (txnpcl_id != 0) { + ACTIVATE_CTP(txnp_ctp, txnpcl_id, CT_TXN); + txnp = (DbTxn *)txnp_ctp->ct_anyp; + } else + txnp = NULL; + + *freep = 0; + + /* + * Ignore memory related flags on server. + */ + /* Set up key and data */ + Dbt skey(skeydata, skeysize); + skey.set_dlen(skeydlen); + skey.set_ulen(skeyulen); + skey.set_doff(skeydoff); + skey.set_flags(DB_DBT_MALLOC | (skeyflags & DB_DBT_PARTIAL)); + + Dbt pkey(pkeydata, pkeysize); + pkey.set_dlen(pkeydlen); + pkey.set_ulen(pkeyulen); + pkey.set_doff(pkeydoff); + pkey.set_flags(DB_DBT_MALLOC | (pkeyflags & DB_DBT_PARTIAL)); + + Dbt data(datadata, datasize); + data.set_dlen(datadlen); + data.set_ulen(dataulen); + data.set_doff(datadoff); + data.set_flags(DB_DBT_MALLOC | (dataflags & DB_DBT_PARTIAL)); + + /* Got all our stuff, now do the get */ + ret = dbp->pget(txnp, &skey, &pkey, &data, flags); + /* + * Otherwise just status. + */ + if (ret == 0) { + /* + * XXX + * We need to xdr_free whatever we are returning, next time. + * However, DB does not allocate a new key if one was given + * and we'd be free'ing up space allocated in the request. + * So, allocate a new key/data pointer if it is the same one + * as in the request. + */ + *freep = 1; + /* + * Key + */ + key_alloc = 0; + if (skey.get_data() == skeydata) { + ret = __os_umalloc(dbp->get_DB()->dbenv, + skey.get_size(), &replyp->skeydata.skeydata_val); + if (ret != 0) { + __os_ufree(dbp->get_DB()->dbenv, skey.get_data()); + __os_ufree(dbp->get_DB()->dbenv, pkey.get_data()); + __os_ufree(dbp->get_DB()->dbenv, data.get_data()); + goto err; + } + key_alloc = 1; + memcpy(replyp->skeydata.skeydata_val, skey.get_data(), + skey.get_size()); + } else + replyp->skeydata.skeydata_val = (char *)skey.get_data(); + + replyp->skeydata.skeydata_len = skey.get_size(); + + /* + * Primary key + */ + if (pkey.get_data() == pkeydata) { + ret = __os_umalloc(dbp->get_DB()->dbenv, + pkey.get_size(), &replyp->pkeydata.pkeydata_val); + if (ret != 0) { + __os_ufree(dbp->get_DB()->dbenv, skey.get_data()); + __os_ufree(dbp->get_DB()->dbenv, pkey.get_data()); + __os_ufree(dbp->get_DB()->dbenv, data.get_data()); + if (key_alloc) + __os_ufree(dbp->get_DB()->dbenv, + replyp->skeydata.skeydata_val); + goto err; + } + /* + * We can set it to 2, because they cannot send the + * pkey over without sending the skey over too. + * So if they did send a pkey, they must have sent + * the skey as well. + */ + key_alloc = 2; + memcpy(replyp->pkeydata.pkeydata_val, pkey.get_data(), + pkey.get_size()); + } else + replyp->pkeydata.pkeydata_val = (char *)pkey.get_data(); + replyp->pkeydata.pkeydata_len = pkey.get_size(); + + /* + * Data + */ + if (data.get_data() == datadata) { + ret = __os_umalloc(dbp->get_DB()->dbenv, + data.get_size(), &replyp->datadata.datadata_val); + if (ret != 0) { + __os_ufree(dbp->get_DB()->dbenv, skey.get_data()); + __os_ufree(dbp->get_DB()->dbenv, pkey.get_data()); + __os_ufree(dbp->get_DB()->dbenv, data.get_data()); + /* + * If key_alloc is 1, just skey needs to be + * freed, if key_alloc is 2, both skey and pkey + * need to be freed. + */ + if (key_alloc--) + __os_ufree(dbp->get_DB()->dbenv, + replyp->skeydata.skeydata_val); + if (key_alloc) + __os_ufree(dbp->get_DB()->dbenv, + replyp->pkeydata.pkeydata_val); + goto err; + } + memcpy(replyp->datadata.datadata_val, data.get_data(), + data.get_size()); + } else + replyp->datadata.datadata_val = (char *)data.get_data(); + replyp->datadata.datadata_len = data.get_size(); + } else { +err: replyp->skeydata.skeydata_val = NULL; + replyp->skeydata.skeydata_len = 0; + replyp->pkeydata.pkeydata_val = NULL; + replyp->pkeydata.pkeydata_len = 0; + replyp->datadata.datadata_val = NULL; + replyp->datadata.datadata_len = 0; + *freep = 0; + } + replyp->status = ret; + return; +} + +/* BEGIN __db_put_proc */ +extern "C" void +__db_put_proc( + long dbpcl_id, + long txnpcl_id, + u_int32_t keydlen, + u_int32_t keydoff, + u_int32_t keyulen, + u_int32_t keyflags, + void *keydata, + u_int32_t keysize, + u_int32_t datadlen, + u_int32_t datadoff, + u_int32_t dataulen, + u_int32_t dataflags, + void *datadata, + u_int32_t datasize, + u_int32_t flags, + __db_put_reply *replyp, + int * freep) +/* END __db_put_proc */ +{ + Db *dbp; + DbTxn *txnp; + ct_entry *dbp_ctp, *txnp_ctp; + int ret; + + ACTIVATE_CTP(dbp_ctp, dbpcl_id, CT_DB); + dbp = (Db *)dbp_ctp->ct_anyp; + if (txnpcl_id != 0) { + ACTIVATE_CTP(txnp_ctp, txnpcl_id, CT_TXN); + txnp = (DbTxn *)txnp_ctp->ct_anyp; + } else + txnp = NULL; + + *freep = 0; + + /* Set up key and data */ + Dbt key(keydata, keysize); + key.set_dlen(keydlen); + key.set_ulen(keyulen); + key.set_doff(keydoff); + key.set_flags(DB_DBT_MALLOC | (keyflags & DB_DBT_PARTIAL)); + + Dbt data(datadata, datasize); + data.set_dlen(datadlen); + data.set_ulen(dataulen); + data.set_doff(datadoff); + data.set_flags(dataflags); + + /* Got all our stuff, now do the put */ + ret = dbp->put(txnp, &key, &data, flags); + /* + * If the client did a DB_APPEND, set up key in reply. + * Otherwise just status. + */ + if (ret == 0 && (flags == DB_APPEND)) { + /* + * XXX + * We need to xdr_free whatever we are returning, next time. + * However, DB does not allocate a new key if one was given + * and we'd be free'ing up space allocated in the request. + * So, allocate a new key/data pointer if it is the same one + * as in the request. + */ + *freep = 1; + /* + * Key + */ + if (key.get_data() == keydata) { + ret = __os_umalloc(dbp->get_DB()->dbenv, + key.get_size(), &replyp->keydata.keydata_val); + if (ret != 0) { + __os_ufree(dbp->get_DB()->dbenv, key.get_data()); + goto err; + } + memcpy(replyp->keydata.keydata_val, key.get_data(), key.get_size()); + } else + replyp->keydata.keydata_val = (char *)key.get_data(); + + replyp->keydata.keydata_len = key.get_size(); + } else { +err: replyp->keydata.keydata_val = NULL; + replyp->keydata.keydata_len = 0; + *freep = 0; + } + replyp->status = ret; + return; +} + +/* BEGIN __db_re_delim_proc */ +extern "C" void +__db_re_delim_proc( + long dbpcl_id, + u_int32_t delim, + __db_re_delim_reply *replyp) +/* END __db_re_delim_proc */ +{ + Db *dbp; + ct_entry *dbp_ctp; + int ret; + + ACTIVATE_CTP(dbp_ctp, dbpcl_id, CT_DB); + dbp = (Db *)dbp_ctp->ct_anyp; + + ret = dbp->set_re_delim(delim); + + replyp->status = ret; + return; +} + +/* BEGIN __db_re_len_proc */ +extern "C" void +__db_re_len_proc( + long dbpcl_id, + u_int32_t len, + __db_re_len_reply *replyp) +/* END __db_re_len_proc */ +{ + Db *dbp; + ct_entry *dbp_ctp; + int ret; + + ACTIVATE_CTP(dbp_ctp, dbpcl_id, CT_DB); + dbp = (Db *)dbp_ctp->ct_anyp; + + ret = dbp->set_re_len(len); + + replyp->status = ret; + return; +} + +/* BEGIN __db_re_pad_proc */ +extern "C" void +__db_re_pad_proc( + long dbpcl_id, + u_int32_t pad, + __db_re_pad_reply *replyp) +/* END __db_re_pad_proc */ +{ + Db *dbp; + ct_entry *dbp_ctp; + int ret; + + ACTIVATE_CTP(dbp_ctp, dbpcl_id, CT_DB); + dbp = (Db *)dbp_ctp->ct_anyp; + + ret = dbp->set_re_pad(pad); + + replyp->status = ret; + return; +} + +/* BEGIN __db_remove_proc */ +extern "C" void +__db_remove_proc( + long dbpcl_id, + char *name, + char *subdb, + u_int32_t flags, + __db_remove_reply *replyp) +/* END __db_remove_proc */ +{ + Db *dbp; + ct_entry *dbp_ctp; + int ret; + + ACTIVATE_CTP(dbp_ctp, dbpcl_id, CT_DB); + dbp = (Db *)dbp_ctp->ct_anyp; + + ret = dbp->remove(name, subdb, flags); + __dbdel_ctp(dbp_ctp); + + replyp->status = ret; + return; +} + +/* BEGIN __db_rename_proc */ +extern "C" void +__db_rename_proc( + long dbpcl_id, + char *name, + char *subdb, + char *newname, + u_int32_t flags, + __db_rename_reply *replyp) +/* END __db_rename_proc */ +{ + Db *dbp; + ct_entry *dbp_ctp; + int ret; + + ACTIVATE_CTP(dbp_ctp, dbpcl_id, CT_DB); + dbp = (Db *)dbp_ctp->ct_anyp; + + ret = dbp->rename(name, subdb, newname, flags); + __dbdel_ctp(dbp_ctp); + + replyp->status = ret; + return; +} + +/* BEGIN __db_stat_proc */ +extern "C" void +__db_stat_proc( + long dbpcl_id, + u_int32_t flags, + __db_stat_reply *replyp, + int * freep) +/* END __db_stat_proc */ +{ + Db *dbp; + DBTYPE type; + ct_entry *dbp_ctp; + u_int32_t *q, *p, *retsp; + int i, len, ret; + void *sp; + + ACTIVATE_CTP(dbp_ctp, dbpcl_id, CT_DB); + dbp = (Db *)dbp_ctp->ct_anyp; + + ret = dbp->stat(&sp, flags); + replyp->status = ret; + if (ret != 0) + return; + /* + * We get here, we have success. Allocate an array so that + * we can use the list generator. Generate the reply, free + * up the space. + */ + /* + * XXX This assumes that all elements of all stat structures + * are u_int32_t fields. They are, currently. + */ + (void)dbp->get_type(&type); + if (type == DB_HASH) + len = sizeof(DB_HASH_STAT); + else if (type == DB_QUEUE) + len = sizeof(DB_QUEUE_STAT); + else /* BTREE or RECNO are same stats */ + len = sizeof(DB_BTREE_STAT); + replyp->stats.stats_len = len / sizeof(u_int32_t); + + if ((ret = __os_umalloc(dbp->get_DB()->dbenv, + len * replyp->stats.stats_len, &retsp)) != 0) + goto out; + for (i = 0, q = retsp, p = (u_int32_t *)sp; i < len; + i++, q++, p++) + *q = *p; + replyp->stats.stats_val = retsp; + __os_ufree(dbp->get_DB()->dbenv, sp); + if (ret == 0) + *freep = 1; +out: + replyp->status = ret; + return; +} + +/* BEGIN __db_sync_proc */ +extern "C" void +__db_sync_proc( + long dbpcl_id, + u_int32_t flags, + __db_sync_reply *replyp) +/* END __db_sync_proc */ +{ + Db *dbp; + ct_entry *dbp_ctp; + int ret; + + ACTIVATE_CTP(dbp_ctp, dbpcl_id, CT_DB); + dbp = (Db *)dbp_ctp->ct_anyp; + + ret = dbp->sync(flags); + + replyp->status = ret; + return; +} + +/* BEGIN __db_truncate_proc */ +extern "C" void +__db_truncate_proc( + long dbpcl_id, + long txnpcl_id, + u_int32_t flags, + __db_truncate_reply *replyp) +/* END __db_truncate_proc */ +{ + Db *dbp; + DbTxn *txnp; + ct_entry *dbp_ctp, *txnp_ctp; + u_int32_t count; + int ret; + + ACTIVATE_CTP(dbp_ctp, dbpcl_id, CT_DB); + dbp = (Db *)dbp_ctp->ct_anyp; + if (txnpcl_id != 0) { + ACTIVATE_CTP(txnp_ctp, txnpcl_id, CT_TXN); + txnp = (DbTxn *)txnp_ctp->ct_anyp; + } else + txnp = NULL; + + ret = dbp->truncate(txnp, &count, flags); + replyp->status = ret; + if (ret == 0) + replyp->count = count; + return; +} + +/* BEGIN __db_cursor_proc */ +extern "C" void +__db_cursor_proc( + long dbpcl_id, + long txnpcl_id, + u_int32_t flags, + __db_cursor_reply *replyp) +/* END __db_cursor_proc */ +{ + Db *dbp; + Dbc *dbc; + DbTxn *txnp; + ct_entry *dbc_ctp, *env_ctp, *dbp_ctp, *txnp_ctp; + int ret; + + ACTIVATE_CTP(dbp_ctp, dbpcl_id, CT_DB); + dbp = (Db *)dbp_ctp->ct_anyp; + dbc_ctp = new_ct_ent(&replyp->status); + if (dbc_ctp == NULL) + return; + + if (txnpcl_id != 0) { + ACTIVATE_CTP(txnp_ctp, txnpcl_id, CT_TXN); + txnp = (DbTxn *)txnp_ctp->ct_anyp; + dbc_ctp->ct_activep = txnp_ctp->ct_activep; + } else + txnp = NULL; + + if ((ret = dbp->cursor(txnp, &dbc, flags)) == 0) { + dbc_ctp->ct_dbc = dbc; + dbc_ctp->ct_type = CT_CURSOR; + dbc_ctp->ct_parent = dbp_ctp; + env_ctp = dbp_ctp->ct_envparent; + dbc_ctp->ct_envparent = env_ctp; + __dbsrv_settimeout(dbc_ctp, env_ctp->ct_timeout); + __dbsrv_active(dbc_ctp); + replyp->dbcidcl_id = dbc_ctp->ct_id; + } else + __dbclear_ctp(dbc_ctp); + + replyp->status = ret; + return; +} + +/* BEGIN __db_join_proc */ +extern "C" void +__db_join_proc( + long dbpcl_id, + u_int32_t *curs, + u_int32_t curslen, + u_int32_t flags, + __db_join_reply *replyp) +/* END __db_join_proc */ +{ + Db *dbp; + Dbc **jcurs, **c; + Dbc *dbc; + ct_entry *dbc_ctp, *ctp, *dbp_ctp; + size_t size; + u_int32_t *cl, i; + int ret; + + ACTIVATE_CTP(dbp_ctp, dbpcl_id, CT_DB); + dbp = (Db *)dbp_ctp->ct_anyp; + + dbc_ctp = new_ct_ent(&replyp->status); + if (dbc_ctp == NULL) + return; + + size = (curslen + 1) * sizeof(Dbc *); + if ((ret = __os_calloc(dbp->get_DB()->dbenv, + curslen + 1, sizeof(Dbc *), &jcurs)) != 0) { + replyp->status = ret; + __dbclear_ctp(dbc_ctp); + return; + } + /* + * If our curslist has a parent txn, we need to use it too + * for the activity timeout. All cursors must be part of + * the same transaction, so just check the first. + */ + ctp = get_tableent(*curs); + DB_ASSERT(ctp->ct_type == CT_CURSOR); + /* + * If we are using a transaction, set the join activity timer + * to point to the parent transaction. + */ + if (ctp->ct_activep != &ctp->ct_active) + dbc_ctp->ct_activep = ctp->ct_activep; + for (i = 0, cl = curs, c = jcurs; i < curslen; i++, cl++, c++) { + ctp = get_tableent(*cl); + if (ctp == NULL) { + replyp->status = DB_NOSERVER_ID; + goto out; + } + /* + * If we are using a txn, the join cursor points to the + * transaction timeout. If we are not using a transaction, + * then all the curslist cursors must point to the join + * cursor's timeout so that we do not timeout any of the + * curlist cursors while the join cursor is active. + * Change the type of the curslist ctps to CT_JOIN so that + * we know they are part of a join list and we can distinguish + * them and later restore them when the join cursor is closed. + */ + DB_ASSERT(ctp->ct_type == CT_CURSOR); + ctp->ct_type |= CT_JOIN; + ctp->ct_origp = ctp->ct_activep; + /* + * Setting this to the ct_active field of the dbc_ctp is + * really just a way to distinguish which join dbc this + * cursor is part of. The ct_activep of this cursor is + * not used at all during its lifetime as part of a join + * cursor. + */ + ctp->ct_activep = &dbc_ctp->ct_active; + *c = ctp->ct_dbc; + } + *c = NULL; + if ((ret = dbp->join(jcurs, &dbc, flags)) == 0) { + dbc_ctp->ct_dbc = dbc; + dbc_ctp->ct_type = (CT_JOINCUR | CT_CURSOR); + dbc_ctp->ct_parent = dbp_ctp; + dbc_ctp->ct_envparent = dbp_ctp->ct_envparent; + __dbsrv_settimeout(dbc_ctp, dbp_ctp->ct_envparent->ct_timeout); + __dbsrv_active(dbc_ctp); + replyp->dbcidcl_id = dbc_ctp->ct_id; + } else { + __dbclear_ctp(dbc_ctp); + /* + * If we get an error, undo what we did above to any cursors. + */ + for (cl = curs; *cl != 0; cl++) { + ctp = get_tableent(*cl); + ctp->ct_type = CT_CURSOR; + ctp->ct_activep = ctp->ct_origp; + } + } + + replyp->status = ret; +out: + __os_free(dbp->get_DB()->dbenv, jcurs); + return; +} + +/* BEGIN __dbc_close_proc */ +extern "C" void +__dbc_close_proc( + long dbccl_id, + __dbc_close_reply *replyp) +/* END __dbc_close_proc */ +{ + ct_entry *dbc_ctp; + + ACTIVATE_CTP(dbc_ctp, dbccl_id, CT_CURSOR); + replyp->status = __dbc_close_int(dbc_ctp); + return; +} + +/* BEGIN __dbc_count_proc */ +extern "C" void +__dbc_count_proc( + long dbccl_id, + u_int32_t flags, + __dbc_count_reply *replyp) +/* END __dbc_count_proc */ +{ + Dbc *dbc; + ct_entry *dbc_ctp; + db_recno_t num; + int ret; + + ACTIVATE_CTP(dbc_ctp, dbccl_id, CT_CURSOR); + dbc = (Dbc *)dbc_ctp->ct_anyp; + + ret = dbc->count(&num, flags); + replyp->status = ret; + if (ret == 0) + replyp->dupcount = num; + return; +} + +/* BEGIN __dbc_del_proc */ +extern "C" void +__dbc_del_proc( + long dbccl_id, + u_int32_t flags, + __dbc_del_reply *replyp) +/* END __dbc_del_proc */ +{ + Dbc *dbc; + ct_entry *dbc_ctp; + int ret; + + ACTIVATE_CTP(dbc_ctp, dbccl_id, CT_CURSOR); + dbc = (Dbc *)dbc_ctp->ct_anyp; + + ret = dbc->del(flags); + + replyp->status = ret; + return; +} + +/* BEGIN __dbc_dup_proc */ +extern "C" void +__dbc_dup_proc( + long dbccl_id, + u_int32_t flags, + __dbc_dup_reply *replyp) +/* END __dbc_dup_proc */ +{ + Dbc *dbc, *newdbc; + ct_entry *dbc_ctp, *new_ctp; + int ret; + + ACTIVATE_CTP(dbc_ctp, dbccl_id, CT_CURSOR); + dbc = (Dbc *)dbc_ctp->ct_anyp; + + new_ctp = new_ct_ent(&replyp->status); + if (new_ctp == NULL) + return; + + if ((ret = dbc->dup(&newdbc, flags)) == 0) { + new_ctp->ct_dbc = newdbc; + new_ctp->ct_type = CT_CURSOR; + new_ctp->ct_parent = dbc_ctp->ct_parent; + new_ctp->ct_envparent = dbc_ctp->ct_envparent; + /* + * If our cursor has a parent txn, we need to use it too. + */ + if (dbc_ctp->ct_activep != &dbc_ctp->ct_active) + new_ctp->ct_activep = dbc_ctp->ct_activep; + __dbsrv_settimeout(new_ctp, dbc_ctp->ct_timeout); + __dbsrv_active(new_ctp); + replyp->dbcidcl_id = new_ctp->ct_id; + } else + __dbclear_ctp(new_ctp); + + replyp->status = ret; + return; +} + +/* BEGIN __dbc_get_proc */ +extern "C" void +__dbc_get_proc( + long dbccl_id, + u_int32_t keydlen, + u_int32_t keydoff, + u_int32_t keyulen, + u_int32_t keyflags, + void *keydata, + u_int32_t keysize, + u_int32_t datadlen, + u_int32_t datadoff, + u_int32_t dataulen, + u_int32_t dataflags, + void *datadata, + u_int32_t datasize, + u_int32_t flags, + __dbc_get_reply *replyp, + int * freep) +/* END __dbc_get_proc */ +{ + Dbc *dbc; + DbEnv *dbenv; + ct_entry *dbc_ctp; + int key_alloc, bulk_alloc, ret; + void *tmpdata; + + ACTIVATE_CTP(dbc_ctp, dbccl_id, CT_CURSOR); + dbc = (Dbc *)dbc_ctp->ct_anyp; + dbenv = DbEnv::get_DbEnv(((DBC *)dbc)->dbp->dbenv); + + *freep = 0; + bulk_alloc = 0; + + /* Set up key and data */ + Dbt key(keydata, keysize); + key.set_dlen(keydlen); + key.set_ulen(keyulen); + key.set_doff(keydoff); + key.set_flags(DB_DBT_MALLOC | (keyflags & DB_DBT_PARTIAL)); + + Dbt data(datadata, datasize); + data.set_dlen(datadlen); + data.set_ulen(dataulen); + data.set_doff(datadoff); + dataflags &= DB_DBT_PARTIAL; + if (flags & DB_MULTIPLE || flags & DB_MULTIPLE_KEY) { + if (data.get_data() == NULL) { + ret = __os_umalloc(dbenv->get_DB_ENV(), + data.get_ulen(), &tmpdata); + if (ret != 0) + goto err; + data.set_data(tmpdata); + bulk_alloc = 1; + } + dataflags |= DB_DBT_USERMEM; + } else + dataflags |= DB_DBT_MALLOC; + data.set_flags(dataflags); + + /* Got all our stuff, now do the get */ + ret = dbc->get(&key, &data, flags); + + /* + * Otherwise just status. + */ + if (ret == 0) { + /* + * XXX + * We need to xdr_free whatever we are returning, next time. + * However, DB does not allocate a new key if one was given + * and we'd be free'ing up space allocated in the request. + * So, allocate a new key/data pointer if it is the same one + * as in the request. + */ + *freep = 1; + /* + * Key + */ + key_alloc = 0; + if (key.get_data() == keydata) { + ret = __os_umalloc(dbenv->get_DB_ENV(), key.get_size(), + &replyp->keydata.keydata_val); + if (ret != 0) { + __os_ufree(dbenv->get_DB_ENV(), key.get_data()); + __os_ufree(dbenv->get_DB_ENV(), data.get_data()); + goto err; + } + key_alloc = 1; + memcpy(replyp->keydata.keydata_val, key.get_data(), key.get_size()); + } else + replyp->keydata.keydata_val = (char *)key.get_data(); + + replyp->keydata.keydata_len = key.get_size(); + + /* + * Data + */ + if (data.get_data() == datadata) { + ret = __os_umalloc(dbenv->get_DB_ENV(), data.get_size(), + &replyp->datadata.datadata_val); + if (ret != 0) { + __os_ufree(dbenv->get_DB_ENV(), key.get_data()); + __os_ufree(dbenv->get_DB_ENV(), data.get_data()); + if (key_alloc) + __os_ufree(dbenv->get_DB_ENV(), + replyp->keydata.keydata_val); + goto err; + } + memcpy(replyp->datadata.datadata_val, data.get_data(), + data.get_size()); + } else + replyp->datadata.datadata_val = (char *)data.get_data(); + replyp->datadata.datadata_len = data.get_size(); + } else { +err: replyp->keydata.keydata_val = NULL; + replyp->keydata.keydata_len = 0; + replyp->datadata.datadata_val = NULL; + replyp->datadata.datadata_len = 0; + *freep = 0; + if (bulk_alloc) + __os_ufree(dbenv->get_DB_ENV(), data.get_data()); + } + replyp->status = ret; + return; +} + +/* BEGIN __dbc_pget_proc */ +extern "C" void +__dbc_pget_proc( + long dbccl_id, + u_int32_t skeydlen, + u_int32_t skeydoff, + u_int32_t skeyulen, + u_int32_t skeyflags, + void *skeydata, + u_int32_t skeysize, + u_int32_t pkeydlen, + u_int32_t pkeydoff, + u_int32_t pkeyulen, + u_int32_t pkeyflags, + void *pkeydata, + u_int32_t pkeysize, + u_int32_t datadlen, + u_int32_t datadoff, + u_int32_t dataulen, + u_int32_t dataflags, + void *datadata, + u_int32_t datasize, + u_int32_t flags, + __dbc_pget_reply *replyp, + int * freep) +/* END __dbc_pget_proc */ +{ + Dbc *dbc; + DbEnv *dbenv; + ct_entry *dbc_ctp; + int key_alloc, ret; + + ACTIVATE_CTP(dbc_ctp, dbccl_id, CT_CURSOR); + dbc = (Dbc *)dbc_ctp->ct_anyp; + dbenv = DbEnv::get_DbEnv(((DBC *)dbc)->dbp->dbenv); + + *freep = 0; + + /* + * Ignore memory related flags on server. + */ + /* Set up key and data */ + Dbt skey(skeydata, skeysize); + skey.set_dlen(skeydlen); + skey.set_ulen(skeyulen); + skey.set_doff(skeydoff); + skey.set_flags(DB_DBT_MALLOC | (skeyflags & DB_DBT_PARTIAL)); + + Dbt pkey(pkeydata, pkeysize); + pkey.set_dlen(pkeydlen); + pkey.set_ulen(pkeyulen); + pkey.set_doff(pkeydoff); + pkey.set_flags(DB_DBT_MALLOC | (pkeyflags & DB_DBT_PARTIAL)); + + Dbt data(datadata, datasize); + data.set_dlen(datadlen); + data.set_ulen(dataulen); + data.set_doff(datadoff); + data.set_flags(DB_DBT_MALLOC | (dataflags & DB_DBT_PARTIAL)); + + /* Got all our stuff, now do the get */ + ret = dbc->pget(&skey, &pkey, &data, flags); + /* + * Otherwise just status. + */ + if (ret == 0) { + /* + * XXX + * We need to xdr_free whatever we are returning, next time. + * However, DB does not allocate a new key if one was given + * and we'd be free'ing up space allocated in the request. + * So, allocate a new key/data pointer if it is the same one + * as in the request. + */ + *freep = 1; + /* + * Key + */ + key_alloc = 0; + if (skey.get_data() == skeydata) { + ret = __os_umalloc(dbenv->get_DB_ENV(), + skey.get_size(), &replyp->skeydata.skeydata_val); + if (ret != 0) { + __os_ufree(dbenv->get_DB_ENV(), skey.get_data()); + __os_ufree(dbenv->get_DB_ENV(), pkey.get_data()); + __os_ufree(dbenv->get_DB_ENV(), data.get_data()); + goto err; + } + key_alloc = 1; + memcpy(replyp->skeydata.skeydata_val, skey.get_data(), + skey.get_size()); + } else + replyp->skeydata.skeydata_val = (char *)skey.get_data(); + replyp->skeydata.skeydata_len = skey.get_size(); + + /* + * Primary key + */ + if (pkey.get_data() == pkeydata) { + ret = __os_umalloc(dbenv->get_DB_ENV(), + pkey.get_size(), &replyp->pkeydata.pkeydata_val); + if (ret != 0) { + __os_ufree(dbenv->get_DB_ENV(), skey.get_data()); + __os_ufree(dbenv->get_DB_ENV(), pkey.get_data()); + __os_ufree(dbenv->get_DB_ENV(), data.get_data()); + if (key_alloc) + __os_ufree(dbenv->get_DB_ENV(), + replyp->skeydata.skeydata_val); + goto err; + } + /* + * We can set it to 2, because they cannot send the + * pkey over without sending the skey over too. + * So if they did send a pkey, they must have sent + * the skey as well. + */ + key_alloc = 2; + memcpy(replyp->pkeydata.pkeydata_val, pkey.get_data(), + pkey.get_size()); + } else + replyp->pkeydata.pkeydata_val = (char *)pkey.get_data(); + replyp->pkeydata.pkeydata_len = pkey.get_size(); + + /* + * Data + */ + if (data.get_data() == datadata) { + ret = __os_umalloc(dbenv->get_DB_ENV(), + data.get_size(), &replyp->datadata.datadata_val); + if (ret != 0) { + __os_ufree(dbenv->get_DB_ENV(), skey.get_data()); + __os_ufree(dbenv->get_DB_ENV(), pkey.get_data()); + __os_ufree(dbenv->get_DB_ENV(), data.get_data()); + /* + * If key_alloc is 1, just skey needs to be + * freed, if key_alloc is 2, both skey and pkey + * need to be freed. + */ + if (key_alloc--) + __os_ufree(dbenv->get_DB_ENV(), + replyp->skeydata.skeydata_val); + if (key_alloc) + __os_ufree(dbenv->get_DB_ENV(), + replyp->pkeydata.pkeydata_val); + goto err; + } + memcpy(replyp->datadata.datadata_val, data.get_data(), + data.get_size()); + } else + replyp->datadata.datadata_val = (char *)data.get_data(); + replyp->datadata.datadata_len = data.get_size(); + } else { +err: replyp->skeydata.skeydata_val = NULL; + replyp->skeydata.skeydata_len = 0; + replyp->pkeydata.pkeydata_val = NULL; + replyp->pkeydata.pkeydata_len = 0; + replyp->datadata.datadata_val = NULL; + replyp->datadata.datadata_len = 0; + *freep = 0; + } + replyp->status = ret; + return; +} + +/* BEGIN __dbc_put_proc */ +extern "C" void +__dbc_put_proc( + long dbccl_id, + u_int32_t keydlen, + u_int32_t keydoff, + u_int32_t keyulen, + u_int32_t keyflags, + void *keydata, + u_int32_t keysize, + u_int32_t datadlen, + u_int32_t datadoff, + u_int32_t dataulen, + u_int32_t dataflags, + void *datadata, + u_int32_t datasize, + u_int32_t flags, + __dbc_put_reply *replyp, + int * freep) +/* END __dbc_put_proc */ +{ + Db *dbp; + Dbc *dbc; + ct_entry *dbc_ctp; + int ret; + DBTYPE dbtype; + + ACTIVATE_CTP(dbc_ctp, dbccl_id, CT_CURSOR); + dbc = (Dbc *)dbc_ctp->ct_anyp; + dbp = (Db *)dbc_ctp->ct_parent->ct_anyp; + + /* Set up key and data */ + Dbt key(keydata, keysize); + key.set_dlen(keydlen); + key.set_ulen(keyulen); + key.set_doff(keydoff); + /* + * Ignore memory related flags on server. + */ + key.set_flags(DB_DBT_MALLOC | (keyflags & DB_DBT_PARTIAL)); + + Dbt data(datadata, datasize); + data.set_dlen(datadlen); + data.set_ulen(dataulen); + data.set_doff(datadoff); + data.set_flags(dataflags); + + /* Got all our stuff, now do the put */ + ret = dbc->put(&key, &data, flags); + + *freep = 0; + replyp->keydata.keydata_val = NULL; + replyp->keydata.keydata_len = 0; + if (ret == 0 && (flags == DB_AFTER || flags == DB_BEFORE)) { + ret = dbp->get_type(&dbtype); + if (ret == 0 && dbtype == DB_RECNO) { + /* + * We need to xdr_free whatever we are returning, next time. + */ + replyp->keydata.keydata_val = (char *)key.get_data(); + replyp->keydata.keydata_len = key.get_size(); + } + } + replyp->status = ret; + return; +} +#endif /* HAVE_RPC */ diff --git a/db/rpc_server/cxx/db_server_cxxutil.cpp b/db/rpc_server/cxx/db_server_cxxutil.cpp new file mode 100644 index 000000000..404440d48 --- /dev/null +++ b/db/rpc_server/cxx/db_server_cxxutil.cpp @@ -0,0 +1,746 @@ +/*- + * See the file LICENSE for redistribution information. + * + * Copyright (c) 2000-2002 + * Sleepycat Software. All rights reserved. + */ + +#include "db_config.h" + +#ifndef lint +static const char revid[] = "Id: db_server_cxxutil.cpp,v 1.8 2002/05/23 07:49:34 mjc Exp "; +#endif /* not lint */ + +#ifndef NO_SYSTEM_INCLUDES +#include <sys/types.h> + +#if TIME_WITH_SYS_TIME +#include <sys/time.h> +#include <time.h> +#else +#if HAVE_SYS_TIME_H +#include <sys/time.h> +#else +#include <time.h> +#endif +#endif + +#include <rpc/rpc.h> + +#include <limits.h> +#include <signal.h> +#include <stdio.h> +#include <stdlib.h> +#include <string.h> +#include <unistd.h> +#endif +#include "dbinc_auto/db_server.h" + +#include "db_int.h" +#include "db_cxx.h" +#include "dbinc_auto/clib_ext.h" + +extern "C" { +#include "dbinc/db_server_int.h" +#include "dbinc_auto/rpc_server_ext.h" +#include "dbinc_auto/common_ext.h" + +extern int __dbsrv_main __P((void)); +} + +static int add_home __P((char *)); +static int add_passwd __P((char *)); +static int env_recover __P((char *)); +static void __dbclear_child __P((ct_entry *)); + +static LIST_HEAD(cthead, ct_entry) __dbsrv_head; +static LIST_HEAD(homehead, home_entry) __dbsrv_home; +static long __dbsrv_defto = DB_SERVER_TIMEOUT; +static long __dbsrv_maxto = DB_SERVER_MAXTIMEOUT; +static long __dbsrv_idleto = DB_SERVER_IDLETIMEOUT; +static char *logfile = NULL; +static char *prog; + +static void usage __P((char *)); +static void version_check __P((void)); + +int __dbsrv_verbose = 0; + +int +main( + int argc, + char **argv) +{ + extern char *optarg; + CLIENT *cl; + int ch, ret; + char *passwd; + + prog = argv[0]; + + version_check(); + + /* + * Check whether another server is running or not. There + * is a race condition where two servers could be racing to + * register with the portmapper. The goal of this check is to + * forbid running additional servers (like those started from + * the test suite) if the user is already running one. + * + * XXX + * This does not solve nor prevent two servers from being + * started at the same time and running recovery at the same + * time on the same environments. + */ + if ((cl = clnt_create("localhost", + DB_RPC_SERVERPROG, DB_RPC_SERVERVERS, "tcp")) != NULL) { + fprintf(stderr, + "%s: Berkeley DB RPC server already running.\n", prog); + clnt_destroy(cl); + return (EXIT_FAILURE); + } + + LIST_INIT(&__dbsrv_home); + while ((ch = getopt(argc, argv, "h:I:L:P:t:T:Vv")) != EOF) + switch (ch) { + case 'h': + (void)add_home(optarg); + break; + case 'I': + if (__db_getlong(NULL, prog, + optarg, 1, LONG_MAX, &__dbsrv_idleto)) + return (EXIT_FAILURE); + break; + case 'L': + logfile = optarg; + break; + case 'P': + passwd = strdup(optarg); + memset(optarg, 0, strlen(optarg)); + if (passwd == NULL) { + fprintf(stderr, "%s: strdup: %s\n", + prog, strerror(errno)); + return (EXIT_FAILURE); + } + if ((ret = add_passwd(passwd)) != 0) { + fprintf(stderr, "%s: strdup: %s\n", + prog, strerror(ret)); + return (EXIT_FAILURE); + } + break; + case 't': + if (__db_getlong(NULL, prog, + optarg, 1, LONG_MAX, &__dbsrv_defto)) + return (EXIT_FAILURE); + break; + case 'T': + if (__db_getlong(NULL, prog, + optarg, 1, LONG_MAX, &__dbsrv_maxto)) + return (EXIT_FAILURE); + break; + case 'V': + printf("%s\n", db_version(NULL, NULL, NULL)); + return (EXIT_SUCCESS); + case 'v': + __dbsrv_verbose = 1; + break; + default: + usage(prog); + } + /* + * Check default timeout against maximum timeout + */ + if (__dbsrv_defto > __dbsrv_maxto) + __dbsrv_defto = __dbsrv_maxto; + + /* + * Check default timeout against idle timeout + * It would be bad to timeout environments sooner than txns. + */ + if (__dbsrv_defto > __dbsrv_idleto) + fprintf(stderr, + "%s: WARNING: Idle timeout %ld is less than resource timeout %ld\n", + prog, __dbsrv_idleto, __dbsrv_defto); + + LIST_INIT(&__dbsrv_head); + + /* + * If a client crashes during an RPC, our reply to it + * generates a SIGPIPE. Ignore SIGPIPE so we don't exit unnecessarily. + */ +#ifdef SIGPIPE + signal(SIGPIPE, SIG_IGN); +#endif + + if (logfile != NULL && __db_util_logset("berkeley_db_svc", logfile)) + return (EXIT_FAILURE); + + /* + * Now that we are ready to start, run recovery on all the + * environments specified. + */ + if (env_recover(prog) != 0) + return (EXIT_FAILURE); + + /* + * We've done our setup, now call the generated server loop + */ + if (__dbsrv_verbose) + printf("%s: Ready to receive requests\n", prog); + __dbsrv_main(); + + /* NOTREACHED */ + abort(); +} + +static void +usage(char *prog) +{ + fprintf(stderr, "usage: %s %s\n\t%s\n", prog, + "[-Vv] [-h home] [-P passwd]", + "[-I idletimeout] [-L logfile] [-t def_timeout] [-T maxtimeout]"); + exit(EXIT_FAILURE); +} + +static void +version_check() +{ + int v_major, v_minor, v_patch; + + /* Make sure we're loaded with the right version of the DB library. */ + (void)db_version(&v_major, &v_minor, &v_patch); + if (v_major != DB_VERSION_MAJOR || + v_minor != DB_VERSION_MINOR || v_patch != DB_VERSION_PATCH) { + fprintf(stderr, + "%s: version %d.%d.%d doesn't match library version %d.%d.%d\n", + prog, DB_VERSION_MAJOR, DB_VERSION_MINOR, + DB_VERSION_PATCH, v_major, v_minor, v_patch); + exit(EXIT_FAILURE); + } +} + +extern "C" void +__dbsrv_settimeout( + ct_entry *ctp, + u_int32_t to) +{ + if (to > (u_int32_t)__dbsrv_maxto) + ctp->ct_timeout = __dbsrv_maxto; + else if (to <= 0) + ctp->ct_timeout = __dbsrv_defto; + else + ctp->ct_timeout = to; +} + +extern "C" void +__dbsrv_timeout(int force) +{ + static long to_hint = -1; + time_t t; + long to; + ct_entry *ctp, *nextctp; + + if ((t = time(NULL)) == -1) + return; + + /* + * Check hint. If hint is further in the future + * than now, no work to do. + */ + if (!force && to_hint > 0 && t < to_hint) + return; + to_hint = -1; + /* + * Timeout transactions or cursors holding DB resources. + * Do this before timing out envs to properly release resources. + * + * !!! + * We can just loop through this list looking for cursors and txns. + * We do not need to verify txn and cursor relationships at this + * point because we maintain the list in LIFO order *and* we + * maintain activity in the ultimate txn parent of any cursor + * so either everything in a txn is timing out, or nothing. + * So, since we are LIFO, we will correctly close/abort all the + * appropriate handles, in the correct order. + */ + for (ctp = LIST_FIRST(&__dbsrv_head); ctp != NULL; ctp = nextctp) { + nextctp = LIST_NEXT(ctp, entries); + switch (ctp->ct_type) { + case CT_TXN: + to = *(ctp->ct_activep) + ctp->ct_timeout; + /* TIMEOUT */ + if (to < t) { + if (__dbsrv_verbose) + printf("Timing out txn id %ld\n", + ctp->ct_id); + (void)((DbTxn *)ctp->ct_anyp)->abort(); + __dbdel_ctp(ctp); + /* + * If we timed out an txn, we may have closed + * all sorts of ctp's. + * So start over with a guaranteed good ctp. + */ + nextctp = LIST_FIRST(&__dbsrv_head); + } else if ((to_hint > 0 && to_hint > to) || + to_hint == -1) + to_hint = to; + break; + case CT_CURSOR: + case (CT_JOINCUR | CT_CURSOR): + to = *(ctp->ct_activep) + ctp->ct_timeout; + /* TIMEOUT */ + if (to < t) { + if (__dbsrv_verbose) + printf("Timing out cursor %ld\n", + ctp->ct_id); + (void)__dbc_close_int(ctp); + /* + * Start over with a guaranteed good ctp. + */ + nextctp = LIST_FIRST(&__dbsrv_head); + } else if ((to_hint > 0 && to_hint > to) || + to_hint == -1) + to_hint = to; + break; + default: + break; + } + } + /* + * Timeout idle handles. + * If we are forcing a timeout, we'll close all env handles. + */ + for (ctp = LIST_FIRST(&__dbsrv_head); ctp != NULL; ctp = nextctp) { + nextctp = LIST_NEXT(ctp, entries); + if (ctp->ct_type != CT_ENV) + continue; + to = *(ctp->ct_activep) + ctp->ct_idle; + /* TIMEOUT */ + if (to < t || force) { + if (__dbsrv_verbose) + printf("Timing out env id %ld\n", ctp->ct_id); + (void)__dbenv_close_int(ctp->ct_id, 0, 1); + /* + * If we timed out an env, we may have closed + * all sorts of ctp's (maybe even all of them. + * So start over with a guaranteed good ctp. + */ + nextctp = LIST_FIRST(&__dbsrv_head); + } + } +} + +/* + * RECURSIVE FUNCTION. We need to clear/free any number of levels of nested + * layers. + */ +static void +__dbclear_child(ct_entry *parent) +{ + ct_entry *ctp, *nextctp; + + for (ctp = LIST_FIRST(&__dbsrv_head); ctp != NULL; + ctp = nextctp) { + nextctp = LIST_NEXT(ctp, entries); + if (ctp->ct_type == 0) + continue; + if (ctp->ct_parent == parent) { + __dbclear_child(ctp); + /* + * Need to do this here because le_next may + * have changed with the recursive call and we + * don't want to point to a removed entry. + */ + nextctp = LIST_NEXT(ctp, entries); + __dbclear_ctp(ctp); + } + } +} + +extern "C" void +__dbclear_ctp(ct_entry *ctp) +{ + LIST_REMOVE(ctp, entries); + __os_free(NULL, ctp); +} + +extern "C" void +__dbdel_ctp(ct_entry *parent) +{ + __dbclear_child(parent); + __dbclear_ctp(parent); +} + +extern "C" ct_entry * +new_ct_ent(int *errp) +{ + time_t t; + ct_entry *ctp, *octp; + int ret; + + if ((ret = __os_malloc(NULL, sizeof(ct_entry), &ctp)) != 0) { + *errp = ret; + return (NULL); + } + memset(ctp, 0, sizeof(ct_entry)); + /* + * Get the time as ID. We may service more than one request per + * second however. If we are, then increment id value until we + * find an unused one. We insert entries in LRU fashion at the + * head of the list. So, if the first entry doesn't match, then + * we know for certain that we can use our entry. + */ + if ((t = time(NULL)) == -1) { + *errp = __os_get_errno(); + __os_free(NULL, ctp); + return (NULL); + } + octp = LIST_FIRST(&__dbsrv_head); + if (octp != NULL && octp->ct_id >= t) + t = octp->ct_id + 1; + ctp->ct_id = t; + ctp->ct_idle = __dbsrv_idleto; + ctp->ct_activep = &ctp->ct_active; + ctp->ct_origp = NULL; + ctp->ct_refcount = 1; + + LIST_INSERT_HEAD(&__dbsrv_head, ctp, entries); + return (ctp); +} + +extern "C" ct_entry * +get_tableent(long id) +{ + ct_entry *ctp; + + for (ctp = LIST_FIRST(&__dbsrv_head); ctp != NULL; + ctp = LIST_NEXT(ctp, entries)) + if (ctp->ct_id == id) + return (ctp); + return (NULL); +} + +extern "C" ct_entry * +__dbsrv_sharedb(ct_entry *db_ctp, const char *name, const char *subdb, DBTYPE type, u_int32_t flags) +{ + ct_entry *ctp; + + /* + * Check if we can share a db handle. Criteria for sharing are: + * If any of the non-sharable flags are set, we cannot share. + * Must be a db ctp, obviously. + * Must share the same env parent. + * Must be the same type, or current one DB_UNKNOWN. + * Must be same byteorder, or current one must not care. + * All flags must match. + * Must be same name, but don't share in-memory databases. + * Must be same subdb name. + */ + if (flags & DB_SERVER_DBNOSHARE) + return (NULL); + for (ctp = LIST_FIRST(&__dbsrv_head); ctp != NULL; + ctp = LIST_NEXT(ctp, entries)) { + /* + * Skip ourselves. + */ + if (ctp == db_ctp) + continue; + if (ctp->ct_type != CT_DB) + continue; + if (ctp->ct_envparent != db_ctp->ct_envparent) + continue; + if (type != DB_UNKNOWN && ctp->ct_dbdp.type != type) + continue; + if (ctp->ct_dbdp.dbflags != LF_ISSET(DB_SERVER_DBFLAGS)) + continue; + if (db_ctp->ct_dbdp.setflags != 0 && + ctp->ct_dbdp.setflags != db_ctp->ct_dbdp.setflags) + continue; + if (name == NULL || ctp->ct_dbdp.db == NULL || + strcmp(name, ctp->ct_dbdp.db) != 0) + continue; + if (subdb != ctp->ct_dbdp.subdb && + (subdb == NULL || ctp->ct_dbdp.subdb == NULL || + strcmp(subdb, ctp->ct_dbdp.subdb) != 0)) + continue; + /* + * If we get here, then we match. + */ + ctp->ct_refcount++; + return (ctp); + } + + return (NULL); +} + +extern "C" ct_entry * +__dbsrv_shareenv(ct_entry *env_ctp, home_entry *home, u_int32_t flags) +{ + ct_entry *ctp; + + /* + * Check if we can share an env. Criteria for sharing are: + * Must be an env ctp, obviously. + * Must share the same home env. + * All flags must match. + */ + for (ctp = LIST_FIRST(&__dbsrv_head); ctp != NULL; + ctp = LIST_NEXT(ctp, entries)) { + /* + * Skip ourselves. + */ + if (ctp == env_ctp) + continue; + if (ctp->ct_type != CT_ENV) + continue; + if (ctp->ct_envdp.home != home) + continue; + if (ctp->ct_envdp.envflags != flags) + continue; + if (ctp->ct_envdp.onflags != env_ctp->ct_envdp.onflags) + continue; + if (ctp->ct_envdp.offflags != env_ctp->ct_envdp.offflags) + continue; + /* + * If we get here, then we match. The only thing left to + * check is the timeout. Since the server timeout set by + * the client is a hint, for sharing we'll give them the + * benefit of the doubt and grant them the longer timeout. + */ + if (ctp->ct_timeout < env_ctp->ct_timeout) + ctp->ct_timeout = env_ctp->ct_timeout; + ctp->ct_refcount++; + return (ctp); + } + + return (NULL); +} + +extern "C" void +__dbsrv_active(ct_entry *ctp) +{ + time_t t; + ct_entry *envctp; + + if (ctp == NULL) + return; + if ((t = time(NULL)) == -1) + return; + *(ctp->ct_activep) = t; + if ((envctp = ctp->ct_envparent) == NULL) + return; + *(envctp->ct_activep) = t; + return; +} + +extern "C" int +__db_close_int(long id, u_int32_t flags) +{ + Db *dbp; + int ret; + ct_entry *ctp; + + ret = 0; + ctp = get_tableent(id); + if (ctp == NULL) + return (DB_NOSERVER_ID); + DB_ASSERT(ctp->ct_type == CT_DB); + if (__dbsrv_verbose && ctp->ct_refcount != 1) + printf("Deref'ing dbp id %ld, refcount %d\n", + id, ctp->ct_refcount); + if (--ctp->ct_refcount != 0) + return (ret); + dbp = ctp->ct_dbp; + if (__dbsrv_verbose) + printf("Closing dbp id %ld\n", id); + + ret = dbp->close(flags); + __dbdel_ctp(ctp); + return (ret); +} + +extern "C" int +__dbc_close_int(ct_entry *dbc_ctp) +{ + Dbc *dbc; + int ret; + ct_entry *ctp; + + dbc = (Dbc *)dbc_ctp->ct_anyp; + + ret = dbc->close(); + /* + * If this cursor is a join cursor then we need to fix up the + * cursors that it was joined from so that they are independent again. + */ + if (dbc_ctp->ct_type & CT_JOINCUR) + for (ctp = LIST_FIRST(&__dbsrv_head); ctp != NULL; + ctp = LIST_NEXT(ctp, entries)) { + /* + * Test if it is a join cursor, and if it is part + * of this one. + */ + if ((ctp->ct_type & CT_JOIN) && + ctp->ct_activep == &dbc_ctp->ct_active) { + ctp->ct_type &= ~CT_JOIN; + ctp->ct_activep = ctp->ct_origp; + __dbsrv_active(ctp); + } + } + __dbclear_ctp(dbc_ctp); + return (ret); + +} + +extern "C" int +__dbenv_close_int(long id, u_int32_t flags, int force) +{ + DbEnv *dbenv; + int ret; + ct_entry *ctp; + + ret = 0; + ctp = get_tableent(id); + if (ctp == NULL) + return (DB_NOSERVER_ID); + DB_ASSERT(ctp->ct_type == CT_ENV); + if (__dbsrv_verbose && ctp->ct_refcount != 1) + printf("Deref'ing env id %ld, refcount %d\n", + id, ctp->ct_refcount); + /* + * If we are timing out, we need to force the close, no matter + * what the refcount. + */ + if (--ctp->ct_refcount != 0 && !force) + return (ret); + dbenv = ctp->ct_envp; + if (__dbsrv_verbose) + printf("Closing env id %ld\n", id); + + ret = dbenv->close(flags); + __dbdel_ctp(ctp); + return (ret); +} + +static int +add_home(char *home) +{ + home_entry *hp, *homep; + int ret; + + if ((ret = __os_malloc(NULL, sizeof(home_entry), &hp)) != 0) + return (ret); + if ((ret = __os_malloc(NULL, strlen(home)+1, &hp->home)) != 0) + return (ret); + memcpy(hp->home, home, strlen(home)+1); + hp->dir = home; + hp->passwd = NULL; + /* + * This loop is to remove any trailing path separators, + * to assure hp->name points to the last component. + */ + hp->name = __db_rpath(home); + *(hp->name) = '\0'; + hp->name++; + while (*(hp->name) == '\0') { + hp->name = __db_rpath(home); + *(hp->name) = '\0'; + hp->name++; + } + /* + * Now we have successfully added it. Make sure there are no + * identical names. + */ + for (homep = LIST_FIRST(&__dbsrv_home); homep != NULL; + homep = LIST_NEXT(homep, entries)) + if (strcmp(homep->name, hp->name) == 0) { + printf("Already added home name %s, at directory %s\n", + hp->name, homep->dir); + return (-1); + } + LIST_INSERT_HEAD(&__dbsrv_home, hp, entries); + if (__dbsrv_verbose) + printf("Added home %s in dir %s\n", hp->name, hp->dir); + return (0); +} + +static int +add_passwd(char *passwd) +{ + home_entry *hp; + + /* + * We add the passwd to the last given home dir. If there + * isn't a home dir, or the most recent one already has a + * passwd, then there is a user error. + */ + hp = LIST_FIRST(&__dbsrv_home); + if (hp == NULL || hp->passwd != NULL) + return (EINVAL); + /* + * We've already strdup'ed the passwd above, so we don't need + * to malloc new space, just point to it. + */ + hp->passwd = passwd; + return (0); +} + +extern "C" home_entry * +get_home(char *name) +{ + home_entry *hp; + + for (hp = LIST_FIRST(&__dbsrv_home); hp != NULL; + hp = LIST_NEXT(hp, entries)) + if (strcmp(name, hp->name) == 0) + return (hp); + return (NULL); +} + +static int +env_recover(char *progname) +{ + DbEnv *dbenv; + home_entry *hp; + u_int32_t flags; + int exitval, ret; + + for (hp = LIST_FIRST(&__dbsrv_home); hp != NULL; + hp = LIST_NEXT(hp, entries)) { + exitval = 0; + dbenv = new DbEnv(DB_CXX_NO_EXCEPTIONS); + if (__dbsrv_verbose == 1) { + (void)dbenv->set_verbose(DB_VERB_RECOVERY, 1); + (void)dbenv->set_verbose(DB_VERB_CHKPOINT, 1); + } + dbenv->set_errfile(stderr); + dbenv->set_errpfx(progname); + if (hp->passwd != NULL) + (void)dbenv->set_encrypt(hp->passwd, DB_ENCRYPT_AES); + + /* + * Initialize the env with DB_RECOVER. That is all we + * have to do to run recovery. + */ + if (__dbsrv_verbose) + printf("Running recovery on %s\n", hp->home); + flags = DB_CREATE | DB_INIT_LOCK | DB_INIT_LOG | DB_INIT_MPOOL | + DB_INIT_TXN | DB_USE_ENVIRON | DB_RECOVER; + if ((ret = dbenv->open(hp->home, flags, 0)) != 0) { + dbenv->err(ret, "DbEnv->open"); + goto error; + } + + if (0) { +error: exitval = 1; + } + if ((ret = dbenv->close(0)) != 0) { + exitval = 1; + fprintf(stderr, "%s: dbenv->close: %s\n", + progname, db_strerror(ret)); + } + if (exitval) + return (exitval); + } + return (0); +} diff --git a/db/rpc_server/java/DbDispatcher.java b/db/rpc_server/java/DbDispatcher.java new file mode 100644 index 000000000..a4f93b80c --- /dev/null +++ b/db/rpc_server/java/DbDispatcher.java @@ -0,0 +1,590 @@ +/*- + * See the file LICENSE for redistribution information. + * + * Copyright (c) 2001-2002 + * Sleepycat Software. All rights reserved. + * + * Id: DbDispatcher.java,v 1.5 2002/08/09 01:56:08 bostic Exp + */ + +package com.sleepycat.db.rpcserver; + +import com.sleepycat.db.*; +import java.io.IOException; +import org.acplt.oncrpc.OncRpcException; + +/** + * Dispatcher for RPC messages for the Java RPC server. + * These are hooks that translate between RPC msg/reply structures and + * DB calls, which keeps the real implementation code in Rpc* classes cleaner. + */ +public abstract class DbDispatcher extends DbServerStub +{ + abstract int addEnv(RpcDbEnv rdbenv); + abstract int addDb(RpcDb rdb); + abstract int addTxn(RpcDbTxn rtxn); + abstract int addCursor(RpcDbc rdbc); + abstract void delEnv(RpcDbEnv rdbenv); + abstract void delDb(RpcDb rdb); + abstract void delTxn(RpcDbTxn rtxn); + abstract void delCursor(RpcDbc rdbc); + abstract RpcDbEnv getEnv(int envid); + abstract RpcDb getDb(int dbid); + abstract RpcDbTxn getTxn(int txnbid); + abstract RpcDbc getCursor(int dbcid); + + public DbDispatcher() throws IOException, OncRpcException + { + super(); + } + + //// Db methods + + public __db_associate_reply __DB_db_associate_4001(__db_associate_msg args) + { + __db_associate_reply reply = new __db_associate_reply(); + RpcDb rdb = getDb(args.dbpcl_id); + if (rdb == null) + reply.status = Db.DB_NOSERVER_ID; + else + rdb.associate(this, args, reply); + return reply; + } + + public __db_bt_maxkey_reply __DB_db_bt_maxkey_4001(__db_bt_maxkey_msg args) + { + __db_bt_maxkey_reply reply = new __db_bt_maxkey_reply(); + RpcDb rdb = getDb(args.dbpcl_id); + if (rdb == null) + reply.status = Db.DB_NOSERVER_ID; + else + rdb.set_bt_maxkey(this, args, reply); + return reply; + } + + public __db_bt_minkey_reply __DB_db_bt_minkey_4001(__db_bt_minkey_msg args) + { + __db_bt_minkey_reply reply = new __db_bt_minkey_reply(); + RpcDb rdb = getDb(args.dbpcl_id); + if (rdb == null) + reply.status = Db.DB_NOSERVER_ID; + else + rdb.set_bt_minkey(this, args, reply); + return reply; + } + + public __db_close_reply __DB_db_close_4001(__db_close_msg args) + { + __db_close_reply reply = new __db_close_reply(); + RpcDb rdb = getDb(args.dbpcl_id); + if (rdb == null) + reply.status = Db.DB_NOSERVER_ID; + else + rdb.close(this, args, reply); + return reply; + } + + public __db_create_reply __DB_db_create_4001(__db_create_msg args) + { + __db_create_reply reply = new __db_create_reply(); + RpcDb rdb = new RpcDb(getEnv(args.dbenvcl_id)); + if (rdb == null) + reply.status = Db.DB_NOSERVER_ID; + else + rdb.create(this, args, reply); + return reply; + } + + public __db_cursor_reply __DB_db_cursor_4001(__db_cursor_msg args) + { + __db_cursor_reply reply = new __db_cursor_reply(); + RpcDb rdb = getDb(args.dbpcl_id); + if (rdb == null) + reply.status = Db.DB_NOSERVER_ID; + else + rdb.cursor(this, args, reply); + return reply; + } + + public __db_del_reply __DB_db_del_4001(__db_del_msg args) + { + __db_del_reply reply = new __db_del_reply(); + RpcDb rdb = getDb(args.dbpcl_id); + if (rdb == null) + reply.status = Db.DB_NOSERVER_ID; + else + rdb.del(this, args, reply); + return reply; + } + + public __db_encrypt_reply __DB_db_encrypt_4001(__db_encrypt_msg args) + { + __db_encrypt_reply reply = new __db_encrypt_reply(); + RpcDb rdb = getDb(args.dbpcl_id); + if (rdb == null) + reply.status = Db.DB_NOSERVER_ID; + else + rdb.set_encrypt(this, args, reply); + return reply; + } + + public __db_extentsize_reply __DB_db_extentsize_4001(__db_extentsize_msg args) + { + __db_extentsize_reply reply = new __db_extentsize_reply(); + RpcDb rdb = getDb(args.dbpcl_id); + if (rdb == null) + reply.status = Db.DB_NOSERVER_ID; + else + rdb.set_q_extentsize(this, args, reply); + return reply; + } + + public __db_flags_reply __DB_db_flags_4001(__db_flags_msg args) + { + __db_flags_reply reply = new __db_flags_reply(); + RpcDb rdb = getDb(args.dbpcl_id); + if (rdb == null) + reply.status = Db.DB_NOSERVER_ID; + else + rdb.set_flags(this, args, reply); + return reply; + } + + public __db_get_reply __DB_db_get_4001(__db_get_msg args) + { + __db_get_reply reply = new __db_get_reply(); + RpcDb rdb = getDb(args.dbpcl_id); + if (rdb == null) + reply.status = Db.DB_NOSERVER_ID; + else + rdb.get(this, args, reply); + return reply; + } + + public __db_h_ffactor_reply __DB_db_h_ffactor_4001(__db_h_ffactor_msg args) + { + __db_h_ffactor_reply reply = new __db_h_ffactor_reply(); + RpcDb rdb = getDb(args.dbpcl_id); + if (rdb == null) + reply.status = Db.DB_NOSERVER_ID; + else + rdb.set_h_ffactor(this, args, reply); + return reply; + } + + public __db_h_nelem_reply __DB_db_h_nelem_4001(__db_h_nelem_msg args) + { + __db_h_nelem_reply reply = new __db_h_nelem_reply(); + RpcDb rdb = getDb(args.dbpcl_id); + if (rdb == null) + reply.status = Db.DB_NOSERVER_ID; + else + rdb.set_h_nelem(this, args, reply); + return reply; + } + + public __db_join_reply __DB_db_join_4001(__db_join_msg args) + { + __db_join_reply reply = new __db_join_reply(); + RpcDb rdb = getDb(args.dbpcl_id); + if (rdb == null) + reply.status = Db.DB_NOSERVER_ID; + else + rdb.join(this, args, reply); + return reply; + } + + public __db_key_range_reply __DB_db_key_range_4001(__db_key_range_msg args) + { + __db_key_range_reply reply = new __db_key_range_reply(); + RpcDb rdb = getDb(args.dbpcl_id); + if (rdb == null) + reply.status = Db.DB_NOSERVER_ID; + else + rdb.key_range(this, args, reply); + return reply; + } + + public __db_lorder_reply __DB_db_lorder_4001(__db_lorder_msg args) + { + __db_lorder_reply reply = new __db_lorder_reply(); + RpcDb rdb = getDb(args.dbpcl_id); + if (rdb == null) + reply.status = Db.DB_NOSERVER_ID; + else + rdb.set_lorder(this, args, reply); + return reply; + } + + public __db_open_reply __DB_db_open_4001(__db_open_msg args) + { + __db_open_reply reply = new __db_open_reply(); + RpcDb rdb = getDb(args.dbpcl_id); + if (rdb == null) + reply.status = Db.DB_NOSERVER_ID; + else + rdb.open(this, args, reply); + return reply; + } + + public __db_pagesize_reply __DB_db_pagesize_4001(__db_pagesize_msg args) + { + __db_pagesize_reply reply = new __db_pagesize_reply(); + RpcDb rdb = getDb(args.dbpcl_id); + if (rdb == null) + reply.status = Db.DB_NOSERVER_ID; + else + rdb.set_pagesize(this, args, reply); + return reply; + } + + public __db_pget_reply __DB_db_pget_4001(__db_pget_msg args) + { + __db_pget_reply reply = new __db_pget_reply(); + RpcDb rdb = getDb(args.dbpcl_id); + if (rdb == null) + reply.status = Db.DB_NOSERVER_ID; + else + rdb.pget(this, args, reply); + return reply; + } + + public __db_put_reply __DB_db_put_4001(__db_put_msg args) + { + __db_put_reply reply = new __db_put_reply(); + RpcDb rdb = getDb(args.dbpcl_id); + if (rdb == null) + reply.status = Db.DB_NOSERVER_ID; + else + rdb.put(this, args, reply); + return reply; + } + + public __db_remove_reply __DB_db_remove_4001(__db_remove_msg args) + { + __db_remove_reply reply = new __db_remove_reply(); + RpcDb rdb = getDb(args.dbpcl_id); + if (rdb == null) + reply.status = Db.DB_NOSERVER_ID; + else + rdb.remove(this, args, reply); + return reply; + } + + public __db_rename_reply __DB_db_rename_4001(__db_rename_msg args) + { + __db_rename_reply reply = new __db_rename_reply(); + RpcDb rdb = getDb(args.dbpcl_id); + if (rdb == null) + reply.status = Db.DB_NOSERVER_ID; + else + rdb.rename(this, args, reply); + return reply; + } + + public __db_re_delim_reply __DB_db_re_delim_4001(__db_re_delim_msg args) + { + __db_re_delim_reply reply = new __db_re_delim_reply(); + RpcDb rdb = getDb(args.dbpcl_id); + if (rdb == null) + reply.status = Db.DB_NOSERVER_ID; + else + rdb.set_re_delim(this, args, reply); + return reply; + } + + public __db_re_len_reply __DB_db_re_len_4001(__db_re_len_msg args) + { + __db_re_len_reply reply = new __db_re_len_reply(); + RpcDb rdb = getDb(args.dbpcl_id); + if (rdb == null) + reply.status = Db.DB_NOSERVER_ID; + else + rdb.set_re_len(this, args, reply); + return reply; + } + + public __db_re_pad_reply __DB_db_re_pad_4001(__db_re_pad_msg args) + { + __db_re_pad_reply reply = new __db_re_pad_reply(); + RpcDb rdb = getDb(args.dbpcl_id); + if (rdb == null) + reply.status = Db.DB_NOSERVER_ID; + else + rdb.set_re_pad(this, args, reply); + return reply; + } + + public __db_stat_reply __DB_db_stat_4001(__db_stat_msg args) + { + __db_stat_reply reply = new __db_stat_reply(); + RpcDb rdb = getDb(args.dbpcl_id); + if (rdb == null) + reply.status = Db.DB_NOSERVER_ID; + else + rdb.stat(this, args, reply); + return reply; + } + + public __db_sync_reply __DB_db_sync_4001(__db_sync_msg args) + { + __db_sync_reply reply = new __db_sync_reply(); + RpcDb rdb = getDb(args.dbpcl_id); + if (rdb == null) + reply.status = Db.DB_NOSERVER_ID; + else + rdb.sync(this, args, reply); + return reply; + } + + public __db_truncate_reply __DB_db_truncate_4001(__db_truncate_msg args) + { + __db_truncate_reply reply = new __db_truncate_reply(); + RpcDb rdb = getDb(args.dbpcl_id); + if (rdb == null) + reply.status = Db.DB_NOSERVER_ID; + else + rdb.truncate(this, args, reply); + return reply; + } + + //// Cursor methods + + public __dbc_close_reply __DB_dbc_close_4001(__dbc_close_msg args) + { + __dbc_close_reply reply = new __dbc_close_reply(); + RpcDbc rdbc = getCursor(args.dbccl_id); + if (rdbc == null) + reply.status = Db.DB_NOSERVER_ID; + else + rdbc.close(this, args, reply); + return reply; + } + + public __dbc_count_reply __DB_dbc_count_4001(__dbc_count_msg args) + { + __dbc_count_reply reply = new __dbc_count_reply(); + RpcDbc rdbc = getCursor(args.dbccl_id); + if (rdbc == null) + reply.status = Db.DB_NOSERVER_ID; + else + rdbc.count(this, args, reply); + return reply; + } + + public __dbc_del_reply __DB_dbc_del_4001(__dbc_del_msg args) + { + __dbc_del_reply reply = new __dbc_del_reply(); + RpcDbc rdbc = getCursor(args.dbccl_id); + if (rdbc == null) + reply.status = Db.DB_NOSERVER_ID; + else + rdbc.del(this, args, reply); + return reply; + } + + public __dbc_dup_reply __DB_dbc_dup_4001(__dbc_dup_msg args) + { + __dbc_dup_reply reply = new __dbc_dup_reply(); + RpcDbc rdbc = getCursor(args.dbccl_id); + if (rdbc == null) + reply.status = Db.DB_NOSERVER_ID; + else + rdbc.dup(this, args, reply); + return reply; + } + + public __dbc_get_reply __DB_dbc_get_4001(__dbc_get_msg args) + { + __dbc_get_reply reply = new __dbc_get_reply(); + RpcDbc rdbc = getCursor(args.dbccl_id); + if (rdbc == null) + reply.status = Db.DB_NOSERVER_ID; + else + rdbc.get(this, args, reply); + return reply; + } + + public __dbc_pget_reply __DB_dbc_pget_4001(__dbc_pget_msg args) { + __dbc_pget_reply reply = new __dbc_pget_reply(); + RpcDbc rdbc = getCursor(args.dbccl_id); + if (rdbc == null) + reply.status = Db.DB_NOSERVER_ID; + else + rdbc.pget(this, args, reply); + return reply; + } + + public __dbc_put_reply __DB_dbc_put_4001(__dbc_put_msg args) { + __dbc_put_reply reply = new __dbc_put_reply(); + RpcDbc rdbc = getCursor(args.dbccl_id); + if (rdbc == null) + reply.status = Db.DB_NOSERVER_ID; + else + rdbc.put(this, args, reply); + return reply; + } + + //// Environment methods + + public __env_cachesize_reply __DB_env_cachesize_4001(__env_cachesize_msg args) + { + __env_cachesize_reply reply = new __env_cachesize_reply(); + RpcDbEnv rdbenv = getEnv(args.dbenvcl_id); + if (rdbenv == null) + reply.status = Db.DB_NOSERVER_ID; + else + rdbenv.set_cachesize(this, args, reply); + return reply; + } + + public __env_close_reply __DB_env_close_4001(__env_close_msg args) + { + __env_close_reply reply = new __env_close_reply(); + RpcDbEnv rdbenv = getEnv(args.dbenvcl_id); + if (rdbenv == null) + reply.status = Db.DB_NOSERVER_ID; + else + rdbenv.close(this, args, reply); + return reply; + } + + public __env_create_reply __DB_env_create_4001(__env_create_msg args) + { + __env_create_reply reply = new __env_create_reply(); + RpcDbEnv rdbenv = new RpcDbEnv(); + rdbenv.create(this, args, reply); + return reply; + } + + public __env_dbremove_reply __DB_env_dbremove_4001(__env_dbremove_msg args) + { + __env_dbremove_reply reply = new __env_dbremove_reply(); + RpcDbEnv rdbenv = getEnv(args.dbenvcl_id); + if (rdbenv == null) + reply.status = Db.DB_NOSERVER_ID; + else + rdbenv.dbremove(this, args, reply); + return reply; + } + + public __env_dbrename_reply __DB_env_dbrename_4001(__env_dbrename_msg args) + { + __env_dbrename_reply reply = new __env_dbrename_reply(); + RpcDbEnv rdbenv = getEnv(args.dbenvcl_id); + if (rdbenv == null) + reply.status = Db.DB_NOSERVER_ID; + else + rdbenv.dbrename(this, args, reply); + return reply; + } + + public __env_encrypt_reply __DB_env_encrypt_4001(__env_encrypt_msg args) + { + __env_encrypt_reply reply = new __env_encrypt_reply(); + RpcDbEnv rdbenv = getEnv(args.dbenvcl_id); + if (rdbenv == null) + reply.status = Db.DB_NOSERVER_ID; + else + rdbenv.set_encrypt(this, args, reply); + return reply; + } + + public __env_flags_reply __DB_env_flags_4001(__env_flags_msg args) + { + __env_flags_reply reply = new __env_flags_reply(); + RpcDbEnv rdbenv = getEnv(args.dbenvcl_id); + if (rdbenv == null) + reply.status = Db.DB_NOSERVER_ID; + else + rdbenv.set_flags(this, args, reply); + return reply; + } + + public __env_open_reply __DB_env_open_4001(__env_open_msg args) + { + __env_open_reply reply = new __env_open_reply(); + RpcDbEnv rdbenv = getEnv(args.dbenvcl_id); + if (rdbenv == null) + reply.status = Db.DB_NOSERVER_ID; + else + rdbenv.open(this, args, reply); + return reply; + } + + public __env_remove_reply __DB_env_remove_4001(__env_remove_msg args) + { + __env_remove_reply reply = new __env_remove_reply(); + RpcDbEnv rdbenv = getEnv(args.dbenvcl_id); + if (rdbenv == null) + reply.status = Db.DB_NOSERVER_ID; + else + rdbenv.remove(this, args, reply); + return reply; + } + + //// Transaction methods + + public __txn_abort_reply __DB_txn_abort_4001(__txn_abort_msg args) + { + __txn_abort_reply reply = new __txn_abort_reply(); + RpcDbTxn rdbtxn = getTxn(args.txnpcl_id); + if (rdbtxn == null) + reply.status = Db.DB_NOSERVER_ID; + else + rdbtxn.abort(this, args, reply); + return reply; + } + + public __txn_begin_reply __DB_txn_begin_4001(__txn_begin_msg args) + { + __txn_begin_reply reply = new __txn_begin_reply(); + RpcDbTxn rdbtxn = new RpcDbTxn(getEnv(args.dbenvcl_id), null); + rdbtxn.begin(this, args, reply); + return reply; + } + + public __txn_commit_reply __DB_txn_commit_4001(__txn_commit_msg args) + { + __txn_commit_reply reply = new __txn_commit_reply(); + RpcDbTxn rdbtxn = getTxn(args.txnpcl_id); + if (rdbtxn == null) + reply.status = Db.DB_NOSERVER_ID; + else + rdbtxn.commit(this, args, reply); + return reply; + } + + public __txn_discard_reply __DB_txn_discard_4001(__txn_discard_msg args) + { + __txn_discard_reply reply = new __txn_discard_reply(); + RpcDbTxn rdbtxn = getTxn(args.txnpcl_id); + if (rdbtxn == null) + reply.status = Db.DB_NOSERVER_ID; + else + rdbtxn.discard(this, args, reply); + return reply; + } + + public __txn_prepare_reply __DB_txn_prepare_4001(__txn_prepare_msg args) + { + __txn_prepare_reply reply = new __txn_prepare_reply(); + RpcDbTxn rdbtxn = getTxn(args.txnpcl_id); + if (rdbtxn == null) + reply.status = Db.DB_NOSERVER_ID; + else + rdbtxn.prepare(this, args, reply); + return reply; + } + + public __txn_recover_reply __DB_txn_recover_4001(__txn_recover_msg args) + { + __txn_recover_reply reply = new __txn_recover_reply(); + RpcDbEnv rdbenv = getEnv(args.dbenvcl_id); + if (rdbenv == null) + reply.status = Db.DB_NOSERVER_ID; + else + rdbenv.txn_recover(this, args, reply); + return reply; + } +} diff --git a/db/rpc_server/java/DbServer.java b/db/rpc_server/java/DbServer.java new file mode 100644 index 000000000..7e3b1ca0a --- /dev/null +++ b/db/rpc_server/java/DbServer.java @@ -0,0 +1,301 @@ +/*- + * See the file LICENSE for redistribution information. + * + * Copyright (c) 2001-2002 + * Sleepycat Software. All rights reserved. + * + * Id: DbServer.java,v 1.5 2002/08/09 01:56:09 bostic Exp + */ + +package com.sleepycat.db.rpcserver; + +import com.sleepycat.db.*; +import java.io.*; +import java.util.*; +import org.acplt.oncrpc.OncRpcException; +import org.acplt.oncrpc.server.OncRpcCallInformation; + +/** + * Main entry point for the Java version of the Berkeley DB RPC server + */ +public class DbServer extends DbDispatcher +{ + public static long idleto = 10 * 60 * 1000; // 5 minutes + public static long defto = 5 * 60 * 1000; // 5 minutes + public static long maxto = 60 * 60 * 1000; // 1 hour + public static String passwd = null; + public static PrintWriter err; + + long now, hint; // updated each operation + FreeList env_list = new FreeList(); + FreeList db_list = new FreeList(); + FreeList txn_list = new FreeList(); + FreeList cursor_list = new FreeList(); + + public DbServer() throws IOException, OncRpcException + { + super(); + init_lists(); + } + + public void dispatchOncRpcCall(OncRpcCallInformation call, int program, + int version, int procedure) throws OncRpcException, IOException + { + long newnow = System.currentTimeMillis(); + // DbServer.err.println("Dispatching RPC call " + procedure + " after delay of " + (newnow - now)); + now = newnow; + // DbServer.err.flush(); + super.dispatchOncRpcCall(call, program, version, procedure); + + try { + doTimeouts(); + } catch(Throwable t) { + System.err.println("Caught " + t + " during doTimeouts()"); + t.printStackTrace(System.err); + } + } + + // Internal methods to track context + private void init_lists() + { + // We do this so that getEnv/Db/etc(0) == null + env_list.add(null); + db_list.add(null); + txn_list.add(null); + cursor_list.add(null); + } + + int addEnv(RpcDbEnv rdbenv) + { + rdbenv.timer.last_access = now; + int id = env_list.add(rdbenv); + return id; + } + + int addDb(RpcDb rdb) + { + int id = db_list.add(rdb); + return id; + } + + int addTxn(RpcDbTxn rtxn) + { + rtxn.timer.last_access = now; + int id = txn_list.add(rtxn); + return id; + } + + int addCursor(RpcDbc rdbc) + { + rdbc.timer.last_access = now; + int id = cursor_list.add(rdbc); + return id; + } + + void delEnv(RpcDbEnv rdbenv) + { + // cursors and transactions will already have been cleaned up + for(LocalIterator i = db_list.iterator(); i.hasNext(); ) { + RpcDb rdb = (RpcDb)i.next(); + if (rdb != null && rdb.rdbenv == rdbenv) + delDb(rdb); + } + + env_list.del(rdbenv); + rdbenv.dispose(); + } + + void delDb(RpcDb rdb) + { + db_list.del(rdb); + rdb.dispose(); + + for(LocalIterator i = cursor_list.iterator(); i.hasNext(); ) { + RpcDbc rdbc = (RpcDbc)i.next(); + if (rdbc != null && rdbc.timer == rdb) + i.remove(); + } + } + + void delTxn(RpcDbTxn rtxn) + { + txn_list.del(rtxn); + rtxn.dispose(); + + for(LocalIterator i = cursor_list.iterator(); i.hasNext(); ) { + RpcDbc rdbc = (RpcDbc)i.next(); + if (rdbc != null && rdbc.timer == rtxn) + i.remove(); + } + + for(LocalIterator i = txn_list.iterator(); i.hasNext(); ) { + RpcDbTxn rtxn_child = (RpcDbTxn)i.next(); + if (rtxn_child != null && rtxn_child.timer == rtxn) + i.remove(); + } + } + + void delCursor(RpcDbc rdbc) + { + cursor_list.del(rdbc); + rdbc.dispose(); + } + + RpcDbEnv getEnv(int envid) + { + RpcDbEnv rdbenv = (RpcDbEnv)env_list.get(envid); + if (rdbenv != null) + rdbenv.timer.last_access = now; + return rdbenv; + } + + RpcDb getDb(int dbid) + { + RpcDb rdb = (RpcDb)db_list.get(dbid); + if (rdb != null) + rdb.rdbenv.timer.last_access = now; + return rdb; + } + + RpcDbTxn getTxn(int txnid) + { + RpcDbTxn rtxn = (RpcDbTxn)txn_list.get(txnid); + if (rtxn != null) + rtxn.timer.last_access = rtxn.rdbenv.timer.last_access = now; + return rtxn; + } + + RpcDbc getCursor(int dbcid) + { + RpcDbc rdbc = (RpcDbc)cursor_list.get(dbcid); + if (rdbc != null) + rdbc.last_access = rdbc.timer.last_access = rdbc.rdbenv.timer.last_access = now; + return rdbc; + } + + void doTimeouts() + { + if (now < hint) { + // DbServer.err.println("Skipping cleaner sweep - now = " + now + ", hint = " + hint); + return; + } + + // DbServer.err.println("Starting a cleaner sweep"); + hint = now + DbServer.maxto; + + for(LocalIterator i = cursor_list.iterator(); i.hasNext(); ) { + RpcDbc rdbc = (RpcDbc)i.next(); + if (rdbc == null) + continue; + + long end_time = rdbc.timer.last_access + rdbc.rdbenv.timeout; + // DbServer.err.println("Examining " + rdbc + ", time left = " + (end_time - now)); + if (end_time < now) { + DbServer.err.println("Cleaning up " + rdbc); + delCursor(rdbc); + } else if (end_time < hint) + hint = end_time; + } + + for(LocalIterator i = txn_list.iterator(); i.hasNext(); ) { + RpcDbTxn rtxn = (RpcDbTxn)i.next(); + if (rtxn == null) + continue; + + long end_time = rtxn.timer.last_access + rtxn.rdbenv.timeout; + // DbServer.err.println("Examining " + rtxn + ", time left = " + (end_time - now)); + if (end_time < now) { + DbServer.err.println("Cleaning up " + rtxn); + delTxn(rtxn); + } else if (end_time < hint) + hint = end_time; + } + + for(LocalIterator i = env_list.iterator(); i.hasNext(); ) { + RpcDbEnv rdbenv = (RpcDbEnv)i.next(); + if (rdbenv == null) + continue; + + long end_time = rdbenv.timer.last_access + rdbenv.idletime; + // DbServer.err.println("Examining " + rdbenv + ", time left = " + (end_time - now)); + if (end_time < now) { + DbServer.err.println("Cleaning up " + rdbenv); + delEnv(rdbenv); + } + } + + // if we didn't find anything, reset the hint + if (hint == now + DbServer.maxto) + hint = 0; + + // DbServer.err.println("Finishing a cleaner sweep"); + } + + // Some constants that aren't available elsewhere + static final int DB_SERVER_FLAGMASK = Db.DB_LOCKDOWN | + Db.DB_PRIVATE | Db.DB_RECOVER | Db.DB_RECOVER_FATAL | + Db.DB_SYSTEM_MEM | Db.DB_USE_ENVIRON | + Db.DB_USE_ENVIRON_ROOT; + static final int DB_SERVER_ENVFLAGS = Db.DB_INIT_CDB | + Db.DB_INIT_LOCK | Db.DB_INIT_LOG | Db.DB_INIT_MPOOL | + Db.DB_INIT_TXN | Db.DB_JOINENV; + static final int DB_SERVER_DBFLAGS = Db.DB_DIRTY_READ | + Db.DB_NOMMAP | Db.DB_RDONLY; + static final int DB_SERVER_DBNOSHARE = Db.DB_EXCL | Db.DB_TRUNCATE; + + public static void main(String[] args) + { + System.out.println("Starting DbServer..."); + for (int i = 0; i < args.length; i++) { + if (args[i].charAt(0) != '-') + usage(); + + switch (args[i].charAt(1)) { + case 'h': + ++i; // add_home(args[++i]); + break; + case 'I': + idleto = Long.parseLong(args[++i]) * 1000L; + break; + case 'P': + passwd = args[++i]; + break; + case 't': + defto = Long.parseLong(args[++i]) * 1000L; + break; + case 'T': + maxto = Long.parseLong(args[++i]) * 1000L; + break; + case 'V': + // version; + break; + case 'v': + // verbose + break; + default: + usage(); + } + } + + try { + DbServer.err = new PrintWriter(new FileOutputStream("JavaRPCServer.trace", true)); + DbServer server = new DbServer(); + server.run(); + } catch (Throwable e) { + System.out.println("DbServer exception:"); + e.printStackTrace(DbServer.err); + } finally { + if (DbServer.err != null) + DbServer.err.close(); + } + + System.out.println("DbServer stopped."); + } + + static void usage() + { + System.err.println("usage: java com.sleepycat.db.rpcserver.DbServer \\"); + System.err.println("[-Vv] [-h home] [-P passwd] [-I idletimeout] [-L logfile] [-t def_timeout] [-T maxtimeout]"); + System.exit(1); + } +} diff --git a/db/rpc_server/java/FreeList.java b/db/rpc_server/java/FreeList.java new file mode 100644 index 000000000..d7eedd746 --- /dev/null +++ b/db/rpc_server/java/FreeList.java @@ -0,0 +1,102 @@ +/*- + * See the file LICENSE for redistribution information. + * + * Copyright (c) 2001-2002 + * Sleepycat Software. All rights reserved. + * + * Id: FreeList.java,v 1.3 2002/08/09 01:56:09 bostic Exp + */ + +package com.sleepycat.db.rpcserver; + +import java.util.*; + +/** + * Keep track of a list of objects by id with a free list. + * Intentionally package-protected exposure. + */ +class FreeList +{ + class FreeIndex { + int index; + FreeIndex(int index) { this.index = index; } + int getIndex() { return index; } + } + + Vector items = new Vector(); + FreeIndex free_head = null; + + public synchronized int add(Object obj) { + int pos; + if (free_head == null) { + pos = items.size(); + items.addElement(obj); + if (pos % 1000 == 0) + DbServer.err.println(this + " grew to size " + pos); + } else { + pos = free_head.getIndex(); + free_head = (FreeIndex)items.elementAt(pos); + items.setElementAt(obj, pos); + } + return pos; + } + + public synchronized void del(int pos) { + Object obj = items.elementAt(pos); + if (obj != null && obj instanceof FreeIndex) + throw new NoSuchElementException("index " + pos + " has already been freed"); + items.setElementAt(free_head, pos); + free_head = new FreeIndex(pos); + } + + public void del(Object obj) { + del(items.indexOf(obj)); + } + + public Object get(int pos) { + Object obj = items.elementAt(pos); + if (obj instanceof FreeIndex) + obj = null; + return obj; + } + + public LocalIterator iterator() { + return new FreeListIterator(); + } + + /** + * Iterator for a FreeList. Note that this class doesn't implement + * java.util.Iterator to maintain compatibility with Java 1.1 + * Intentionally package-protected exposure. + */ + class FreeListIterator implements LocalIterator { + int current; + + FreeListIterator() { current = findNext(-1); } + + private int findNext(int start) { + int next = start; + while (++next < items.size()) { + Object obj = items.elementAt(next); + if (obj == null || !(obj instanceof FreeIndex)) + break; + } + return next; + } + + public boolean hasNext() { + return (findNext(current) < items.size()); + } + + public Object next() { + current = findNext(current); + if (current == items.size()) + throw new NoSuchElementException("enumerated past end of FreeList"); + return items.elementAt(current); + } + + public void remove() { + del(current); + } + } +} diff --git a/db/rpc_server/java/LocalIterator.java b/db/rpc_server/java/LocalIterator.java new file mode 100644 index 000000000..498ded344 --- /dev/null +++ b/db/rpc_server/java/LocalIterator.java @@ -0,0 +1,23 @@ +/*- + * See the file LICENSE for redistribution information. + * + * Copyright (c) 2001-2002 + * Sleepycat Software. All rights reserved. + * + * Id: LocalIterator.java,v 1.2 2002/08/09 01:56:09 bostic Exp + */ + +package com.sleepycat.db.rpcserver; + +import java.util.*; + +/** + * Iterator interface. Note that this matches java.util.Iterator + * but maintains compatibility with Java 1.1 + * Intentionally package-protected exposure. + */ +interface LocalIterator { + boolean hasNext(); + Object next(); + void remove(); +} diff --git a/db/rpc_server/java/README b/db/rpc_server/java/README new file mode 100644 index 000000000..c2d8f3abd --- /dev/null +++ b/db/rpc_server/java/README @@ -0,0 +1,24 @@ +Berkeley DB Java RPC server, copyright (C) 2002 Sleepycat Software + +The Java implementation of the Berkeley DB RPC server is intended +primarily for testing purposes. It provides the same interface +as the C and C++ RPC servers, but is implemented via the Java API +rather than the C or C++ APIs. This allows the existing Tcl test +suite to exercise the Java API without modification. + +The Java RPC server relies on a Java version of rpcgen to +automatically generate appropriate Java classes from the RPC +interface specification (../db_server.x). We use jrpcgen, which +is part of the Remote Tea for Java project: + acplt.plt.rwth-aachen.de/ks/english/remotetea.html + +To rebuild the Java stubs from db_server.x, you will need to +download the full Remote Tea package, but if you just want to +compile the Java sources and run the Java RPC server, the runtime +component of Remote Tea is included in oncrpc.jar. Building +the Java RPC server is automatic when Berkeley DB is configured +with the both --enable-rpc and --enable-java. + +All of the Remote Tea project is licensed under the Library GNU +Public License, and we have made no modifications to their +released code. diff --git a/db/rpc_server/java/RpcDb.java b/db/rpc_server/java/RpcDb.java new file mode 100644 index 000000000..19320c179 --- /dev/null +++ b/db/rpc_server/java/RpcDb.java @@ -0,0 +1,694 @@ +/*- + * See the file LICENSE for redistribution information. + * + * Copyright (c) 2001-2002 + * Sleepycat Software. All rights reserved. + * + * Id: RpcDb.java,v 1.8 2002/08/09 01:56:09 bostic Exp + */ + +package com.sleepycat.db.rpcserver; + +import com.sleepycat.db.*; +import java.io.IOException; +import java.io.*; +import java.util.*; + +/** + * RPC wrapper around a db object for the Java RPC server. + */ +public class RpcDb extends Timer +{ + static final byte[] empty = new byte[0]; + Db db; + RpcDbEnv rdbenv; + int refcount = 1; + String dbname, subdbname; + int type, setflags, openflags; + + public RpcDb(RpcDbEnv rdbenv) + { + this.rdbenv = rdbenv; + } + + void dispose() + { + if (db != null) { + try { + db.close(0); + } catch(DbException e) { + e.printStackTrace(DbServer.err); + } + db = null; + } + } + + public void associate(DbDispatcher server, + __db_associate_msg args, __db_associate_reply reply) + { + try { + RpcDbTxn rtxn = server.getTxn(args.txnpcl_id); + DbTxn txn = (rtxn != null) ? rtxn.txn : null; + /* + * We do not support DB_CREATE for associate. Users + * can only access secondary indices on a read-only basis, + * so whatever they are looking for needs to be there already. + */ + db.associate(txn, server.getDb(args.sdbpcl_id).db, null, args.flags); + reply.status = 0; + } catch(DbException e) { + e.printStackTrace(DbServer.err); + reply.status = e.get_errno(); + } + } + + public void close(DbDispatcher server, + __db_close_msg args, __db_close_reply reply) + { + if (--refcount != 0) { + reply.status = 0; + return; + } + + try { + db.close(args.flags); + db = null; + reply.status = 0; + } catch(DbException e) { + e.printStackTrace(DbServer.err); + reply.status = e.get_errno(); + } finally { + server.delDb(this); + } + } + + public void create(DbDispatcher server, + __db_create_msg args, __db_create_reply reply) + { + try { + db = new Db(server.getEnv(args.dbenvcl_id).dbenv, args.flags); + reply.dbcl_id = server.addDb(this); + reply.status = 0; + } catch(DbException e) { + e.printStackTrace(DbServer.err); + reply.status = e.get_errno(); + } + } + + public void cursor(DbDispatcher server, + __db_cursor_msg args, __db_cursor_reply reply) + { + try { + RpcDbTxn rtxn = server.getTxn(args.txnpcl_id); + DbTxn txn = (rtxn != null) ? rtxn.txn : null; + Dbc dbc = db.cursor(txn, args.flags); + RpcDbc rdbc = new RpcDbc(this, dbc, false); + rdbc.timer = (rtxn != null) ? rtxn.timer : this; + reply.dbcidcl_id = server.addCursor(rdbc); + reply.status = 0; + } catch(DbException e) { + e.printStackTrace(DbServer.err); + reply.status = e.get_errno(); + } + } + + public void del(DbDispatcher server, + __db_del_msg args, __db_del_reply reply) + { + try { + RpcDbTxn rtxn = server.getTxn(args.txnpcl_id); + DbTxn txn = (rtxn != null) ? rtxn.txn : null; + Dbt key = new Dbt(args.keydata); + key.set_dlen(args.keydlen); + key.set_doff(args.keydoff); + key.set_ulen(args.keyulen); + key.set_flags(args.keyflags); + + db.del(txn, key, args.flags); + reply.status = 0; + } catch(DbException e) { + e.printStackTrace(DbServer.err); + reply.status = e.get_errno(); + } + } + + public void get(DbDispatcher server, + __db_get_msg args, __db_get_reply reply) + { + try { + RpcDbTxn rtxn = server.getTxn(args.txnpcl_id); + DbTxn txn = (rtxn != null) ? rtxn.txn : null; + Dbt key = new Dbt(args.keydata); + key.set_dlen(args.keydlen); + key.set_doff(args.keydoff); + key.set_ulen(args.keyulen); + key.set_flags(Db.DB_DBT_MALLOC | + (args.keyflags & Db.DB_DBT_PARTIAL)); + + Dbt data = new Dbt(args.datadata); + data.set_dlen(args.datadlen); + data.set_doff(args.datadoff); + data.set_ulen(args.dataulen); + if ((args.flags & Db.DB_MULTIPLE) != 0) { + if (data.get_data().length == 0) + data.set_data(new byte[data.get_ulen()]); + data.set_flags(Db.DB_DBT_USERMEM | + (args.dataflags & Db.DB_DBT_PARTIAL)); + } else + data.set_flags(Db.DB_DBT_MALLOC | + (args.dataflags & Db.DB_DBT_PARTIAL)); + + reply.status = db.get(txn, key, data, args.flags); + + if (key.get_data() == args.keydata || + key.get_data().length != key.get_size()) { + reply.keydata = new byte[key.get_size()]; + System.arraycopy(key.get_data(), 0, reply.keydata, 0, key.get_size()); + } else + reply.keydata = key.get_data(); + + if (data.get_data() == args.datadata || + data.get_data().length != data.get_size()) { + reply.datadata = new byte[data.get_size()]; + System.arraycopy(data.get_data(), 0, reply.datadata, 0, data.get_size()); + } else + reply.datadata = data.get_data(); + } catch(DbException e) { + e.printStackTrace(DbServer.err); + reply.status = e.get_errno(); + reply.keydata = reply.datadata = empty; + } + } + + public void join(DbDispatcher server, + __db_join_msg args, __db_join_reply reply) + { + try { + Dbc[] cursors = new Dbc[args.curs.length + 1]; + for(int i = 0; i < args.curs.length; i++) { + RpcDbc rdbc = server.getCursor(args.curs[i]); + if (rdbc == null) { + reply.status = Db.DB_NOSERVER_ID; + return; + } + cursors[i] = rdbc.dbc; + } + cursors[args.curs.length] = null; + + Dbc jdbc = db.join(cursors, args.flags); + + RpcDbc rjdbc = new RpcDbc(this, jdbc, true); + /* + * If our curslist has a parent txn, we need to use it too + * for the activity timeout. All cursors must be part of + * the same transaction, so just check the first. + */ + RpcDbc rdbc0 = server.getCursor(args.curs[0]); + if (rdbc0.timer != rdbc0) + rjdbc.timer = rdbc0.timer; + + /* + * All of the curslist cursors must point to the join + * cursor's timeout so that we do not timeout any of the + * curlist cursors while the join cursor is active. + */ + for(int i = 0; i < args.curs.length; i++) { + RpcDbc rdbc = server.getCursor(args.curs[i]); + rdbc.orig_timer = rdbc.timer; + rdbc.timer = rjdbc; + } + reply.dbcidcl_id = server.addCursor(rjdbc); + reply.status = 0; + } catch(DbException e) { + e.printStackTrace(DbServer.err); + reply.status = e.get_errno(); + } + } + + public void key_range(DbDispatcher server, + __db_key_range_msg args, __db_key_range_reply reply) + { + try { + RpcDbTxn rtxn = server.getTxn(args.txnpcl_id); + DbTxn txn = (rtxn != null) ? rtxn.txn : null; + Dbt key = new Dbt(args.keydata); + key.set_dlen(args.keydlen); + key.set_doff(args.keydoff); + key.set_ulen(args.keyulen); + key.set_flags(args.keyflags); + + DbKeyRange range = new DbKeyRange(); + + db.key_range(txn, key, range, args.flags); + reply.status = 0; + reply.less = range.less; + reply.equal = range.equal; + reply.greater = range.greater; + } catch(DbException e) { + e.printStackTrace(DbServer.err); + reply.status = e.get_errno(); + } + } + + private boolean findSharedDb(DbDispatcher server, __db_open_reply reply) + throws DbException + { + RpcDb rdb = null; + boolean matchFound = false; + LocalIterator i = ((DbServer)server).db_list.iterator(); + + while (!matchFound && i.hasNext()) { + rdb = (RpcDb)i.next(); + if (rdb != null && rdb != this && rdb.rdbenv == rdbenv && + (type == Db.DB_UNKNOWN || rdb.type == type) && + openflags == rdb.openflags && + setflags == rdb.setflags && + dbname != null && rdb.dbname != null && + dbname.equals(rdb.dbname) && + (subdbname == rdb.subdbname || + (subdbname != null && rdb.subdbname != null && + subdbname.equals(rdb.subdbname)))) + matchFound = true; + } + + if (matchFound) { + ++rdb.refcount; + reply.dbcl_id = ((FreeList.FreeListIterator)i).current; + reply.type = rdb.db.get_type(); + reply.dbflags = rdb.db.get_flags_raw(); + // FIXME: not possible to work out byteorder from Java? + reply.lorder = rdb.db.get_byteswapped() ? 4321 : 1234; + reply.status = 0; + + DbServer.err.println("Sharing Db: " + reply.dbcl_id); + } + + return matchFound; + } + + public void open(DbDispatcher server, + __db_open_msg args, __db_open_reply reply) + { + try { + dbname = (args.name.length() > 0) ? args.name : null; + subdbname = (args.subdb.length() > 0) ? args.subdb : null; + type = args.type; + openflags = args.flags & DbServer.DB_SERVER_DBFLAGS; + + if (findSharedDb(server, reply)) { + db.close(0); + db = null; + server.delDb(this); + } else { + DbServer.err.println("Calling db.open(" + null + ", " + dbname + ", " + subdbname + ", " + args.type + ", " + Integer.toHexString(args.flags) + ", " + args.mode + ")"); + db.open(null, dbname, subdbname, args.type, args.flags, args.mode); + + reply.dbcl_id = args.dbpcl_id; + reply.type = this.type = db.get_type(); + reply.dbflags = db.get_flags_raw(); + // FIXME: not possible to work out byteorder from Java? + reply.lorder = db.get_byteswapped() ? 4321 : 1234; + reply.status = 0; + } + } catch(DbException e) { + e.printStackTrace(DbServer.err); + reply.status = e.get_errno(); + } catch(FileNotFoundException e) { + e.printStackTrace(DbServer.err); + reply.status = Db.DB_NOTFOUND; + } + + // System.err.println("Db.open: reply.status = " + reply.status + ", reply.dbcl_id = " + reply.dbcl_id); + } + + public void pget(DbDispatcher server, + __db_pget_msg args, __db_pget_reply reply) + { + try { + RpcDbTxn rtxn = server.getTxn(args.txnpcl_id); + DbTxn txn = (rtxn != null) ? rtxn.txn : null; + Dbt skey = new Dbt(args.skeydata); + skey.set_dlen(args.skeydlen); + skey.set_doff(args.skeydoff); + skey.set_ulen(args.skeyulen); + skey.set_flags(Db.DB_DBT_MALLOC | + (args.skeyflags & Db.DB_DBT_PARTIAL)); + + Dbt pkey = new Dbt(args.pkeydata); + pkey.set_dlen(args.pkeydlen); + pkey.set_doff(args.pkeydoff); + pkey.set_ulen(args.pkeyulen); + pkey.set_flags(Db.DB_DBT_MALLOC | + (args.pkeyflags & Db.DB_DBT_PARTIAL)); + + Dbt data = new Dbt(args.datadata); + data.set_dlen(args.datadlen); + data.set_doff(args.datadoff); + data.set_ulen(args.dataulen); + data.set_flags(Db.DB_DBT_MALLOC | + (args.dataflags & Db.DB_DBT_PARTIAL)); + + db.pget(txn, skey, pkey, data, args.flags); + + if (skey.get_data() == args.skeydata || + skey.get_data().length != skey.get_size()) { + reply.skeydata = new byte[skey.get_size()]; + System.arraycopy(skey.get_data(), 0, reply.skeydata, 0, skey.get_size()); + } else + reply.skeydata = skey.get_data(); + + if (pkey.get_data() == args.pkeydata || + pkey.get_data().length != pkey.get_size()) { + reply.pkeydata = new byte[pkey.get_size()]; + System.arraycopy(pkey.get_data(), 0, reply.pkeydata, 0, pkey.get_size()); + } else + reply.pkeydata = pkey.get_data(); + + if (data.get_data() == args.datadata || + data.get_data().length != data.get_size()) { + reply.datadata = new byte[data.get_size()]; + System.arraycopy(data.get_data(), 0, reply.datadata, 0, data.get_size()); + } else + reply.datadata = data.get_data(); + + reply.status = 0; + } catch(DbException e) { + e.printStackTrace(DbServer.err); + reply.status = e.get_errno(); + reply.skeydata = reply.pkeydata = reply.datadata = empty; + } + } + + public void put(DbDispatcher server, + __db_put_msg args, __db_put_reply reply) + { + try { + RpcDbTxn rtxn = server.getTxn(args.txnpcl_id); + DbTxn txn = (rtxn != null) ? rtxn.txn : null; + + Dbt key = new Dbt(args.keydata); + key.set_dlen(args.keydlen); + key.set_doff(args.keydoff); + key.set_ulen(args.keyulen); + key.set_flags(Db.DB_DBT_MALLOC | + (args.keyflags & Db.DB_DBT_PARTIAL)); + + Dbt data = new Dbt(args.datadata); + data.set_dlen(args.datadlen); + data.set_doff(args.datadoff); + data.set_ulen(args.dataulen); + data.set_flags(args.dataflags); + + reply.status = db.put(txn, key, data, args.flags); + + /* + * If the client did a DB_APPEND, set up key in reply. + * Otherwise just status. + */ + if ((args.flags & Db.DB_APPEND) != 0) { + if (key.get_data() == args.keydata || + key.get_data().length != key.get_size()) { + reply.keydata = new byte[key.get_size()]; + System.arraycopy(key.get_data(), 0, reply.keydata, 0, key.get_size()); + } else + reply.keydata = key.get_data(); + } else + reply.keydata = empty; + } catch(DbException e) { + reply.keydata = empty; + reply.status = e.get_errno(); + DbServer.err.println("Exception, setting status to " + reply.status); + e.printStackTrace(DbServer.err); + } + } + + public void remove(DbDispatcher server, + __db_remove_msg args, __db_remove_reply reply) + { + try { + args.name = (args.name.length() > 0) ? args.name : null; + args.subdb = (args.subdb.length() > 0) ? args.subdb : null; + db.remove(args.name, args.subdb, args.flags); + db = null; + reply.status = 0; + } catch(DbException e) { + e.printStackTrace(DbServer.err); + reply.status = e.get_errno(); + } catch(FileNotFoundException e) { + e.printStackTrace(DbServer.err); + reply.status = Db.DB_NOTFOUND; + } finally { + server.delDb(this); + } + } + + public void rename(DbDispatcher server, + __db_rename_msg args, __db_rename_reply reply) + { + try { + args.name = (args.name.length() > 0) ? args.name : null; + args.subdb = (args.subdb.length() > 0) ? args.subdb : null; + args.newname = (args.newname.length() > 0) ? args.newname : null; + db.rename(args.name, args.subdb, args.newname, args.flags); + db = null; + reply.status = 0; + } catch(DbException e) { + e.printStackTrace(DbServer.err); + reply.status = e.get_errno(); + } catch(FileNotFoundException e) { + e.printStackTrace(DbServer.err); + reply.status = Db.DB_NOTFOUND; + } finally { + server.delDb(this); + } + } + + public void set_bt_maxkey(DbDispatcher server, + __db_bt_maxkey_msg args, __db_bt_maxkey_reply reply) + { + try { + db.set_bt_maxkey(args.maxkey); + reply.status = 0; + } catch(DbException e) { + e.printStackTrace(DbServer.err); + reply.status = e.get_errno(); + } + } + + public void set_bt_minkey(DbDispatcher server, + __db_bt_minkey_msg args, __db_bt_minkey_reply reply) + { + try { + db.set_bt_minkey(args.minkey); + reply.status = 0; + } catch(DbException e) { + e.printStackTrace(DbServer.err); + reply.status = e.get_errno(); + } + } + + public void set_encrypt(DbDispatcher server, + __db_encrypt_msg args, __db_encrypt_reply reply) + { + try { + db.set_encrypt(args.passwd, args.flags); + reply.status = 0; + } catch(DbException e) { + e.printStackTrace(DbServer.err); + reply.status = e.get_errno(); + } + } + + public void set_flags(DbDispatcher server, + __db_flags_msg args, __db_flags_reply reply) + { + try { + // DbServer.err.println("Calling db.setflags(" + Integer.toHexString(args.flags) + ")"); + db.set_flags(args.flags); + setflags |= args.flags; + reply.status = 0; + } catch(DbException e) { + e.printStackTrace(DbServer.err); + reply.status = e.get_errno(); + } + } + + public void set_h_ffactor(DbDispatcher server, + __db_h_ffactor_msg args, __db_h_ffactor_reply reply) + { + try { + db.set_h_ffactor(args.ffactor); + reply.status = 0; + } catch(DbException e) { + e.printStackTrace(DbServer.err); + reply.status = e.get_errno(); + } + } + + public void set_h_nelem(DbDispatcher server, + __db_h_nelem_msg args, __db_h_nelem_reply reply) + { + try { + db.set_h_nelem(args.nelem); + reply.status = 0; + } catch(DbException e) { + e.printStackTrace(DbServer.err); + reply.status = e.get_errno(); + } + } + + public void set_lorder(DbDispatcher server, + __db_lorder_msg args, __db_lorder_reply reply) + { + try { + db.set_lorder(args.lorder); + reply.status = 0; + } catch(DbException e) { + e.printStackTrace(DbServer.err); + reply.status = e.get_errno(); + } + } + + public void set_pagesize(DbDispatcher server, + __db_pagesize_msg args, __db_pagesize_reply reply) + { + try { + db.set_pagesize(args.pagesize); + reply.status = 0; + } catch(DbException e) { + e.printStackTrace(DbServer.err); + reply.status = e.get_errno(); + } + } + + public void set_q_extentsize(DbDispatcher server, + __db_extentsize_msg args, __db_extentsize_reply reply) + { + try { + db.set_q_extentsize(args.extentsize); + reply.status = 0; + } catch(DbException e) { + e.printStackTrace(DbServer.err); + reply.status = e.get_errno(); + } + } + + public void set_re_delim(DbDispatcher server, + __db_re_delim_msg args, __db_re_delim_reply reply) + { + try { + db.set_re_delim(args.delim); + reply.status = 0; + } catch(DbException e) { + e.printStackTrace(DbServer.err); + reply.status = e.get_errno(); + } + } + + public void set_re_len(DbDispatcher server, + __db_re_len_msg args, __db_re_len_reply reply) + { + try { + db.set_re_len(args.len); + reply.status = 0; + } catch(DbException e) { + e.printStackTrace(DbServer.err); + reply.status = e.get_errno(); + } + } + + public void set_re_pad(DbDispatcher server, + __db_re_pad_msg args, __db_re_pad_reply reply) + { + try { + db.set_re_pad(args.pad); + reply.status = 0; + } catch(DbException e) { + e.printStackTrace(DbServer.err); + reply.status = e.get_errno(); + } + } + + public void stat(DbDispatcher server, + __db_stat_msg args, __db_stat_reply reply) + { + try { + Object raw_stat = db.stat(args.flags); + + if (raw_stat instanceof DbHashStat) { + DbHashStat hs = (DbHashStat)raw_stat; + int[] raw_stats = { + hs.hash_magic, hs.hash_version, + hs.hash_metaflags, hs.hash_nkeys, + hs.hash_ndata, hs.hash_pagesize, + hs.hash_ffactor, hs.hash_buckets, + hs.hash_free, hs.hash_bfree, + hs.hash_bigpages, hs.hash_big_bfree, + hs.hash_overflows, hs.hash_ovfl_free, + hs.hash_dup, hs.hash_dup_free + }; + reply.stats = raw_stats; + } else if (raw_stat instanceof DbQueueStat) { + DbQueueStat qs = (DbQueueStat)raw_stat; + int[] raw_stats = { + qs.qs_magic, qs.qs_version, + qs.qs_metaflags, qs.qs_nkeys, + qs.qs_ndata, qs.qs_pagesize, + qs.qs_extentsize, qs.qs_pages, + qs.qs_re_len, qs.qs_re_pad, + qs.qs_pgfree, qs.qs_first_recno, + qs.qs_cur_recno + }; + reply.stats = raw_stats; + } else if (raw_stat instanceof DbBtreeStat) { + DbBtreeStat bs = (DbBtreeStat)raw_stat; + int[] raw_stats = { + bs.bt_magic, bs.bt_version, + bs.bt_metaflags, bs.bt_nkeys, + bs.bt_ndata, bs.bt_pagesize, + bs.bt_maxkey, bs.bt_minkey, + bs.bt_re_len, bs.bt_re_pad, + bs.bt_levels, bs.bt_int_pg, + bs.bt_leaf_pg, bs.bt_dup_pg, + bs.bt_over_pg, bs.bt_free, + bs.bt_int_pgfree, bs.bt_leaf_pgfree, + bs.bt_dup_pgfree, bs.bt_over_pgfree + }; + reply.stats = raw_stats; + } else + throw new DbException("Invalid return type from db.stat()", Db.DB_NOTFOUND); + + reply.status = 0; + } catch(DbException e) { + e.printStackTrace(DbServer.err); + reply.status = e.get_errno(); + reply.stats = new int[0]; + } + } + + public void sync(DbDispatcher server, + __db_sync_msg args, __db_sync_reply reply) + { + try { + db.sync(args.flags); + reply.status = 0; + } catch(DbException e) { + e.printStackTrace(DbServer.err); + reply.status = e.get_errno(); + } + } + + public void truncate(DbDispatcher server, + __db_truncate_msg args, __db_truncate_reply reply) + { + try { + RpcDbTxn rtxn = server.getTxn(args.txnpcl_id); + DbTxn txn = (rtxn != null) ? rtxn.txn : null; + reply.count = db.truncate(txn, args.flags); + reply.status = 0; + } catch(DbException e) { + e.printStackTrace(DbServer.err); + reply.status = e.get_errno(); + } + } +} diff --git a/db/rpc_server/java/RpcDbEnv.java b/db/rpc_server/java/RpcDbEnv.java new file mode 100644 index 000000000..3dbaea7c1 --- /dev/null +++ b/db/rpc_server/java/RpcDbEnv.java @@ -0,0 +1,264 @@ +/*- + * See the file LICENSE for redistribution information. + * + * Copyright (c) 2001-2002 + * Sleepycat Software. All rights reserved. + * + * Id: RpcDbEnv.java,v 1.5 2002/08/09 01:56:10 bostic Exp + */ + +package com.sleepycat.db.rpcserver; + +import com.sleepycat.db.*; +import java.io.IOException; +import java.io.*; +import java.util.*; + +/** + * RPC wrapper around a dbenv for the Java RPC server. + */ +public class RpcDbEnv extends Timer +{ + DbEnv dbenv; + String home; + long idletime, timeout; + int openflags, onflags, offflags; + int refcount = 1; + + void dispose() + { + if (dbenv != null) { + try { + dbenv.close(0); + } catch(DbException e) { + e.printStackTrace(DbServer.err); + } + dbenv = null; + } + } + + public void close(DbDispatcher server, + __env_close_msg args, __env_close_reply reply) + { + if (--refcount != 0) { + reply.status = 0; + return; + } + + try { + dbenv.close(args.flags); + dbenv = null; + reply.status = 0; + } catch(DbException e) { + e.printStackTrace(DbServer.err); + reply.status = e.get_errno(); + } finally { + server.delEnv(this); + } + } + + public void create(DbDispatcher server, + __env_create_msg args, __env_create_reply reply) + { + this.idletime = (args.timeout != 0) ? args.timeout : DbServer.idleto; + this.timeout = DbServer.defto; + dbenv = new DbEnv(0); + reply.envcl_id = server.addEnv(this); + reply.status = 0; + } + + public void dbremove(DbDispatcher server, + __env_dbremove_msg args, __env_dbremove_reply reply) + { + try { + args.name = (args.name.length() > 0) ? args.name : null; + args.subdb = (args.subdb.length() > 0) ? args.subdb : null; + + RpcDbTxn rtxn = server.getTxn(args.txnpcl_id); + DbTxn txn = (rtxn != null) ? rtxn.txn : null; + dbenv.dbremove(txn, args.name, args.subdb, args.flags); + reply.status = 0; + } catch(DbException e) { + e.printStackTrace(DbServer.err); + reply.status = e.get_errno(); + } + } + + public void dbrename(DbDispatcher server, + __env_dbrename_msg args, __env_dbrename_reply reply) + { + try { + args.name = (args.name.length() > 0) ? args.name : null; + args.subdb = (args.subdb.length() > 0) ? args.subdb : null; + args.newname = (args.newname.length() > 0) ? args.newname : null; + + RpcDbTxn rtxn = server.getTxn(args.txnpcl_id); + DbTxn txn = (rtxn != null) ? rtxn.txn : null; + dbenv.dbrename(txn, args.name, args.subdb, args.newname, args.flags); + reply.status = 0; + } catch(DbException e) { + e.printStackTrace(DbServer.err); + reply.status = e.get_errno(); + } + } + + private boolean findSharedDbEnv(DbDispatcher server, __env_open_reply reply) + throws DbException + { + RpcDbEnv rdbenv = null; + boolean matchFound = false; + LocalIterator i = ((DbServer)server).env_list.iterator(); + + while (!matchFound && i.hasNext()) { + rdbenv = (RpcDbEnv)i.next(); + if (rdbenv != null && rdbenv != this && + (home == rdbenv.home || + (home != null && home.equals(rdbenv.home))) && + openflags == rdbenv.openflags && + onflags == rdbenv.onflags && + offflags == rdbenv.offflags) + matchFound = true; + } + + if (matchFound) { + /* + * The only thing left to check is the timeout. + * Since the server timeout set by the client is a hint, for sharing + * we'll give them the benefit of the doubt and grant them the + * longer timeout. + */ + if (rdbenv.timeout < timeout) + rdbenv.timeout = timeout; + + ++rdbenv.refcount; + reply.envcl_id = ((FreeList.FreeListIterator)i).current; + reply.status = 0; + + DbServer.err.println("Sharing DbEnv: " + reply.envcl_id); + } + + return matchFound; + } + + public void open(DbDispatcher server, + __env_open_msg args, __env_open_reply reply) + { + try { + home = (args.home.length() > 0) ? args.home : null; + + /* + * If they are using locking do deadlock detection for them, + * internally. + */ + if ((args.flags & Db.DB_INIT_LOCK) != 0) + dbenv.set_lk_detect(Db.DB_LOCK_DEFAULT); + + // adjust flags for RPC + int newflags = (args.flags & ~DbServer.DB_SERVER_FLAGMASK); + openflags = (newflags & DbServer.DB_SERVER_ENVFLAGS); + + if (findSharedDbEnv(server, reply)) { + dbenv.close(0); + dbenv = null; + server.delEnv(this); + } else { + // TODO: check home? + dbenv.open(home, newflags, args.mode); + reply.status = 0; + reply.envcl_id = args.dbenvcl_id; + } + } catch(DbException e) { + e.printStackTrace(DbServer.err); + reply.status = e.get_errno(); + } catch(FileNotFoundException e) { + reply.status = Db.DB_NOTFOUND; + } + + // System.err.println("DbEnv.open: reply.status = " + reply.status + ", reply.envcl_id = " + reply.envcl_id); + } + + public void remove(DbDispatcher server, + __env_remove_msg args, __env_remove_reply reply) + { + try { + args.home = (args.home.length() > 0) ? args.home : null; + // TODO: check home? + + dbenv.remove(args.home, args.flags); + dbenv = null; + reply.status = 0; + } catch(DbException e) { + e.printStackTrace(DbServer.err); + reply.status = e.get_errno(); + } catch(FileNotFoundException e) { + reply.status = Db.DB_NOTFOUND; + } finally { + server.delEnv(this); + } + } + + public void set_cachesize(DbDispatcher server, + __env_cachesize_msg args, __env_cachesize_reply reply) + { + try { + dbenv.set_cachesize(args.gbytes, args.bytes, args.ncache); + reply.status = 0; + } catch(DbException e) { + e.printStackTrace(DbServer.err); + reply.status = e.get_errno(); + } + } + + public void set_encrypt(DbDispatcher server, + __env_encrypt_msg args, __env_encrypt_reply reply) + { + try { + dbenv.set_encrypt(args.passwd, args.flags); + reply.status = 0; + } catch(DbException e) { + e.printStackTrace(DbServer.err); + reply.status = e.get_errno(); + } + } + + public void set_flags(DbDispatcher server, + __env_flags_msg args, __env_flags_reply reply) + { + try { + dbenv.set_flags(args.flags, args.onoff != 0); + if (args.onoff != 0) + onflags |= args.flags; + else + offflags |= args.flags; + reply.status = 0; + } catch(DbException e) { + e.printStackTrace(DbServer.err); + reply.status = e.get_errno(); + } + } + + // txn_recover implementation + public void txn_recover(DbDispatcher server, + __txn_recover_msg args, __txn_recover_reply reply) + { + try { + DbPreplist[] prep_list = dbenv.txn_recover(args.count, args.flags); + if (prep_list != null && prep_list.length > 0) { + int count = prep_list.length; + reply.retcount = count; + reply.txn = new int[count]; + reply.gid = new byte[count * Db.DB_XIDDATASIZE]; + + for(int i = 0; i < count; i++) { + reply.txn[i] = server.addTxn(new RpcDbTxn(this, prep_list[i].txn)); + System.arraycopy(prep_list[i].gid, 0, reply.gid, i * Db.DB_XIDDATASIZE, Db.DB_XIDDATASIZE); + } + } + + reply.status = 0; + } catch(DbException e) { + e.printStackTrace(DbServer.err); + reply.status = e.get_errno(); + } + } +} diff --git a/db/rpc_server/java/RpcDbTxn.java b/db/rpc_server/java/RpcDbTxn.java new file mode 100644 index 000000000..feaa4d7d9 --- /dev/null +++ b/db/rpc_server/java/RpcDbTxn.java @@ -0,0 +1,123 @@ +/*- + * See the file LICENSE for redistribution information. + * + * Copyright (c) 2001-2002 + * Sleepycat Software. All rights reserved. + * + * Id: RpcDbTxn.java,v 1.2 2002/08/09 01:56:10 bostic Exp + */ + +package com.sleepycat.db.rpcserver; + +import com.sleepycat.db.*; +import java.io.IOException; +import java.io.*; +import java.util.*; + +/** + * RPC wrapper around a txn object for the Java RPC server. + */ +public class RpcDbTxn extends Timer +{ + RpcDbEnv rdbenv; + DbTxn txn; + + public RpcDbTxn(RpcDbEnv rdbenv, DbTxn txn) + { + this.rdbenv = rdbenv; + this.txn = txn; + } + + void dispose() + { + if (txn != null) { + try { + txn.abort(); + } catch(DbException e) { + e.printStackTrace(DbServer.err); + } + txn = null; + } + } + + public void abort(DbDispatcher server, + __txn_abort_msg args, __txn_abort_reply reply) + { + try { + txn.abort(); + txn = null; + reply.status = 0; + } catch(DbException e) { + e.printStackTrace(DbServer.err); + reply.status = e.get_errno(); + } finally { + server.delTxn(this); + } + } + + public void begin(DbDispatcher server, + __txn_begin_msg args, __txn_begin_reply reply) + { + try { + if (rdbenv == null) { + reply.status = Db.DB_NOSERVER_ID; + return; + } + DbEnv dbenv = rdbenv.dbenv; + RpcDbTxn rparent = server.getTxn(args.parentcl_id); + DbTxn parent = (rparent != null) ? rparent.txn : null; + + txn = dbenv.txn_begin(parent, args.flags); + + if (rparent != null) + timer = rparent.timer; + reply.txnidcl_id = server.addTxn(this); + reply.status = 0; + } catch(DbException e) { + e.printStackTrace(DbServer.err); + reply.status = e.get_errno(); + } + } + + public void commit(DbDispatcher server, + __txn_commit_msg args, __txn_commit_reply reply) + { + try { + txn.commit(args.flags); + txn = null; + reply.status = 0; + } catch(DbException e) { + e.printStackTrace(DbServer.err); + reply.status = e.get_errno(); + } finally { + server.delTxn(this); + } + } + + public void discard(DbDispatcher server, + __txn_discard_msg args, __txn_discard_reply reply) + { + try { + txn.discard(args.flags); + txn = null; + reply.status = 0; + } catch(DbException e) { + e.printStackTrace(DbServer.err); + reply.status = e.get_errno(); + } finally { + server.delTxn(this); + } + } + + public void prepare(DbDispatcher server, + __txn_prepare_msg args, __txn_prepare_reply reply) + { + try { + txn.prepare(args.gid); + reply.status = 0; + } catch(DbException e) { + e.printStackTrace(DbServer.err); + reply.status = e.get_errno(); + } + } +} diff --git a/db/rpc_server/java/RpcDbc.java b/db/rpc_server/java/RpcDbc.java new file mode 100644 index 000000000..9419e792f --- /dev/null +++ b/db/rpc_server/java/RpcDbc.java @@ -0,0 +1,238 @@ +/*- + * See the file LICENSE for redistribution information. + * + * Copyright (c) 2001-2002 + * Sleepycat Software. All rights reserved. + * + * Id: RpcDbc.java,v 1.3 2002/08/09 01:56:10 bostic Exp + */ + +package com.sleepycat.db.rpcserver; + +import com.sleepycat.db.*; +import java.io.IOException; +import java.io.*; +import java.util.*; + +/** + * RPC wrapper around a dbc object for the Java RPC server. + */ +public class RpcDbc extends Timer +{ + static final byte[] empty = new byte[0]; + RpcDbEnv rdbenv; + RpcDb rdb; + Dbc dbc; + Timer orig_timer; + boolean isJoin; + + public RpcDbc(RpcDb rdb, Dbc dbc, boolean isJoin) + { + this.rdb = rdb; + this.rdbenv = rdb.rdbenv; + this.dbc = dbc; + this.isJoin = isJoin; + } + + void dispose() + { + if (dbc != null) { + try { + dbc.close(); + } catch(DbException e) { + e.printStackTrace(DbServer.err); + } + dbc = null; + } + } + + public void close(DbDispatcher server, + __dbc_close_msg args, __dbc_close_reply reply) + { + try { + dbc.close(); + dbc = null; + + if (isJoin) + for(LocalIterator i = ((DbServer)server).cursor_list.iterator(); i.hasNext(); ) { + RpcDbc rdbc = (RpcDbc)i.next(); + // Unjoin cursors that were joined to create this + if (rdbc != null && rdbc.timer == this) + rdbc.timer = rdbc.orig_timer; + } + + reply.status = 0; + } catch(DbException e) { + e.printStackTrace(DbServer.err); + reply.status = e.get_errno(); + } finally { + server.delCursor(this); + } + } + + public void count(DbDispatcher server, + __dbc_count_msg args, __dbc_count_reply reply) + { + try { + reply.dupcount = dbc.count(args.flags); + reply.status = 0; + } catch(DbException e) { + e.printStackTrace(DbServer.err); + reply.status = e.get_errno(); + } + } + + public void del(DbDispatcher server, + __dbc_del_msg args, __dbc_del_reply reply) + { + try { + reply.status = dbc.del(args.flags); + } catch(DbException e) { + e.printStackTrace(DbServer.err); + reply.status = e.get_errno(); + } + } + + public void dup(DbDispatcher server, + __dbc_dup_msg args, __dbc_dup_reply reply) + { + try { + Dbc newdbc = dbc.dup(args.flags); + RpcDbc rdbc = new RpcDbc(rdb, newdbc, false); + /* If this cursor has a parent txn, we need to use it too. */ + if (timer != this) + rdbc.timer = timer; + reply.dbcidcl_id = server.addCursor(rdbc); + reply.status = 0; + } catch(DbException e) { + e.printStackTrace(DbServer.err); + reply.status = e.get_errno(); + } + } + + public void get(DbDispatcher server, + __dbc_get_msg args, __dbc_get_reply reply) + { + try { + Dbt key = new Dbt(args.keydata); + key.set_dlen(args.keydlen); + key.set_ulen(args.keyulen); + key.set_doff(args.keydoff); + key.set_flags(Db.DB_DBT_MALLOC | + (args.keyflags & Db.DB_DBT_PARTIAL)); + + Dbt data = new Dbt(args.datadata); + data.set_dlen(args.datadlen); + data.set_ulen(args.dataulen); + data.set_doff(args.datadoff); + if ((args.flags & Db.DB_MULTIPLE) != 0 || + (args.flags & Db.DB_MULTIPLE_KEY) != 0) { + if (data.get_data().length == 0) + data.set_data(new byte[data.get_ulen()]); + data.set_flags(Db.DB_DBT_USERMEM | + (args.dataflags & Db.DB_DBT_PARTIAL)); + } else + data.set_flags(Db.DB_DBT_MALLOC | + (args.dataflags & Db.DB_DBT_PARTIAL)); + + reply.status = dbc.get(key, data, args.flags); + + if (key.get_data() == args.keydata) { + reply.keydata = new byte[key.get_size()]; + System.arraycopy(key.get_data(), 0, reply.keydata, 0, key.get_size()); + } else + reply.keydata = key.get_data(); + + if (data.get_data() == args.datadata) { + reply.datadata = new byte[data.get_size()]; + System.arraycopy(data.get_data(), 0, reply.datadata, 0, data.get_size()); + } else + reply.datadata = data.get_data(); + } catch(DbException e) { + e.printStackTrace(DbServer.err); + reply.status = e.get_errno(); + reply.keydata = reply.datadata = empty; + } + } + + public void pget(DbDispatcher server, + __dbc_pget_msg args, __dbc_pget_reply reply) + { + try { + Dbt skey = new Dbt(args.skeydata); + skey.set_dlen(args.skeydlen); + skey.set_doff(args.skeydoff); + skey.set_ulen(args.skeyulen); + skey.set_flags(Db.DB_DBT_MALLOC | + (args.skeyflags & Db.DB_DBT_PARTIAL)); + + Dbt pkey = new Dbt(args.pkeydata); + pkey.set_dlen(args.pkeydlen); + pkey.set_doff(args.pkeydoff); + pkey.set_ulen(args.pkeyulen); + pkey.set_flags(Db.DB_DBT_MALLOC | + (args.pkeyflags & Db.DB_DBT_PARTIAL)); + + Dbt data = new Dbt(args.datadata); + data.set_dlen(args.datadlen); + data.set_doff(args.datadoff); + data.set_ulen(args.dataulen); + data.set_flags(Db.DB_DBT_MALLOC | + (args.dataflags & Db.DB_DBT_PARTIAL)); + + reply.status = dbc.pget(skey, pkey, data, args.flags); + + if (skey.get_data() == args.skeydata) { + reply.skeydata = new byte[skey.get_size()]; + System.arraycopy(skey.get_data(), 0, reply.skeydata, 0, skey.get_size()); + } else + reply.skeydata = skey.get_data(); + + if (pkey.get_data() == args.pkeydata) { + reply.pkeydata = new byte[pkey.get_size()]; + System.arraycopy(pkey.get_data(), 0, reply.pkeydata, 0, pkey.get_size()); + } else + reply.pkeydata = pkey.get_data(); + + if (data.get_data() == args.datadata) { + reply.datadata = new byte[data.get_size()]; + System.arraycopy(data.get_data(), 0, reply.datadata, 0, data.get_size()); + } else + reply.datadata = data.get_data(); + } catch(DbException e) { + e.printStackTrace(DbServer.err); + reply.status = e.get_errno(); + } + } + + public void put(DbDispatcher server, + __dbc_put_msg args, __dbc_put_reply reply) + { + try { + Dbt key = new Dbt(args.keydata); + key.set_dlen(args.keydlen); + key.set_ulen(args.keyulen); + key.set_doff(args.keydoff); + key.set_flags(args.keyflags & Db.DB_DBT_PARTIAL); + + Dbt data = new Dbt(args.datadata); + data.set_dlen(args.datadlen); + data.set_ulen(args.dataulen); + data.set_doff(args.datadoff); + data.set_flags(args.dataflags); + + reply.status = dbc.put(key, data, args.flags); + + if (reply.status == 0 && + (args.flags == Db.DB_AFTER || args.flags == Db.DB_BEFORE) && + rdb.db.get_type() == Db.DB_RECNO) + reply.keydata = key.get_data(); + else + reply.keydata = empty; + } catch(DbException e) { + e.printStackTrace(DbServer.err); + reply.status = e.get_errno(); + reply.keydata = empty; + } + } +} diff --git a/db/rpc_server/java/Timer.java b/db/rpc_server/java/Timer.java new file mode 100644 index 000000000..5aa133d28 --- /dev/null +++ b/db/rpc_server/java/Timer.java @@ -0,0 +1,22 @@ +/*- + * See the file LICENSE for redistribution information. + * + * Copyright (c) 2001-2002 + * Sleepycat Software. All rights reserved. + * + * Id: Timer.java,v 1.1 2002/01/03 02:59:39 mjc Exp + */ + +package com.sleepycat.db.rpcserver; + +/** + * Class to keep track of access times. This is slightly devious by having + * both the access_time and a reference to another Timer that can be + * used to group/share access times. This is done to keep the Java code + * close to the canonical C implementation of the RPC server. + */ +public class Timer +{ + Timer timer = this; + long last_access; +} diff --git a/db/rpc_server/java/gen/DbServerStub.java b/db/rpc_server/java/gen/DbServerStub.java new file mode 100644 index 000000000..90fc13a6d --- /dev/null +++ b/db/rpc_server/java/gen/DbServerStub.java @@ -0,0 +1,495 @@ +/* + * Automatically generated by jrpcgen 0.95.1 on 3/19/02 10:30 AM + * jrpcgen is part of the "Remote Tea" ONC/RPC package for Java + * See http://acplt.org/ks/remotetea.html for details + */ +package com.sleepycat.db.rpcserver; +import org.acplt.oncrpc.*; +import java.io.IOException; + +import org.acplt.oncrpc.server.*; + +/** + */ +public abstract class DbServerStub extends OncRpcServerStub implements OncRpcDispatchable { + + public DbServerStub() + throws OncRpcException, IOException { + this(0); + } + + public DbServerStub(int port) + throws OncRpcException, IOException { + info = new OncRpcServerTransportRegistrationInfo [] { + new OncRpcServerTransportRegistrationInfo(db_server.DB_RPC_SERVERPROG, 4001), + }; + transports = new OncRpcServerTransport [] { + new OncRpcUdpServerTransport(this, port, info, 32768), + new OncRpcTcpServerTransport(this, port, info, 32768) + }; + } + + public void dispatchOncRpcCall(OncRpcCallInformation call, int program, int version, int procedure) + throws OncRpcException, IOException { + if ( version == 4001 ) { + switch ( procedure ) { + case 1: { + __env_cachesize_msg args$ = new __env_cachesize_msg(); + call.retrieveCall(args$); + __env_cachesize_reply result$ = __DB_env_cachesize_4001(args$); + call.reply(result$); + break; + } + case 2: { + __env_close_msg args$ = new __env_close_msg(); + call.retrieveCall(args$); + __env_close_reply result$ = __DB_env_close_4001(args$); + call.reply(result$); + break; + } + case 3: { + __env_create_msg args$ = new __env_create_msg(); + call.retrieveCall(args$); + __env_create_reply result$ = __DB_env_create_4001(args$); + call.reply(result$); + break; + } + case 4: { + __env_dbremove_msg args$ = new __env_dbremove_msg(); + call.retrieveCall(args$); + __env_dbremove_reply result$ = __DB_env_dbremove_4001(args$); + call.reply(result$); + break; + } + case 5: { + __env_dbrename_msg args$ = new __env_dbrename_msg(); + call.retrieveCall(args$); + __env_dbrename_reply result$ = __DB_env_dbrename_4001(args$); + call.reply(result$); + break; + } + case 6: { + __env_encrypt_msg args$ = new __env_encrypt_msg(); + call.retrieveCall(args$); + __env_encrypt_reply result$ = __DB_env_encrypt_4001(args$); + call.reply(result$); + break; + } + case 7: { + __env_flags_msg args$ = new __env_flags_msg(); + call.retrieveCall(args$); + __env_flags_reply result$ = __DB_env_flags_4001(args$); + call.reply(result$); + break; + } + case 8: { + __env_open_msg args$ = new __env_open_msg(); + call.retrieveCall(args$); + __env_open_reply result$ = __DB_env_open_4001(args$); + call.reply(result$); + break; + } + case 9: { + __env_remove_msg args$ = new __env_remove_msg(); + call.retrieveCall(args$); + __env_remove_reply result$ = __DB_env_remove_4001(args$); + call.reply(result$); + break; + } + case 10: { + __txn_abort_msg args$ = new __txn_abort_msg(); + call.retrieveCall(args$); + __txn_abort_reply result$ = __DB_txn_abort_4001(args$); + call.reply(result$); + break; + } + case 11: { + __txn_begin_msg args$ = new __txn_begin_msg(); + call.retrieveCall(args$); + __txn_begin_reply result$ = __DB_txn_begin_4001(args$); + call.reply(result$); + break; + } + case 12: { + __txn_commit_msg args$ = new __txn_commit_msg(); + call.retrieveCall(args$); + __txn_commit_reply result$ = __DB_txn_commit_4001(args$); + call.reply(result$); + break; + } + case 13: { + __txn_discard_msg args$ = new __txn_discard_msg(); + call.retrieveCall(args$); + __txn_discard_reply result$ = __DB_txn_discard_4001(args$); + call.reply(result$); + break; + } + case 14: { + __txn_prepare_msg args$ = new __txn_prepare_msg(); + call.retrieveCall(args$); + __txn_prepare_reply result$ = __DB_txn_prepare_4001(args$); + call.reply(result$); + break; + } + case 15: { + __txn_recover_msg args$ = new __txn_recover_msg(); + call.retrieveCall(args$); + __txn_recover_reply result$ = __DB_txn_recover_4001(args$); + call.reply(result$); + break; + } + case 16: { + __db_associate_msg args$ = new __db_associate_msg(); + call.retrieveCall(args$); + __db_associate_reply result$ = __DB_db_associate_4001(args$); + call.reply(result$); + break; + } + case 17: { + __db_bt_maxkey_msg args$ = new __db_bt_maxkey_msg(); + call.retrieveCall(args$); + __db_bt_maxkey_reply result$ = __DB_db_bt_maxkey_4001(args$); + call.reply(result$); + break; + } + case 18: { + __db_bt_minkey_msg args$ = new __db_bt_minkey_msg(); + call.retrieveCall(args$); + __db_bt_minkey_reply result$ = __DB_db_bt_minkey_4001(args$); + call.reply(result$); + break; + } + case 19: { + __db_close_msg args$ = new __db_close_msg(); + call.retrieveCall(args$); + __db_close_reply result$ = __DB_db_close_4001(args$); + call.reply(result$); + break; + } + case 20: { + __db_create_msg args$ = new __db_create_msg(); + call.retrieveCall(args$); + __db_create_reply result$ = __DB_db_create_4001(args$); + call.reply(result$); + break; + } + case 21: { + __db_del_msg args$ = new __db_del_msg(); + call.retrieveCall(args$); + __db_del_reply result$ = __DB_db_del_4001(args$); + call.reply(result$); + break; + } + case 22: { + __db_encrypt_msg args$ = new __db_encrypt_msg(); + call.retrieveCall(args$); + __db_encrypt_reply result$ = __DB_db_encrypt_4001(args$); + call.reply(result$); + break; + } + case 23: { + __db_extentsize_msg args$ = new __db_extentsize_msg(); + call.retrieveCall(args$); + __db_extentsize_reply result$ = __DB_db_extentsize_4001(args$); + call.reply(result$); + break; + } + case 24: { + __db_flags_msg args$ = new __db_flags_msg(); + call.retrieveCall(args$); + __db_flags_reply result$ = __DB_db_flags_4001(args$); + call.reply(result$); + break; + } + case 25: { + __db_get_msg args$ = new __db_get_msg(); + call.retrieveCall(args$); + __db_get_reply result$ = __DB_db_get_4001(args$); + call.reply(result$); + break; + } + case 26: { + __db_h_ffactor_msg args$ = new __db_h_ffactor_msg(); + call.retrieveCall(args$); + __db_h_ffactor_reply result$ = __DB_db_h_ffactor_4001(args$); + call.reply(result$); + break; + } + case 27: { + __db_h_nelem_msg args$ = new __db_h_nelem_msg(); + call.retrieveCall(args$); + __db_h_nelem_reply result$ = __DB_db_h_nelem_4001(args$); + call.reply(result$); + break; + } + case 28: { + __db_key_range_msg args$ = new __db_key_range_msg(); + call.retrieveCall(args$); + __db_key_range_reply result$ = __DB_db_key_range_4001(args$); + call.reply(result$); + break; + } + case 29: { + __db_lorder_msg args$ = new __db_lorder_msg(); + call.retrieveCall(args$); + __db_lorder_reply result$ = __DB_db_lorder_4001(args$); + call.reply(result$); + break; + } + case 30: { + __db_open_msg args$ = new __db_open_msg(); + call.retrieveCall(args$); + __db_open_reply result$ = __DB_db_open_4001(args$); + call.reply(result$); + break; + } + case 31: { + __db_pagesize_msg args$ = new __db_pagesize_msg(); + call.retrieveCall(args$); + __db_pagesize_reply result$ = __DB_db_pagesize_4001(args$); + call.reply(result$); + break; + } + case 32: { + __db_pget_msg args$ = new __db_pget_msg(); + call.retrieveCall(args$); + __db_pget_reply result$ = __DB_db_pget_4001(args$); + call.reply(result$); + break; + } + case 33: { + __db_put_msg args$ = new __db_put_msg(); + call.retrieveCall(args$); + __db_put_reply result$ = __DB_db_put_4001(args$); + call.reply(result$); + break; + } + case 34: { + __db_re_delim_msg args$ = new __db_re_delim_msg(); + call.retrieveCall(args$); + __db_re_delim_reply result$ = __DB_db_re_delim_4001(args$); + call.reply(result$); + break; + } + case 35: { + __db_re_len_msg args$ = new __db_re_len_msg(); + call.retrieveCall(args$); + __db_re_len_reply result$ = __DB_db_re_len_4001(args$); + call.reply(result$); + break; + } + case 36: { + __db_re_pad_msg args$ = new __db_re_pad_msg(); + call.retrieveCall(args$); + __db_re_pad_reply result$ = __DB_db_re_pad_4001(args$); + call.reply(result$); + break; + } + case 37: { + __db_remove_msg args$ = new __db_remove_msg(); + call.retrieveCall(args$); + __db_remove_reply result$ = __DB_db_remove_4001(args$); + call.reply(result$); + break; + } + case 38: { + __db_rename_msg args$ = new __db_rename_msg(); + call.retrieveCall(args$); + __db_rename_reply result$ = __DB_db_rename_4001(args$); + call.reply(result$); + break; + } + case 39: { + __db_stat_msg args$ = new __db_stat_msg(); + call.retrieveCall(args$); + __db_stat_reply result$ = __DB_db_stat_4001(args$); + call.reply(result$); + break; + } + case 40: { + __db_sync_msg args$ = new __db_sync_msg(); + call.retrieveCall(args$); + __db_sync_reply result$ = __DB_db_sync_4001(args$); + call.reply(result$); + break; + } + case 41: { + __db_truncate_msg args$ = new __db_truncate_msg(); + call.retrieveCall(args$); + __db_truncate_reply result$ = __DB_db_truncate_4001(args$); + call.reply(result$); + break; + } + case 42: { + __db_cursor_msg args$ = new __db_cursor_msg(); + call.retrieveCall(args$); + __db_cursor_reply result$ = __DB_db_cursor_4001(args$); + call.reply(result$); + break; + } + case 43: { + __db_join_msg args$ = new __db_join_msg(); + call.retrieveCall(args$); + __db_join_reply result$ = __DB_db_join_4001(args$); + call.reply(result$); + break; + } + case 44: { + __dbc_close_msg args$ = new __dbc_close_msg(); + call.retrieveCall(args$); + __dbc_close_reply result$ = __DB_dbc_close_4001(args$); + call.reply(result$); + break; + } + case 45: { + __dbc_count_msg args$ = new __dbc_count_msg(); + call.retrieveCall(args$); + __dbc_count_reply result$ = __DB_dbc_count_4001(args$); + call.reply(result$); + break; + } + case 46: { + __dbc_del_msg args$ = new __dbc_del_msg(); + call.retrieveCall(args$); + __dbc_del_reply result$ = __DB_dbc_del_4001(args$); + call.reply(result$); + break; + } + case 47: { + __dbc_dup_msg args$ = new __dbc_dup_msg(); + call.retrieveCall(args$); + __dbc_dup_reply result$ = __DB_dbc_dup_4001(args$); + call.reply(result$); + break; + } + case 48: { + __dbc_get_msg args$ = new __dbc_get_msg(); + call.retrieveCall(args$); + __dbc_get_reply result$ = __DB_dbc_get_4001(args$); + call.reply(result$); + break; + } + case 49: { + __dbc_pget_msg args$ = new __dbc_pget_msg(); + call.retrieveCall(args$); + __dbc_pget_reply result$ = __DB_dbc_pget_4001(args$); + call.reply(result$); + break; + } + case 50: { + __dbc_put_msg args$ = new __dbc_put_msg(); + call.retrieveCall(args$); + __dbc_put_reply result$ = __DB_dbc_put_4001(args$); + call.reply(result$); + break; + } + default: + call.failProcedureUnavailable(); + } + } else { + call.failProcedureUnavailable(); + } + } + + public abstract __env_cachesize_reply __DB_env_cachesize_4001(__env_cachesize_msg arg1); + + public abstract __env_close_reply __DB_env_close_4001(__env_close_msg arg1); + + public abstract __env_create_reply __DB_env_create_4001(__env_create_msg arg1); + + public abstract __env_dbremove_reply __DB_env_dbremove_4001(__env_dbremove_msg arg1); + + public abstract __env_dbrename_reply __DB_env_dbrename_4001(__env_dbrename_msg arg1); + + public abstract __env_encrypt_reply __DB_env_encrypt_4001(__env_encrypt_msg arg1); + + public abstract __env_flags_reply __DB_env_flags_4001(__env_flags_msg arg1); + + public abstract __env_open_reply __DB_env_open_4001(__env_open_msg arg1); + + public abstract __env_remove_reply __DB_env_remove_4001(__env_remove_msg arg1); + + public abstract __txn_abort_reply __DB_txn_abort_4001(__txn_abort_msg arg1); + + public abstract __txn_begin_reply __DB_txn_begin_4001(__txn_begin_msg arg1); + + public abstract __txn_commit_reply __DB_txn_commit_4001(__txn_commit_msg arg1); + + public abstract __txn_discard_reply __DB_txn_discard_4001(__txn_discard_msg arg1); + + public abstract __txn_prepare_reply __DB_txn_prepare_4001(__txn_prepare_msg arg1); + + public abstract __txn_recover_reply __DB_txn_recover_4001(__txn_recover_msg arg1); + + public abstract __db_associate_reply __DB_db_associate_4001(__db_associate_msg arg1); + + public abstract __db_bt_maxkey_reply __DB_db_bt_maxkey_4001(__db_bt_maxkey_msg arg1); + + public abstract __db_bt_minkey_reply __DB_db_bt_minkey_4001(__db_bt_minkey_msg arg1); + + public abstract __db_close_reply __DB_db_close_4001(__db_close_msg arg1); + + public abstract __db_create_reply __DB_db_create_4001(__db_create_msg arg1); + + public abstract __db_del_reply __DB_db_del_4001(__db_del_msg arg1); + + public abstract __db_encrypt_reply __DB_db_encrypt_4001(__db_encrypt_msg arg1); + + public abstract __db_extentsize_reply __DB_db_extentsize_4001(__db_extentsize_msg arg1); + + public abstract __db_flags_reply __DB_db_flags_4001(__db_flags_msg arg1); + + public abstract __db_get_reply __DB_db_get_4001(__db_get_msg arg1); + + public abstract __db_h_ffactor_reply __DB_db_h_ffactor_4001(__db_h_ffactor_msg arg1); + + public abstract __db_h_nelem_reply __DB_db_h_nelem_4001(__db_h_nelem_msg arg1); + + public abstract __db_key_range_reply __DB_db_key_range_4001(__db_key_range_msg arg1); + + public abstract __db_lorder_reply __DB_db_lorder_4001(__db_lorder_msg arg1); + + public abstract __db_open_reply __DB_db_open_4001(__db_open_msg arg1); + + public abstract __db_pagesize_reply __DB_db_pagesize_4001(__db_pagesize_msg arg1); + + public abstract __db_pget_reply __DB_db_pget_4001(__db_pget_msg arg1); + + public abstract __db_put_reply __DB_db_put_4001(__db_put_msg arg1); + + public abstract __db_re_delim_reply __DB_db_re_delim_4001(__db_re_delim_msg arg1); + + public abstract __db_re_len_reply __DB_db_re_len_4001(__db_re_len_msg arg1); + + public abstract __db_re_pad_reply __DB_db_re_pad_4001(__db_re_pad_msg arg1); + + public abstract __db_remove_reply __DB_db_remove_4001(__db_remove_msg arg1); + + public abstract __db_rename_reply __DB_db_rename_4001(__db_rename_msg arg1); + + public abstract __db_stat_reply __DB_db_stat_4001(__db_stat_msg arg1); + + public abstract __db_sync_reply __DB_db_sync_4001(__db_sync_msg arg1); + + public abstract __db_truncate_reply __DB_db_truncate_4001(__db_truncate_msg arg1); + + public abstract __db_cursor_reply __DB_db_cursor_4001(__db_cursor_msg arg1); + + public abstract __db_join_reply __DB_db_join_4001(__db_join_msg arg1); + + public abstract __dbc_close_reply __DB_dbc_close_4001(__dbc_close_msg arg1); + + public abstract __dbc_count_reply __DB_dbc_count_4001(__dbc_count_msg arg1); + + public abstract __dbc_del_reply __DB_dbc_del_4001(__dbc_del_msg arg1); + + public abstract __dbc_dup_reply __DB_dbc_dup_4001(__dbc_dup_msg arg1); + + public abstract __dbc_get_reply __DB_dbc_get_4001(__dbc_get_msg arg1); + + public abstract __dbc_pget_reply __DB_dbc_pget_4001(__dbc_pget_msg arg1); + + public abstract __dbc_put_reply __DB_dbc_put_4001(__dbc_put_msg arg1); + +} +// End of DbServerStub.java diff --git a/db/rpc_server/java/gen/__db_associate_msg.java b/db/rpc_server/java/gen/__db_associate_msg.java new file mode 100644 index 000000000..8977303b9 --- /dev/null +++ b/db/rpc_server/java/gen/__db_associate_msg.java @@ -0,0 +1,41 @@ +/* + * Automatically generated by jrpcgen 0.95.1 on 4/25/02 11:01 AM + * jrpcgen is part of the "Remote Tea" ONC/RPC package for Java + * See http://acplt.org/ks/remotetea.html for details + */ +package com.sleepycat.db.rpcserver; +import org.acplt.oncrpc.*; +import java.io.IOException; + +public class __db_associate_msg implements XdrAble { + public int dbpcl_id; + public int txnpcl_id; + public int sdbpcl_id; + public int flags; + + public __db_associate_msg() { + } + + public __db_associate_msg(XdrDecodingStream xdr) + throws OncRpcException, IOException { + xdrDecode(xdr); + } + + public void xdrEncode(XdrEncodingStream xdr) + throws OncRpcException, IOException { + xdr.xdrEncodeInt(dbpcl_id); + xdr.xdrEncodeInt(txnpcl_id); + xdr.xdrEncodeInt(sdbpcl_id); + xdr.xdrEncodeInt(flags); + } + + public void xdrDecode(XdrDecodingStream xdr) + throws OncRpcException, IOException { + dbpcl_id = xdr.xdrDecodeInt(); + txnpcl_id = xdr.xdrDecodeInt(); + sdbpcl_id = xdr.xdrDecodeInt(); + flags = xdr.xdrDecodeInt(); + } + +} +// End of __db_associate_msg.java diff --git a/db/rpc_server/java/gen/__db_associate_reply.java b/db/rpc_server/java/gen/__db_associate_reply.java new file mode 100644 index 000000000..476d0868b --- /dev/null +++ b/db/rpc_server/java/gen/__db_associate_reply.java @@ -0,0 +1,32 @@ +/* + * Automatically generated by jrpcgen 0.95.1 on 12/18/01 7:23 PM + * jrpcgen is part of the "Remote Tea" ONC/RPC package for Java + * See http://acplt.org/ks/remotetea.html for details + */ +package com.sleepycat.db.rpcserver; +import org.acplt.oncrpc.*; +import java.io.IOException; + +public class __db_associate_reply implements XdrAble { + public int status; + + public __db_associate_reply() { + } + + public __db_associate_reply(XdrDecodingStream xdr) + throws OncRpcException, IOException { + xdrDecode(xdr); + } + + public void xdrEncode(XdrEncodingStream xdr) + throws OncRpcException, IOException { + xdr.xdrEncodeInt(status); + } + + public void xdrDecode(XdrDecodingStream xdr) + throws OncRpcException, IOException { + status = xdr.xdrDecodeInt(); + } + +} +// End of __db_associate_reply.java diff --git a/db/rpc_server/java/gen/__db_bt_maxkey_msg.java b/db/rpc_server/java/gen/__db_bt_maxkey_msg.java new file mode 100644 index 000000000..007ce16a9 --- /dev/null +++ b/db/rpc_server/java/gen/__db_bt_maxkey_msg.java @@ -0,0 +1,35 @@ +/* + * Automatically generated by jrpcgen 0.95.1 on 12/18/01 7:23 PM + * jrpcgen is part of the "Remote Tea" ONC/RPC package for Java + * See http://acplt.org/ks/remotetea.html for details + */ +package com.sleepycat.db.rpcserver; +import org.acplt.oncrpc.*; +import java.io.IOException; + +public class __db_bt_maxkey_msg implements XdrAble { + public int dbpcl_id; + public int maxkey; + + public __db_bt_maxkey_msg() { + } + + public __db_bt_maxkey_msg(XdrDecodingStream xdr) + throws OncRpcException, IOException { + xdrDecode(xdr); + } + + public void xdrEncode(XdrEncodingStream xdr) + throws OncRpcException, IOException { + xdr.xdrEncodeInt(dbpcl_id); + xdr.xdrEncodeInt(maxkey); + } + + public void xdrDecode(XdrDecodingStream xdr) + throws OncRpcException, IOException { + dbpcl_id = xdr.xdrDecodeInt(); + maxkey = xdr.xdrDecodeInt(); + } + +} +// End of __db_bt_maxkey_msg.java diff --git a/db/rpc_server/java/gen/__db_bt_maxkey_reply.java b/db/rpc_server/java/gen/__db_bt_maxkey_reply.java new file mode 100644 index 000000000..855573271 --- /dev/null +++ b/db/rpc_server/java/gen/__db_bt_maxkey_reply.java @@ -0,0 +1,32 @@ +/* + * Automatically generated by jrpcgen 0.95.1 on 12/18/01 7:23 PM + * jrpcgen is part of the "Remote Tea" ONC/RPC package for Java + * See http://acplt.org/ks/remotetea.html for details + */ +package com.sleepycat.db.rpcserver; +import org.acplt.oncrpc.*; +import java.io.IOException; + +public class __db_bt_maxkey_reply implements XdrAble { + public int status; + + public __db_bt_maxkey_reply() { + } + + public __db_bt_maxkey_reply(XdrDecodingStream xdr) + throws OncRpcException, IOException { + xdrDecode(xdr); + } + + public void xdrEncode(XdrEncodingStream xdr) + throws OncRpcException, IOException { + xdr.xdrEncodeInt(status); + } + + public void xdrDecode(XdrDecodingStream xdr) + throws OncRpcException, IOException { + status = xdr.xdrDecodeInt(); + } + +} +// End of __db_bt_maxkey_reply.java diff --git a/db/rpc_server/java/gen/__db_bt_minkey_msg.java b/db/rpc_server/java/gen/__db_bt_minkey_msg.java new file mode 100644 index 000000000..c86ec3824 --- /dev/null +++ b/db/rpc_server/java/gen/__db_bt_minkey_msg.java @@ -0,0 +1,35 @@ +/* + * Automatically generated by jrpcgen 0.95.1 on 12/18/01 7:23 PM + * jrpcgen is part of the "Remote Tea" ONC/RPC package for Java + * See http://acplt.org/ks/remotetea.html for details + */ +package com.sleepycat.db.rpcserver; +import org.acplt.oncrpc.*; +import java.io.IOException; + +public class __db_bt_minkey_msg implements XdrAble { + public int dbpcl_id; + public int minkey; + + public __db_bt_minkey_msg() { + } + + public __db_bt_minkey_msg(XdrDecodingStream xdr) + throws OncRpcException, IOException { + xdrDecode(xdr); + } + + public void xdrEncode(XdrEncodingStream xdr) + throws OncRpcException, IOException { + xdr.xdrEncodeInt(dbpcl_id); + xdr.xdrEncodeInt(minkey); + } + + public void xdrDecode(XdrDecodingStream xdr) + throws OncRpcException, IOException { + dbpcl_id = xdr.xdrDecodeInt(); + minkey = xdr.xdrDecodeInt(); + } + +} +// End of __db_bt_minkey_msg.java diff --git a/db/rpc_server/java/gen/__db_bt_minkey_reply.java b/db/rpc_server/java/gen/__db_bt_minkey_reply.java new file mode 100644 index 000000000..4d944b6bf --- /dev/null +++ b/db/rpc_server/java/gen/__db_bt_minkey_reply.java @@ -0,0 +1,32 @@ +/* + * Automatically generated by jrpcgen 0.95.1 on 12/18/01 7:23 PM + * jrpcgen is part of the "Remote Tea" ONC/RPC package for Java + * See http://acplt.org/ks/remotetea.html for details + */ +package com.sleepycat.db.rpcserver; +import org.acplt.oncrpc.*; +import java.io.IOException; + +public class __db_bt_minkey_reply implements XdrAble { + public int status; + + public __db_bt_minkey_reply() { + } + + public __db_bt_minkey_reply(XdrDecodingStream xdr) + throws OncRpcException, IOException { + xdrDecode(xdr); + } + + public void xdrEncode(XdrEncodingStream xdr) + throws OncRpcException, IOException { + xdr.xdrEncodeInt(status); + } + + public void xdrDecode(XdrDecodingStream xdr) + throws OncRpcException, IOException { + status = xdr.xdrDecodeInt(); + } + +} +// End of __db_bt_minkey_reply.java diff --git a/db/rpc_server/java/gen/__db_close_msg.java b/db/rpc_server/java/gen/__db_close_msg.java new file mode 100644 index 000000000..ce8d21370 --- /dev/null +++ b/db/rpc_server/java/gen/__db_close_msg.java @@ -0,0 +1,35 @@ +/* + * Automatically generated by jrpcgen 0.95.1 on 12/18/01 7:23 PM + * jrpcgen is part of the "Remote Tea" ONC/RPC package for Java + * See http://acplt.org/ks/remotetea.html for details + */ +package com.sleepycat.db.rpcserver; +import org.acplt.oncrpc.*; +import java.io.IOException; + +public class __db_close_msg implements XdrAble { + public int dbpcl_id; + public int flags; + + public __db_close_msg() { + } + + public __db_close_msg(XdrDecodingStream xdr) + throws OncRpcException, IOException { + xdrDecode(xdr); + } + + public void xdrEncode(XdrEncodingStream xdr) + throws OncRpcException, IOException { + xdr.xdrEncodeInt(dbpcl_id); + xdr.xdrEncodeInt(flags); + } + + public void xdrDecode(XdrDecodingStream xdr) + throws OncRpcException, IOException { + dbpcl_id = xdr.xdrDecodeInt(); + flags = xdr.xdrDecodeInt(); + } + +} +// End of __db_close_msg.java diff --git a/db/rpc_server/java/gen/__db_close_reply.java b/db/rpc_server/java/gen/__db_close_reply.java new file mode 100644 index 000000000..a9380e9c0 --- /dev/null +++ b/db/rpc_server/java/gen/__db_close_reply.java @@ -0,0 +1,32 @@ +/* + * Automatically generated by jrpcgen 0.95.1 on 12/18/01 7:23 PM + * jrpcgen is part of the "Remote Tea" ONC/RPC package for Java + * See http://acplt.org/ks/remotetea.html for details + */ +package com.sleepycat.db.rpcserver; +import org.acplt.oncrpc.*; +import java.io.IOException; + +public class __db_close_reply implements XdrAble { + public int status; + + public __db_close_reply() { + } + + public __db_close_reply(XdrDecodingStream xdr) + throws OncRpcException, IOException { + xdrDecode(xdr); + } + + public void xdrEncode(XdrEncodingStream xdr) + throws OncRpcException, IOException { + xdr.xdrEncodeInt(status); + } + + public void xdrDecode(XdrDecodingStream xdr) + throws OncRpcException, IOException { + status = xdr.xdrDecodeInt(); + } + +} +// End of __db_close_reply.java diff --git a/db/rpc_server/java/gen/__db_create_msg.java b/db/rpc_server/java/gen/__db_create_msg.java new file mode 100644 index 000000000..d21ca50f8 --- /dev/null +++ b/db/rpc_server/java/gen/__db_create_msg.java @@ -0,0 +1,35 @@ +/* + * Automatically generated by jrpcgen 0.95.1 on 12/18/01 7:23 PM + * jrpcgen is part of the "Remote Tea" ONC/RPC package for Java + * See http://acplt.org/ks/remotetea.html for details + */ +package com.sleepycat.db.rpcserver; +import org.acplt.oncrpc.*; +import java.io.IOException; + +public class __db_create_msg implements XdrAble { + public int dbenvcl_id; + public int flags; + + public __db_create_msg() { + } + + public __db_create_msg(XdrDecodingStream xdr) + throws OncRpcException, IOException { + xdrDecode(xdr); + } + + public void xdrEncode(XdrEncodingStream xdr) + throws OncRpcException, IOException { + xdr.xdrEncodeInt(dbenvcl_id); + xdr.xdrEncodeInt(flags); + } + + public void xdrDecode(XdrDecodingStream xdr) + throws OncRpcException, IOException { + dbenvcl_id = xdr.xdrDecodeInt(); + flags = xdr.xdrDecodeInt(); + } + +} +// End of __db_create_msg.java diff --git a/db/rpc_server/java/gen/__db_create_reply.java b/db/rpc_server/java/gen/__db_create_reply.java new file mode 100644 index 000000000..e3dcbbab1 --- /dev/null +++ b/db/rpc_server/java/gen/__db_create_reply.java @@ -0,0 +1,35 @@ +/* + * Automatically generated by jrpcgen 0.95.1 on 12/18/01 7:23 PM + * jrpcgen is part of the "Remote Tea" ONC/RPC package for Java + * See http://acplt.org/ks/remotetea.html for details + */ +package com.sleepycat.db.rpcserver; +import org.acplt.oncrpc.*; +import java.io.IOException; + +public class __db_create_reply implements XdrAble { + public int status; + public int dbcl_id; + + public __db_create_reply() { + } + + public __db_create_reply(XdrDecodingStream xdr) + throws OncRpcException, IOException { + xdrDecode(xdr); + } + + public void xdrEncode(XdrEncodingStream xdr) + throws OncRpcException, IOException { + xdr.xdrEncodeInt(status); + xdr.xdrEncodeInt(dbcl_id); + } + + public void xdrDecode(XdrDecodingStream xdr) + throws OncRpcException, IOException { + status = xdr.xdrDecodeInt(); + dbcl_id = xdr.xdrDecodeInt(); + } + +} +// End of __db_create_reply.java diff --git a/db/rpc_server/java/gen/__db_cursor_msg.java b/db/rpc_server/java/gen/__db_cursor_msg.java new file mode 100644 index 000000000..60e09db6e --- /dev/null +++ b/db/rpc_server/java/gen/__db_cursor_msg.java @@ -0,0 +1,38 @@ +/* + * Automatically generated by jrpcgen 0.95.1 on 12/18/01 7:23 PM + * jrpcgen is part of the "Remote Tea" ONC/RPC package for Java + * See http://acplt.org/ks/remotetea.html for details + */ +package com.sleepycat.db.rpcserver; +import org.acplt.oncrpc.*; +import java.io.IOException; + +public class __db_cursor_msg implements XdrAble { + public int dbpcl_id; + public int txnpcl_id; + public int flags; + + public __db_cursor_msg() { + } + + public __db_cursor_msg(XdrDecodingStream xdr) + throws OncRpcException, IOException { + xdrDecode(xdr); + } + + public void xdrEncode(XdrEncodingStream xdr) + throws OncRpcException, IOException { + xdr.xdrEncodeInt(dbpcl_id); + xdr.xdrEncodeInt(txnpcl_id); + xdr.xdrEncodeInt(flags); + } + + public void xdrDecode(XdrDecodingStream xdr) + throws OncRpcException, IOException { + dbpcl_id = xdr.xdrDecodeInt(); + txnpcl_id = xdr.xdrDecodeInt(); + flags = xdr.xdrDecodeInt(); + } + +} +// End of __db_cursor_msg.java diff --git a/db/rpc_server/java/gen/__db_cursor_reply.java b/db/rpc_server/java/gen/__db_cursor_reply.java new file mode 100644 index 000000000..bafd2817c --- /dev/null +++ b/db/rpc_server/java/gen/__db_cursor_reply.java @@ -0,0 +1,35 @@ +/* + * Automatically generated by jrpcgen 0.95.1 on 12/18/01 7:23 PM + * jrpcgen is part of the "Remote Tea" ONC/RPC package for Java + * See http://acplt.org/ks/remotetea.html for details + */ +package com.sleepycat.db.rpcserver; +import org.acplt.oncrpc.*; +import java.io.IOException; + +public class __db_cursor_reply implements XdrAble { + public int status; + public int dbcidcl_id; + + public __db_cursor_reply() { + } + + public __db_cursor_reply(XdrDecodingStream xdr) + throws OncRpcException, IOException { + xdrDecode(xdr); + } + + public void xdrEncode(XdrEncodingStream xdr) + throws OncRpcException, IOException { + xdr.xdrEncodeInt(status); + xdr.xdrEncodeInt(dbcidcl_id); + } + + public void xdrDecode(XdrDecodingStream xdr) + throws OncRpcException, IOException { + status = xdr.xdrDecodeInt(); + dbcidcl_id = xdr.xdrDecodeInt(); + } + +} +// End of __db_cursor_reply.java diff --git a/db/rpc_server/java/gen/__db_del_msg.java b/db/rpc_server/java/gen/__db_del_msg.java new file mode 100644 index 000000000..fdf47907d --- /dev/null +++ b/db/rpc_server/java/gen/__db_del_msg.java @@ -0,0 +1,53 @@ +/* + * Automatically generated by jrpcgen 0.95.1 on 12/18/01 7:23 PM + * jrpcgen is part of the "Remote Tea" ONC/RPC package for Java + * See http://acplt.org/ks/remotetea.html for details + */ +package com.sleepycat.db.rpcserver; +import org.acplt.oncrpc.*; +import java.io.IOException; + +public class __db_del_msg implements XdrAble { + public int dbpcl_id; + public int txnpcl_id; + public int keydlen; + public int keydoff; + public int keyulen; + public int keyflags; + public byte [] keydata; + public int flags; + + public __db_del_msg() { + } + + public __db_del_msg(XdrDecodingStream xdr) + throws OncRpcException, IOException { + xdrDecode(xdr); + } + + public void xdrEncode(XdrEncodingStream xdr) + throws OncRpcException, IOException { + xdr.xdrEncodeInt(dbpcl_id); + xdr.xdrEncodeInt(txnpcl_id); + xdr.xdrEncodeInt(keydlen); + xdr.xdrEncodeInt(keydoff); + xdr.xdrEncodeInt(keyulen); + xdr.xdrEncodeInt(keyflags); + xdr.xdrEncodeDynamicOpaque(keydata); + xdr.xdrEncodeInt(flags); + } + + public void xdrDecode(XdrDecodingStream xdr) + throws OncRpcException, IOException { + dbpcl_id = xdr.xdrDecodeInt(); + txnpcl_id = xdr.xdrDecodeInt(); + keydlen = xdr.xdrDecodeInt(); + keydoff = xdr.xdrDecodeInt(); + keyulen = xdr.xdrDecodeInt(); + keyflags = xdr.xdrDecodeInt(); + keydata = xdr.xdrDecodeDynamicOpaque(); + flags = xdr.xdrDecodeInt(); + } + +} +// End of __db_del_msg.java diff --git a/db/rpc_server/java/gen/__db_del_reply.java b/db/rpc_server/java/gen/__db_del_reply.java new file mode 100644 index 000000000..8a5544594 --- /dev/null +++ b/db/rpc_server/java/gen/__db_del_reply.java @@ -0,0 +1,32 @@ +/* + * Automatically generated by jrpcgen 0.95.1 on 12/18/01 7:23 PM + * jrpcgen is part of the "Remote Tea" ONC/RPC package for Java + * See http://acplt.org/ks/remotetea.html for details + */ +package com.sleepycat.db.rpcserver; +import org.acplt.oncrpc.*; +import java.io.IOException; + +public class __db_del_reply implements XdrAble { + public int status; + + public __db_del_reply() { + } + + public __db_del_reply(XdrDecodingStream xdr) + throws OncRpcException, IOException { + xdrDecode(xdr); + } + + public void xdrEncode(XdrEncodingStream xdr) + throws OncRpcException, IOException { + xdr.xdrEncodeInt(status); + } + + public void xdrDecode(XdrDecodingStream xdr) + throws OncRpcException, IOException { + status = xdr.xdrDecodeInt(); + } + +} +// End of __db_del_reply.java diff --git a/db/rpc_server/java/gen/__db_encrypt_msg.java b/db/rpc_server/java/gen/__db_encrypt_msg.java new file mode 100644 index 000000000..46d9f8ee7 --- /dev/null +++ b/db/rpc_server/java/gen/__db_encrypt_msg.java @@ -0,0 +1,38 @@ +/* + * Automatically generated by jrpcgen 0.95.1 on 2/13/02 1:05 PM + * jrpcgen is part of the "Remote Tea" ONC/RPC package for Java + * See http://acplt.org/ks/remotetea.html for details + */ +package com.sleepycat.db.rpcserver; +import org.acplt.oncrpc.*; +import java.io.IOException; + +public class __db_encrypt_msg implements XdrAble { + public int dbpcl_id; + public String passwd; + public int flags; + + public __db_encrypt_msg() { + } + + public __db_encrypt_msg(XdrDecodingStream xdr) + throws OncRpcException, IOException { + xdrDecode(xdr); + } + + public void xdrEncode(XdrEncodingStream xdr) + throws OncRpcException, IOException { + xdr.xdrEncodeInt(dbpcl_id); + xdr.xdrEncodeString(passwd); + xdr.xdrEncodeInt(flags); + } + + public void xdrDecode(XdrDecodingStream xdr) + throws OncRpcException, IOException { + dbpcl_id = xdr.xdrDecodeInt(); + passwd = xdr.xdrDecodeString(); + flags = xdr.xdrDecodeInt(); + } + +} +// End of __db_encrypt_msg.java diff --git a/db/rpc_server/java/gen/__db_encrypt_reply.java b/db/rpc_server/java/gen/__db_encrypt_reply.java new file mode 100644 index 000000000..a97cc98c9 --- /dev/null +++ b/db/rpc_server/java/gen/__db_encrypt_reply.java @@ -0,0 +1,32 @@ +/* + * Automatically generated by jrpcgen 0.95.1 on 2/13/02 1:05 PM + * jrpcgen is part of the "Remote Tea" ONC/RPC package for Java + * See http://acplt.org/ks/remotetea.html for details + */ +package com.sleepycat.db.rpcserver; +import org.acplt.oncrpc.*; +import java.io.IOException; + +public class __db_encrypt_reply implements XdrAble { + public int status; + + public __db_encrypt_reply() { + } + + public __db_encrypt_reply(XdrDecodingStream xdr) + throws OncRpcException, IOException { + xdrDecode(xdr); + } + + public void xdrEncode(XdrEncodingStream xdr) + throws OncRpcException, IOException { + xdr.xdrEncodeInt(status); + } + + public void xdrDecode(XdrDecodingStream xdr) + throws OncRpcException, IOException { + status = xdr.xdrDecodeInt(); + } + +} +// End of __db_encrypt_reply.java diff --git a/db/rpc_server/java/gen/__db_extentsize_msg.java b/db/rpc_server/java/gen/__db_extentsize_msg.java new file mode 100644 index 000000000..41a51cff9 --- /dev/null +++ b/db/rpc_server/java/gen/__db_extentsize_msg.java @@ -0,0 +1,35 @@ +/* + * Automatically generated by jrpcgen 0.95.1 on 12/18/01 7:23 PM + * jrpcgen is part of the "Remote Tea" ONC/RPC package for Java + * See http://acplt.org/ks/remotetea.html for details + */ +package com.sleepycat.db.rpcserver; +import org.acplt.oncrpc.*; +import java.io.IOException; + +public class __db_extentsize_msg implements XdrAble { + public int dbpcl_id; + public int extentsize; + + public __db_extentsize_msg() { + } + + public __db_extentsize_msg(XdrDecodingStream xdr) + throws OncRpcException, IOException { + xdrDecode(xdr); + } + + public void xdrEncode(XdrEncodingStream xdr) + throws OncRpcException, IOException { + xdr.xdrEncodeInt(dbpcl_id); + xdr.xdrEncodeInt(extentsize); + } + + public void xdrDecode(XdrDecodingStream xdr) + throws OncRpcException, IOException { + dbpcl_id = xdr.xdrDecodeInt(); + extentsize = xdr.xdrDecodeInt(); + } + +} +// End of __db_extentsize_msg.java diff --git a/db/rpc_server/java/gen/__db_extentsize_reply.java b/db/rpc_server/java/gen/__db_extentsize_reply.java new file mode 100644 index 000000000..409625486 --- /dev/null +++ b/db/rpc_server/java/gen/__db_extentsize_reply.java @@ -0,0 +1,32 @@ +/* + * Automatically generated by jrpcgen 0.95.1 on 12/18/01 7:23 PM + * jrpcgen is part of the "Remote Tea" ONC/RPC package for Java + * See http://acplt.org/ks/remotetea.html for details + */ +package com.sleepycat.db.rpcserver; +import org.acplt.oncrpc.*; +import java.io.IOException; + +public class __db_extentsize_reply implements XdrAble { + public int status; + + public __db_extentsize_reply() { + } + + public __db_extentsize_reply(XdrDecodingStream xdr) + throws OncRpcException, IOException { + xdrDecode(xdr); + } + + public void xdrEncode(XdrEncodingStream xdr) + throws OncRpcException, IOException { + xdr.xdrEncodeInt(status); + } + + public void xdrDecode(XdrDecodingStream xdr) + throws OncRpcException, IOException { + status = xdr.xdrDecodeInt(); + } + +} +// End of __db_extentsize_reply.java diff --git a/db/rpc_server/java/gen/__db_flags_msg.java b/db/rpc_server/java/gen/__db_flags_msg.java new file mode 100644 index 000000000..d8752e2e4 --- /dev/null +++ b/db/rpc_server/java/gen/__db_flags_msg.java @@ -0,0 +1,35 @@ +/* + * Automatically generated by jrpcgen 0.95.1 on 12/18/01 7:23 PM + * jrpcgen is part of the "Remote Tea" ONC/RPC package for Java + * See http://acplt.org/ks/remotetea.html for details + */ +package com.sleepycat.db.rpcserver; +import org.acplt.oncrpc.*; +import java.io.IOException; + +public class __db_flags_msg implements XdrAble { + public int dbpcl_id; + public int flags; + + public __db_flags_msg() { + } + + public __db_flags_msg(XdrDecodingStream xdr) + throws OncRpcException, IOException { + xdrDecode(xdr); + } + + public void xdrEncode(XdrEncodingStream xdr) + throws OncRpcException, IOException { + xdr.xdrEncodeInt(dbpcl_id); + xdr.xdrEncodeInt(flags); + } + + public void xdrDecode(XdrDecodingStream xdr) + throws OncRpcException, IOException { + dbpcl_id = xdr.xdrDecodeInt(); + flags = xdr.xdrDecodeInt(); + } + +} +// End of __db_flags_msg.java diff --git a/db/rpc_server/java/gen/__db_flags_reply.java b/db/rpc_server/java/gen/__db_flags_reply.java new file mode 100644 index 000000000..c4ec253db --- /dev/null +++ b/db/rpc_server/java/gen/__db_flags_reply.java @@ -0,0 +1,32 @@ +/* + * Automatically generated by jrpcgen 0.95.1 on 12/18/01 7:23 PM + * jrpcgen is part of the "Remote Tea" ONC/RPC package for Java + * See http://acplt.org/ks/remotetea.html for details + */ +package com.sleepycat.db.rpcserver; +import org.acplt.oncrpc.*; +import java.io.IOException; + +public class __db_flags_reply implements XdrAble { + public int status; + + public __db_flags_reply() { + } + + public __db_flags_reply(XdrDecodingStream xdr) + throws OncRpcException, IOException { + xdrDecode(xdr); + } + + public void xdrEncode(XdrEncodingStream xdr) + throws OncRpcException, IOException { + xdr.xdrEncodeInt(status); + } + + public void xdrDecode(XdrDecodingStream xdr) + throws OncRpcException, IOException { + status = xdr.xdrDecodeInt(); + } + +} +// End of __db_flags_reply.java diff --git a/db/rpc_server/java/gen/__db_get_msg.java b/db/rpc_server/java/gen/__db_get_msg.java new file mode 100644 index 000000000..3dfe8e9d8 --- /dev/null +++ b/db/rpc_server/java/gen/__db_get_msg.java @@ -0,0 +1,68 @@ +/* + * Automatically generated by jrpcgen 0.95.1 on 12/18/01 7:23 PM + * jrpcgen is part of the "Remote Tea" ONC/RPC package for Java + * See http://acplt.org/ks/remotetea.html for details + */ +package com.sleepycat.db.rpcserver; +import org.acplt.oncrpc.*; +import java.io.IOException; + +public class __db_get_msg implements XdrAble { + public int dbpcl_id; + public int txnpcl_id; + public int keydlen; + public int keydoff; + public int keyulen; + public int keyflags; + public byte [] keydata; + public int datadlen; + public int datadoff; + public int dataulen; + public int dataflags; + public byte [] datadata; + public int flags; + + public __db_get_msg() { + } + + public __db_get_msg(XdrDecodingStream xdr) + throws OncRpcException, IOException { + xdrDecode(xdr); + } + + public void xdrEncode(XdrEncodingStream xdr) + throws OncRpcException, IOException { + xdr.xdrEncodeInt(dbpcl_id); + xdr.xdrEncodeInt(txnpcl_id); + xdr.xdrEncodeInt(keydlen); + xdr.xdrEncodeInt(keydoff); + xdr.xdrEncodeInt(keyulen); + xdr.xdrEncodeInt(keyflags); + xdr.xdrEncodeDynamicOpaque(keydata); + xdr.xdrEncodeInt(datadlen); + xdr.xdrEncodeInt(datadoff); + xdr.xdrEncodeInt(dataulen); + xdr.xdrEncodeInt(dataflags); + xdr.xdrEncodeDynamicOpaque(datadata); + xdr.xdrEncodeInt(flags); + } + + public void xdrDecode(XdrDecodingStream xdr) + throws OncRpcException, IOException { + dbpcl_id = xdr.xdrDecodeInt(); + txnpcl_id = xdr.xdrDecodeInt(); + keydlen = xdr.xdrDecodeInt(); + keydoff = xdr.xdrDecodeInt(); + keyulen = xdr.xdrDecodeInt(); + keyflags = xdr.xdrDecodeInt(); + keydata = xdr.xdrDecodeDynamicOpaque(); + datadlen = xdr.xdrDecodeInt(); + datadoff = xdr.xdrDecodeInt(); + dataulen = xdr.xdrDecodeInt(); + dataflags = xdr.xdrDecodeInt(); + datadata = xdr.xdrDecodeDynamicOpaque(); + flags = xdr.xdrDecodeInt(); + } + +} +// End of __db_get_msg.java diff --git a/db/rpc_server/java/gen/__db_get_reply.java b/db/rpc_server/java/gen/__db_get_reply.java new file mode 100644 index 000000000..64ce52572 --- /dev/null +++ b/db/rpc_server/java/gen/__db_get_reply.java @@ -0,0 +1,38 @@ +/* + * Automatically generated by jrpcgen 0.95.1 on 12/18/01 7:23 PM + * jrpcgen is part of the "Remote Tea" ONC/RPC package for Java + * See http://acplt.org/ks/remotetea.html for details + */ +package com.sleepycat.db.rpcserver; +import org.acplt.oncrpc.*; +import java.io.IOException; + +public class __db_get_reply implements XdrAble { + public int status; + public byte [] keydata; + public byte [] datadata; + + public __db_get_reply() { + } + + public __db_get_reply(XdrDecodingStream xdr) + throws OncRpcException, IOException { + xdrDecode(xdr); + } + + public void xdrEncode(XdrEncodingStream xdr) + throws OncRpcException, IOException { + xdr.xdrEncodeInt(status); + xdr.xdrEncodeDynamicOpaque(keydata); + xdr.xdrEncodeDynamicOpaque(datadata); + } + + public void xdrDecode(XdrDecodingStream xdr) + throws OncRpcException, IOException { + status = xdr.xdrDecodeInt(); + keydata = xdr.xdrDecodeDynamicOpaque(); + datadata = xdr.xdrDecodeDynamicOpaque(); + } + +} +// End of __db_get_reply.java diff --git a/db/rpc_server/java/gen/__db_h_ffactor_msg.java b/db/rpc_server/java/gen/__db_h_ffactor_msg.java new file mode 100644 index 000000000..8d2ed1b1c --- /dev/null +++ b/db/rpc_server/java/gen/__db_h_ffactor_msg.java @@ -0,0 +1,35 @@ +/* + * Automatically generated by jrpcgen 0.95.1 on 12/18/01 7:23 PM + * jrpcgen is part of the "Remote Tea" ONC/RPC package for Java + * See http://acplt.org/ks/remotetea.html for details + */ +package com.sleepycat.db.rpcserver; +import org.acplt.oncrpc.*; +import java.io.IOException; + +public class __db_h_ffactor_msg implements XdrAble { + public int dbpcl_id; + public int ffactor; + + public __db_h_ffactor_msg() { + } + + public __db_h_ffactor_msg(XdrDecodingStream xdr) + throws OncRpcException, IOException { + xdrDecode(xdr); + } + + public void xdrEncode(XdrEncodingStream xdr) + throws OncRpcException, IOException { + xdr.xdrEncodeInt(dbpcl_id); + xdr.xdrEncodeInt(ffactor); + } + + public void xdrDecode(XdrDecodingStream xdr) + throws OncRpcException, IOException { + dbpcl_id = xdr.xdrDecodeInt(); + ffactor = xdr.xdrDecodeInt(); + } + +} +// End of __db_h_ffactor_msg.java diff --git a/db/rpc_server/java/gen/__db_h_ffactor_reply.java b/db/rpc_server/java/gen/__db_h_ffactor_reply.java new file mode 100644 index 000000000..1885ec502 --- /dev/null +++ b/db/rpc_server/java/gen/__db_h_ffactor_reply.java @@ -0,0 +1,32 @@ +/* + * Automatically generated by jrpcgen 0.95.1 on 12/18/01 7:23 PM + * jrpcgen is part of the "Remote Tea" ONC/RPC package for Java + * See http://acplt.org/ks/remotetea.html for details + */ +package com.sleepycat.db.rpcserver; +import org.acplt.oncrpc.*; +import java.io.IOException; + +public class __db_h_ffactor_reply implements XdrAble { + public int status; + + public __db_h_ffactor_reply() { + } + + public __db_h_ffactor_reply(XdrDecodingStream xdr) + throws OncRpcException, IOException { + xdrDecode(xdr); + } + + public void xdrEncode(XdrEncodingStream xdr) + throws OncRpcException, IOException { + xdr.xdrEncodeInt(status); + } + + public void xdrDecode(XdrDecodingStream xdr) + throws OncRpcException, IOException { + status = xdr.xdrDecodeInt(); + } + +} +// End of __db_h_ffactor_reply.java diff --git a/db/rpc_server/java/gen/__db_h_nelem_msg.java b/db/rpc_server/java/gen/__db_h_nelem_msg.java new file mode 100644 index 000000000..7d0843517 --- /dev/null +++ b/db/rpc_server/java/gen/__db_h_nelem_msg.java @@ -0,0 +1,35 @@ +/* + * Automatically generated by jrpcgen 0.95.1 on 12/18/01 7:23 PM + * jrpcgen is part of the "Remote Tea" ONC/RPC package for Java + * See http://acplt.org/ks/remotetea.html for details + */ +package com.sleepycat.db.rpcserver; +import org.acplt.oncrpc.*; +import java.io.IOException; + +public class __db_h_nelem_msg implements XdrAble { + public int dbpcl_id; + public int nelem; + + public __db_h_nelem_msg() { + } + + public __db_h_nelem_msg(XdrDecodingStream xdr) + throws OncRpcException, IOException { + xdrDecode(xdr); + } + + public void xdrEncode(XdrEncodingStream xdr) + throws OncRpcException, IOException { + xdr.xdrEncodeInt(dbpcl_id); + xdr.xdrEncodeInt(nelem); + } + + public void xdrDecode(XdrDecodingStream xdr) + throws OncRpcException, IOException { + dbpcl_id = xdr.xdrDecodeInt(); + nelem = xdr.xdrDecodeInt(); + } + +} +// End of __db_h_nelem_msg.java diff --git a/db/rpc_server/java/gen/__db_h_nelem_reply.java b/db/rpc_server/java/gen/__db_h_nelem_reply.java new file mode 100644 index 000000000..20c5c774e --- /dev/null +++ b/db/rpc_server/java/gen/__db_h_nelem_reply.java @@ -0,0 +1,32 @@ +/* + * Automatically generated by jrpcgen 0.95.1 on 12/18/01 7:23 PM + * jrpcgen is part of the "Remote Tea" ONC/RPC package for Java + * See http://acplt.org/ks/remotetea.html for details + */ +package com.sleepycat.db.rpcserver; +import org.acplt.oncrpc.*; +import java.io.IOException; + +public class __db_h_nelem_reply implements XdrAble { + public int status; + + public __db_h_nelem_reply() { + } + + public __db_h_nelem_reply(XdrDecodingStream xdr) + throws OncRpcException, IOException { + xdrDecode(xdr); + } + + public void xdrEncode(XdrEncodingStream xdr) + throws OncRpcException, IOException { + xdr.xdrEncodeInt(status); + } + + public void xdrDecode(XdrDecodingStream xdr) + throws OncRpcException, IOException { + status = xdr.xdrDecodeInt(); + } + +} +// End of __db_h_nelem_reply.java diff --git a/db/rpc_server/java/gen/__db_join_msg.java b/db/rpc_server/java/gen/__db_join_msg.java new file mode 100644 index 000000000..88c72dbd6 --- /dev/null +++ b/db/rpc_server/java/gen/__db_join_msg.java @@ -0,0 +1,38 @@ +/* + * Automatically generated by jrpcgen 0.95.1 on 12/18/01 7:23 PM + * jrpcgen is part of the "Remote Tea" ONC/RPC package for Java + * See http://acplt.org/ks/remotetea.html for details + */ +package com.sleepycat.db.rpcserver; +import org.acplt.oncrpc.*; +import java.io.IOException; + +public class __db_join_msg implements XdrAble { + public int dbpcl_id; + public int [] curs; + public int flags; + + public __db_join_msg() { + } + + public __db_join_msg(XdrDecodingStream xdr) + throws OncRpcException, IOException { + xdrDecode(xdr); + } + + public void xdrEncode(XdrEncodingStream xdr) + throws OncRpcException, IOException { + xdr.xdrEncodeInt(dbpcl_id); + xdr.xdrEncodeIntVector(curs); + xdr.xdrEncodeInt(flags); + } + + public void xdrDecode(XdrDecodingStream xdr) + throws OncRpcException, IOException { + dbpcl_id = xdr.xdrDecodeInt(); + curs = xdr.xdrDecodeIntVector(); + flags = xdr.xdrDecodeInt(); + } + +} +// End of __db_join_msg.java diff --git a/db/rpc_server/java/gen/__db_join_reply.java b/db/rpc_server/java/gen/__db_join_reply.java new file mode 100644 index 000000000..80980e23d --- /dev/null +++ b/db/rpc_server/java/gen/__db_join_reply.java @@ -0,0 +1,35 @@ +/* + * Automatically generated by jrpcgen 0.95.1 on 12/18/01 7:23 PM + * jrpcgen is part of the "Remote Tea" ONC/RPC package for Java + * See http://acplt.org/ks/remotetea.html for details + */ +package com.sleepycat.db.rpcserver; +import org.acplt.oncrpc.*; +import java.io.IOException; + +public class __db_join_reply implements XdrAble { + public int status; + public int dbcidcl_id; + + public __db_join_reply() { + } + + public __db_join_reply(XdrDecodingStream xdr) + throws OncRpcException, IOException { + xdrDecode(xdr); + } + + public void xdrEncode(XdrEncodingStream xdr) + throws OncRpcException, IOException { + xdr.xdrEncodeInt(status); + xdr.xdrEncodeInt(dbcidcl_id); + } + + public void xdrDecode(XdrDecodingStream xdr) + throws OncRpcException, IOException { + status = xdr.xdrDecodeInt(); + dbcidcl_id = xdr.xdrDecodeInt(); + } + +} +// End of __db_join_reply.java diff --git a/db/rpc_server/java/gen/__db_key_range_msg.java b/db/rpc_server/java/gen/__db_key_range_msg.java new file mode 100644 index 000000000..233077e09 --- /dev/null +++ b/db/rpc_server/java/gen/__db_key_range_msg.java @@ -0,0 +1,53 @@ +/* + * Automatically generated by jrpcgen 0.95.1 on 12/18/01 7:23 PM + * jrpcgen is part of the "Remote Tea" ONC/RPC package for Java + * See http://acplt.org/ks/remotetea.html for details + */ +package com.sleepycat.db.rpcserver; +import org.acplt.oncrpc.*; +import java.io.IOException; + +public class __db_key_range_msg implements XdrAble { + public int dbpcl_id; + public int txnpcl_id; + public int keydlen; + public int keydoff; + public int keyulen; + public int keyflags; + public byte [] keydata; + public int flags; + + public __db_key_range_msg() { + } + + public __db_key_range_msg(XdrDecodingStream xdr) + throws OncRpcException, IOException { + xdrDecode(xdr); + } + + public void xdrEncode(XdrEncodingStream xdr) + throws OncRpcException, IOException { + xdr.xdrEncodeInt(dbpcl_id); + xdr.xdrEncodeInt(txnpcl_id); + xdr.xdrEncodeInt(keydlen); + xdr.xdrEncodeInt(keydoff); + xdr.xdrEncodeInt(keyulen); + xdr.xdrEncodeInt(keyflags); + xdr.xdrEncodeDynamicOpaque(keydata); + xdr.xdrEncodeInt(flags); + } + + public void xdrDecode(XdrDecodingStream xdr) + throws OncRpcException, IOException { + dbpcl_id = xdr.xdrDecodeInt(); + txnpcl_id = xdr.xdrDecodeInt(); + keydlen = xdr.xdrDecodeInt(); + keydoff = xdr.xdrDecodeInt(); + keyulen = xdr.xdrDecodeInt(); + keyflags = xdr.xdrDecodeInt(); + keydata = xdr.xdrDecodeDynamicOpaque(); + flags = xdr.xdrDecodeInt(); + } + +} +// End of __db_key_range_msg.java diff --git a/db/rpc_server/java/gen/__db_key_range_reply.java b/db/rpc_server/java/gen/__db_key_range_reply.java new file mode 100644 index 000000000..09244c13d --- /dev/null +++ b/db/rpc_server/java/gen/__db_key_range_reply.java @@ -0,0 +1,41 @@ +/* + * Automatically generated by jrpcgen 0.95.1 on 12/18/01 7:23 PM + * jrpcgen is part of the "Remote Tea" ONC/RPC package for Java + * See http://acplt.org/ks/remotetea.html for details + */ +package com.sleepycat.db.rpcserver; +import org.acplt.oncrpc.*; +import java.io.IOException; + +public class __db_key_range_reply implements XdrAble { + public int status; + public double less; + public double equal; + public double greater; + + public __db_key_range_reply() { + } + + public __db_key_range_reply(XdrDecodingStream xdr) + throws OncRpcException, IOException { + xdrDecode(xdr); + } + + public void xdrEncode(XdrEncodingStream xdr) + throws OncRpcException, IOException { + xdr.xdrEncodeInt(status); + xdr.xdrEncodeDouble(less); + xdr.xdrEncodeDouble(equal); + xdr.xdrEncodeDouble(greater); + } + + public void xdrDecode(XdrDecodingStream xdr) + throws OncRpcException, IOException { + status = xdr.xdrDecodeInt(); + less = xdr.xdrDecodeDouble(); + equal = xdr.xdrDecodeDouble(); + greater = xdr.xdrDecodeDouble(); + } + +} +// End of __db_key_range_reply.java diff --git a/db/rpc_server/java/gen/__db_lorder_msg.java b/db/rpc_server/java/gen/__db_lorder_msg.java new file mode 100644 index 000000000..3399ad8da --- /dev/null +++ b/db/rpc_server/java/gen/__db_lorder_msg.java @@ -0,0 +1,35 @@ +/* + * Automatically generated by jrpcgen 0.95.1 on 12/18/01 7:23 PM + * jrpcgen is part of the "Remote Tea" ONC/RPC package for Java + * See http://acplt.org/ks/remotetea.html for details + */ +package com.sleepycat.db.rpcserver; +import org.acplt.oncrpc.*; +import java.io.IOException; + +public class __db_lorder_msg implements XdrAble { + public int dbpcl_id; + public int lorder; + + public __db_lorder_msg() { + } + + public __db_lorder_msg(XdrDecodingStream xdr) + throws OncRpcException, IOException { + xdrDecode(xdr); + } + + public void xdrEncode(XdrEncodingStream xdr) + throws OncRpcException, IOException { + xdr.xdrEncodeInt(dbpcl_id); + xdr.xdrEncodeInt(lorder); + } + + public void xdrDecode(XdrDecodingStream xdr) + throws OncRpcException, IOException { + dbpcl_id = xdr.xdrDecodeInt(); + lorder = xdr.xdrDecodeInt(); + } + +} +// End of __db_lorder_msg.java diff --git a/db/rpc_server/java/gen/__db_lorder_reply.java b/db/rpc_server/java/gen/__db_lorder_reply.java new file mode 100644 index 000000000..cdcda4d4f --- /dev/null +++ b/db/rpc_server/java/gen/__db_lorder_reply.java @@ -0,0 +1,32 @@ +/* + * Automatically generated by jrpcgen 0.95.1 on 12/18/01 7:23 PM + * jrpcgen is part of the "Remote Tea" ONC/RPC package for Java + * See http://acplt.org/ks/remotetea.html for details + */ +package com.sleepycat.db.rpcserver; +import org.acplt.oncrpc.*; +import java.io.IOException; + +public class __db_lorder_reply implements XdrAble { + public int status; + + public __db_lorder_reply() { + } + + public __db_lorder_reply(XdrDecodingStream xdr) + throws OncRpcException, IOException { + xdrDecode(xdr); + } + + public void xdrEncode(XdrEncodingStream xdr) + throws OncRpcException, IOException { + xdr.xdrEncodeInt(status); + } + + public void xdrDecode(XdrDecodingStream xdr) + throws OncRpcException, IOException { + status = xdr.xdrDecodeInt(); + } + +} +// End of __db_lorder_reply.java diff --git a/db/rpc_server/java/gen/__db_open_msg.java b/db/rpc_server/java/gen/__db_open_msg.java new file mode 100644 index 000000000..14dbd9e3b --- /dev/null +++ b/db/rpc_server/java/gen/__db_open_msg.java @@ -0,0 +1,50 @@ +/* + * Automatically generated by jrpcgen 0.95.1 on 2/13/02 1:05 PM + * jrpcgen is part of the "Remote Tea" ONC/RPC package for Java + * See http://acplt.org/ks/remotetea.html for details + */ +package com.sleepycat.db.rpcserver; +import org.acplt.oncrpc.*; +import java.io.IOException; + +public class __db_open_msg implements XdrAble { + public int dbpcl_id; + public int txnpcl_id; + public String name; + public String subdb; + public int type; + public int flags; + public int mode; + + public __db_open_msg() { + } + + public __db_open_msg(XdrDecodingStream xdr) + throws OncRpcException, IOException { + xdrDecode(xdr); + } + + public void xdrEncode(XdrEncodingStream xdr) + throws OncRpcException, IOException { + xdr.xdrEncodeInt(dbpcl_id); + xdr.xdrEncodeInt(txnpcl_id); + xdr.xdrEncodeString(name); + xdr.xdrEncodeString(subdb); + xdr.xdrEncodeInt(type); + xdr.xdrEncodeInt(flags); + xdr.xdrEncodeInt(mode); + } + + public void xdrDecode(XdrDecodingStream xdr) + throws OncRpcException, IOException { + dbpcl_id = xdr.xdrDecodeInt(); + txnpcl_id = xdr.xdrDecodeInt(); + name = xdr.xdrDecodeString(); + subdb = xdr.xdrDecodeString(); + type = xdr.xdrDecodeInt(); + flags = xdr.xdrDecodeInt(); + mode = xdr.xdrDecodeInt(); + } + +} +// End of __db_open_msg.java diff --git a/db/rpc_server/java/gen/__db_open_reply.java b/db/rpc_server/java/gen/__db_open_reply.java new file mode 100644 index 000000000..d90c3754c --- /dev/null +++ b/db/rpc_server/java/gen/__db_open_reply.java @@ -0,0 +1,44 @@ +/* + * Automatically generated by jrpcgen 0.95.1 on 12/18/01 7:23 PM + * jrpcgen is part of the "Remote Tea" ONC/RPC package for Java + * See http://acplt.org/ks/remotetea.html for details + */ +package com.sleepycat.db.rpcserver; +import org.acplt.oncrpc.*; +import java.io.IOException; + +public class __db_open_reply implements XdrAble { + public int status; + public int dbcl_id; + public int type; + public int dbflags; + public int lorder; + + public __db_open_reply() { + } + + public __db_open_reply(XdrDecodingStream xdr) + throws OncRpcException, IOException { + xdrDecode(xdr); + } + + public void xdrEncode(XdrEncodingStream xdr) + throws OncRpcException, IOException { + xdr.xdrEncodeInt(status); + xdr.xdrEncodeInt(dbcl_id); + xdr.xdrEncodeInt(type); + xdr.xdrEncodeInt(dbflags); + xdr.xdrEncodeInt(lorder); + } + + public void xdrDecode(XdrDecodingStream xdr) + throws OncRpcException, IOException { + status = xdr.xdrDecodeInt(); + dbcl_id = xdr.xdrDecodeInt(); + type = xdr.xdrDecodeInt(); + dbflags = xdr.xdrDecodeInt(); + lorder = xdr.xdrDecodeInt(); + } + +} +// End of __db_open_reply.java diff --git a/db/rpc_server/java/gen/__db_pagesize_msg.java b/db/rpc_server/java/gen/__db_pagesize_msg.java new file mode 100644 index 000000000..a452ea4e3 --- /dev/null +++ b/db/rpc_server/java/gen/__db_pagesize_msg.java @@ -0,0 +1,35 @@ +/* + * Automatically generated by jrpcgen 0.95.1 on 12/18/01 7:23 PM + * jrpcgen is part of the "Remote Tea" ONC/RPC package for Java + * See http://acplt.org/ks/remotetea.html for details + */ +package com.sleepycat.db.rpcserver; +import org.acplt.oncrpc.*; +import java.io.IOException; + +public class __db_pagesize_msg implements XdrAble { + public int dbpcl_id; + public int pagesize; + + public __db_pagesize_msg() { + } + + public __db_pagesize_msg(XdrDecodingStream xdr) + throws OncRpcException, IOException { + xdrDecode(xdr); + } + + public void xdrEncode(XdrEncodingStream xdr) + throws OncRpcException, IOException { + xdr.xdrEncodeInt(dbpcl_id); + xdr.xdrEncodeInt(pagesize); + } + + public void xdrDecode(XdrDecodingStream xdr) + throws OncRpcException, IOException { + dbpcl_id = xdr.xdrDecodeInt(); + pagesize = xdr.xdrDecodeInt(); + } + +} +// End of __db_pagesize_msg.java diff --git a/db/rpc_server/java/gen/__db_pagesize_reply.java b/db/rpc_server/java/gen/__db_pagesize_reply.java new file mode 100644 index 000000000..830b2078b --- /dev/null +++ b/db/rpc_server/java/gen/__db_pagesize_reply.java @@ -0,0 +1,32 @@ +/* + * Automatically generated by jrpcgen 0.95.1 on 12/18/01 7:23 PM + * jrpcgen is part of the "Remote Tea" ONC/RPC package for Java + * See http://acplt.org/ks/remotetea.html for details + */ +package com.sleepycat.db.rpcserver; +import org.acplt.oncrpc.*; +import java.io.IOException; + +public class __db_pagesize_reply implements XdrAble { + public int status; + + public __db_pagesize_reply() { + } + + public __db_pagesize_reply(XdrDecodingStream xdr) + throws OncRpcException, IOException { + xdrDecode(xdr); + } + + public void xdrEncode(XdrEncodingStream xdr) + throws OncRpcException, IOException { + xdr.xdrEncodeInt(status); + } + + public void xdrDecode(XdrDecodingStream xdr) + throws OncRpcException, IOException { + status = xdr.xdrDecodeInt(); + } + +} +// End of __db_pagesize_reply.java diff --git a/db/rpc_server/java/gen/__db_pget_msg.java b/db/rpc_server/java/gen/__db_pget_msg.java new file mode 100644 index 000000000..11d27ca9e --- /dev/null +++ b/db/rpc_server/java/gen/__db_pget_msg.java @@ -0,0 +1,83 @@ +/* + * Automatically generated by jrpcgen 0.95.1 on 12/18/01 7:23 PM + * jrpcgen is part of the "Remote Tea" ONC/RPC package for Java + * See http://acplt.org/ks/remotetea.html for details + */ +package com.sleepycat.db.rpcserver; +import org.acplt.oncrpc.*; +import java.io.IOException; + +public class __db_pget_msg implements XdrAble { + public int dbpcl_id; + public int txnpcl_id; + public int skeydlen; + public int skeydoff; + public int skeyulen; + public int skeyflags; + public byte [] skeydata; + public int pkeydlen; + public int pkeydoff; + public int pkeyulen; + public int pkeyflags; + public byte [] pkeydata; + public int datadlen; + public int datadoff; + public int dataulen; + public int dataflags; + public byte [] datadata; + public int flags; + + public __db_pget_msg() { + } + + public __db_pget_msg(XdrDecodingStream xdr) + throws OncRpcException, IOException { + xdrDecode(xdr); + } + + public void xdrEncode(XdrEncodingStream xdr) + throws OncRpcException, IOException { + xdr.xdrEncodeInt(dbpcl_id); + xdr.xdrEncodeInt(txnpcl_id); + xdr.xdrEncodeInt(skeydlen); + xdr.xdrEncodeInt(skeydoff); + xdr.xdrEncodeInt(skeyulen); + xdr.xdrEncodeInt(skeyflags); + xdr.xdrEncodeDynamicOpaque(skeydata); + xdr.xdrEncodeInt(pkeydlen); + xdr.xdrEncodeInt(pkeydoff); + xdr.xdrEncodeInt(pkeyulen); + xdr.xdrEncodeInt(pkeyflags); + xdr.xdrEncodeDynamicOpaque(pkeydata); + xdr.xdrEncodeInt(datadlen); + xdr.xdrEncodeInt(datadoff); + xdr.xdrEncodeInt(dataulen); + xdr.xdrEncodeInt(dataflags); + xdr.xdrEncodeDynamicOpaque(datadata); + xdr.xdrEncodeInt(flags); + } + + public void xdrDecode(XdrDecodingStream xdr) + throws OncRpcException, IOException { + dbpcl_id = xdr.xdrDecodeInt(); + txnpcl_id = xdr.xdrDecodeInt(); + skeydlen = xdr.xdrDecodeInt(); + skeydoff = xdr.xdrDecodeInt(); + skeyulen = xdr.xdrDecodeInt(); + skeyflags = xdr.xdrDecodeInt(); + skeydata = xdr.xdrDecodeDynamicOpaque(); + pkeydlen = xdr.xdrDecodeInt(); + pkeydoff = xdr.xdrDecodeInt(); + pkeyulen = xdr.xdrDecodeInt(); + pkeyflags = xdr.xdrDecodeInt(); + pkeydata = xdr.xdrDecodeDynamicOpaque(); + datadlen = xdr.xdrDecodeInt(); + datadoff = xdr.xdrDecodeInt(); + dataulen = xdr.xdrDecodeInt(); + dataflags = xdr.xdrDecodeInt(); + datadata = xdr.xdrDecodeDynamicOpaque(); + flags = xdr.xdrDecodeInt(); + } + +} +// End of __db_pget_msg.java diff --git a/db/rpc_server/java/gen/__db_pget_reply.java b/db/rpc_server/java/gen/__db_pget_reply.java new file mode 100644 index 000000000..86c9c2111 --- /dev/null +++ b/db/rpc_server/java/gen/__db_pget_reply.java @@ -0,0 +1,41 @@ +/* + * Automatically generated by jrpcgen 0.95.1 on 12/18/01 7:23 PM + * jrpcgen is part of the "Remote Tea" ONC/RPC package for Java + * See http://acplt.org/ks/remotetea.html for details + */ +package com.sleepycat.db.rpcserver; +import org.acplt.oncrpc.*; +import java.io.IOException; + +public class __db_pget_reply implements XdrAble { + public int status; + public byte [] skeydata; + public byte [] pkeydata; + public byte [] datadata; + + public __db_pget_reply() { + } + + public __db_pget_reply(XdrDecodingStream xdr) + throws OncRpcException, IOException { + xdrDecode(xdr); + } + + public void xdrEncode(XdrEncodingStream xdr) + throws OncRpcException, IOException { + xdr.xdrEncodeInt(status); + xdr.xdrEncodeDynamicOpaque(skeydata); + xdr.xdrEncodeDynamicOpaque(pkeydata); + xdr.xdrEncodeDynamicOpaque(datadata); + } + + public void xdrDecode(XdrDecodingStream xdr) + throws OncRpcException, IOException { + status = xdr.xdrDecodeInt(); + skeydata = xdr.xdrDecodeDynamicOpaque(); + pkeydata = xdr.xdrDecodeDynamicOpaque(); + datadata = xdr.xdrDecodeDynamicOpaque(); + } + +} +// End of __db_pget_reply.java diff --git a/db/rpc_server/java/gen/__db_put_msg.java b/db/rpc_server/java/gen/__db_put_msg.java new file mode 100644 index 000000000..b6159cff3 --- /dev/null +++ b/db/rpc_server/java/gen/__db_put_msg.java @@ -0,0 +1,68 @@ +/* + * Automatically generated by jrpcgen 0.95.1 on 12/18/01 7:23 PM + * jrpcgen is part of the "Remote Tea" ONC/RPC package for Java + * See http://acplt.org/ks/remotetea.html for details + */ +package com.sleepycat.db.rpcserver; +import org.acplt.oncrpc.*; +import java.io.IOException; + +public class __db_put_msg implements XdrAble { + public int dbpcl_id; + public int txnpcl_id; + public int keydlen; + public int keydoff; + public int keyulen; + public int keyflags; + public byte [] keydata; + public int datadlen; + public int datadoff; + public int dataulen; + public int dataflags; + public byte [] datadata; + public int flags; + + public __db_put_msg() { + } + + public __db_put_msg(XdrDecodingStream xdr) + throws OncRpcException, IOException { + xdrDecode(xdr); + } + + public void xdrEncode(XdrEncodingStream xdr) + throws OncRpcException, IOException { + xdr.xdrEncodeInt(dbpcl_id); + xdr.xdrEncodeInt(txnpcl_id); + xdr.xdrEncodeInt(keydlen); + xdr.xdrEncodeInt(keydoff); + xdr.xdrEncodeInt(keyulen); + xdr.xdrEncodeInt(keyflags); + xdr.xdrEncodeDynamicOpaque(keydata); + xdr.xdrEncodeInt(datadlen); + xdr.xdrEncodeInt(datadoff); + xdr.xdrEncodeInt(dataulen); + xdr.xdrEncodeInt(dataflags); + xdr.xdrEncodeDynamicOpaque(datadata); + xdr.xdrEncodeInt(flags); + } + + public void xdrDecode(XdrDecodingStream xdr) + throws OncRpcException, IOException { + dbpcl_id = xdr.xdrDecodeInt(); + txnpcl_id = xdr.xdrDecodeInt(); + keydlen = xdr.xdrDecodeInt(); + keydoff = xdr.xdrDecodeInt(); + keyulen = xdr.xdrDecodeInt(); + keyflags = xdr.xdrDecodeInt(); + keydata = xdr.xdrDecodeDynamicOpaque(); + datadlen = xdr.xdrDecodeInt(); + datadoff = xdr.xdrDecodeInt(); + dataulen = xdr.xdrDecodeInt(); + dataflags = xdr.xdrDecodeInt(); + datadata = xdr.xdrDecodeDynamicOpaque(); + flags = xdr.xdrDecodeInt(); + } + +} +// End of __db_put_msg.java diff --git a/db/rpc_server/java/gen/__db_put_reply.java b/db/rpc_server/java/gen/__db_put_reply.java new file mode 100644 index 000000000..fc89ae1c3 --- /dev/null +++ b/db/rpc_server/java/gen/__db_put_reply.java @@ -0,0 +1,35 @@ +/* + * Automatically generated by jrpcgen 0.95.1 on 12/18/01 7:23 PM + * jrpcgen is part of the "Remote Tea" ONC/RPC package for Java + * See http://acplt.org/ks/remotetea.html for details + */ +package com.sleepycat.db.rpcserver; +import org.acplt.oncrpc.*; +import java.io.IOException; + +public class __db_put_reply implements XdrAble { + public int status; + public byte [] keydata; + + public __db_put_reply() { + } + + public __db_put_reply(XdrDecodingStream xdr) + throws OncRpcException, IOException { + xdrDecode(xdr); + } + + public void xdrEncode(XdrEncodingStream xdr) + throws OncRpcException, IOException { + xdr.xdrEncodeInt(status); + xdr.xdrEncodeDynamicOpaque(keydata); + } + + public void xdrDecode(XdrDecodingStream xdr) + throws OncRpcException, IOException { + status = xdr.xdrDecodeInt(); + keydata = xdr.xdrDecodeDynamicOpaque(); + } + +} +// End of __db_put_reply.java diff --git a/db/rpc_server/java/gen/__db_re_delim_msg.java b/db/rpc_server/java/gen/__db_re_delim_msg.java new file mode 100644 index 000000000..c386bddd2 --- /dev/null +++ b/db/rpc_server/java/gen/__db_re_delim_msg.java @@ -0,0 +1,35 @@ +/* + * Automatically generated by jrpcgen 0.95.1 on 12/18/01 7:23 PM + * jrpcgen is part of the "Remote Tea" ONC/RPC package for Java + * See http://acplt.org/ks/remotetea.html for details + */ +package com.sleepycat.db.rpcserver; +import org.acplt.oncrpc.*; +import java.io.IOException; + +public class __db_re_delim_msg implements XdrAble { + public int dbpcl_id; + public int delim; + + public __db_re_delim_msg() { + } + + public __db_re_delim_msg(XdrDecodingStream xdr) + throws OncRpcException, IOException { + xdrDecode(xdr); + } + + public void xdrEncode(XdrEncodingStream xdr) + throws OncRpcException, IOException { + xdr.xdrEncodeInt(dbpcl_id); + xdr.xdrEncodeInt(delim); + } + + public void xdrDecode(XdrDecodingStream xdr) + throws OncRpcException, IOException { + dbpcl_id = xdr.xdrDecodeInt(); + delim = xdr.xdrDecodeInt(); + } + +} +// End of __db_re_delim_msg.java diff --git a/db/rpc_server/java/gen/__db_re_delim_reply.java b/db/rpc_server/java/gen/__db_re_delim_reply.java new file mode 100644 index 000000000..aa8a797f5 --- /dev/null +++ b/db/rpc_server/java/gen/__db_re_delim_reply.java @@ -0,0 +1,32 @@ +/* + * Automatically generated by jrpcgen 0.95.1 on 12/18/01 7:23 PM + * jrpcgen is part of the "Remote Tea" ONC/RPC package for Java + * See http://acplt.org/ks/remotetea.html for details + */ +package com.sleepycat.db.rpcserver; +import org.acplt.oncrpc.*; +import java.io.IOException; + +public class __db_re_delim_reply implements XdrAble { + public int status; + + public __db_re_delim_reply() { + } + + public __db_re_delim_reply(XdrDecodingStream xdr) + throws OncRpcException, IOException { + xdrDecode(xdr); + } + + public void xdrEncode(XdrEncodingStream xdr) + throws OncRpcException, IOException { + xdr.xdrEncodeInt(status); + } + + public void xdrDecode(XdrDecodingStream xdr) + throws OncRpcException, IOException { + status = xdr.xdrDecodeInt(); + } + +} +// End of __db_re_delim_reply.java diff --git a/db/rpc_server/java/gen/__db_re_len_msg.java b/db/rpc_server/java/gen/__db_re_len_msg.java new file mode 100644 index 000000000..664de5c89 --- /dev/null +++ b/db/rpc_server/java/gen/__db_re_len_msg.java @@ -0,0 +1,35 @@ +/* + * Automatically generated by jrpcgen 0.95.1 on 12/18/01 7:23 PM + * jrpcgen is part of the "Remote Tea" ONC/RPC package for Java + * See http://acplt.org/ks/remotetea.html for details + */ +package com.sleepycat.db.rpcserver; +import org.acplt.oncrpc.*; +import java.io.IOException; + +public class __db_re_len_msg implements XdrAble { + public int dbpcl_id; + public int len; + + public __db_re_len_msg() { + } + + public __db_re_len_msg(XdrDecodingStream xdr) + throws OncRpcException, IOException { + xdrDecode(xdr); + } + + public void xdrEncode(XdrEncodingStream xdr) + throws OncRpcException, IOException { + xdr.xdrEncodeInt(dbpcl_id); + xdr.xdrEncodeInt(len); + } + + public void xdrDecode(XdrDecodingStream xdr) + throws OncRpcException, IOException { + dbpcl_id = xdr.xdrDecodeInt(); + len = xdr.xdrDecodeInt(); + } + +} +// End of __db_re_len_msg.java diff --git a/db/rpc_server/java/gen/__db_re_len_reply.java b/db/rpc_server/java/gen/__db_re_len_reply.java new file mode 100644 index 000000000..dda27c8c1 --- /dev/null +++ b/db/rpc_server/java/gen/__db_re_len_reply.java @@ -0,0 +1,32 @@ +/* + * Automatically generated by jrpcgen 0.95.1 on 12/18/01 7:23 PM + * jrpcgen is part of the "Remote Tea" ONC/RPC package for Java + * See http://acplt.org/ks/remotetea.html for details + */ +package com.sleepycat.db.rpcserver; +import org.acplt.oncrpc.*; +import java.io.IOException; + +public class __db_re_len_reply implements XdrAble { + public int status; + + public __db_re_len_reply() { + } + + public __db_re_len_reply(XdrDecodingStream xdr) + throws OncRpcException, IOException { + xdrDecode(xdr); + } + + public void xdrEncode(XdrEncodingStream xdr) + throws OncRpcException, IOException { + xdr.xdrEncodeInt(status); + } + + public void xdrDecode(XdrDecodingStream xdr) + throws OncRpcException, IOException { + status = xdr.xdrDecodeInt(); + } + +} +// End of __db_re_len_reply.java diff --git a/db/rpc_server/java/gen/__db_re_pad_msg.java b/db/rpc_server/java/gen/__db_re_pad_msg.java new file mode 100644 index 000000000..2c1290b6e --- /dev/null +++ b/db/rpc_server/java/gen/__db_re_pad_msg.java @@ -0,0 +1,35 @@ +/* + * Automatically generated by jrpcgen 0.95.1 on 12/18/01 7:23 PM + * jrpcgen is part of the "Remote Tea" ONC/RPC package for Java + * See http://acplt.org/ks/remotetea.html for details + */ +package com.sleepycat.db.rpcserver; +import org.acplt.oncrpc.*; +import java.io.IOException; + +public class __db_re_pad_msg implements XdrAble { + public int dbpcl_id; + public int pad; + + public __db_re_pad_msg() { + } + + public __db_re_pad_msg(XdrDecodingStream xdr) + throws OncRpcException, IOException { + xdrDecode(xdr); + } + + public void xdrEncode(XdrEncodingStream xdr) + throws OncRpcException, IOException { + xdr.xdrEncodeInt(dbpcl_id); + xdr.xdrEncodeInt(pad); + } + + public void xdrDecode(XdrDecodingStream xdr) + throws OncRpcException, IOException { + dbpcl_id = xdr.xdrDecodeInt(); + pad = xdr.xdrDecodeInt(); + } + +} +// End of __db_re_pad_msg.java diff --git a/db/rpc_server/java/gen/__db_re_pad_reply.java b/db/rpc_server/java/gen/__db_re_pad_reply.java new file mode 100644 index 000000000..f0aaa9a3a --- /dev/null +++ b/db/rpc_server/java/gen/__db_re_pad_reply.java @@ -0,0 +1,32 @@ +/* + * Automatically generated by jrpcgen 0.95.1 on 12/18/01 7:23 PM + * jrpcgen is part of the "Remote Tea" ONC/RPC package for Java + * See http://acplt.org/ks/remotetea.html for details + */ +package com.sleepycat.db.rpcserver; +import org.acplt.oncrpc.*; +import java.io.IOException; + +public class __db_re_pad_reply implements XdrAble { + public int status; + + public __db_re_pad_reply() { + } + + public __db_re_pad_reply(XdrDecodingStream xdr) + throws OncRpcException, IOException { + xdrDecode(xdr); + } + + public void xdrEncode(XdrEncodingStream xdr) + throws OncRpcException, IOException { + xdr.xdrEncodeInt(status); + } + + public void xdrDecode(XdrDecodingStream xdr) + throws OncRpcException, IOException { + status = xdr.xdrDecodeInt(); + } + +} +// End of __db_re_pad_reply.java diff --git a/db/rpc_server/java/gen/__db_remove_msg.java b/db/rpc_server/java/gen/__db_remove_msg.java new file mode 100644 index 000000000..dfa9066a7 --- /dev/null +++ b/db/rpc_server/java/gen/__db_remove_msg.java @@ -0,0 +1,41 @@ +/* + * Automatically generated by jrpcgen 0.95.1 on 12/18/01 7:23 PM + * jrpcgen is part of the "Remote Tea" ONC/RPC package for Java + * See http://acplt.org/ks/remotetea.html for details + */ +package com.sleepycat.db.rpcserver; +import org.acplt.oncrpc.*; +import java.io.IOException; + +public class __db_remove_msg implements XdrAble { + public int dbpcl_id; + public String name; + public String subdb; + public int flags; + + public __db_remove_msg() { + } + + public __db_remove_msg(XdrDecodingStream xdr) + throws OncRpcException, IOException { + xdrDecode(xdr); + } + + public void xdrEncode(XdrEncodingStream xdr) + throws OncRpcException, IOException { + xdr.xdrEncodeInt(dbpcl_id); + xdr.xdrEncodeString(name); + xdr.xdrEncodeString(subdb); + xdr.xdrEncodeInt(flags); + } + + public void xdrDecode(XdrDecodingStream xdr) + throws OncRpcException, IOException { + dbpcl_id = xdr.xdrDecodeInt(); + name = xdr.xdrDecodeString(); + subdb = xdr.xdrDecodeString(); + flags = xdr.xdrDecodeInt(); + } + +} +// End of __db_remove_msg.java diff --git a/db/rpc_server/java/gen/__db_remove_reply.java b/db/rpc_server/java/gen/__db_remove_reply.java new file mode 100644 index 000000000..a2b86c049 --- /dev/null +++ b/db/rpc_server/java/gen/__db_remove_reply.java @@ -0,0 +1,32 @@ +/* + * Automatically generated by jrpcgen 0.95.1 on 12/18/01 7:23 PM + * jrpcgen is part of the "Remote Tea" ONC/RPC package for Java + * See http://acplt.org/ks/remotetea.html for details + */ +package com.sleepycat.db.rpcserver; +import org.acplt.oncrpc.*; +import java.io.IOException; + +public class __db_remove_reply implements XdrAble { + public int status; + + public __db_remove_reply() { + } + + public __db_remove_reply(XdrDecodingStream xdr) + throws OncRpcException, IOException { + xdrDecode(xdr); + } + + public void xdrEncode(XdrEncodingStream xdr) + throws OncRpcException, IOException { + xdr.xdrEncodeInt(status); + } + + public void xdrDecode(XdrDecodingStream xdr) + throws OncRpcException, IOException { + status = xdr.xdrDecodeInt(); + } + +} +// End of __db_remove_reply.java diff --git a/db/rpc_server/java/gen/__db_rename_msg.java b/db/rpc_server/java/gen/__db_rename_msg.java new file mode 100644 index 000000000..12b434e33 --- /dev/null +++ b/db/rpc_server/java/gen/__db_rename_msg.java @@ -0,0 +1,44 @@ +/* + * Automatically generated by jrpcgen 0.95.1 on 12/18/01 7:23 PM + * jrpcgen is part of the "Remote Tea" ONC/RPC package for Java + * See http://acplt.org/ks/remotetea.html for details + */ +package com.sleepycat.db.rpcserver; +import org.acplt.oncrpc.*; +import java.io.IOException; + +public class __db_rename_msg implements XdrAble { + public int dbpcl_id; + public String name; + public String subdb; + public String newname; + public int flags; + + public __db_rename_msg() { + } + + public __db_rename_msg(XdrDecodingStream xdr) + throws OncRpcException, IOException { + xdrDecode(xdr); + } + + public void xdrEncode(XdrEncodingStream xdr) + throws OncRpcException, IOException { + xdr.xdrEncodeInt(dbpcl_id); + xdr.xdrEncodeString(name); + xdr.xdrEncodeString(subdb); + xdr.xdrEncodeString(newname); + xdr.xdrEncodeInt(flags); + } + + public void xdrDecode(XdrDecodingStream xdr) + throws OncRpcException, IOException { + dbpcl_id = xdr.xdrDecodeInt(); + name = xdr.xdrDecodeString(); + subdb = xdr.xdrDecodeString(); + newname = xdr.xdrDecodeString(); + flags = xdr.xdrDecodeInt(); + } + +} +// End of __db_rename_msg.java diff --git a/db/rpc_server/java/gen/__db_rename_reply.java b/db/rpc_server/java/gen/__db_rename_reply.java new file mode 100644 index 000000000..4e4a22be5 --- /dev/null +++ b/db/rpc_server/java/gen/__db_rename_reply.java @@ -0,0 +1,32 @@ +/* + * Automatically generated by jrpcgen 0.95.1 on 12/18/01 7:23 PM + * jrpcgen is part of the "Remote Tea" ONC/RPC package for Java + * See http://acplt.org/ks/remotetea.html for details + */ +package com.sleepycat.db.rpcserver; +import org.acplt.oncrpc.*; +import java.io.IOException; + +public class __db_rename_reply implements XdrAble { + public int status; + + public __db_rename_reply() { + } + + public __db_rename_reply(XdrDecodingStream xdr) + throws OncRpcException, IOException { + xdrDecode(xdr); + } + + public void xdrEncode(XdrEncodingStream xdr) + throws OncRpcException, IOException { + xdr.xdrEncodeInt(status); + } + + public void xdrDecode(XdrDecodingStream xdr) + throws OncRpcException, IOException { + status = xdr.xdrDecodeInt(); + } + +} +// End of __db_rename_reply.java diff --git a/db/rpc_server/java/gen/__db_stat_msg.java b/db/rpc_server/java/gen/__db_stat_msg.java new file mode 100644 index 000000000..af536b5f7 --- /dev/null +++ b/db/rpc_server/java/gen/__db_stat_msg.java @@ -0,0 +1,35 @@ +/* + * Automatically generated by jrpcgen 0.95.1 on 12/18/01 7:23 PM + * jrpcgen is part of the "Remote Tea" ONC/RPC package for Java + * See http://acplt.org/ks/remotetea.html for details + */ +package com.sleepycat.db.rpcserver; +import org.acplt.oncrpc.*; +import java.io.IOException; + +public class __db_stat_msg implements XdrAble { + public int dbpcl_id; + public int flags; + + public __db_stat_msg() { + } + + public __db_stat_msg(XdrDecodingStream xdr) + throws OncRpcException, IOException { + xdrDecode(xdr); + } + + public void xdrEncode(XdrEncodingStream xdr) + throws OncRpcException, IOException { + xdr.xdrEncodeInt(dbpcl_id); + xdr.xdrEncodeInt(flags); + } + + public void xdrDecode(XdrDecodingStream xdr) + throws OncRpcException, IOException { + dbpcl_id = xdr.xdrDecodeInt(); + flags = xdr.xdrDecodeInt(); + } + +} +// End of __db_stat_msg.java diff --git a/db/rpc_server/java/gen/__db_stat_reply.java b/db/rpc_server/java/gen/__db_stat_reply.java new file mode 100644 index 000000000..8df146014 --- /dev/null +++ b/db/rpc_server/java/gen/__db_stat_reply.java @@ -0,0 +1,35 @@ +/* + * Automatically generated by jrpcgen 0.95.1 on 12/18/01 7:23 PM + * jrpcgen is part of the "Remote Tea" ONC/RPC package for Java + * See http://acplt.org/ks/remotetea.html for details + */ +package com.sleepycat.db.rpcserver; +import org.acplt.oncrpc.*; +import java.io.IOException; + +public class __db_stat_reply implements XdrAble { + public int status; + public int [] stats; + + public __db_stat_reply() { + } + + public __db_stat_reply(XdrDecodingStream xdr) + throws OncRpcException, IOException { + xdrDecode(xdr); + } + + public void xdrEncode(XdrEncodingStream xdr) + throws OncRpcException, IOException { + xdr.xdrEncodeInt(status); + xdr.xdrEncodeIntVector(stats); + } + + public void xdrDecode(XdrDecodingStream xdr) + throws OncRpcException, IOException { + status = xdr.xdrDecodeInt(); + stats = xdr.xdrDecodeIntVector(); + } + +} +// End of __db_stat_reply.java diff --git a/db/rpc_server/java/gen/__db_sync_msg.java b/db/rpc_server/java/gen/__db_sync_msg.java new file mode 100644 index 000000000..c6594670f --- /dev/null +++ b/db/rpc_server/java/gen/__db_sync_msg.java @@ -0,0 +1,35 @@ +/* + * Automatically generated by jrpcgen 0.95.1 on 12/18/01 7:23 PM + * jrpcgen is part of the "Remote Tea" ONC/RPC package for Java + * See http://acplt.org/ks/remotetea.html for details + */ +package com.sleepycat.db.rpcserver; +import org.acplt.oncrpc.*; +import java.io.IOException; + +public class __db_sync_msg implements XdrAble { + public int dbpcl_id; + public int flags; + + public __db_sync_msg() { + } + + public __db_sync_msg(XdrDecodingStream xdr) + throws OncRpcException, IOException { + xdrDecode(xdr); + } + + public void xdrEncode(XdrEncodingStream xdr) + throws OncRpcException, IOException { + xdr.xdrEncodeInt(dbpcl_id); + xdr.xdrEncodeInt(flags); + } + + public void xdrDecode(XdrDecodingStream xdr) + throws OncRpcException, IOException { + dbpcl_id = xdr.xdrDecodeInt(); + flags = xdr.xdrDecodeInt(); + } + +} +// End of __db_sync_msg.java diff --git a/db/rpc_server/java/gen/__db_sync_reply.java b/db/rpc_server/java/gen/__db_sync_reply.java new file mode 100644 index 000000000..d0a8bc8b1 --- /dev/null +++ b/db/rpc_server/java/gen/__db_sync_reply.java @@ -0,0 +1,32 @@ +/* + * Automatically generated by jrpcgen 0.95.1 on 12/18/01 7:23 PM + * jrpcgen is part of the "Remote Tea" ONC/RPC package for Java + * See http://acplt.org/ks/remotetea.html for details + */ +package com.sleepycat.db.rpcserver; +import org.acplt.oncrpc.*; +import java.io.IOException; + +public class __db_sync_reply implements XdrAble { + public int status; + + public __db_sync_reply() { + } + + public __db_sync_reply(XdrDecodingStream xdr) + throws OncRpcException, IOException { + xdrDecode(xdr); + } + + public void xdrEncode(XdrEncodingStream xdr) + throws OncRpcException, IOException { + xdr.xdrEncodeInt(status); + } + + public void xdrDecode(XdrDecodingStream xdr) + throws OncRpcException, IOException { + status = xdr.xdrDecodeInt(); + } + +} +// End of __db_sync_reply.java diff --git a/db/rpc_server/java/gen/__db_truncate_msg.java b/db/rpc_server/java/gen/__db_truncate_msg.java new file mode 100644 index 000000000..38810d656 --- /dev/null +++ b/db/rpc_server/java/gen/__db_truncate_msg.java @@ -0,0 +1,38 @@ +/* + * Automatically generated by jrpcgen 0.95.1 on 12/18/01 7:23 PM + * jrpcgen is part of the "Remote Tea" ONC/RPC package for Java + * See http://acplt.org/ks/remotetea.html for details + */ +package com.sleepycat.db.rpcserver; +import org.acplt.oncrpc.*; +import java.io.IOException; + +public class __db_truncate_msg implements XdrAble { + public int dbpcl_id; + public int txnpcl_id; + public int flags; + + public __db_truncate_msg() { + } + + public __db_truncate_msg(XdrDecodingStream xdr) + throws OncRpcException, IOException { + xdrDecode(xdr); + } + + public void xdrEncode(XdrEncodingStream xdr) + throws OncRpcException, IOException { + xdr.xdrEncodeInt(dbpcl_id); + xdr.xdrEncodeInt(txnpcl_id); + xdr.xdrEncodeInt(flags); + } + + public void xdrDecode(XdrDecodingStream xdr) + throws OncRpcException, IOException { + dbpcl_id = xdr.xdrDecodeInt(); + txnpcl_id = xdr.xdrDecodeInt(); + flags = xdr.xdrDecodeInt(); + } + +} +// End of __db_truncate_msg.java diff --git a/db/rpc_server/java/gen/__db_truncate_reply.java b/db/rpc_server/java/gen/__db_truncate_reply.java new file mode 100644 index 000000000..c4f688690 --- /dev/null +++ b/db/rpc_server/java/gen/__db_truncate_reply.java @@ -0,0 +1,35 @@ +/* + * Automatically generated by jrpcgen 0.95.1 on 12/18/01 7:23 PM + * jrpcgen is part of the "Remote Tea" ONC/RPC package for Java + * See http://acplt.org/ks/remotetea.html for details + */ +package com.sleepycat.db.rpcserver; +import org.acplt.oncrpc.*; +import java.io.IOException; + +public class __db_truncate_reply implements XdrAble { + public int status; + public int count; + + public __db_truncate_reply() { + } + + public __db_truncate_reply(XdrDecodingStream xdr) + throws OncRpcException, IOException { + xdrDecode(xdr); + } + + public void xdrEncode(XdrEncodingStream xdr) + throws OncRpcException, IOException { + xdr.xdrEncodeInt(status); + xdr.xdrEncodeInt(count); + } + + public void xdrDecode(XdrDecodingStream xdr) + throws OncRpcException, IOException { + status = xdr.xdrDecodeInt(); + count = xdr.xdrDecodeInt(); + } + +} +// End of __db_truncate_reply.java diff --git a/db/rpc_server/java/gen/__dbc_close_msg.java b/db/rpc_server/java/gen/__dbc_close_msg.java new file mode 100644 index 000000000..eb1ca7f7e --- /dev/null +++ b/db/rpc_server/java/gen/__dbc_close_msg.java @@ -0,0 +1,32 @@ +/* + * Automatically generated by jrpcgen 0.95.1 on 12/18/01 7:23 PM + * jrpcgen is part of the "Remote Tea" ONC/RPC package for Java + * See http://acplt.org/ks/remotetea.html for details + */ +package com.sleepycat.db.rpcserver; +import org.acplt.oncrpc.*; +import java.io.IOException; + +public class __dbc_close_msg implements XdrAble { + public int dbccl_id; + + public __dbc_close_msg() { + } + + public __dbc_close_msg(XdrDecodingStream xdr) + throws OncRpcException, IOException { + xdrDecode(xdr); + } + + public void xdrEncode(XdrEncodingStream xdr) + throws OncRpcException, IOException { + xdr.xdrEncodeInt(dbccl_id); + } + + public void xdrDecode(XdrDecodingStream xdr) + throws OncRpcException, IOException { + dbccl_id = xdr.xdrDecodeInt(); + } + +} +// End of __dbc_close_msg.java diff --git a/db/rpc_server/java/gen/__dbc_close_reply.java b/db/rpc_server/java/gen/__dbc_close_reply.java new file mode 100644 index 000000000..47459aace --- /dev/null +++ b/db/rpc_server/java/gen/__dbc_close_reply.java @@ -0,0 +1,32 @@ +/* + * Automatically generated by jrpcgen 0.95.1 on 12/18/01 7:23 PM + * jrpcgen is part of the "Remote Tea" ONC/RPC package for Java + * See http://acplt.org/ks/remotetea.html for details + */ +package com.sleepycat.db.rpcserver; +import org.acplt.oncrpc.*; +import java.io.IOException; + +public class __dbc_close_reply implements XdrAble { + public int status; + + public __dbc_close_reply() { + } + + public __dbc_close_reply(XdrDecodingStream xdr) + throws OncRpcException, IOException { + xdrDecode(xdr); + } + + public void xdrEncode(XdrEncodingStream xdr) + throws OncRpcException, IOException { + xdr.xdrEncodeInt(status); + } + + public void xdrDecode(XdrDecodingStream xdr) + throws OncRpcException, IOException { + status = xdr.xdrDecodeInt(); + } + +} +// End of __dbc_close_reply.java diff --git a/db/rpc_server/java/gen/__dbc_count_msg.java b/db/rpc_server/java/gen/__dbc_count_msg.java new file mode 100644 index 000000000..5f554e18a --- /dev/null +++ b/db/rpc_server/java/gen/__dbc_count_msg.java @@ -0,0 +1,35 @@ +/* + * Automatically generated by jrpcgen 0.95.1 on 12/18/01 7:23 PM + * jrpcgen is part of the "Remote Tea" ONC/RPC package for Java + * See http://acplt.org/ks/remotetea.html for details + */ +package com.sleepycat.db.rpcserver; +import org.acplt.oncrpc.*; +import java.io.IOException; + +public class __dbc_count_msg implements XdrAble { + public int dbccl_id; + public int flags; + + public __dbc_count_msg() { + } + + public __dbc_count_msg(XdrDecodingStream xdr) + throws OncRpcException, IOException { + xdrDecode(xdr); + } + + public void xdrEncode(XdrEncodingStream xdr) + throws OncRpcException, IOException { + xdr.xdrEncodeInt(dbccl_id); + xdr.xdrEncodeInt(flags); + } + + public void xdrDecode(XdrDecodingStream xdr) + throws OncRpcException, IOException { + dbccl_id = xdr.xdrDecodeInt(); + flags = xdr.xdrDecodeInt(); + } + +} +// End of __dbc_count_msg.java diff --git a/db/rpc_server/java/gen/__dbc_count_reply.java b/db/rpc_server/java/gen/__dbc_count_reply.java new file mode 100644 index 000000000..4daecdd22 --- /dev/null +++ b/db/rpc_server/java/gen/__dbc_count_reply.java @@ -0,0 +1,35 @@ +/* + * Automatically generated by jrpcgen 0.95.1 on 12/18/01 7:23 PM + * jrpcgen is part of the "Remote Tea" ONC/RPC package for Java + * See http://acplt.org/ks/remotetea.html for details + */ +package com.sleepycat.db.rpcserver; +import org.acplt.oncrpc.*; +import java.io.IOException; + +public class __dbc_count_reply implements XdrAble { + public int status; + public int dupcount; + + public __dbc_count_reply() { + } + + public __dbc_count_reply(XdrDecodingStream xdr) + throws OncRpcException, IOException { + xdrDecode(xdr); + } + + public void xdrEncode(XdrEncodingStream xdr) + throws OncRpcException, IOException { + xdr.xdrEncodeInt(status); + xdr.xdrEncodeInt(dupcount); + } + + public void xdrDecode(XdrDecodingStream xdr) + throws OncRpcException, IOException { + status = xdr.xdrDecodeInt(); + dupcount = xdr.xdrDecodeInt(); + } + +} +// End of __dbc_count_reply.java diff --git a/db/rpc_server/java/gen/__dbc_del_msg.java b/db/rpc_server/java/gen/__dbc_del_msg.java new file mode 100644 index 000000000..bc4bd05f5 --- /dev/null +++ b/db/rpc_server/java/gen/__dbc_del_msg.java @@ -0,0 +1,35 @@ +/* + * Automatically generated by jrpcgen 0.95.1 on 12/18/01 7:23 PM + * jrpcgen is part of the "Remote Tea" ONC/RPC package for Java + * See http://acplt.org/ks/remotetea.html for details + */ +package com.sleepycat.db.rpcserver; +import org.acplt.oncrpc.*; +import java.io.IOException; + +public class __dbc_del_msg implements XdrAble { + public int dbccl_id; + public int flags; + + public __dbc_del_msg() { + } + + public __dbc_del_msg(XdrDecodingStream xdr) + throws OncRpcException, IOException { + xdrDecode(xdr); + } + + public void xdrEncode(XdrEncodingStream xdr) + throws OncRpcException, IOException { + xdr.xdrEncodeInt(dbccl_id); + xdr.xdrEncodeInt(flags); + } + + public void xdrDecode(XdrDecodingStream xdr) + throws OncRpcException, IOException { + dbccl_id = xdr.xdrDecodeInt(); + flags = xdr.xdrDecodeInt(); + } + +} +// End of __dbc_del_msg.java diff --git a/db/rpc_server/java/gen/__dbc_del_reply.java b/db/rpc_server/java/gen/__dbc_del_reply.java new file mode 100644 index 000000000..e55ac9ffa --- /dev/null +++ b/db/rpc_server/java/gen/__dbc_del_reply.java @@ -0,0 +1,32 @@ +/* + * Automatically generated by jrpcgen 0.95.1 on 12/18/01 7:23 PM + * jrpcgen is part of the "Remote Tea" ONC/RPC package for Java + * See http://acplt.org/ks/remotetea.html for details + */ +package com.sleepycat.db.rpcserver; +import org.acplt.oncrpc.*; +import java.io.IOException; + +public class __dbc_del_reply implements XdrAble { + public int status; + + public __dbc_del_reply() { + } + + public __dbc_del_reply(XdrDecodingStream xdr) + throws OncRpcException, IOException { + xdrDecode(xdr); + } + + public void xdrEncode(XdrEncodingStream xdr) + throws OncRpcException, IOException { + xdr.xdrEncodeInt(status); + } + + public void xdrDecode(XdrDecodingStream xdr) + throws OncRpcException, IOException { + status = xdr.xdrDecodeInt(); + } + +} +// End of __dbc_del_reply.java diff --git a/db/rpc_server/java/gen/__dbc_dup_msg.java b/db/rpc_server/java/gen/__dbc_dup_msg.java new file mode 100644 index 000000000..9a3894e61 --- /dev/null +++ b/db/rpc_server/java/gen/__dbc_dup_msg.java @@ -0,0 +1,35 @@ +/* + * Automatically generated by jrpcgen 0.95.1 on 12/18/01 7:23 PM + * jrpcgen is part of the "Remote Tea" ONC/RPC package for Java + * See http://acplt.org/ks/remotetea.html for details + */ +package com.sleepycat.db.rpcserver; +import org.acplt.oncrpc.*; +import java.io.IOException; + +public class __dbc_dup_msg implements XdrAble { + public int dbccl_id; + public int flags; + + public __dbc_dup_msg() { + } + + public __dbc_dup_msg(XdrDecodingStream xdr) + throws OncRpcException, IOException { + xdrDecode(xdr); + } + + public void xdrEncode(XdrEncodingStream xdr) + throws OncRpcException, IOException { + xdr.xdrEncodeInt(dbccl_id); + xdr.xdrEncodeInt(flags); + } + + public void xdrDecode(XdrDecodingStream xdr) + throws OncRpcException, IOException { + dbccl_id = xdr.xdrDecodeInt(); + flags = xdr.xdrDecodeInt(); + } + +} +// End of __dbc_dup_msg.java diff --git a/db/rpc_server/java/gen/__dbc_dup_reply.java b/db/rpc_server/java/gen/__dbc_dup_reply.java new file mode 100644 index 000000000..6b942f1a6 --- /dev/null +++ b/db/rpc_server/java/gen/__dbc_dup_reply.java @@ -0,0 +1,35 @@ +/* + * Automatically generated by jrpcgen 0.95.1 on 12/18/01 7:23 PM + * jrpcgen is part of the "Remote Tea" ONC/RPC package for Java + * See http://acplt.org/ks/remotetea.html for details + */ +package com.sleepycat.db.rpcserver; +import org.acplt.oncrpc.*; +import java.io.IOException; + +public class __dbc_dup_reply implements XdrAble { + public int status; + public int dbcidcl_id; + + public __dbc_dup_reply() { + } + + public __dbc_dup_reply(XdrDecodingStream xdr) + throws OncRpcException, IOException { + xdrDecode(xdr); + } + + public void xdrEncode(XdrEncodingStream xdr) + throws OncRpcException, IOException { + xdr.xdrEncodeInt(status); + xdr.xdrEncodeInt(dbcidcl_id); + } + + public void xdrDecode(XdrDecodingStream xdr) + throws OncRpcException, IOException { + status = xdr.xdrDecodeInt(); + dbcidcl_id = xdr.xdrDecodeInt(); + } + +} +// End of __dbc_dup_reply.java diff --git a/db/rpc_server/java/gen/__dbc_get_msg.java b/db/rpc_server/java/gen/__dbc_get_msg.java new file mode 100644 index 000000000..672ace43f --- /dev/null +++ b/db/rpc_server/java/gen/__dbc_get_msg.java @@ -0,0 +1,65 @@ +/* + * Automatically generated by jrpcgen 0.95.1 on 12/18/01 7:23 PM + * jrpcgen is part of the "Remote Tea" ONC/RPC package for Java + * See http://acplt.org/ks/remotetea.html for details + */ +package com.sleepycat.db.rpcserver; +import org.acplt.oncrpc.*; +import java.io.IOException; + +public class __dbc_get_msg implements XdrAble { + public int dbccl_id; + public int keydlen; + public int keydoff; + public int keyulen; + public int keyflags; + public byte [] keydata; + public int datadlen; + public int datadoff; + public int dataulen; + public int dataflags; + public byte [] datadata; + public int flags; + + public __dbc_get_msg() { + } + + public __dbc_get_msg(XdrDecodingStream xdr) + throws OncRpcException, IOException { + xdrDecode(xdr); + } + + public void xdrEncode(XdrEncodingStream xdr) + throws OncRpcException, IOException { + xdr.xdrEncodeInt(dbccl_id); + xdr.xdrEncodeInt(keydlen); + xdr.xdrEncodeInt(keydoff); + xdr.xdrEncodeInt(keyulen); + xdr.xdrEncodeInt(keyflags); + xdr.xdrEncodeDynamicOpaque(keydata); + xdr.xdrEncodeInt(datadlen); + xdr.xdrEncodeInt(datadoff); + xdr.xdrEncodeInt(dataulen); + xdr.xdrEncodeInt(dataflags); + xdr.xdrEncodeDynamicOpaque(datadata); + xdr.xdrEncodeInt(flags); + } + + public void xdrDecode(XdrDecodingStream xdr) + throws OncRpcException, IOException { + dbccl_id = xdr.xdrDecodeInt(); + keydlen = xdr.xdrDecodeInt(); + keydoff = xdr.xdrDecodeInt(); + keyulen = xdr.xdrDecodeInt(); + keyflags = xdr.xdrDecodeInt(); + keydata = xdr.xdrDecodeDynamicOpaque(); + datadlen = xdr.xdrDecodeInt(); + datadoff = xdr.xdrDecodeInt(); + dataulen = xdr.xdrDecodeInt(); + dataflags = xdr.xdrDecodeInt(); + datadata = xdr.xdrDecodeDynamicOpaque(); + flags = xdr.xdrDecodeInt(); + } + +} +// End of __dbc_get_msg.java diff --git a/db/rpc_server/java/gen/__dbc_get_reply.java b/db/rpc_server/java/gen/__dbc_get_reply.java new file mode 100644 index 000000000..8671fec63 --- /dev/null +++ b/db/rpc_server/java/gen/__dbc_get_reply.java @@ -0,0 +1,38 @@ +/* + * Automatically generated by jrpcgen 0.95.1 on 12/18/01 7:23 PM + * jrpcgen is part of the "Remote Tea" ONC/RPC package for Java + * See http://acplt.org/ks/remotetea.html for details + */ +package com.sleepycat.db.rpcserver; +import org.acplt.oncrpc.*; +import java.io.IOException; + +public class __dbc_get_reply implements XdrAble { + public int status; + public byte [] keydata; + public byte [] datadata; + + public __dbc_get_reply() { + } + + public __dbc_get_reply(XdrDecodingStream xdr) + throws OncRpcException, IOException { + xdrDecode(xdr); + } + + public void xdrEncode(XdrEncodingStream xdr) + throws OncRpcException, IOException { + xdr.xdrEncodeInt(status); + xdr.xdrEncodeDynamicOpaque(keydata); + xdr.xdrEncodeDynamicOpaque(datadata); + } + + public void xdrDecode(XdrDecodingStream xdr) + throws OncRpcException, IOException { + status = xdr.xdrDecodeInt(); + keydata = xdr.xdrDecodeDynamicOpaque(); + datadata = xdr.xdrDecodeDynamicOpaque(); + } + +} +// End of __dbc_get_reply.java diff --git a/db/rpc_server/java/gen/__dbc_pget_msg.java b/db/rpc_server/java/gen/__dbc_pget_msg.java new file mode 100644 index 000000000..8ca3c6171 --- /dev/null +++ b/db/rpc_server/java/gen/__dbc_pget_msg.java @@ -0,0 +1,80 @@ +/* + * Automatically generated by jrpcgen 0.95.1 on 12/18/01 7:23 PM + * jrpcgen is part of the "Remote Tea" ONC/RPC package for Java + * See http://acplt.org/ks/remotetea.html for details + */ +package com.sleepycat.db.rpcserver; +import org.acplt.oncrpc.*; +import java.io.IOException; + +public class __dbc_pget_msg implements XdrAble { + public int dbccl_id; + public int skeydlen; + public int skeydoff; + public int skeyulen; + public int skeyflags; + public byte [] skeydata; + public int pkeydlen; + public int pkeydoff; + public int pkeyulen; + public int pkeyflags; + public byte [] pkeydata; + public int datadlen; + public int datadoff; + public int dataulen; + public int dataflags; + public byte [] datadata; + public int flags; + + public __dbc_pget_msg() { + } + + public __dbc_pget_msg(XdrDecodingStream xdr) + throws OncRpcException, IOException { + xdrDecode(xdr); + } + + public void xdrEncode(XdrEncodingStream xdr) + throws OncRpcException, IOException { + xdr.xdrEncodeInt(dbccl_id); + xdr.xdrEncodeInt(skeydlen); + xdr.xdrEncodeInt(skeydoff); + xdr.xdrEncodeInt(skeyulen); + xdr.xdrEncodeInt(skeyflags); + xdr.xdrEncodeDynamicOpaque(skeydata); + xdr.xdrEncodeInt(pkeydlen); + xdr.xdrEncodeInt(pkeydoff); + xdr.xdrEncodeInt(pkeyulen); + xdr.xdrEncodeInt(pkeyflags); + xdr.xdrEncodeDynamicOpaque(pkeydata); + xdr.xdrEncodeInt(datadlen); + xdr.xdrEncodeInt(datadoff); + xdr.xdrEncodeInt(dataulen); + xdr.xdrEncodeInt(dataflags); + xdr.xdrEncodeDynamicOpaque(datadata); + xdr.xdrEncodeInt(flags); + } + + public void xdrDecode(XdrDecodingStream xdr) + throws OncRpcException, IOException { + dbccl_id = xdr.xdrDecodeInt(); + skeydlen = xdr.xdrDecodeInt(); + skeydoff = xdr.xdrDecodeInt(); + skeyulen = xdr.xdrDecodeInt(); + skeyflags = xdr.xdrDecodeInt(); + skeydata = xdr.xdrDecodeDynamicOpaque(); + pkeydlen = xdr.xdrDecodeInt(); + pkeydoff = xdr.xdrDecodeInt(); + pkeyulen = xdr.xdrDecodeInt(); + pkeyflags = xdr.xdrDecodeInt(); + pkeydata = xdr.xdrDecodeDynamicOpaque(); + datadlen = xdr.xdrDecodeInt(); + datadoff = xdr.xdrDecodeInt(); + dataulen = xdr.xdrDecodeInt(); + dataflags = xdr.xdrDecodeInt(); + datadata = xdr.xdrDecodeDynamicOpaque(); + flags = xdr.xdrDecodeInt(); + } + +} +// End of __dbc_pget_msg.java diff --git a/db/rpc_server/java/gen/__dbc_pget_reply.java b/db/rpc_server/java/gen/__dbc_pget_reply.java new file mode 100644 index 000000000..16cc79587 --- /dev/null +++ b/db/rpc_server/java/gen/__dbc_pget_reply.java @@ -0,0 +1,41 @@ +/* + * Automatically generated by jrpcgen 0.95.1 on 12/18/01 7:23 PM + * jrpcgen is part of the "Remote Tea" ONC/RPC package for Java + * See http://acplt.org/ks/remotetea.html for details + */ +package com.sleepycat.db.rpcserver; +import org.acplt.oncrpc.*; +import java.io.IOException; + +public class __dbc_pget_reply implements XdrAble { + public int status; + public byte [] skeydata; + public byte [] pkeydata; + public byte [] datadata; + + public __dbc_pget_reply() { + } + + public __dbc_pget_reply(XdrDecodingStream xdr) + throws OncRpcException, IOException { + xdrDecode(xdr); + } + + public void xdrEncode(XdrEncodingStream xdr) + throws OncRpcException, IOException { + xdr.xdrEncodeInt(status); + xdr.xdrEncodeDynamicOpaque(skeydata); + xdr.xdrEncodeDynamicOpaque(pkeydata); + xdr.xdrEncodeDynamicOpaque(datadata); + } + + public void xdrDecode(XdrDecodingStream xdr) + throws OncRpcException, IOException { + status = xdr.xdrDecodeInt(); + skeydata = xdr.xdrDecodeDynamicOpaque(); + pkeydata = xdr.xdrDecodeDynamicOpaque(); + datadata = xdr.xdrDecodeDynamicOpaque(); + } + +} +// End of __dbc_pget_reply.java diff --git a/db/rpc_server/java/gen/__dbc_put_msg.java b/db/rpc_server/java/gen/__dbc_put_msg.java new file mode 100644 index 000000000..98d12423d --- /dev/null +++ b/db/rpc_server/java/gen/__dbc_put_msg.java @@ -0,0 +1,65 @@ +/* + * Automatically generated by jrpcgen 0.95.1 on 12/18/01 7:23 PM + * jrpcgen is part of the "Remote Tea" ONC/RPC package for Java + * See http://acplt.org/ks/remotetea.html for details + */ +package com.sleepycat.db.rpcserver; +import org.acplt.oncrpc.*; +import java.io.IOException; + +public class __dbc_put_msg implements XdrAble { + public int dbccl_id; + public int keydlen; + public int keydoff; + public int keyulen; + public int keyflags; + public byte [] keydata; + public int datadlen; + public int datadoff; + public int dataulen; + public int dataflags; + public byte [] datadata; + public int flags; + + public __dbc_put_msg() { + } + + public __dbc_put_msg(XdrDecodingStream xdr) + throws OncRpcException, IOException { + xdrDecode(xdr); + } + + public void xdrEncode(XdrEncodingStream xdr) + throws OncRpcException, IOException { + xdr.xdrEncodeInt(dbccl_id); + xdr.xdrEncodeInt(keydlen); + xdr.xdrEncodeInt(keydoff); + xdr.xdrEncodeInt(keyulen); + xdr.xdrEncodeInt(keyflags); + xdr.xdrEncodeDynamicOpaque(keydata); + xdr.xdrEncodeInt(datadlen); + xdr.xdrEncodeInt(datadoff); + xdr.xdrEncodeInt(dataulen); + xdr.xdrEncodeInt(dataflags); + xdr.xdrEncodeDynamicOpaque(datadata); + xdr.xdrEncodeInt(flags); + } + + public void xdrDecode(XdrDecodingStream xdr) + throws OncRpcException, IOException { + dbccl_id = xdr.xdrDecodeInt(); + keydlen = xdr.xdrDecodeInt(); + keydoff = xdr.xdrDecodeInt(); + keyulen = xdr.xdrDecodeInt(); + keyflags = xdr.xdrDecodeInt(); + keydata = xdr.xdrDecodeDynamicOpaque(); + datadlen = xdr.xdrDecodeInt(); + datadoff = xdr.xdrDecodeInt(); + dataulen = xdr.xdrDecodeInt(); + dataflags = xdr.xdrDecodeInt(); + datadata = xdr.xdrDecodeDynamicOpaque(); + flags = xdr.xdrDecodeInt(); + } + +} +// End of __dbc_put_msg.java diff --git a/db/rpc_server/java/gen/__dbc_put_reply.java b/db/rpc_server/java/gen/__dbc_put_reply.java new file mode 100644 index 000000000..385f9f783 --- /dev/null +++ b/db/rpc_server/java/gen/__dbc_put_reply.java @@ -0,0 +1,35 @@ +/* + * Automatically generated by jrpcgen 0.95.1 on 12/18/01 7:23 PM + * jrpcgen is part of the "Remote Tea" ONC/RPC package for Java + * See http://acplt.org/ks/remotetea.html for details + */ +package com.sleepycat.db.rpcserver; +import org.acplt.oncrpc.*; +import java.io.IOException; + +public class __dbc_put_reply implements XdrAble { + public int status; + public byte [] keydata; + + public __dbc_put_reply() { + } + + public __dbc_put_reply(XdrDecodingStream xdr) + throws OncRpcException, IOException { + xdrDecode(xdr); + } + + public void xdrEncode(XdrEncodingStream xdr) + throws OncRpcException, IOException { + xdr.xdrEncodeInt(status); + xdr.xdrEncodeDynamicOpaque(keydata); + } + + public void xdrDecode(XdrDecodingStream xdr) + throws OncRpcException, IOException { + status = xdr.xdrDecodeInt(); + keydata = xdr.xdrDecodeDynamicOpaque(); + } + +} +// End of __dbc_put_reply.java diff --git a/db/rpc_server/java/gen/__env_cachesize_msg.java b/db/rpc_server/java/gen/__env_cachesize_msg.java new file mode 100644 index 000000000..d1fce1ffa --- /dev/null +++ b/db/rpc_server/java/gen/__env_cachesize_msg.java @@ -0,0 +1,41 @@ +/* + * Automatically generated by jrpcgen 0.95.1 on 12/18/01 7:23 PM + * jrpcgen is part of the "Remote Tea" ONC/RPC package for Java + * See http://acplt.org/ks/remotetea.html for details + */ +package com.sleepycat.db.rpcserver; +import org.acplt.oncrpc.*; +import java.io.IOException; + +public class __env_cachesize_msg implements XdrAble { + public int dbenvcl_id; + public int gbytes; + public int bytes; + public int ncache; + + public __env_cachesize_msg() { + } + + public __env_cachesize_msg(XdrDecodingStream xdr) + throws OncRpcException, IOException { + xdrDecode(xdr); + } + + public void xdrEncode(XdrEncodingStream xdr) + throws OncRpcException, IOException { + xdr.xdrEncodeInt(dbenvcl_id); + xdr.xdrEncodeInt(gbytes); + xdr.xdrEncodeInt(bytes); + xdr.xdrEncodeInt(ncache); + } + + public void xdrDecode(XdrDecodingStream xdr) + throws OncRpcException, IOException { + dbenvcl_id = xdr.xdrDecodeInt(); + gbytes = xdr.xdrDecodeInt(); + bytes = xdr.xdrDecodeInt(); + ncache = xdr.xdrDecodeInt(); + } + +} +// End of __env_cachesize_msg.java diff --git a/db/rpc_server/java/gen/__env_cachesize_reply.java b/db/rpc_server/java/gen/__env_cachesize_reply.java new file mode 100644 index 000000000..193f8355d --- /dev/null +++ b/db/rpc_server/java/gen/__env_cachesize_reply.java @@ -0,0 +1,32 @@ +/* + * Automatically generated by jrpcgen 0.95.1 on 12/18/01 7:23 PM + * jrpcgen is part of the "Remote Tea" ONC/RPC package for Java + * See http://acplt.org/ks/remotetea.html for details + */ +package com.sleepycat.db.rpcserver; +import org.acplt.oncrpc.*; +import java.io.IOException; + +public class __env_cachesize_reply implements XdrAble { + public int status; + + public __env_cachesize_reply() { + } + + public __env_cachesize_reply(XdrDecodingStream xdr) + throws OncRpcException, IOException { + xdrDecode(xdr); + } + + public void xdrEncode(XdrEncodingStream xdr) + throws OncRpcException, IOException { + xdr.xdrEncodeInt(status); + } + + public void xdrDecode(XdrDecodingStream xdr) + throws OncRpcException, IOException { + status = xdr.xdrDecodeInt(); + } + +} +// End of __env_cachesize_reply.java diff --git a/db/rpc_server/java/gen/__env_close_msg.java b/db/rpc_server/java/gen/__env_close_msg.java new file mode 100644 index 000000000..5e657bacf --- /dev/null +++ b/db/rpc_server/java/gen/__env_close_msg.java @@ -0,0 +1,35 @@ +/* + * Automatically generated by jrpcgen 0.95.1 on 12/18/01 7:23 PM + * jrpcgen is part of the "Remote Tea" ONC/RPC package for Java + * See http://acplt.org/ks/remotetea.html for details + */ +package com.sleepycat.db.rpcserver; +import org.acplt.oncrpc.*; +import java.io.IOException; + +public class __env_close_msg implements XdrAble { + public int dbenvcl_id; + public int flags; + + public __env_close_msg() { + } + + public __env_close_msg(XdrDecodingStream xdr) + throws OncRpcException, IOException { + xdrDecode(xdr); + } + + public void xdrEncode(XdrEncodingStream xdr) + throws OncRpcException, IOException { + xdr.xdrEncodeInt(dbenvcl_id); + xdr.xdrEncodeInt(flags); + } + + public void xdrDecode(XdrDecodingStream xdr) + throws OncRpcException, IOException { + dbenvcl_id = xdr.xdrDecodeInt(); + flags = xdr.xdrDecodeInt(); + } + +} +// End of __env_close_msg.java diff --git a/db/rpc_server/java/gen/__env_close_reply.java b/db/rpc_server/java/gen/__env_close_reply.java new file mode 100644 index 000000000..11e61f7c8 --- /dev/null +++ b/db/rpc_server/java/gen/__env_close_reply.java @@ -0,0 +1,32 @@ +/* + * Automatically generated by jrpcgen 0.95.1 on 12/18/01 7:23 PM + * jrpcgen is part of the "Remote Tea" ONC/RPC package for Java + * See http://acplt.org/ks/remotetea.html for details + */ +package com.sleepycat.db.rpcserver; +import org.acplt.oncrpc.*; +import java.io.IOException; + +public class __env_close_reply implements XdrAble { + public int status; + + public __env_close_reply() { + } + + public __env_close_reply(XdrDecodingStream xdr) + throws OncRpcException, IOException { + xdrDecode(xdr); + } + + public void xdrEncode(XdrEncodingStream xdr) + throws OncRpcException, IOException { + xdr.xdrEncodeInt(status); + } + + public void xdrDecode(XdrDecodingStream xdr) + throws OncRpcException, IOException { + status = xdr.xdrDecodeInt(); + } + +} +// End of __env_close_reply.java diff --git a/db/rpc_server/java/gen/__env_create_msg.java b/db/rpc_server/java/gen/__env_create_msg.java new file mode 100644 index 000000000..dbe546ae2 --- /dev/null +++ b/db/rpc_server/java/gen/__env_create_msg.java @@ -0,0 +1,32 @@ +/* + * Automatically generated by jrpcgen 0.95.1 on 12/18/01 7:23 PM + * jrpcgen is part of the "Remote Tea" ONC/RPC package for Java + * See http://acplt.org/ks/remotetea.html for details + */ +package com.sleepycat.db.rpcserver; +import org.acplt.oncrpc.*; +import java.io.IOException; + +public class __env_create_msg implements XdrAble { + public int timeout; + + public __env_create_msg() { + } + + public __env_create_msg(XdrDecodingStream xdr) + throws OncRpcException, IOException { + xdrDecode(xdr); + } + + public void xdrEncode(XdrEncodingStream xdr) + throws OncRpcException, IOException { + xdr.xdrEncodeInt(timeout); + } + + public void xdrDecode(XdrDecodingStream xdr) + throws OncRpcException, IOException { + timeout = xdr.xdrDecodeInt(); + } + +} +// End of __env_create_msg.java diff --git a/db/rpc_server/java/gen/__env_create_reply.java b/db/rpc_server/java/gen/__env_create_reply.java new file mode 100644 index 000000000..5427fc4bc --- /dev/null +++ b/db/rpc_server/java/gen/__env_create_reply.java @@ -0,0 +1,35 @@ +/* + * Automatically generated by jrpcgen 0.95.1 on 12/18/01 7:23 PM + * jrpcgen is part of the "Remote Tea" ONC/RPC package for Java + * See http://acplt.org/ks/remotetea.html for details + */ +package com.sleepycat.db.rpcserver; +import org.acplt.oncrpc.*; +import java.io.IOException; + +public class __env_create_reply implements XdrAble { + public int status; + public int envcl_id; + + public __env_create_reply() { + } + + public __env_create_reply(XdrDecodingStream xdr) + throws OncRpcException, IOException { + xdrDecode(xdr); + } + + public void xdrEncode(XdrEncodingStream xdr) + throws OncRpcException, IOException { + xdr.xdrEncodeInt(status); + xdr.xdrEncodeInt(envcl_id); + } + + public void xdrDecode(XdrDecodingStream xdr) + throws OncRpcException, IOException { + status = xdr.xdrDecodeInt(); + envcl_id = xdr.xdrDecodeInt(); + } + +} +// End of __env_create_reply.java diff --git a/db/rpc_server/java/gen/__env_dbremove_msg.java b/db/rpc_server/java/gen/__env_dbremove_msg.java new file mode 100644 index 000000000..9730a92c5 --- /dev/null +++ b/db/rpc_server/java/gen/__env_dbremove_msg.java @@ -0,0 +1,44 @@ +/* + * Automatically generated by jrpcgen 0.95.1 on 3/19/02 10:30 AM + * jrpcgen is part of the "Remote Tea" ONC/RPC package for Java + * See http://acplt.org/ks/remotetea.html for details + */ +package com.sleepycat.db.rpcserver; +import org.acplt.oncrpc.*; +import java.io.IOException; + +public class __env_dbremove_msg implements XdrAble { + public int dbenvcl_id; + public int txnpcl_id; + public String name; + public String subdb; + public int flags; + + public __env_dbremove_msg() { + } + + public __env_dbremove_msg(XdrDecodingStream xdr) + throws OncRpcException, IOException { + xdrDecode(xdr); + } + + public void xdrEncode(XdrEncodingStream xdr) + throws OncRpcException, IOException { + xdr.xdrEncodeInt(dbenvcl_id); + xdr.xdrEncodeInt(txnpcl_id); + xdr.xdrEncodeString(name); + xdr.xdrEncodeString(subdb); + xdr.xdrEncodeInt(flags); + } + + public void xdrDecode(XdrDecodingStream xdr) + throws OncRpcException, IOException { + dbenvcl_id = xdr.xdrDecodeInt(); + txnpcl_id = xdr.xdrDecodeInt(); + name = xdr.xdrDecodeString(); + subdb = xdr.xdrDecodeString(); + flags = xdr.xdrDecodeInt(); + } + +} +// End of __env_dbremove_msg.java diff --git a/db/rpc_server/java/gen/__env_dbremove_reply.java b/db/rpc_server/java/gen/__env_dbremove_reply.java new file mode 100644 index 000000000..75cc5a940 --- /dev/null +++ b/db/rpc_server/java/gen/__env_dbremove_reply.java @@ -0,0 +1,32 @@ +/* + * Automatically generated by jrpcgen 0.95.1 on 3/19/02 10:30 AM + * jrpcgen is part of the "Remote Tea" ONC/RPC package for Java + * See http://acplt.org/ks/remotetea.html for details + */ +package com.sleepycat.db.rpcserver; +import org.acplt.oncrpc.*; +import java.io.IOException; + +public class __env_dbremove_reply implements XdrAble { + public int status; + + public __env_dbremove_reply() { + } + + public __env_dbremove_reply(XdrDecodingStream xdr) + throws OncRpcException, IOException { + xdrDecode(xdr); + } + + public void xdrEncode(XdrEncodingStream xdr) + throws OncRpcException, IOException { + xdr.xdrEncodeInt(status); + } + + public void xdrDecode(XdrDecodingStream xdr) + throws OncRpcException, IOException { + status = xdr.xdrDecodeInt(); + } + +} +// End of __env_dbremove_reply.java diff --git a/db/rpc_server/java/gen/__env_dbrename_msg.java b/db/rpc_server/java/gen/__env_dbrename_msg.java new file mode 100644 index 000000000..0bbda262b --- /dev/null +++ b/db/rpc_server/java/gen/__env_dbrename_msg.java @@ -0,0 +1,47 @@ +/* + * Automatically generated by jrpcgen 0.95.1 on 3/19/02 10:30 AM + * jrpcgen is part of the "Remote Tea" ONC/RPC package for Java + * See http://acplt.org/ks/remotetea.html for details + */ +package com.sleepycat.db.rpcserver; +import org.acplt.oncrpc.*; +import java.io.IOException; + +public class __env_dbrename_msg implements XdrAble { + public int dbenvcl_id; + public int txnpcl_id; + public String name; + public String subdb; + public String newname; + public int flags; + + public __env_dbrename_msg() { + } + + public __env_dbrename_msg(XdrDecodingStream xdr) + throws OncRpcException, IOException { + xdrDecode(xdr); + } + + public void xdrEncode(XdrEncodingStream xdr) + throws OncRpcException, IOException { + xdr.xdrEncodeInt(dbenvcl_id); + xdr.xdrEncodeInt(txnpcl_id); + xdr.xdrEncodeString(name); + xdr.xdrEncodeString(subdb); + xdr.xdrEncodeString(newname); + xdr.xdrEncodeInt(flags); + } + + public void xdrDecode(XdrDecodingStream xdr) + throws OncRpcException, IOException { + dbenvcl_id = xdr.xdrDecodeInt(); + txnpcl_id = xdr.xdrDecodeInt(); + name = xdr.xdrDecodeString(); + subdb = xdr.xdrDecodeString(); + newname = xdr.xdrDecodeString(); + flags = xdr.xdrDecodeInt(); + } + +} +// End of __env_dbrename_msg.java diff --git a/db/rpc_server/java/gen/__env_dbrename_reply.java b/db/rpc_server/java/gen/__env_dbrename_reply.java new file mode 100644 index 000000000..0cc888230 --- /dev/null +++ b/db/rpc_server/java/gen/__env_dbrename_reply.java @@ -0,0 +1,32 @@ +/* + * Automatically generated by jrpcgen 0.95.1 on 3/19/02 10:30 AM + * jrpcgen is part of the "Remote Tea" ONC/RPC package for Java + * See http://acplt.org/ks/remotetea.html for details + */ +package com.sleepycat.db.rpcserver; +import org.acplt.oncrpc.*; +import java.io.IOException; + +public class __env_dbrename_reply implements XdrAble { + public int status; + + public __env_dbrename_reply() { + } + + public __env_dbrename_reply(XdrDecodingStream xdr) + throws OncRpcException, IOException { + xdrDecode(xdr); + } + + public void xdrEncode(XdrEncodingStream xdr) + throws OncRpcException, IOException { + xdr.xdrEncodeInt(status); + } + + public void xdrDecode(XdrDecodingStream xdr) + throws OncRpcException, IOException { + status = xdr.xdrDecodeInt(); + } + +} +// End of __env_dbrename_reply.java diff --git a/db/rpc_server/java/gen/__env_encrypt_msg.java b/db/rpc_server/java/gen/__env_encrypt_msg.java new file mode 100644 index 000000000..84e9a36d3 --- /dev/null +++ b/db/rpc_server/java/gen/__env_encrypt_msg.java @@ -0,0 +1,38 @@ +/* + * Automatically generated by jrpcgen 0.95.1 on 2/13/02 1:05 PM + * jrpcgen is part of the "Remote Tea" ONC/RPC package for Java + * See http://acplt.org/ks/remotetea.html for details + */ +package com.sleepycat.db.rpcserver; +import org.acplt.oncrpc.*; +import java.io.IOException; + +public class __env_encrypt_msg implements XdrAble { + public int dbenvcl_id; + public String passwd; + public int flags; + + public __env_encrypt_msg() { + } + + public __env_encrypt_msg(XdrDecodingStream xdr) + throws OncRpcException, IOException { + xdrDecode(xdr); + } + + public void xdrEncode(XdrEncodingStream xdr) + throws OncRpcException, IOException { + xdr.xdrEncodeInt(dbenvcl_id); + xdr.xdrEncodeString(passwd); + xdr.xdrEncodeInt(flags); + } + + public void xdrDecode(XdrDecodingStream xdr) + throws OncRpcException, IOException { + dbenvcl_id = xdr.xdrDecodeInt(); + passwd = xdr.xdrDecodeString(); + flags = xdr.xdrDecodeInt(); + } + +} +// End of __env_encrypt_msg.java diff --git a/db/rpc_server/java/gen/__env_encrypt_reply.java b/db/rpc_server/java/gen/__env_encrypt_reply.java new file mode 100644 index 000000000..e202a3089 --- /dev/null +++ b/db/rpc_server/java/gen/__env_encrypt_reply.java @@ -0,0 +1,32 @@ +/* + * Automatically generated by jrpcgen 0.95.1 on 2/13/02 1:05 PM + * jrpcgen is part of the "Remote Tea" ONC/RPC package for Java + * See http://acplt.org/ks/remotetea.html for details + */ +package com.sleepycat.db.rpcserver; +import org.acplt.oncrpc.*; +import java.io.IOException; + +public class __env_encrypt_reply implements XdrAble { + public int status; + + public __env_encrypt_reply() { + } + + public __env_encrypt_reply(XdrDecodingStream xdr) + throws OncRpcException, IOException { + xdrDecode(xdr); + } + + public void xdrEncode(XdrEncodingStream xdr) + throws OncRpcException, IOException { + xdr.xdrEncodeInt(status); + } + + public void xdrDecode(XdrDecodingStream xdr) + throws OncRpcException, IOException { + status = xdr.xdrDecodeInt(); + } + +} +// End of __env_encrypt_reply.java diff --git a/db/rpc_server/java/gen/__env_flags_msg.java b/db/rpc_server/java/gen/__env_flags_msg.java new file mode 100644 index 000000000..25cd5f85f --- /dev/null +++ b/db/rpc_server/java/gen/__env_flags_msg.java @@ -0,0 +1,38 @@ +/* + * Automatically generated by jrpcgen 0.95.1 on 12/18/01 7:23 PM + * jrpcgen is part of the "Remote Tea" ONC/RPC package for Java + * See http://acplt.org/ks/remotetea.html for details + */ +package com.sleepycat.db.rpcserver; +import org.acplt.oncrpc.*; +import java.io.IOException; + +public class __env_flags_msg implements XdrAble { + public int dbenvcl_id; + public int flags; + public int onoff; + + public __env_flags_msg() { + } + + public __env_flags_msg(XdrDecodingStream xdr) + throws OncRpcException, IOException { + xdrDecode(xdr); + } + + public void xdrEncode(XdrEncodingStream xdr) + throws OncRpcException, IOException { + xdr.xdrEncodeInt(dbenvcl_id); + xdr.xdrEncodeInt(flags); + xdr.xdrEncodeInt(onoff); + } + + public void xdrDecode(XdrDecodingStream xdr) + throws OncRpcException, IOException { + dbenvcl_id = xdr.xdrDecodeInt(); + flags = xdr.xdrDecodeInt(); + onoff = xdr.xdrDecodeInt(); + } + +} +// End of __env_flags_msg.java diff --git a/db/rpc_server/java/gen/__env_flags_reply.java b/db/rpc_server/java/gen/__env_flags_reply.java new file mode 100644 index 000000000..d348a9224 --- /dev/null +++ b/db/rpc_server/java/gen/__env_flags_reply.java @@ -0,0 +1,32 @@ +/* + * Automatically generated by jrpcgen 0.95.1 on 12/18/01 7:23 PM + * jrpcgen is part of the "Remote Tea" ONC/RPC package for Java + * See http://acplt.org/ks/remotetea.html for details + */ +package com.sleepycat.db.rpcserver; +import org.acplt.oncrpc.*; +import java.io.IOException; + +public class __env_flags_reply implements XdrAble { + public int status; + + public __env_flags_reply() { + } + + public __env_flags_reply(XdrDecodingStream xdr) + throws OncRpcException, IOException { + xdrDecode(xdr); + } + + public void xdrEncode(XdrEncodingStream xdr) + throws OncRpcException, IOException { + xdr.xdrEncodeInt(status); + } + + public void xdrDecode(XdrDecodingStream xdr) + throws OncRpcException, IOException { + status = xdr.xdrDecodeInt(); + } + +} +// End of __env_flags_reply.java diff --git a/db/rpc_server/java/gen/__env_open_msg.java b/db/rpc_server/java/gen/__env_open_msg.java new file mode 100644 index 000000000..e4649b41f --- /dev/null +++ b/db/rpc_server/java/gen/__env_open_msg.java @@ -0,0 +1,41 @@ +/* + * Automatically generated by jrpcgen 0.95.1 on 12/18/01 7:23 PM + * jrpcgen is part of the "Remote Tea" ONC/RPC package for Java + * See http://acplt.org/ks/remotetea.html for details + */ +package com.sleepycat.db.rpcserver; +import org.acplt.oncrpc.*; +import java.io.IOException; + +public class __env_open_msg implements XdrAble { + public int dbenvcl_id; + public String home; + public int flags; + public int mode; + + public __env_open_msg() { + } + + public __env_open_msg(XdrDecodingStream xdr) + throws OncRpcException, IOException { + xdrDecode(xdr); + } + + public void xdrEncode(XdrEncodingStream xdr) + throws OncRpcException, IOException { + xdr.xdrEncodeInt(dbenvcl_id); + xdr.xdrEncodeString(home); + xdr.xdrEncodeInt(flags); + xdr.xdrEncodeInt(mode); + } + + public void xdrDecode(XdrDecodingStream xdr) + throws OncRpcException, IOException { + dbenvcl_id = xdr.xdrDecodeInt(); + home = xdr.xdrDecodeString(); + flags = xdr.xdrDecodeInt(); + mode = xdr.xdrDecodeInt(); + } + +} +// End of __env_open_msg.java diff --git a/db/rpc_server/java/gen/__env_open_reply.java b/db/rpc_server/java/gen/__env_open_reply.java new file mode 100644 index 000000000..1994afb4c --- /dev/null +++ b/db/rpc_server/java/gen/__env_open_reply.java @@ -0,0 +1,35 @@ +/* + * Automatically generated by jrpcgen 0.95.1 on 12/18/01 7:23 PM + * jrpcgen is part of the "Remote Tea" ONC/RPC package for Java + * See http://acplt.org/ks/remotetea.html for details + */ +package com.sleepycat.db.rpcserver; +import org.acplt.oncrpc.*; +import java.io.IOException; + +public class __env_open_reply implements XdrAble { + public int status; + public int envcl_id; + + public __env_open_reply() { + } + + public __env_open_reply(XdrDecodingStream xdr) + throws OncRpcException, IOException { + xdrDecode(xdr); + } + + public void xdrEncode(XdrEncodingStream xdr) + throws OncRpcException, IOException { + xdr.xdrEncodeInt(status); + xdr.xdrEncodeInt(envcl_id); + } + + public void xdrDecode(XdrDecodingStream xdr) + throws OncRpcException, IOException { + status = xdr.xdrDecodeInt(); + envcl_id = xdr.xdrDecodeInt(); + } + +} +// End of __env_open_reply.java diff --git a/db/rpc_server/java/gen/__env_remove_msg.java b/db/rpc_server/java/gen/__env_remove_msg.java new file mode 100644 index 000000000..b32d758f0 --- /dev/null +++ b/db/rpc_server/java/gen/__env_remove_msg.java @@ -0,0 +1,38 @@ +/* + * Automatically generated by jrpcgen 0.95.1 on 12/18/01 7:23 PM + * jrpcgen is part of the "Remote Tea" ONC/RPC package for Java + * See http://acplt.org/ks/remotetea.html for details + */ +package com.sleepycat.db.rpcserver; +import org.acplt.oncrpc.*; +import java.io.IOException; + +public class __env_remove_msg implements XdrAble { + public int dbenvcl_id; + public String home; + public int flags; + + public __env_remove_msg() { + } + + public __env_remove_msg(XdrDecodingStream xdr) + throws OncRpcException, IOException { + xdrDecode(xdr); + } + + public void xdrEncode(XdrEncodingStream xdr) + throws OncRpcException, IOException { + xdr.xdrEncodeInt(dbenvcl_id); + xdr.xdrEncodeString(home); + xdr.xdrEncodeInt(flags); + } + + public void xdrDecode(XdrDecodingStream xdr) + throws OncRpcException, IOException { + dbenvcl_id = xdr.xdrDecodeInt(); + home = xdr.xdrDecodeString(); + flags = xdr.xdrDecodeInt(); + } + +} +// End of __env_remove_msg.java diff --git a/db/rpc_server/java/gen/__env_remove_reply.java b/db/rpc_server/java/gen/__env_remove_reply.java new file mode 100644 index 000000000..19e4d52f6 --- /dev/null +++ b/db/rpc_server/java/gen/__env_remove_reply.java @@ -0,0 +1,32 @@ +/* + * Automatically generated by jrpcgen 0.95.1 on 12/18/01 7:23 PM + * jrpcgen is part of the "Remote Tea" ONC/RPC package for Java + * See http://acplt.org/ks/remotetea.html for details + */ +package com.sleepycat.db.rpcserver; +import org.acplt.oncrpc.*; +import java.io.IOException; + +public class __env_remove_reply implements XdrAble { + public int status; + + public __env_remove_reply() { + } + + public __env_remove_reply(XdrDecodingStream xdr) + throws OncRpcException, IOException { + xdrDecode(xdr); + } + + public void xdrEncode(XdrEncodingStream xdr) + throws OncRpcException, IOException { + xdr.xdrEncodeInt(status); + } + + public void xdrDecode(XdrDecodingStream xdr) + throws OncRpcException, IOException { + status = xdr.xdrDecodeInt(); + } + +} +// End of __env_remove_reply.java diff --git a/db/rpc_server/java/gen/__txn_abort_msg.java b/db/rpc_server/java/gen/__txn_abort_msg.java new file mode 100644 index 000000000..ff44c534e --- /dev/null +++ b/db/rpc_server/java/gen/__txn_abort_msg.java @@ -0,0 +1,32 @@ +/* + * Automatically generated by jrpcgen 0.95.1 on 12/18/01 7:23 PM + * jrpcgen is part of the "Remote Tea" ONC/RPC package for Java + * See http://acplt.org/ks/remotetea.html for details + */ +package com.sleepycat.db.rpcserver; +import org.acplt.oncrpc.*; +import java.io.IOException; + +public class __txn_abort_msg implements XdrAble { + public int txnpcl_id; + + public __txn_abort_msg() { + } + + public __txn_abort_msg(XdrDecodingStream xdr) + throws OncRpcException, IOException { + xdrDecode(xdr); + } + + public void xdrEncode(XdrEncodingStream xdr) + throws OncRpcException, IOException { + xdr.xdrEncodeInt(txnpcl_id); + } + + public void xdrDecode(XdrDecodingStream xdr) + throws OncRpcException, IOException { + txnpcl_id = xdr.xdrDecodeInt(); + } + +} +// End of __txn_abort_msg.java diff --git a/db/rpc_server/java/gen/__txn_abort_reply.java b/db/rpc_server/java/gen/__txn_abort_reply.java new file mode 100644 index 000000000..58f275c1a --- /dev/null +++ b/db/rpc_server/java/gen/__txn_abort_reply.java @@ -0,0 +1,32 @@ +/* + * Automatically generated by jrpcgen 0.95.1 on 12/18/01 7:23 PM + * jrpcgen is part of the "Remote Tea" ONC/RPC package for Java + * See http://acplt.org/ks/remotetea.html for details + */ +package com.sleepycat.db.rpcserver; +import org.acplt.oncrpc.*; +import java.io.IOException; + +public class __txn_abort_reply implements XdrAble { + public int status; + + public __txn_abort_reply() { + } + + public __txn_abort_reply(XdrDecodingStream xdr) + throws OncRpcException, IOException { + xdrDecode(xdr); + } + + public void xdrEncode(XdrEncodingStream xdr) + throws OncRpcException, IOException { + xdr.xdrEncodeInt(status); + } + + public void xdrDecode(XdrDecodingStream xdr) + throws OncRpcException, IOException { + status = xdr.xdrDecodeInt(); + } + +} +// End of __txn_abort_reply.java diff --git a/db/rpc_server/java/gen/__txn_begin_msg.java b/db/rpc_server/java/gen/__txn_begin_msg.java new file mode 100644 index 000000000..877031e8d --- /dev/null +++ b/db/rpc_server/java/gen/__txn_begin_msg.java @@ -0,0 +1,38 @@ +/* + * Automatically generated by jrpcgen 0.95.1 on 12/18/01 7:23 PM + * jrpcgen is part of the "Remote Tea" ONC/RPC package for Java + * See http://acplt.org/ks/remotetea.html for details + */ +package com.sleepycat.db.rpcserver; +import org.acplt.oncrpc.*; +import java.io.IOException; + +public class __txn_begin_msg implements XdrAble { + public int dbenvcl_id; + public int parentcl_id; + public int flags; + + public __txn_begin_msg() { + } + + public __txn_begin_msg(XdrDecodingStream xdr) + throws OncRpcException, IOException { + xdrDecode(xdr); + } + + public void xdrEncode(XdrEncodingStream xdr) + throws OncRpcException, IOException { + xdr.xdrEncodeInt(dbenvcl_id); + xdr.xdrEncodeInt(parentcl_id); + xdr.xdrEncodeInt(flags); + } + + public void xdrDecode(XdrDecodingStream xdr) + throws OncRpcException, IOException { + dbenvcl_id = xdr.xdrDecodeInt(); + parentcl_id = xdr.xdrDecodeInt(); + flags = xdr.xdrDecodeInt(); + } + +} +// End of __txn_begin_msg.java diff --git a/db/rpc_server/java/gen/__txn_begin_reply.java b/db/rpc_server/java/gen/__txn_begin_reply.java new file mode 100644 index 000000000..65a0c4016 --- /dev/null +++ b/db/rpc_server/java/gen/__txn_begin_reply.java @@ -0,0 +1,35 @@ +/* + * Automatically generated by jrpcgen 0.95.1 on 12/18/01 7:23 PM + * jrpcgen is part of the "Remote Tea" ONC/RPC package for Java + * See http://acplt.org/ks/remotetea.html for details + */ +package com.sleepycat.db.rpcserver; +import org.acplt.oncrpc.*; +import java.io.IOException; + +public class __txn_begin_reply implements XdrAble { + public int status; + public int txnidcl_id; + + public __txn_begin_reply() { + } + + public __txn_begin_reply(XdrDecodingStream xdr) + throws OncRpcException, IOException { + xdrDecode(xdr); + } + + public void xdrEncode(XdrEncodingStream xdr) + throws OncRpcException, IOException { + xdr.xdrEncodeInt(status); + xdr.xdrEncodeInt(txnidcl_id); + } + + public void xdrDecode(XdrDecodingStream xdr) + throws OncRpcException, IOException { + status = xdr.xdrDecodeInt(); + txnidcl_id = xdr.xdrDecodeInt(); + } + +} +// End of __txn_begin_reply.java diff --git a/db/rpc_server/java/gen/__txn_commit_msg.java b/db/rpc_server/java/gen/__txn_commit_msg.java new file mode 100644 index 000000000..4b988d0c2 --- /dev/null +++ b/db/rpc_server/java/gen/__txn_commit_msg.java @@ -0,0 +1,35 @@ +/* + * Automatically generated by jrpcgen 0.95.1 on 12/18/01 7:23 PM + * jrpcgen is part of the "Remote Tea" ONC/RPC package for Java + * See http://acplt.org/ks/remotetea.html for details + */ +package com.sleepycat.db.rpcserver; +import org.acplt.oncrpc.*; +import java.io.IOException; + +public class __txn_commit_msg implements XdrAble { + public int txnpcl_id; + public int flags; + + public __txn_commit_msg() { + } + + public __txn_commit_msg(XdrDecodingStream xdr) + throws OncRpcException, IOException { + xdrDecode(xdr); + } + + public void xdrEncode(XdrEncodingStream xdr) + throws OncRpcException, IOException { + xdr.xdrEncodeInt(txnpcl_id); + xdr.xdrEncodeInt(flags); + } + + public void xdrDecode(XdrDecodingStream xdr) + throws OncRpcException, IOException { + txnpcl_id = xdr.xdrDecodeInt(); + flags = xdr.xdrDecodeInt(); + } + +} +// End of __txn_commit_msg.java diff --git a/db/rpc_server/java/gen/__txn_commit_reply.java b/db/rpc_server/java/gen/__txn_commit_reply.java new file mode 100644 index 000000000..b26937b82 --- /dev/null +++ b/db/rpc_server/java/gen/__txn_commit_reply.java @@ -0,0 +1,32 @@ +/* + * Automatically generated by jrpcgen 0.95.1 on 12/18/01 7:23 PM + * jrpcgen is part of the "Remote Tea" ONC/RPC package for Java + * See http://acplt.org/ks/remotetea.html for details + */ +package com.sleepycat.db.rpcserver; +import org.acplt.oncrpc.*; +import java.io.IOException; + +public class __txn_commit_reply implements XdrAble { + public int status; + + public __txn_commit_reply() { + } + + public __txn_commit_reply(XdrDecodingStream xdr) + throws OncRpcException, IOException { + xdrDecode(xdr); + } + + public void xdrEncode(XdrEncodingStream xdr) + throws OncRpcException, IOException { + xdr.xdrEncodeInt(status); + } + + public void xdrDecode(XdrDecodingStream xdr) + throws OncRpcException, IOException { + status = xdr.xdrDecodeInt(); + } + +} +// End of __txn_commit_reply.java diff --git a/db/rpc_server/java/gen/__txn_discard_msg.java b/db/rpc_server/java/gen/__txn_discard_msg.java new file mode 100644 index 000000000..87f5d4f77 --- /dev/null +++ b/db/rpc_server/java/gen/__txn_discard_msg.java @@ -0,0 +1,35 @@ +/* + * Automatically generated by jrpcgen 0.95.1 on 12/18/01 7:23 PM + * jrpcgen is part of the "Remote Tea" ONC/RPC package for Java + * See http://acplt.org/ks/remotetea.html for details + */ +package com.sleepycat.db.rpcserver; +import org.acplt.oncrpc.*; +import java.io.IOException; + +public class __txn_discard_msg implements XdrAble { + public int txnpcl_id; + public int flags; + + public __txn_discard_msg() { + } + + public __txn_discard_msg(XdrDecodingStream xdr) + throws OncRpcException, IOException { + xdrDecode(xdr); + } + + public void xdrEncode(XdrEncodingStream xdr) + throws OncRpcException, IOException { + xdr.xdrEncodeInt(txnpcl_id); + xdr.xdrEncodeInt(flags); + } + + public void xdrDecode(XdrDecodingStream xdr) + throws OncRpcException, IOException { + txnpcl_id = xdr.xdrDecodeInt(); + flags = xdr.xdrDecodeInt(); + } + +} +// End of __txn_discard_msg.java diff --git a/db/rpc_server/java/gen/__txn_discard_reply.java b/db/rpc_server/java/gen/__txn_discard_reply.java new file mode 100644 index 000000000..9792211af --- /dev/null +++ b/db/rpc_server/java/gen/__txn_discard_reply.java @@ -0,0 +1,32 @@ +/* + * Automatically generated by jrpcgen 0.95.1 on 12/18/01 7:23 PM + * jrpcgen is part of the "Remote Tea" ONC/RPC package for Java + * See http://acplt.org/ks/remotetea.html for details + */ +package com.sleepycat.db.rpcserver; +import org.acplt.oncrpc.*; +import java.io.IOException; + +public class __txn_discard_reply implements XdrAble { + public int status; + + public __txn_discard_reply() { + } + + public __txn_discard_reply(XdrDecodingStream xdr) + throws OncRpcException, IOException { + xdrDecode(xdr); + } + + public void xdrEncode(XdrEncodingStream xdr) + throws OncRpcException, IOException { + xdr.xdrEncodeInt(status); + } + + public void xdrDecode(XdrDecodingStream xdr) + throws OncRpcException, IOException { + status = xdr.xdrDecodeInt(); + } + +} +// End of __txn_discard_reply.java diff --git a/db/rpc_server/java/gen/__txn_prepare_msg.java b/db/rpc_server/java/gen/__txn_prepare_msg.java new file mode 100644 index 000000000..6e09f2c77 --- /dev/null +++ b/db/rpc_server/java/gen/__txn_prepare_msg.java @@ -0,0 +1,35 @@ +/* + * Automatically generated by jrpcgen 0.95.1 on 12/18/01 7:23 PM + * jrpcgen is part of the "Remote Tea" ONC/RPC package for Java + * See http://acplt.org/ks/remotetea.html for details + */ +package com.sleepycat.db.rpcserver; +import org.acplt.oncrpc.*; +import java.io.IOException; + +public class __txn_prepare_msg implements XdrAble { + public int txnpcl_id; + public byte [] gid; + + public __txn_prepare_msg() { + } + + public __txn_prepare_msg(XdrDecodingStream xdr) + throws OncRpcException, IOException { + xdrDecode(xdr); + } + + public void xdrEncode(XdrEncodingStream xdr) + throws OncRpcException, IOException { + xdr.xdrEncodeInt(txnpcl_id); + xdr.xdrEncodeOpaque(gid, 128); + } + + public void xdrDecode(XdrDecodingStream xdr) + throws OncRpcException, IOException { + txnpcl_id = xdr.xdrDecodeInt(); + gid = xdr.xdrDecodeOpaque(128); + } + +} +// End of __txn_prepare_msg.java diff --git a/db/rpc_server/java/gen/__txn_prepare_reply.java b/db/rpc_server/java/gen/__txn_prepare_reply.java new file mode 100644 index 000000000..d75901179 --- /dev/null +++ b/db/rpc_server/java/gen/__txn_prepare_reply.java @@ -0,0 +1,32 @@ +/* + * Automatically generated by jrpcgen 0.95.1 on 12/18/01 7:23 PM + * jrpcgen is part of the "Remote Tea" ONC/RPC package for Java + * See http://acplt.org/ks/remotetea.html for details + */ +package com.sleepycat.db.rpcserver; +import org.acplt.oncrpc.*; +import java.io.IOException; + +public class __txn_prepare_reply implements XdrAble { + public int status; + + public __txn_prepare_reply() { + } + + public __txn_prepare_reply(XdrDecodingStream xdr) + throws OncRpcException, IOException { + xdrDecode(xdr); + } + + public void xdrEncode(XdrEncodingStream xdr) + throws OncRpcException, IOException { + xdr.xdrEncodeInt(status); + } + + public void xdrDecode(XdrDecodingStream xdr) + throws OncRpcException, IOException { + status = xdr.xdrDecodeInt(); + } + +} +// End of __txn_prepare_reply.java diff --git a/db/rpc_server/java/gen/__txn_recover_msg.java b/db/rpc_server/java/gen/__txn_recover_msg.java new file mode 100644 index 000000000..651533344 --- /dev/null +++ b/db/rpc_server/java/gen/__txn_recover_msg.java @@ -0,0 +1,38 @@ +/* + * Automatically generated by jrpcgen 0.95.1 on 12/18/01 7:23 PM + * jrpcgen is part of the "Remote Tea" ONC/RPC package for Java + * See http://acplt.org/ks/remotetea.html for details + */ +package com.sleepycat.db.rpcserver; +import org.acplt.oncrpc.*; +import java.io.IOException; + +public class __txn_recover_msg implements XdrAble { + public int dbenvcl_id; + public int count; + public int flags; + + public __txn_recover_msg() { + } + + public __txn_recover_msg(XdrDecodingStream xdr) + throws OncRpcException, IOException { + xdrDecode(xdr); + } + + public void xdrEncode(XdrEncodingStream xdr) + throws OncRpcException, IOException { + xdr.xdrEncodeInt(dbenvcl_id); + xdr.xdrEncodeInt(count); + xdr.xdrEncodeInt(flags); + } + + public void xdrDecode(XdrDecodingStream xdr) + throws OncRpcException, IOException { + dbenvcl_id = xdr.xdrDecodeInt(); + count = xdr.xdrDecodeInt(); + flags = xdr.xdrDecodeInt(); + } + +} +// End of __txn_recover_msg.java diff --git a/db/rpc_server/java/gen/__txn_recover_reply.java b/db/rpc_server/java/gen/__txn_recover_reply.java new file mode 100644 index 000000000..0161ec949 --- /dev/null +++ b/db/rpc_server/java/gen/__txn_recover_reply.java @@ -0,0 +1,41 @@ +/* + * Automatically generated by jrpcgen 0.95.1 on 12/18/01 7:23 PM + * jrpcgen is part of the "Remote Tea" ONC/RPC package for Java + * See http://acplt.org/ks/remotetea.html for details + */ +package com.sleepycat.db.rpcserver; +import org.acplt.oncrpc.*; +import java.io.IOException; + +public class __txn_recover_reply implements XdrAble { + public int status; + public int [] txn; + public byte [] gid; + public int retcount; + + public __txn_recover_reply() { + } + + public __txn_recover_reply(XdrDecodingStream xdr) + throws OncRpcException, IOException { + xdrDecode(xdr); + } + + public void xdrEncode(XdrEncodingStream xdr) + throws OncRpcException, IOException { + xdr.xdrEncodeInt(status); + xdr.xdrEncodeIntVector(txn); + xdr.xdrEncodeDynamicOpaque(gid); + xdr.xdrEncodeInt(retcount); + } + + public void xdrDecode(XdrDecodingStream xdr) + throws OncRpcException, IOException { + status = xdr.xdrDecodeInt(); + txn = xdr.xdrDecodeIntVector(); + gid = xdr.xdrDecodeDynamicOpaque(); + retcount = xdr.xdrDecodeInt(); + } + +} +// End of __txn_recover_reply.java diff --git a/db/rpc_server/java/gen/db_server.java b/db/rpc_server/java/gen/db_server.java new file mode 100644 index 000000000..a14a77028 --- /dev/null +++ b/db/rpc_server/java/gen/db_server.java @@ -0,0 +1,67 @@ +/* + * Automatically generated by jrpcgen 0.95.1 on 3/19/02 10:30 AM + * jrpcgen is part of the "Remote Tea" ONC/RPC package for Java + * See http://acplt.org/ks/remotetea.html for details + */ +package com.sleepycat.db.rpcserver; +import org.acplt.oncrpc.*; +import java.io.IOException; + +/** + * A collection of constants used by the "db_server" ONC/RPC program. + */ +public interface db_server { + public static final int __DB_db_close_4001 = 19; + public static final int __DB_db_flags_4001 = 24; + public static final int __DB_dbc_dup_4001 = 47; + public static final int __DB_db_encrypt_4001 = 22; + public static final int __DB_env_dbrename_4001 = 5; + public static final int __DB_env_remove_4001 = 9; + public static final int __DB_dbc_pget_4001 = 49; + public static final int __DB_env_cachesize_4001 = 1; + public static final int __DB_db_lorder_4001 = 29; + public static final int __DB_db_key_range_4001 = 28; + public static final int __DB_db_bt_minkey_4001 = 18; + public static final int __DB_db_sync_4001 = 40; + public static final int __DB_dbc_close_4001 = 44; + public static final int __DB_db_join_4001 = 43; + public static final int __DB_db_pagesize_4001 = 31; + public static final int DB_RPC_SERVERVERS = 4001; + public static final int __DB_db_open_4001 = 30; + public static final int __DB_dbc_get_4001 = 48; + public static final int __DB_db_cursor_4001 = 42; + public static final int __DB_txn_commit_4001 = 12; + public static final int __DB_dbc_del_4001 = 46; + public static final int __DB_env_create_4001 = 3; + public static final int __DB_env_open_4001 = 8; + public static final int __DB_txn_prepare_4001 = 14; + public static final int __DB_db_pget_4001 = 32; + public static final int __DB_db_stat_4001 = 39; + public static final int __DB_db_h_nelem_4001 = 27; + public static final int __DB_db_remove_4001 = 37; + public static final int __DB_db_re_delim_4001 = 34; + public static final int __DB_db_re_pad_4001 = 36; + public static final int __DB_txn_abort_4001 = 10; + public static final int __DB_txn_recover_4001 = 15; + public static final int __DB_db_get_4001 = 25; + public static final int __DB_db_extentsize_4001 = 23; + public static final int DB_RPC_SERVERPROG = 351457; + public static final int __DB_dbc_put_4001 = 50; + public static final int __DB_db_truncate_4001 = 41; + public static final int __DB_db_del_4001 = 21; + public static final int __DB_db_bt_maxkey_4001 = 17; + public static final int __DB_env_dbremove_4001 = 4; + public static final int __DB_txn_discard_4001 = 13; + public static final int __DB_db_re_len_4001 = 35; + public static final int __DB_env_close_4001 = 2; + public static final int __DB_env_flags_4001 = 7; + public static final int __DB_db_rename_4001 = 38; + public static final int __DB_db_associate_4001 = 16; + public static final int __DB_txn_begin_4001 = 11; + public static final int __DB_env_encrypt_4001 = 6; + public static final int __DB_db_h_ffactor_4001 = 26; + public static final int __DB_db_put_4001 = 33; + public static final int __DB_db_create_4001 = 20; + public static final int __DB_dbc_count_4001 = 45; +} +// End of db_server.java diff --git a/db/rpc_server/java/jrpcgen.jar b/db/rpc_server/java/jrpcgen.jar Binary files differnew file mode 100644 index 000000000..338825b84 --- /dev/null +++ b/db/rpc_server/java/jrpcgen.jar diff --git a/db/rpc_server/java/oncrpc.jar b/db/rpc_server/java/oncrpc.jar Binary files differnew file mode 100644 index 000000000..e0f5cfa69 --- /dev/null +++ b/db/rpc_server/java/oncrpc.jar diff --git a/db/rpc_server/java/s_jrpcgen b/db/rpc_server/java/s_jrpcgen new file mode 100644 index 000000000..fed8cbf56 --- /dev/null +++ b/db/rpc_server/java/s_jrpcgen @@ -0,0 +1,3 @@ +#!/bin/sh + +java -jar jrpcgen.jar -d gen -noclient -nobackup -p com.sleepycat.db.rpcserver -s DbServerStub ../db_server.x |