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