]> andersk Git - moira.git/blob - lib/mr_connect.c
Added last_time_used field to client structure.
[moira.git] / lib / mr_connect.c
1 /*
2  *      $Source$
3  *      $Author$
4  *      $Header$
5  *
6  *      Copyright (C) 1987 by the Massachusetts Institute of Technology
7  *      
8  *      This routine is part of the client library.  It handles
9  * creating a connection to the sms server.
10  */
11
12 #ifndef lint
13 static char *rcsid_sms_connect_c = "$Header$";
14 #endif lint
15
16 #include "sms_private.h"
17
18 /*
19  * Open a connection to the sms server.
20  */
21
22 int sms_connect()
23 {
24     extern int errno;
25         
26     if (!sms_inited) sms_init();
27     if (_sms_conn) return SMS_ALREADY_CONNECTED;
28                 
29     /* 
30      *  * should do a hesiod call to find the sms machine name & service
31      *   * number/name.
32      *   */
33     /* XXX gdb doesn't give real return codes. Can we trust errno?*/
34     errno = 0;
35     _sms_conn = start_server_connection(SMS_GDB_SERV, ""); 
36     if (_sms_conn == NULL) {
37         return errno;
38     }
39     return 0;
40 }
41         
42 int sms_disconnect()
43 {
44     CHECK_CONNECTED;
45     _sms_conn = sever_connection(_sms_conn);
46     return 0;
47 }
48
49 int sms_noop()
50 {
51     int status;
52     sms_params param_st;
53     struct sms_params *params = NULL;
54     struct sms_params *reply = NULL;
55
56     CHECK_CONNECTED;
57     params = &param_st;
58     params->sms_procno = SMS_NOOP;
59     params->sms_argc = 0;
60     params->sms_argl = NULL;
61     params->sms_argv = NULL;
62         
63     if ((status = sms_do_call(params, &reply)) == 0)
64         status = reply->sms_status;
65         
66     sms_destroy_reply(reply);
67
68     return status;
69 }
70
71 /*
72  * Local Variables:
73  * mode: c
74  * c-indent-level: 4
75  * c-continued-statement-offset: 4
76  * c-brace-offset: -4
77  * c-argdecl-indent: 4
78  * c-label-offset: -4
79  * End:
80  */
This page took 0.16357 seconds and 5 git commands to generate.