/*======================================================================= * Interface for an example Rx server/client application, using both * * standard and streamed calls. * ** * Edward R. Zayas * * Transarc Corporation * ** ** * The United States Government has rights in this work pursuant * * to contract no. MDA972-90-C-0036 between the United States Defense * * Advanced Research Projects Agency and Transarc Corporation. * ** * (C) Copyright 1991 Transarc Corporation * ** * Redistribution and use in source and binary forms are permitted * provided that: (1) source distributions retain this entire copy- * * right notice and comment, and (2) distributions including binaries * * display the following acknowledgement: * ** * ''This product includes software developed by Transarc * * Corporation and its contributors'' * ** * in the documentation or other materials mentioning features or * * use of this software. Neither the name of Transarc nor the names * * of its contributors may be used to endorse or promote products * * derived from this software without specific prior written * * permission. * ** * THIS SOFTWARE IS PROVIDED "AS IS" AND WITHOUT ANY EXPRESS OR IMPLIED * * WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF * * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. =======================================================================*/ package RXDEMO_ %#include <rx/rx.h> %#include <rx/rx_null.h> %#define RXDEMO_SERVER_PORT 8000 /* Service port to advertise */ %#define RXDEMO_SERVICE_PORT 0 /* User server's port */ %#define RXDEMO_SERVICE_ID 4 /* Service ID */ %#define RXDEMO_NULL_SECOBJ_IDX 0 /* Index of null security object */ /* Maximum number of requests that will be handled by this service * simultaneously. This number will be guaranteed to execute in * parallel if other service's results are being processed. */ %#define RXDEMO_MAX 3 /* Minimum number of requests that are guaranteed to be * handled simultaneously. */ %#define RXDEMO_MIN 2 /* Index of the "null" security class in the sample service. */ %#define RXDEMO_NULL 0 /* Maximum number of characters in a file name (for demo purposes). */ %#define RXDEMO_NAME_MAX_CHARS 64 /* Define the max number of bytes to transfer at one shot. */ %#define RXDEMO_BUFF_BYTES 512 /* Values returned by the RXDEMO_Getfile() call. * RXDEMO_CODE_SUCCESS : Everything went fine. * RXDEMO_CODE_CANT_OPEN : Can't open named file. * RXDEMO_CODE_CANT_STAT : Can't stat open file. * RXDEMO_CODE_CANT_READ : Error reading the open file. * RXDEMO_CODE_WRITE_ERROR : Error writing the open file. */ /* ------------Interface calls defined for this service ----------- */ %#define RXDEMO_CODE_SUCCESS 0 %#define RXDEMO_CODE_CANT_OPEN 1 %#define RXDEMO_CODE_CANT_STAT 2 %#define RXDEMO_CODE_CANT_READ 3 %#define RXDEMO_CODE_WRITE_ERROR 4 /* ------------------------------------------------------------------- * RXDEMO_Add * * * Summary: * Add the two numbers provided and return the result. * * Parameters: * int a_first : first operand. * int a_second : Second operand. * int *a_result : Sum of the above. * * Side effects: None. *-------------------------------------------------------------------- */ Add(IN int a, int b, OUT int *result) = 1; /*------------------------------------------------------------------- * RXDEMO_Getfile * * Summary: * Return the contents of the named file in the server's environment. * Parameters: * STRING a_nameToRead : Name of the file whose contents are to be * fetched. * int *a_result : Set to the result of opening and reading the file * on the server side. * * Side effects: None. *-------------------------------------------------------------------- */ Getfile(IN string a_nameToRead<RXDEMO_NAME_MAX_CHARS>, OUT int *a_result) split = 2;
/*======================================================================= % Client side of an example Rx application, using both standard and % % streamed calls. % %% % Edward R. Zayas % % Transarc Corporation % %% %% % The United States Government has rights in this work pursuant % % to contract no. MDA972-90-C-0036 between the United States Defense % % Advanced Research Projects Agency and Transarc Corporation. % %% % (C) Copyright 1991 Transarc Corporation % %% % Redistribution and use in source and binary forms are permitted % % provided that: (1) source distributions retain this entire copy- % % right notice and comment, and (2) distributions including binaries % % display the following acknowledgement: % %% % ''This product includes software developed by Transarc % % Corporation and its contributors'' % %% % in the documentation or other materials mentioning features or % % use of this software. Neither the name of Transarc nor the names % % of its contributors may be used to endorse or promote products % % derived from this software without specific prior written % % permission. % %% % THIS SOFTWARE IS PROVIDED "AS IS" AND WITHOUT ANY EXPRESS OR IMPLIED % % WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF % % MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. % %======================================================================= */ #include <sys/types.h> #include <netdb.h> #include <stdio.h> #include "rxdemo.h" static char pn[] = "rxdemo"; /* Program name */ static u_long GetIpAddress(a_hostName) char *a_hostName; { /* GetIPAddress */ static char rn[] = "GetIPAddress"; /* Routine name */ struct hostent *hostEntP; /* Ptr to host descriptor */ u_long hostIPAddr; /* Host IP address */ hostEntP = gethostbyname(a_hostName); if (hostEntP == (struct hostent *)0) { printf("[%s:%s] Host '%s' not found\n", pn, rn, a_hostName); exit(1); } if (hostEntP->h_length != sizeof(u_long)) { printf("[%s:%s] Wrong host address length (%d bytes instead of %d)", pn, rn, hostEntP->h_length, sizeof(u_long)); exit(1); } bcopy(hostEntP->h_addr, (char *)&hostIPAddr, sizeof(hostIPAddr)); return(hostIPAddr); } /* GetIpAddress */
main(argc, argv) int argc; char **argv; { /* Main */ struct rx_connection *rxConnP; /* Ptr to server connection */ struct rx_call *rxCallP; /* Ptr to Rx call descriptor */ u_long hostIPAddr; /* IP address of chosen host */ int demoUDPPort; /* UDP port of Rx service */ struct rx_securityClass *nullSecObjP; /* Ptr to null security object */ int operand1, operand2; /* Numbers to add int sum; Their sum */ int code; /* Return code */ char fileName[64]; /* Buffer for desired file's name */ long fileDataBytes; /* Num bytes in file to get */ char buff[RXDEMO_BUFF_BYTES+1]; /* Read buffer */ int currBytesToRead; /* Num bytes to read in one iteration */ int maxBytesToRead; /* Max bytes to read in one iteration */ int bytesReallyRead; /* Num bytes read off Rx stream */ int getResults; /* Results of the file fetch */ printf("\n%s: Example Rx client process\n\n", pn); if ((argc < 2) || (argc > 3)) { printf("Usage: rxdemo <HostName> [PortToUse]"); exit(1); } hostIPAddr = GetIpAddress(argv[1]); if (argc > 2) demoUDPPort = atoi(argv[2]); else demoUDPPort = RXDEMO_SERVER_PORT; /* Initialize the Rx facility. */ code = rx_Init(htons(demoUDPPort)); if (code) { printf("** Error calling rx_Init(); code is %d\n", code); exit(1); } /* Create a client-side null security object. */ nullSecObjP = rxnull_NewClientSecurityObject(); if (nullSecObjP == (struct rx_securityClass *)0) { printf("%s: Can't create a null client-side security object!\n", pn); exit(1); } /* Set up a connection to the desired Rx service, telling it to use * the null security object we just created. */ printf("Connecting to Rx server on '%s', IP address 0x%x, UDP port %d\n", argv[1], hostIPAddr, demoUDPPort); rxConnP = rx_NewConnection(hostIPAddr, RXDEMO_SERVER_PORT, RXDEMO_SERVICE_ID, nullSecObjP, RXDEMO_NULL_SECOBJ_IDX); if (rxConnP == (struct rx_connection *)0) { printf("rxdemo: Can't create connection to server!\n"); exit(1); } else printf(" ---> Connected.\n");
/* Perform our first, simple remote procedure call. */ operand1 = 1; operand2 = 2; printf("Asking server to add %d and %d: ", operand1, operand2); code = RXDEMO_Add(rxConnP, operand1, operand2, &sum); if (code) { printf(" // ** Error in the RXDEMO_Add RPC: code is %d\n", code); exit(1); } printf("Reported sum is %d\n", sum);
/* Set up for our second, streamed procedure call. */ printf("Name of file to read from server: "); scanf("%s", fileName); maxBytesToRead = RXDEMO_BUFF_BYTES; printf("Setting up an Rx call for RXDEMO_Getfile..."); rxCallP = rx_NewCall(rxConnP); if (rxCallP == (struct rx_call *)0) { printf("** Can't create call\n"); exit(1); } printf("done\n");
/* Sending IN parameters for the streamed call. */ code = StartRXDEMO_Getfile(rxCallP, fileName); if (code) { printf("** Error calling StartRXDEMO_Getfile(); code is %d\n", code); exit(1); }
bytesReallyRead = rx_Read(rxCallP, &fileDataBytes, sizeof(long)); if (bytesReallyRead != sizeof(long)) { printf("** Only %d bytes read for file length; should have been %d\n", bytesReallyRead, sizeof(long)); exit(1); } fileDataBytes = ntohl(fileDataBytes);
/* Read the file bytes via the Rx call, a buffer at a time. */ printf("[file contents (%d bytes) fetched over the Rx call appear below]\n\n", fileDataBytes); while (fileDataBytes > 0) { currBytesToRead = (fileDataBytes > maxBytesToRead ? maxBytesToRead : fileDataBytes); bytesReallyRead = rx_Read(rxCallP, buff, currBytesToRead); if (bytesReallyRead != currBytesToRead) { printf("\nExpecting %d bytes on this read, got %d instead\n", currBytesToRead, bytesReallyRead); exit(1); } /* Null-terminate the chunk before printing it. */ buff[currBytesToRead] = 0; printf("%s", buff); /* Adjust the number of bytes left to read. */ fileDataBytes -= currBytesToRead; } /* Read one bufferful of the file */
/* finish off the Rx call, getting the OUT parameters. */ printf("\n\n[End of file data]\n"); code = EndRXDEMO_Getfile(rxCallP, &getResults); if (code) { printf("** Error getting file transfer results; code is %d\n", code); exit(1); }
/* finish off the Rx call. */ code = rx_EndCall(rxCallP, code); if (code) printf("Error in calling rx_EndCall(); code is %d\n", code); printf("\n\nrxdemo complete.\n");
/*====================================================================== % % Advanced Research Projects Agency and Transarc Corporation. % %% % (C) Copyright 1991 Transarc Corporation % %% % Redistribution and use in source and binary forms are permitted % % provided that: (1) source distributions retain this entire copy- % % right notice and comment, and (2) distributions including binaries % % display the following acknowledgement: % %% % ''This product includes software developed by Transarc % % Corporation and its contributors'' % %% % in the documentation or other materials mentioning features or % % use of this software. Neither the name of Transarc nor the names % % of its contributors may be used to endorse or promote products % % derived from this software without specific prior written % % permission. % %% % THIS SOFTWARE IS PROVIDED "AS IS" AND WITHOUT ANY EXPRESS OR IMPLIED % % WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF % % MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. % % ====================================================================== */ /* Server portion of the example RXDEMO application, using both % standard and streamed calls. % % Edward R. Zayas % Transarc Corporation % % % The United States Government has rights in this work pursuant % to contract no. MDA972-90-C-0036 between the United States Defense % */ #include <sys/types.h> #include <sys/stat.h> #include <sys/file.h> #include <netdb.h> #include <stdio.h> #include "rxdemo.h" #define N_SECURITY_OBJECTS 1 extern RXDEMO_ExecuteRequest();
main(argc, argv) int argc; char **argv; { /* Main */ static char pn[] = "rxdemo_server"; /* Program name */ struct rx_securityClass (securityObjects[1]); /* Security objs */ struct rx_service *rxServiceP; /* Ptr to Rx service descriptor */ struct rx_call *rxCallP; /* Ptr to Rx call descriptor */ int demoUDPPort; /* UDP port of Rx service */ int fd; /* file descriptor */ int code; /* Return code */ printf("\n%s: Example Rx server process\n\n", pn); if (argc >2) { printf("Usage: rxdemo [PortToUse]"); exit(1); } if (argc > 1) demoUDPPort = atoi(argv[1]); else demoUDPPort = RXDEMO_SERVER_PORT; /* Initialize the Rx facility, telling it the UDP port number this * server will use for its single service. */ printf("Listening on UDP port %d\n", demoUDPPort); code = rx_Init(demoUDPPort); if (code) { printf("** Error calling rx_Init(); code is %d\n", code); exit(1); }
/* Create a single server-side security object. In this case, the * null security object (for unauthenticated connections) will be used * to control security on connections made to this server. */ securityObjects[RXDEMO_NULL_SECOBJ_IDX] = rxnull_NewServerSecurityObject(); if (securityObjects[RXDEMO_NULL_SECOBJ_IDX] == (struct rx_securityClass *) 0) { printf("** Can't create server-side security object\n"); exit(1); }
/* Instantiate a single sample service. The rxgen-generated procedure * called to dispatch requests is passed in (RXDEMO_ExecuteRequest). */ rxServiceP = rx_NewService( 0, RXDEMO_SERVICE_ID, "rxdemo", securityObjects, 1, RXDEMO_ExecuteRequest ); if (rxServiceP == (struct rx_service *) 0) { printf("** Can't create Rx service\n"); exit(1); }
/* Start up Rx services, donating this thread to the server pool. */ rx_StartServer(1); /* We should never return from the previous call. */ printf("** rx_StartServer() returned!!\n"); exit(1); } /* Main */
int RXDEMO_Add(a_rxCallP, a_operand1, a_operand2, a_resultP) struct rx_call *a_rxCallP; int a_operand1, a_operand2; int *a_resultP; { /* RXDEMO_Add */ printf("\t[Handling call to RXDEMO_Add(%d, %d)]\n", a_operand1, a_operand2); *a_resultP = a_operand1 + a_operand2; return(0); } /* RXDEMO_Add */
int RXDEMO_Getfile(a_rxCallP, a_nameToRead, a_resultP) struct rx_call *a_rxCallP; char *a_nameToRead; int *a_resultP; { /* RXDEMO_Getfile */ struct stat fileStat; /* Stat structure for file */ long fileBytes; /* Size of file in bytes */ long nbofileBytes; /* file bytes in network byte order */ int code; /* Return code */ int bytesReallyWritten; /* Bytes written on Rx channel */ int bytesToSend; /* Num bytes to read & send this time */ int maxBytesToSend; /* Max num bytes to read & send ever */ int bytesRead; /* Num bytes read from file */ char buff[RXDEMO_BUFF_BYTES+1]; /* Read buffer */ int fd; /* file descriptor */ maxBytesToSend = RXDEMO_BUFF_BYTES; printf("\t[Handling call to RXDEMO_Getfile(%s)]\n", a_nameToRead); fd = open(a_nameToRead, O_RDONLY, 0444); if (fd <0) { printf("\t\t[**Can't open file '%s']\n", a_nameToRead); *a_resultP = RXDEMO_CODE_CANT_OPEN; return(1); } else printf("\t\t[file opened]\n"); /* Stat the file to find out how big it is. */ code = fstat(fd, &fileStat); if (code) { a_resultP = RXDEMO_CODE_CANT_STAT; printf("\t\t[file closed]\n"); close(fd); return(1); } fileBytes = fileStat.st_size; printf("\t\t[file has %d bytes]\n", fileBytes);
nbofileBytes = htonl(fileBytes); /* Write out the size of the file to the Rx call. */ bytesReallyWritten = rx_Write(a_rxCallP, &nbofileBytes, sizeof(long)); if (bytesReallyWritten != sizeof(long)) { printf("** %d bytes written instead of %d for file length\n", bytesReallyWritten, sizeof(long)); *a_resultP = RXDEMO_CODE_WRITE_ERROR; printf("\t\t[file closed]\n"); close(fd); return(1); }
/* Write out the contents of the file, one buffer at a time. */ while (fileBytes > 0) { /* figure out the number of bytes to * read (and send) this time. */ bytesToSend = (fileBytes > maxBytesToSend ? maxBytesToSend : fileBytes); bytesRead = read(fd, buff, bytesToSend); if (bytesRead != bytesToSend) { printf("Read %d instead of %d bytes from the file\n", bytesRead, bytesToSend); *a_resultP = RXDEMO_CODE_WRITE_ERROR; printf("\t\t[file closed]\n"); close(fd); return(1); } /* Go ahead and send them. */ bytesReallyWritten = rx_Write(a_rxCallP, buff, bytesToSend); if (bytesReallyWritten != bytesToSend) { printf("%d file bytes written instead of %d\n", bytesReallyWritten, bytesToSend); *a_resultP = RXDEMO_CODE_WRITE_ERROR; printf("\t\t[file closed]\n"); close(fd); return(1); } /* Update the number of bytes left to go. */ fileBytes -= bytesToSend; } /* Write out the file to our caller */
/* Close the file, then return happily. */ *a_resultP = RXDEMO_CODE_SUCCESS; printf("\t\t[file closed]\n"); close(fd); return(0); } /* RXDEMO_Getfile */
make system
/*#=======================================================================# # The United States Government has rights in this work pursuant # # to contract no. MDA972-90-C-0036 between the United States Defense # # Advanced Research Projects Agency and Transarc Corporation. # # # # (C) Copyright 1991 Transarc Corporation # # # # Redistribution and use in source and binary forms are permitted # # provided that: (1) source distributions retain this entire copy-# # right notice and comment, and (2) distributions including binaries # # display the following acknowledgement: # # # # ''This product includes software developed by Transarc # # Corporation and its contributors'' # # # # in the documentation or other materials mentioning features or # # use of this software. Neither the name of Transarc nor the names # # of its contributors may be used to endorse or promote products # # derived from this software without specific prior written # # permission. # # # # THIS SOFTWARE IS PROVIDED "AS IS" AND WITHOUT ANY EXPRESS OR IMPLIED # # WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF # # MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. # #=======================================================================# */ SHELL = /bin/sh TOOL_CELL = grand.central.org AFS_INCLIB_CELL = transarc.com USR_CONTRIB = /afs/${TOOL_CELL}/darpa/usr/contrib/ PROJ_DIR = ${USR_CONTRIB}.site/grand.central.org/rxdemo/ AFS_INCLIB_DIR = /afs/${AFS_INCLIB_CELL}/afs/dest/ RXGEN = ${AFS_INCLIB_DIR}bin/rxgen INSTALL = ${AFS_INCLIB_DIR}bin/install LIBS = ${AFS_INCLIB_DIR}lib/librx.a \ ${AFS_INCLIB_DIR}lib/liblwp.a CFLAGS = -g \ -I. \ -I${AFS_INCLIB_DIR}include \ -I${AFS_INCLIB_DIR}include/afs \ -I${AFS_INCLIB_DIR} \ -I/usr/include system: install install: all ${INSTALL} rxdemo_client ${PROJ_DIR}bin ${INSTALL} rxdemo_server ${PROJ_DIR}bin all: rxdemo_client rxdemo_server rxdemo_client: rxdemo_client.o ${LIBS} rxdemo.cs.o ${CC} ${CFLAGS} -o rxdemo_client rxdemo_client.o rxdemo.cs.o ${LIBS} rxdemo_server: rxdemo_server.o rxdemo.ss.o ${LIBS} ${CC} ${CFLAGS} -o rxdemo_server rxdemo_server.o rxdemo.ss.o ${LIBS} rxdemo_client.o: rxdemo.h rxdemo_server.o: rxdemo.h rxdemo.cs.c rxdemo.ss.c rxdemo.er.c rxdemo.h: rxdemo.xg rxgen rxdemo.xg clean: rm -f *.o rxdemo.cs.c rxdemo.ss.c rxdemo.xdr.c rxdemo.h \ rxdemo_client rxdemo_server core
/*======================================================================% * % THIS SOFTWARE IS PROVIDED "AS IS" AND WITHOUT ANY EXPRESS OR IMPLIED % * % WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF % * % MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. % * %====================================================================== */ /* Machine generated file --Do NOT edit */ #include "rxdemo.h" #define RXDEMO_CODE_WRITE_ERROR 4 #include <rx/rx.h> #include <rx/rx_null.h> #define RXDEMO_SERVER_PORT 8000 /* Service port to advertise */ #define RXDEMO_SERVICE_PORT 0 /* User server's port */ #define RXDEMO_SERVICE_ID 4 /* Service ID */ #define RXDEMO_NULL_SECOBJ_IDX 0 /* Index of null security object */ #define RXDEMO_MAX 3 #define RXDEMO_MIN 2 #define RXDEMO_NULL 0 #define RXDEMO_NAME_MAX_CHARS 64 #define RXDEMO_BUFF_BYTES 512 #define RXDEMO_CODE_SUCCESS 0 #define RXDEMO_CODE_CANT_OPEN 1 #define RXDEMO_CODE_CANT_STAT 2 #define RXDEMO_CODE_CANT_READ 3 #define RXDEMO_CODE_WRITE_ERROR 4
int RXDEMO_Add(z_conn, a, b, result) register struct rx_connection *z_conn; int a, b; int * result; { struct rx_call *z_call = rx_NewCall(z_conn); static int z_op = 1; int z_result; XDR z_xdrs; xdrrx_create(&z_xdrs, z_call, XDR_ENCODE); /* Marshal the arguments */ if ((!xdr_int(&z_xdrs, &z_op)) || (!xdr_int(&z_xdrs, &a)) || (!xdr_int(&z_xdrs, &b))) { z_result = RXGEN_CC_MARSHAL; goto fail; } /* Un-marshal the reply arguments */ z_xdrs.x_op = XDR_DECODE; if ((!xdr_int(&z_xdrs, result))) { z_result = RXGEN_CC_UNMARSHAL; goto fail; } z_result = RXGEN_SUCCESS; fail: return rx_EndCall(z_call, z_result); }
int StartRXDEMO_Getfile(z_call, a_nameToRead) register struct rx_call *z_call; char * a_nameToRead; { static int z_op = 2; int z_result; XDR z_xdrs; xdrrx_create(&z_xdrs, z_call, XDR_ENCODE); /* Marshal the arguments */ if ((!xdr_int(&z_xdrs, &z_op)) || (!xdr_string(&z_xdrs, &a_nameToRead, RXDEMO_NAME_MAX_CHARS))) { z_result = RXGEN_CC_MARSHAL; goto fail; } z_result = RXGEN_SUCCESS; fail: return z_result; }
int EndRXDEMO_Getfile(z_call, a_result) register struct rx_call *z_call; int * a_result; { int z_result; XDR z_xdrs; /* Un-marshal the reply arguments */ xdrrx_create(&z_xdrs, z_call, XDR_DECODE); if ((!xdr_int(&z_xdrs, a_result))) { z_result = RXGEN_CC_UNMARSHAL; goto fail; } z_result = RXGEN_SUCCESS; fail: return z_result; }
/*======================================================================% % Edward R. Zayas % % Transarc Corporation % % % % % % The United States Government has rights in this work pursuant % % to contract no. MDA972-90-C-0036 between the United States Defense % % Advanced Research Projects Agency and Transarc Corporation. % % % % (C) Copyright 1991 Transarc Corporation % % % % Redistribution and use in source and binary forms are permitted % % provided that: (1) source distributions retain this entire copy¬% % right notice and comment, and (2) distributions including binaries % %====================================================================== */ /* Machine generated file --Do NOT edit */ #include "rxdemo.h" #include <rx/rx.h> #include <rx/rx_null.h> #define RXDEMO_SERVER_PORT 8000 /* Service port to advertise */ #define RXDEMO_SERVICE_PORT 0 /* User server's port */ #define RXDEMO_SERVICE_ID 4 /* Service ID */ #define RXDEMO_NULL_SECOBJ_IDX 0 /* Index of null security object */ #define RXDEMO_MAX 3 #define RXDEMO_MIN 2 #define RXDEMO_NULL 0 #define RXDEMO_NAME_MAX_CHARS 64 #define RXDEMO_BUFF_BYTES 512 #define RXDEMO_CODE_SUCCESS 0 #define RXDEMO_CODE_CANT_OPEN 1 #define RXDEMO_CODE_CANT_STAT 2 #define RXDEMO_CODE_CANT_READ 3 #define RXDEMO_CODE_WRITE_ERROR 4
long _RXDEMO_Add(z_call, z_xdrs) struct rx_call *z_call; XDR *z_xdrs; { long z_result; int a, b; int result; if ((!xdr_int(z_xdrs, &a)) || (!xdr_int(z_xdrs, &b))) { z_result = RXGEN_SS_UNMARSHAL; goto fail; } z_result = RXDEMO_Add(z_call, a, b, &result); z_xdrs->x_op = XDR_ENCODE; if ((!xdr_int(z_xdrs, &result))) z_result = RXGEN_SS_MARSHAL; fail: return z_result; }
long _RXDEMO_Getfile(z_call, z_xdrs) struct rx_call *z_call; XDR *z_xdrs; { long z_result; char * a_nameToRead=(char *)0; int a_result; if ((!xdr_string(z_xdrs, &a_nameToRead, RXDEMO_NAME_MAX_CHARS))) { z_result = RXGEN_SS_UNMARSHAL; goto fail; } z_result = RXDEMO_Getfile(z_call, a_nameToRead, &a_result); z_xdrs->x_op = XDR_ENCODE; if ((!xdr_int(z_xdrs, &a_result))) z_result = RXGEN_SS_MARSHAL; fail: z_xdrs->x_op = XDR_FREE; if (!xdr_string(z_xdrs, &a_nameToRead, RXDEMO_NAME_MAX_CHARS)) goto fail1; return z_result; fail1: return RXGEN_SS_XDRFREE; }
long _RXDEMO_Add(); long _RXDEMO_Getfile(); static long (*StubProcsArray0[])() = {_RXDEMO_Add, _RXDEMO_Getfile};
RXDEMO_ExecuteRequest(z_call) register struct rx_call *z_call; { int op; XDR z_xdrs; long z_result; xdrrx_create(&z_xdrs, z_call, XDR_DECODE); if (!xdr_int(&z_xdrs, &op)) z_result = RXGEN_DECODE; else if (op < RXDEMO_LOWEST_OPCODE || op > RXDEMO_HIGHEST_OPCODE) z_result = RXGEN_OPCODE; else z_result = (*StubProcsArray0[op -RXDEMO_LOWEST_OPCODE])(z_call, &z_xdrs); return z_result; }
/*======================================================================% %% % in the documentation or other materials mentioning features or % % use of this software. Neither the name of Transarc nor the names % % of its contributors may be used to endorse or promote products % % derived from this software without specific prior written % % permission. % % % % THIS SOFTWARE IS PROVIDED "AS IS" AND WITHOUT ANY EXPRESS OR IMPLIED % % WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF % % MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. % % Edward R. Zayas % Transarc Corporation % % % The United States Government has rights in this work pursuant to contract no. MDA972-90-C-0036 between the United States Defense % Advanced Research Projects Agency and Transarc Corporation. % % (C) Copyright 1991 Transarc Corporation % % Redistribution and use in source and binary forms are permitted % % provided that: (1) source distributions retain this entire copy¬ % right notice and comment, and (2) distributions including binaries % % display the following acknowledgement: % % % % ``This product includes software developed by Transarc % % Corporation and its contributors'' % %====================================================================== */ /* Machine generated file --Do NOT edit */ #include "rxdemo.h" #include <rx/rx.h> #include <rx/rx_null.h> #define RXDEMO_SERVER_PORT 8000 /* Service port to advertise */ #define RXDEMO_SERVICE_PORT 0 /* User server's port */ #define RXDEMO_SERVICE_ID 4 /* Service ID */ #define RXDEMO_NULL_SECOBJ_IDX 0 /* Index of null security object */ #define RXDEMO_MAX 3 #define RXDEMO_MIN 2 #define RXDEMO_NULL 0 #define RXDEMO_NAME_MAX_CHARS 64 #define RXDEMO_BUFF_BYTES 512 #define RXDEMO_CODE_SUCCESS 0 #define RXDEMO_CODE_CANT_OPEN 1 #define RXDEMO_CODE_CANT_STAT 2 #define RXDEMO_CODE_CANT_READ 3 #define RXDEMO_CODE_WRITE_ERROR 4
[file contents (2450 bytes) fetched over the Rx call appear below] /*#=======================================================================# # The United States Government has rights in this work pursuant # # to contract no. MDA972-90-C-0036 between the United States Defense # # Advanced Research Projects Agency and Transarc Corporation. # # # # (C) Copyright 1991 Transarc Corporation # # # # Redistribution and use in source and binary forms are permitted # # provided that: (1) source distributions retain this entire copy-# # right notice and comment, and (2) distributions including binaries # # display the following acknowledgement: # # # # ''This product includes software developed by Transarc # # Corporation and its contributors'' # # # # in the documentation or other materials mentioning features or # # use of this software. Neither the name of Transarc nor the names # # of its contributors may be used to endorse or promote products # # derived from this software without specific prior written # # permission. # # # # THIS SOFTWARE IS PROVIDED "AS IS" AND WITHOUT ANY EXPRESS OR IMPLIED # # WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF # # MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. # #=======================================================================# */ SHELL = /bin/sh TOOL_CELL = grand.central.org AFS_INCLIB_CELL = transarc.com USR_CONTRIB = /afs/${TOOL_CELL}/darpa/usr/contrib/ PROJ_DIR = ${USR_CONTRIB}.site/grand.central.org/rxdemo/ AFS_INCLIB_DIR = /afs/${AFS_INCLIB_CELL}/afs/dest/ RXGEN = ${AFS_INCLIB_DIR}bin/rxgen INSTALL = ${AFS_INCLIB_DIR}bin/install LIBS = ${AFS_INCLIB_DIR}lib/librx.a \ ${AFS_INCLIB_DIR}lib/liblwp.a CFLAGS = -g \ -I. \ -I${AFS_INCLIB_DIR}include \ -I${AFS_INCLIB_DIR}include/afs \ -I${AFS_INCLIB_DIR} \ -I/usr/include system: install install: all ${INSTALL} rxdemo_client ${PROJ_DIR}bin ${INSTALL} rxdemo_server ${PROJ_DIR}bin all: rxdemo_client rxdemo_server rxdemo_client: rxdemo_client.o ${LIBS} rxdemo.cs.o ${CC} ${CFLAGS} -o rxdemo_client rxdemo_client.o rxdemo.cs.o ${LIBS} rxdemo_server: rxdemo_server.o rxdemo.ss.o ${LIBS} ${CC} ${CFLAGS} -o rxdemo_server rxdemo_server.o rxdemo.ss.o ${LIBS} rxdemo_client.o: rxdemo.h rxdemo_server.o: rxdemo.h rxdemo.cs.c rxdemo.ss.c rxdemo.er.c rxdemo.h: rxdemo.xg rxgen rxdemo.xg clean: rm -f *.o rxdemo.cs.c rxdemo.ss.c rxdemo.xdr.c rxdemo.h \ rxdemo_client rxdemo_server core [End of file data] rxdemo complete.