7 * Revision 1.18 1994/06/02 23:35:15 markc
8 * Modified RPCUser class to support improved error checking for igen.
10 * Revision 1.17 1994/04/21 23:23:44 hollings
11 * removed paradynd name from make args function.
13 * Revision 1.16 1994/04/06 22:45:24 markc
14 * Cleaned up rpcUtil.h. Moved include files to rpcUtil.C where they belonged.
16 * Revision 1.15 1994/03/31 22:59:04 hollings
17 * added well known port as a paramter to xdrRPC constructor.
19 * Revision 1.14 1994/03/25 16:07:31 markc
20 * Added option to specify timeout on readReady.
22 * Revision 1.13 1994/03/20 01:45:23 markc
23 * Changed xdr_Boolean to char rather than int to reflect Boolean change.
25 * Revision 1.12 1994/03/11 21:01:24 hollings
26 * Changed Boolean from int to char to match X11 convention.
32 #include <sys/types.h>
33 #include <sys/socket.h>
36 #include <rpc/types.h>
40 #define xdr_Boolean xdr_char
42 typedef int (*xdrIOFunc)(int handle, char *buf, unsigned int len);
48 // Functions common to server and client side.
52 XDRrpc(char *m, char *u, char *p, xdrIOFunc, xdrIOFunc,
53 char **arg_list=0, int nblock=0, int wellKnownPortFd = 0);
54 XDRrpc(int fd, xdrIOFunc readRoutine, xdrIOFunc writeRoutine, int nblock=0);
55 XDRrpc(int family, int port, int type, char *machine, xdrIOFunc readFunc,
56 xdrIOFunc writeFunc, int nblock=0);
58 void closeConnect() { if (fd >= 0) close(fd); fd = -1;}
60 int get_fd() { return fd;}
61 int readReady(int timeout=0);
64 int pid; // pid of child;
65 static int __wellKnownPortFd__;
66 // should the fd be closed by a destructor ??
72 void setNonBlock() { ; }
73 void setTid(int id) { tid = id; }
76 // these are only to be used by implmentors of thread RPCs.
77 // the value is only valid during a thread RPC.
78 unsigned int requestingThread;
79 unsigned int getRequestingThread() { return requestingThread; }
84 // client side common routines that are transport independent.
88 void awaitResponce(int tag);
89 void verifyProtocolAndVersion();
91 int get_err_state() { return err_state;}
92 int clear_err_state() {err_state = 0;}
93 int did_error_occur() {return (err_state != 0);}
99 // server side routines that are transport independent.
103 int __versionVerifyDone__;
105 int get_err_state() { return err_state;}
106 int clear_err_state() {err_state = 0;}
107 int did_error_occur() {return (err_state != 0);}
112 extern int RPC_readReady (int fd, int timeout=0);
113 extern int RPC_setup_socket (int *sfd, // return file descriptor
114 int family, // AF_INET ...
115 int type); // SOCK_STREAM ...
116 extern int xdr_String(XDR*, String*);
117 extern int RPCprocessCreate(int *pid, char *hostName, char *userName,
118 char *commandLine, char **arg_list = 0,
119 int wellKnownPort = 0);
120 extern char **RPC_make_arg_list (int family, int type, int port, int flag);
122 RPC_undo_arg_list (int argc, char **arg_list, char **machine, int &family,
123 int &type, int &well_known_socket, int &flag);
124 extern int RPC_getConnect (int fd);