2 // xdr client pvm client/server
4 // xdr client, pvm server
5 // this is started by 'paradyn' and starts the other paradynd's
8 // xdr client, pvm client
9 // started by pvm server, attempts to establish socket to xdr server
10 // by passing messages to pvm server
14 #include "xdr_link.CLNT.h"
15 #include <util/h/list.h>
20 static int started_by_paradynd(char *m, int f, int t, int s);
21 static int get_list_of_pvm_clients(char *m, int f, int t, int s, int flag);
22 static xdr_linkUser *xdr_link_conn= 0;
25 main (int argc, char *argv[])
27 // is this the first 'paradyn' --> no args passed in
28 // else, this is not the first paradyn
29 int family, type, well_known_socket, flag;
34 if (tid != PvmNoParent)
38 assert (RPC_undo_arg_list (argc, argv, &machine, &family, &type, &well_known_socket, &flag) == 0);
42 // the first paradynd started
43 // start others and act as server until they all report
44 pvm_perror("In first\n");
45 xdr_link_conn = new xdr_linkUser (0, NULL, NULL);
46 xdr_link_conn->connected("from first\n");
49 if (get_list_of_pvm_clients(machine, family, type, well_known_socket, 0)
52 // there was an error starting the remote paradynd's, exit
58 delete (xdr_link_conn);
63 pvm_perror("In else\n");
64 // talk to paradyn through 'first' paradynd
65 if (started_by_paradynd(machine, family, type, well_known_socket) == -1)
69 delete(xdr_link_conn);
70 // do normal paradynd behavior here
75 get_list_of_pvm_clients(char *machine, int family, int type,
76 int well_known_socket, int flag)
78 struct taskinfo *taskp;
79 struct hostinfo *hostp;
80 int narch, nhost, loop, pvmd_tid, tids, i;
83 if ((pvm_tasks(pvm_mytid(), &narch, &taskp) < 0) || (narch < 1))
86 pvmd_tid = taskp[0].ti_host;
87 if (pvm_config(&nhost, &narch, &hostp) < 0)
90 pvm_argv = RPC_make_arg_list ("xdrc_pvm", family, type, well_known_socket, 0);
91 for (loop=0; loop<nhost; ++loop)
93 assert (hostp->hi_name);
95 // don't start a paradyn on this machine
96 //if (pvmd_tid != hostp[loop].hi_tid)
98 if (pvm_spawn("xdrc_pvm", pvm_argv, 1, hostp->hi_name, 1, &kidid) != 1)
100 pvm_perror("spawn failed\n");
118 started_by_paradynd(char *machine, int family, int type, int well_known_socket)
120 xdr_link_conn = new xdr_linkUser(family, well_known_socket, type, machine, NULL, NULL);
122 xdr_link_conn->connected("pvm client connected\n");