7 * Revision 1.26 1994/11/11 06:59:09 markc
8 * Added additional argument to RPC_make_arg_list and RPC_undo_arg_list to
9 * support remote executition for paradyndPVM.
11 * Revision 1.25 1994/11/01 16:07:33 markc
12 * Added Object classes that provide os independent symbol tables.
13 * Added stl-like container classes with iterators.
15 * Revision 1.24 1994/10/12 20:22:08 krisna
18 * Revision 1.23 1994/09/22 03:18:05 markc
19 * changes to remove compiler warnings
20 * changed pid passed to RPCprocessCreate
22 * Revision 1.22 1994/08/17 18:23:53 markc
23 * Added new classes: Cstring KeyList, KList
24 * Added new function: RPCgetArg
25 * Changed typedefs in machineType.h to #defines
27 * Revision 1.21 1994/07/28 22:21:26 krisna
28 * changed declaration of xdrIOFunc to conform to prototypes
30 * Revision 1.20 1994/07/19 18:29:59 markc
31 * Made machineName default to zero as last parameter to RPC_make_arg_list.
32 * Added typecast to malloc call in RPC_make_arg_list.
34 * Revision 1.19 1994/07/18 19:09:10 hollings
35 * added extra arg to RPC_make_arg_list.
37 * Revision 1.18 1994/06/02 23:35:15 markc
38 * Modified RPCUser class to support improved error checking for igen.
40 * Revision 1.17 1994/04/21 23:23:44 hollings
41 * removed paradynd name from make args function.
43 * Revision 1.16 1994/04/06 22:45:24 markc
44 * Cleaned up rpcUtil.h. Moved include files to rpcUtil.C where they belonged.
46 * Revision 1.15 1994/03/31 22:59:04 hollings
47 * added well known port as a paramter to xdrRPC constructor.
49 * Revision 1.14 1994/03/25 16:07:31 markc
50 * Added option to specify timeout on readReady.
52 * Revision 1.13 1994/03/20 01:45:23 markc
53 * Changed xdr_Boolean to char rather than int to reflect Boolean change.
55 * Revision 1.12 1994/03/11 21:01:24 hollings
56 * Changed Boolean from int to char to match X11 convention.
63 #include <sys/types.h>
64 #include <sys/socket.h>
65 #include <rpc/types.h>
70 #define xdr_Boolean xdr_char
72 typedef int (*xdrIOFunc)(const void *, char *, int);
76 extern int RPC_readReady (int fd, int timeout=0);
80 // Functions common to server and client side.
84 XDRrpc(char *m, char *u, char *p, xdrIOFunc, xdrIOFunc,
85 char **arg_list=0, int nblock=0, int wellKnownPortFd = 0);
86 XDRrpc(int fd, xdrIOFunc readRoutine, xdrIOFunc writeRoutine, int nblock=0);
87 XDRrpc(int family, int port, int type, char *machine, xdrIOFunc readFunc,
88 xdrIOFunc writeFunc, int nblock=0);
90 inline void setNonBlock() {
92 fcntl (fd, F_SETFL, O_NONBLOCK);
94 inline void closeConnect() {
95 if (fd >= 0) close(fd); fd = -1;
100 inline int readReady(int timeout=0) {
101 return RPC_readReady (fd, timeout);
106 inline int getPid() {
109 inline void setPid(int to) {
112 inline XDR *getXdrs() {
115 inline void setDir(xdr_op d) {__xdrs__->x_op = d;}
119 int pid; // pid of child;
120 static int __wellKnownPortFd__;
124 // common routines that are transport independent.
128 inline RPCBase(int st=0, int v=0) { err_state = st; versionVerifyDone = v;}
130 inline int get_err_state() { return err_state;}
131 inline void clear_err_state() {err_state = 0;}
132 inline int did_error_occur() {return (err_state != 0);}
133 inline int getVersionVerifyDone() { return versionVerifyDone;}
134 inline void setVersionVerifyDone() { versionVerifyDone = 1;}
135 inline void set_err_state(int s) { err_state = s;}
137 int versionVerifyDone;
143 inline THREADrpc(int t) { tid = t; }
145 inline void setTid(int id) { tid = id; }
146 inline int getTid() { return tid;}
148 // see not on requestingThread, the use of this may be unsafe
149 inline unsigned int getRequestingThread() { return requestingThread; }
150 inline void setRequestingThread(int t) { requestingThread = t;}
153 // these are only to be used by implmentors of thread RPCs.
154 // the value is only valid during a thread RPC.
155 unsigned int requestingThread;
158 extern int RPC_setup_socket (int *sfd, // return file descriptor
159 int family, // AF_INET ...
160 int type); // SOCK_STREAM ...
161 extern int xdr_char_PTR (XDR*, char**);
162 extern int RPCprocessCreate(int &pid, const char *hostName, const char *userName,
163 const char *commandLine, char **arg_list = 0,
164 int wellKnownPort = 0);
166 extern char **RPC_make_arg_list (int family, int type,
170 char *machienName = (char*) 0);
173 RPC_undo_arg_list (int argc, char **arg_list, char **machine, int &family,
174 int &type, int &well_known_socket, int &flag, int &firstPVM);
175 extern int RPC_getConnect (int fd);
177 extern char **RPCgetArg(int &argc, const char *input);