Minor hacks really.
[egate.git] / util / gips.c
1 /* Gateway kernel
2  * Europagate, 1995
3  *
4  * $Log: gips.c,v $
5  * Revision 1.3  1995/04/20 15:12:46  adam
6  * Minor hacks really.
7  *
8  * Revision 1.2  1995/04/19  16:02:06  adam
9  * Some hacks to get the FIFO communication work!! Isn't reliable.
10  *
11  * Revision 1.1  1995/03/27  08:25:00  adam
12  * New module gip: Gateway IPc module.
13  * New module gw-db: Gateway hash-db module (user information table).
14  *
15  */
16
17 #include <stdio.h>
18 #include <stdlib.h>
19 #include <assert.h>
20 #include <string.h>
21 #include <unistd.h>
22 #include <fcntl.h>
23
24 #include <gw-log.h>
25 #include <gip.h>
26
27 GIP gips_initialize (const char *name)
28 {
29     return gip_initialize (name);
30 }
31
32 int gips_destroy (GIP gip)
33 {
34     return gip_destroy (gip);
35 }
36
37 int gips_open (GIP gip, const char *client)
38 {
39     gw_log (GW_LOG_DEBUG, "gips", "open writeonly of %s", client);
40     gip->wfd = open (client, O_WRONLY);
41     gw_log (GW_LOG_DEBUG, "gips", "open readonly of %s", gip->name);
42     gip->rfd = open (gip->name, O_RDONLY);
43     if (gip->rfd == -1)
44         return -1;
45     if (gip->wfd == -1)
46         return -1;
47     return 0;
48 }
49
50 int gips_close (GIP gip)
51 {
52     if (gip->rfd != -1)
53     {
54         close (gip->rfd);
55         gip->rfd = -1;
56     }
57     if (gip->wfd != -1)
58     {
59         close (gip->wfd);
60         gip->wfd = -1;
61     }
62     return 0;
63 }