15 #include <sys/types.h>
16 #include <sys/socket.h>
17 #include <netinet/in.h>
24 #include <rpc/types.h>
28 // functions that g++-fixincludes missed
30 void bzero (char*, int);
31 int select (int, fd_set*, fd_set*, fd_set*, struct timeval*);
33 int gethostname(char*, int);
34 int socket(int, int, int);
35 int bind(int s, struct sockaddr *, int);
36 int getsockname(int, struct sockaddr*, int *);
38 int connect(int s, struct sockaddr*, int);
39 int socketpair(int, int, int, int sv[2]);
41 int accept(int, struct sockaddr *addr, int *);
44 #define xdr_Boolean xdr_bool
46 typedef int (*xdrIOFunc)(int handle, char *buf, unsigned int len);
52 // Functions common to server and client side.
56 XDRrpc(char *m, char *u, char *p, xdrIOFunc, xdrIOFunc,
57 char **arg_list=0, int nblock=0);
58 XDRrpc(int fd, xdrIOFunc readRoutine, xdrIOFunc writeRoutine, int nblock=0);
59 XDRrpc(int family, int port, int type, char *machine, xdrIOFunc readFunc,
60 xdrIOFunc writeFunc, int nblock=0);
62 void closeConnect() { if (fd >= 0) close(fd); fd = -1;}
64 int get_fd() { return fd;}
68 int pid; // pid of child;
69 // should the fd be closed by a destructor ??
75 void setNonBlock() { ; }
76 void setTid(int id) { tid = id; }
79 // these are only to be used by implmentors of thread RPCs.
80 // the value is only valid during a thread RPC.
81 unsigned int requestingThread;
82 unsigned int getRequestingThread() { return requestingThread; }
87 // client side common routines that are transport independent.
91 void awaitResponce(int tag);
92 void verifyProtocolAndVersion();
96 // server side routines that are transport independent.
100 int __versionVerifyDone__;
103 extern int RPC_readReady (int fd);
104 extern int RPC_setup_socket (int *sfd, // return file descriptor
105 int family, // AF_INET ...
106 int type); // SOCK_STREAM ...
107 extern int xdr_String(XDR*, String*);
108 extern int RPCprocessCreate(int *pid, char *hostName, char *userName,
109 char *commandLine, char **arg_list = 0);
110 extern char **RPC_make_arg_list (char *program, int family, int type, int port, int flag);
112 RPC_undo_arg_list (int argc, char **arg_list, char **machine, int *family,
113 int *type, int *well_known_socket, int *flag);
114 extern int RPC_getConnect (int fd);