db_server_svc.c 9.03 KB
Newer Older
unknown's avatar
unknown committed
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359
#include "db_config.h"
#ifdef HAVE_RPC
/*
 * Please do not edit this file.
 * It was generated using rpcgen.
 */

#include "db_server.h"
#include <stdio.h>
#include <stdlib.h> /* getenv, exit */
#include <memory.h>
#include <sys/socket.h>
#include <netinet/in.h>
extern void __dbsrv_timeout();

#ifdef DEBUG
#define	RPC_SVC_FG
#endif

static void
db_serverprog_1(rqstp, transp)
	struct svc_req *rqstp;
	register SVCXPRT *transp;
{
	union {
		__env_cachesize_msg __db_env_cachesize_1_arg;
		__env_close_msg __db_env_close_1_arg;
		__env_create_msg __db_env_create_1_arg;
		__env_flags_msg __db_env_flags_1_arg;
		__env_open_msg __db_env_open_1_arg;
		__env_remove_msg __db_env_remove_1_arg;
		__txn_abort_msg __db_txn_abort_1_arg;
		__txn_begin_msg __db_txn_begin_1_arg;
		__txn_commit_msg __db_txn_commit_1_arg;
		__db_bt_maxkey_msg __db_db_bt_maxkey_1_arg;
		__db_bt_minkey_msg __db_db_bt_minkey_1_arg;
		__db_close_msg __db_db_close_1_arg;
		__db_create_msg __db_db_create_1_arg;
		__db_del_msg __db_db_del_1_arg;
		__db_extentsize_msg __db_db_extentsize_1_arg;
		__db_flags_msg __db_db_flags_1_arg;
		__db_get_msg __db_db_get_1_arg;
		__db_h_ffactor_msg __db_db_h_ffactor_1_arg;
		__db_h_nelem_msg __db_db_h_nelem_1_arg;
		__db_key_range_msg __db_db_key_range_1_arg;
		__db_lorder_msg __db_db_lorder_1_arg;
		__db_open_msg __db_db_open_1_arg;
		__db_pagesize_msg __db_db_pagesize_1_arg;
		__db_put_msg __db_db_put_1_arg;
		__db_re_delim_msg __db_db_re_delim_1_arg;
		__db_re_len_msg __db_db_re_len_1_arg;
		__db_re_pad_msg __db_db_re_pad_1_arg;
		__db_remove_msg __db_db_remove_1_arg;
		__db_rename_msg __db_db_rename_1_arg;
		__db_stat_msg __db_db_stat_1_arg;
		__db_swapped_msg __db_db_swapped_1_arg;
		__db_sync_msg __db_db_sync_1_arg;
		__db_cursor_msg __db_db_cursor_1_arg;
		__db_join_msg __db_db_join_1_arg;
		__dbc_close_msg __db_dbc_close_1_arg;
		__dbc_count_msg __db_dbc_count_1_arg;
		__dbc_del_msg __db_dbc_del_1_arg;
		__dbc_dup_msg __db_dbc_dup_1_arg;
		__dbc_get_msg __db_dbc_get_1_arg;
		__dbc_put_msg __db_dbc_put_1_arg;
	} argument;
	char *result;
	bool_t (*xdr_argument)(), (*xdr_result)();
	char *(*local)();

	switch (rqstp->rq_proc) {
	case NULLPROC:
		(void) svc_sendreply(transp, 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_1;
		break;

	case __DB_env_close:
		xdr_argument = xdr___env_close_msg;
		xdr_result = xdr___env_close_reply;
		local = (char *(*)()) __db_env_close_1;
		break;

	case __DB_env_create:
		xdr_argument = xdr___env_create_msg;
		xdr_result = xdr___env_create_reply;
		local = (char *(*)()) __db_env_create_1;
		break;

	case __DB_env_flags:
		xdr_argument = xdr___env_flags_msg;
		xdr_result = xdr___env_flags_reply;
		local = (char *(*)()) __db_env_flags_1;
		break;

	case __DB_env_open:
		xdr_argument = xdr___env_open_msg;
		xdr_result = xdr___env_open_reply;
		local = (char *(*)()) __db_env_open_1;
		break;

	case __DB_env_remove:
		xdr_argument = xdr___env_remove_msg;
		xdr_result = xdr___env_remove_reply;
		local = (char *(*)()) __db_env_remove_1;
		break;

	case __DB_txn_abort:
		xdr_argument = xdr___txn_abort_msg;
		xdr_result = xdr___txn_abort_reply;
		local = (char *(*)()) __db_txn_abort_1;
		break;

	case __DB_txn_begin:
		xdr_argument = xdr___txn_begin_msg;
		xdr_result = xdr___txn_begin_reply;
		local = (char *(*)()) __db_txn_begin_1;
		break;

	case __DB_txn_commit:
		xdr_argument = xdr___txn_commit_msg;
		xdr_result = xdr___txn_commit_reply;
		local = (char *(*)()) __db_txn_commit_1;
		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_1;
		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_1;
		break;

	case __DB_db_close:
		xdr_argument = xdr___db_close_msg;
		xdr_result = xdr___db_close_reply;
		local = (char *(*)()) __db_db_close_1;
		break;

	case __DB_db_create:
		xdr_argument = xdr___db_create_msg;
		xdr_result = xdr___db_create_reply;
		local = (char *(*)()) __db_db_create_1;
		break;

	case __DB_db_del:
		xdr_argument = xdr___db_del_msg;
		xdr_result = xdr___db_del_reply;
		local = (char *(*)()) __db_db_del_1;
		break;

	case __DB_db_extentsize:
		xdr_argument = xdr___db_extentsize_msg;
		xdr_result = xdr___db_extentsize_reply;
		local = (char *(*)()) __db_db_extentsize_1;
		break;

	case __DB_db_flags:
		xdr_argument = xdr___db_flags_msg;
		xdr_result = xdr___db_flags_reply;
		local = (char *(*)()) __db_db_flags_1;
		break;

	case __DB_db_get:
		xdr_argument = xdr___db_get_msg;
		xdr_result = xdr___db_get_reply;
		local = (char *(*)()) __db_db_get_1;
		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_1;
		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_1;
		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_1;
		break;

	case __DB_db_lorder:
		xdr_argument = xdr___db_lorder_msg;
		xdr_result = xdr___db_lorder_reply;
		local = (char *(*)()) __db_db_lorder_1;
		break;

	case __DB_db_open:
		xdr_argument = xdr___db_open_msg;
		xdr_result = xdr___db_open_reply;
		local = (char *(*)()) __db_db_open_1;
		break;

	case __DB_db_pagesize:
		xdr_argument = xdr___db_pagesize_msg;
		xdr_result = xdr___db_pagesize_reply;
		local = (char *(*)()) __db_db_pagesize_1;
		break;

	case __DB_db_put:
		xdr_argument = xdr___db_put_msg;
		xdr_result = xdr___db_put_reply;
		local = (char *(*)()) __db_db_put_1;
		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_1;
		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_1;
		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_1;
		break;

	case __DB_db_remove:
		xdr_argument = xdr___db_remove_msg;
		xdr_result = xdr___db_remove_reply;
		local = (char *(*)()) __db_db_remove_1;
		break;

	case __DB_db_rename:
		xdr_argument = xdr___db_rename_msg;
		xdr_result = xdr___db_rename_reply;
		local = (char *(*)()) __db_db_rename_1;
		break;

	case __DB_db_stat:
		xdr_argument = xdr___db_stat_msg;
		xdr_result = xdr___db_stat_reply;
		local = (char *(*)()) __db_db_stat_1;
		break;

	case __DB_db_swapped:
		xdr_argument = xdr___db_swapped_msg;
		xdr_result = xdr___db_swapped_reply;
		local = (char *(*)()) __db_db_swapped_1;
		break;

	case __DB_db_sync:
		xdr_argument = xdr___db_sync_msg;
		xdr_result = xdr___db_sync_reply;
		local = (char *(*)()) __db_db_sync_1;
		break;

	case __DB_db_cursor:
		xdr_argument = xdr___db_cursor_msg;
		xdr_result = xdr___db_cursor_reply;
		local = (char *(*)()) __db_db_cursor_1;
		break;

	case __DB_db_join:
		xdr_argument = xdr___db_join_msg;
		xdr_result = xdr___db_join_reply;
		local = (char *(*)()) __db_db_join_1;
		break;

	case __DB_dbc_close:
		xdr_argument = xdr___dbc_close_msg;
		xdr_result = xdr___dbc_close_reply;
		local = (char *(*)()) __db_dbc_close_1;
		break;

	case __DB_dbc_count:
		xdr_argument = xdr___dbc_count_msg;
		xdr_result = xdr___dbc_count_reply;
		local = (char *(*)()) __db_dbc_count_1;
		break;

	case __DB_dbc_del:
		xdr_argument = xdr___dbc_del_msg;
		xdr_result = xdr___dbc_del_reply;
		local = (char *(*)()) __db_dbc_del_1;
		break;

	case __DB_dbc_dup:
		xdr_argument = xdr___dbc_dup_msg;
		xdr_result = xdr___dbc_dup_reply;
		local = (char *(*)()) __db_dbc_dup_1;
		break;

	case __DB_dbc_get:
		xdr_argument = xdr___dbc_get_msg;
		xdr_result = xdr___dbc_get_reply;
		local = (char *(*)()) __db_dbc_get_1;
		break;

	case __DB_dbc_put:
		xdr_argument = xdr___dbc_put_msg;
		xdr_result = xdr___dbc_put_reply;
		local = (char *(*)()) __db_dbc_put_1;
		break;

	default:
		svcerr_noproc(transp);
		return;
	}
	(void) memset((char *)&argument, 0, sizeof (argument));
	if (!svc_getargs(transp, xdr_argument, &argument)) {
		svcerr_decode(transp);
		return;
	}
	result = (*local)(&argument, rqstp);
	if (result != NULL && !svc_sendreply(transp, xdr_result, result)) {
		svcerr_systemerr(transp);
	}
	if (!svc_freeargs(transp, xdr_argument, &argument)) {
		fprintf(stderr, "unable to free arguments");
		exit(1);
	}
	__dbsrv_timeout(0);
	return;
}

void __dbsrv_main()
{
	register SVCXPRT *transp;

	(void) pmap_unset(DB_SERVERPROG, DB_SERVERVERS);

	transp = svctcp_create(RPC_ANYSOCK, 0, 0);
	if (transp == NULL) {
		fprintf(stderr, "cannot create tcp service.");
		exit(1);
	}
	if (!svc_register(transp, DB_SERVERPROG, DB_SERVERVERS, db_serverprog_1, IPPROTO_TCP)) {
		fprintf(stderr, "unable to register (DB_SERVERPROG, DB_SERVERVERS, tcp).");
		exit(1);
	}

	svc_run();
	fprintf(stderr, "svc_run returned");
	exit(1);
	/* NOTREACHED */
}
#endif /* HAVE_RPC */