7 * Revision 1.20 1994/07/19 18:29:59 markc
8 * Made machineName default to zero as last parameter to RPC_make_arg_list.
9 * Added typecast to malloc call in RPC_make_arg_list.
11 * Revision 1.19 1994/07/18 19:09:10 hollings
12 * added extra arg to RPC_make_arg_list.
14 * Revision 1.18 1994/06/02 23:35:15 markc
15 * Modified RPCUser class to support improved error checking for igen.
17 * Revision 1.17 1994/04/21 23:23:44 hollings
18 * removed paradynd name from make args function.
20 * Revision 1.16 1994/04/06 22:45:24 markc
21 * Cleaned up rpcUtil.h. Moved include files to rpcUtil.C where they belonged.
23 * Revision 1.15 1994/03/31 22:59:04 hollings
24 * added well known port as a paramter to xdrRPC constructor.
26 * Revision 1.14 1994/03/25 16:07:31 markc
27 * Added option to specify timeout on readReady.
29 * Revision 1.13 1994/03/20 01:45:23 markc
30 * Changed xdr_Boolean to char rather than int to reflect Boolean change.
32 * Revision 1.12 1994/03/11 21:01:24 hollings
33 * Changed Boolean from int to char to match X11 convention.
39 #include <sys/types.h>
40 #include <sys/socket.h>
43 #include <rpc/types.h>
47 #define xdr_Boolean xdr_char
49 typedef int (*xdrIOFunc)(int handle, char *buf, unsigned int len);
55 // Functions common to server and client side.
59 XDRrpc(char *m, char *u, char *p, xdrIOFunc, xdrIOFunc,
60 char **arg_list=0, int nblock=0, int wellKnownPortFd = 0);
61 XDRrpc(int fd, xdrIOFunc readRoutine, xdrIOFunc writeRoutine, int nblock=0);
62 XDRrpc(int family, int port, int type, char *machine, xdrIOFunc readFunc,
63 xdrIOFunc writeFunc, int nblock=0);
65 void closeConnect() { if (fd >= 0) close(fd); fd = -1;}
67 int get_fd() { return fd;}
68 int readReady(int timeout=0);
71 int pid; // pid of child;
72 static int __wellKnownPortFd__;
73 // should the fd be closed by a destructor ??
79 void setNonBlock() { ; }
80 void setTid(int id) { tid = id; }
83 // these are only to be used by implmentors of thread RPCs.
84 // the value is only valid during a thread RPC.
85 unsigned int requestingThread;
86 unsigned int getRequestingThread() { return requestingThread; }
91 // client side common routines that are transport independent.
95 void awaitResponce(int tag);
96 void verifyProtocolAndVersion();
98 int get_err_state() { return err_state;}
99 int clear_err_state() {err_state = 0;}
100 int did_error_occur() {return (err_state != 0);}
106 // server side routines that are transport independent.
110 int __versionVerifyDone__;
112 int get_err_state() { return err_state;}
113 int clear_err_state() {err_state = 0;}
114 int did_error_occur() {return (err_state != 0);}
119 extern int RPC_readReady (int fd, int timeout=0);
120 extern int RPC_setup_socket (int *sfd, // return file descriptor
121 int family, // AF_INET ...
122 int type); // SOCK_STREAM ...
123 extern int xdr_String(XDR*, String*);
124 extern int RPCprocessCreate(int *pid, char *hostName, char *userName,
125 char *commandLine, char **arg_list = 0,
126 int wellKnownPort = 0);
128 extern char **RPC_make_arg_list (int family, int type,
131 char *machienName = (char*) 0);
134 RPC_undo_arg_list (int argc, char **arg_list, char **machine, int &family,
135 int &type, int &well_known_socket, int &flag);
136 extern int RPC_getConnect (int fd);