New module gip: Gateway IPc module.
[egate.git] / util / gipc.c
1 /* Gateway kernel
2  * Europagate, 1995
3  *
4  * $Log: gipc.c,v $
5  * Revision 1.1  1995/03/27 08:24:59  adam
6  * New module gip: Gateway IPc module.
7  * New module gw-db: Gateway hash-db module (user information table).
8  *
9  */
10
11 #include <stdio.h>
12 #include <stdlib.h>
13 #include <assert.h>
14 #include <string.h>
15 #include <unistd.h>
16 #include <fcntl.h>
17
18 #include <gip.h>
19
20 GIP gipc_initialize (const char *name)
21 {
22     return gip_initialize (name);
23 }
24
25 int gipc_destroy (GIP gip)
26 {
27     return gip_destroy (gip);
28 }
29
30 int gipc_open (GIP gip, const char *server, int sync)
31 {
32     if (sync) 
33     {
34         gip->rfd = open (gip->name, O_RDONLY);
35         gip->wfd = open (server, O_WRONLY);
36     }
37     else
38     {
39         gip->wfd = open (server, O_WRONLY);
40         gip->rfd = open (gip->name, O_RDONLY);
41     }
42     if (gip->rfd == -1)
43         return -1;
44     if (gip->wfd == -1)
45         return -1;
46     return 0;
47 }
48
49 int gipc_close (GIP gip)
50 {
51     close (gip->rfd);
52     close (gip->wfd);
53     return 0;
54 }