Beispiel #1
0
int main(int argn, char *argc[])
{
	//Program parameters : argc[1] : HostName or Host IP
	//                                         argc[2] : Server Program Number
	//                                         other arguments depend on test case

	//run_mode can switch into stand alone program or program launch by shell script
	//1 : stand alone, debug mode, more screen information
	//0 : launch by shell script as test case, only one printf -> result status
	int run_mode = 0;
	int test_status = 1;	//Default test result set to FAILED
	int progNum = atoi(argc[2]);

	char *registeredProc();
	bool_t rslt;

	if (run_mode == 1) {
		printf("Server #%d\n", progNum);
	}

	svc_unreg(progNum, VERSNUM);
	rslt = rpc_reg(progNum, VERSNUM, PROCNUM, (void *)registeredProc,
		       (xdrproc_t) xdr_int, (xdrproc_t) xdr_int, "visible");
	test_status = (rslt == 0) ? 0 : 1;

	//This last printf gives the result status to the tests suite
	//normally should be 0: test has passed or 1: test has failed
	printf("%d\n", test_status);

	return test_status;
}
Beispiel #2
0
/*
 * For connectionless kind of transport. Obsoleted by rpc_reg()
 */
int
registerrpc(rpcprog_t prognum, rpcvers_t versnum, rpcproc_t procnum,
	char *(*progname)(), xdrproc_t inproc, xdrproc_t outproc)
{
	return (rpc_reg(prognum, versnum, procnum, progname, inproc,
				outproc, "udp"));
}
Beispiel #3
0
int main(int argn, char *argc[]) 
{
	//Server parameter is : argc[1] : Server Program Number
	//					    others arguments depend on server program
	int run_mode = 0;
	int progNum = atoi(argc[1]);
	char *simplePing_proc();
	bool_t rslt;
    char nettype[16] = "visible";

	if (run_mode)
	{
		printf("Prog Num : %d\n", progNum);
	}

	svc_unreg(progNum, VERSNUM);

	rslt = rpc_reg(progNum, VERSNUM, PROCSIMPLEPING, (void *)simplePing_proc,
					(xdrproc_t)xdr_int, (xdrproc_t)xdr_int, nettype);

	svc_run();

	fprintf(stderr, "svc_run() returned.  ERROR has occurred.\n");
	svc_unreg(progNum, VERSNUM);

	return 1;
}
Beispiel #4
0
void *my_thread_process(void *arg)
{
	char *registeredProc();
	int i;

	if (run_mode == 1) {
		fprintf(stderr, "Thread %ld\n", (long)arg);
	}

	for (i = 0; i < callNb; i++) {
		thread_array_result[atoi(arg)] =
		    thread_array_result[atoi(arg)] + !rpc_reg(progNum +
							      atoi(arg),
							      VERSNUM, PROCNUM,
							      (void *)
							      registeredProc,
							      (xdrproc_t)
							      xdr_int,
							      (xdrproc_t)
							      xdr_int,
							      "visible");
	}

	pthread_exit(0);
}
Beispiel #5
0
/*
 * For connectionless kind of transport. Obsoleted by rpc_reg()
 */
int
registerrpc(int prognum, int versnum, int procnum,
	char *(*progname)(char [UDPMSGSIZE]),
	xdrproc_t inproc, xdrproc_t outproc)
{
	return rpc_reg((rpcprog_t)prognum, (rpcvers_t)versnum,
	    (rpcproc_t)procnum, progname, inproc, outproc, __UNCONST("udp"));
}