7 * Revision 1.21 1994/07/28 22:21:26 krisna
8 * changed declaration of xdrIOFunc to conform to prototypes
10 * Revision 1.20 1994/07/19 18:29:59 markc
11 * Made machineName default to zero as last parameter to RPC_make_arg_list.
12 * Added typecast to malloc call in RPC_make_arg_list.
14 * Revision 1.19 1994/07/18 19:09:10 hollings
15 * added extra arg to RPC_make_arg_list.
17 * Revision 1.18 1994/06/02 23:35:15 markc
18 * Modified RPCUser class to support improved error checking for igen.
20 * Revision 1.17 1994/04/21 23:23:44 hollings
21 * removed paradynd name from make args function.
23 * Revision 1.16 1994/04/06 22:45:24 markc
24 * Cleaned up rpcUtil.h. Moved include files to rpcUtil.C where they belonged.
26 * Revision 1.15 1994/03/31 22:59:04 hollings
27 * added well known port as a paramter to xdrRPC constructor.
29 * Revision 1.14 1994/03/25 16:07:31 markc
30 * Added option to specify timeout on readReady.
32 * Revision 1.13 1994/03/20 01:45:23 markc
33 * Changed xdr_Boolean to char rather than int to reflect Boolean change.
35 * Revision 1.12 1994/03/11 21:01:24 hollings
36 * Changed Boolean from int to char to match X11 convention.
42 #include <sys/types.h>
43 #include <sys/socket.h>
46 #include <rpc/types.h>
50 #define xdr_Boolean xdr_char
52 typedef int (*xdrIOFunc)(const void *, char *, int);
58 // Functions common to server and client side.
62 XDRrpc(char *m, char *u, char *p, xdrIOFunc, xdrIOFunc,
63 char **arg_list=0, int nblock=0, int wellKnownPortFd = 0);
64 XDRrpc(int fd, xdrIOFunc readRoutine, xdrIOFunc writeRoutine, int nblock=0);
65 XDRrpc(int family, int port, int type, char *machine, xdrIOFunc readFunc,
66 xdrIOFunc writeFunc, int nblock=0);
68 void closeConnect() { if (fd >= 0) close(fd); fd = -1;}
70 int get_fd() { return fd;}
71 int readReady(int timeout=0);
74 int pid; // pid of child;
75 static int __wellKnownPortFd__;
76 // should the fd be closed by a destructor ??
82 void setNonBlock() { ; }
83 void setTid(int id) { tid = id; }
86 // these are only to be used by implmentors of thread RPCs.
87 // the value is only valid during a thread RPC.
88 unsigned int requestingThread;
89 unsigned int getRequestingThread() { return requestingThread; }
94 // client side common routines that are transport independent.
98 void awaitResponce(int tag);
99 void verifyProtocolAndVersion();
101 int get_err_state() { return err_state;}
102 int clear_err_state() {err_state = 0;}
103 int did_error_occur() {return (err_state != 0);}
109 // server side routines that are transport independent.
113 int __versionVerifyDone__;
115 int get_err_state() { return err_state;}
116 int clear_err_state() {err_state = 0;}
117 int did_error_occur() {return (err_state != 0);}
122 extern int RPC_readReady (int fd, int timeout=0);
123 extern int RPC_setup_socket (int *sfd, // return file descriptor
124 int family, // AF_INET ...
125 int type); // SOCK_STREAM ...
126 extern int xdr_String(XDR*, String*);
127 extern int RPCprocessCreate(int *pid, char *hostName, char *userName,
128 char *commandLine, char **arg_list = 0,
129 int wellKnownPort = 0);
131 extern char **RPC_make_arg_list (int family, int type,
134 char *machienName = (char*) 0);
137 RPC_undo_arg_list (int argc, char **arg_list, char **machine, int &family,
138 int &type, int &well_known_socket, int &flag);
139 extern int RPC_getConnect (int fd);