]> andersk Git - moira.git/blob - lib/mr_call.c
63e576ad6e2a1e17c30d5e87175fd1bd27a19541
[moira.git] / lib / mr_call.c
1 /* $Id $
2  *
3  * Pass an mr_params off to the Moira server and get a reply
4  *
5  * Copyright (C) 1987-1998 by the Massachusetts Institute of Technology
6  * For copying and distribution information, please see the file
7  * <mit-copyright.h>.
8  */
9
10 #include <mit-copyright.h>
11 #include <moira.h>
12 #include "mr_private.h"
13
14 RCSID("$Header$");
15
16 int mr_do_call(struct mr_params *params, struct mr_params **reply)
17 {
18   CHECK_CONNECTED;
19
20   if (!_mr_send_op)
21     _mr_send_op = create_operation();
22
23   if (!_mr_recv_op)
24     _mr_recv_op = create_operation();
25
26   initialize_operation(_mr_send_op, mr_start_send, (char *)params, NULL);
27   queue_operation(_mr_conn, CON_OUTPUT, _mr_send_op);
28
29   initialize_operation(_mr_recv_op, mr_start_recv, (char *)reply, NULL);
30   queue_operation(_mr_conn, CON_INPUT, _mr_recv_op);
31
32   /* Block until operation done. */
33   complete_operation(_mr_send_op);
34   complete_operation(_mr_recv_op);
35   /* Look at results */
36   if ((OP_STATUS(_mr_send_op) != OP_COMPLETE) ||
37       (OP_STATUS(_mr_recv_op) != OP_COMPLETE))
38     {
39       mr_disconnect();
40       return MR_ABORTED;
41     }
42   return 0;
43 }
This page took 0.028106 seconds and 3 git commands to generate.