1 | /* |
2 | * This Source Code Form is subject to the terms of the Mozilla Public |
3 | * License, v. 2.0. If a copy of the MPL was not distributed with this |
4 | * file, You can obtain one at http://mozilla.org/MPL/2.0/. |
5 | * |
6 | * Copyright 1997 - July 2008 CWI, August 2008 - 2019 MonetDB B.V. |
7 | */ |
8 | |
9 | #ifndef _MULTIPLEX_H |
10 | #define _MULTIPLEX_H 1 |
11 | |
12 | #include "mapi.h" |
13 | #include "stream.h" |
14 | |
15 | #include "merovingian.h" |
16 | |
17 | typedef struct _multiplex_database { |
18 | Mapi conn; /* current connection in use */ |
19 | Mapi newconn; /* new connection we should set live (or NULL) */ |
20 | char connupdate; /* if set, we have to cycle newconn into conn */ |
21 | char *user; |
22 | char *pass; |
23 | char *database; |
24 | MapiHdl hdl; |
25 | } multiplex_database; |
26 | |
27 | typedef struct _multiplex_client { |
28 | char *name; |
29 | int sock; |
30 | stream *fdin; |
31 | stream *fout; |
32 | struct _multiplex_client *next; |
33 | } multiplex_client; |
34 | |
35 | typedef struct _multiplex { |
36 | pthread_t tid; |
37 | int gdklock; |
38 | char shutdown; |
39 | char *name; |
40 | char *pool; |
41 | FILE *sout; |
42 | FILE *serr; |
43 | int dbcc; |
44 | multiplex_database **dbcv; |
45 | multiplex_client *clients; |
46 | } multiplex; |
47 | |
48 | err multiplexInit(char *name, char *pattern, FILE *sout, FILE *serr); |
49 | void multiplexDestroy(char *mp); |
50 | void multiplexAddClient(char *mp, int sock, stream *fout, stream *fdin, char *name); |
51 | void multiplexRemoveClient(multiplex *m, multiplex_client *c); |
52 | void multiplexNotifyAddedDB(const char *database); |
53 | void multiplexNotifyRemovedDB(const char *database); |
54 | |
55 | #endif |
56 | |
57 | /* vim:set ts=4 sw=4 noexpandtab: */ |
58 | |