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 _REMOTE_DEF |
10 | #define _REMOTE_DEF |
11 | #ifdef HAVE_MAPI |
12 | |
13 | #include "mal.h" |
14 | #include "mal_exception.h" |
15 | #include "mal_interpreter.h" |
16 | #include "mal_function.h" /* for printFunction */ |
17 | #include "mal_listing.h" |
18 | #include "mal_instruction.h" /* for getmodule/func macros */ |
19 | #include "mapi.h" |
20 | #include "mutils.h" |
21 | |
22 | /* #define _DEBUG_REMOTE */ |
23 | |
24 | #define RMTT_L_ENDIAN (0<<1) |
25 | #define RMTT_B_ENDIAN (1<<1) |
26 | #define RMTT_32_BITS (0<<2) |
27 | #define RMTT_64_BITS (1<<2) |
28 | #define RMTT_32_OIDS (0<<3) |
29 | #define RMTT_64_OIDS (1<<3) |
30 | |
31 | typedef struct _connection { |
32 | MT_Lock lock; /* lock to avoid interference */ |
33 | str name; /* the handle for this connection */ |
34 | Mapi mconn; /* the Mapi handle for the connection */ |
35 | unsigned char type; /* binary profile of the connection target */ |
36 | size_t nextid; /* id counter */ |
37 | struct _connection *next; /* the next connection in the list */ |
38 | } *connection; |
39 | |
40 | #ifndef WIN32 |
41 | #include <sys/socket.h> /* socket */ |
42 | #include <sys/un.h> /* sockaddr_un */ |
43 | #endif |
44 | #include <unistd.h> /* gethostname */ |
45 | |
46 | /* #define _DEBUG_REMOTE_ trace the interaction */ |
47 | /* #define _DEBUG_MAPI_ trace mapi interaction */ |
48 | |
49 | mal_export str RMTprelude(void *ret); |
50 | mal_export str RMTepilogue(void *ret); |
51 | mal_export str RMTresolve(bat *ret, str *pat); |
52 | mal_export str RMTconnectScen( str *ret, str *ouri, str *user, str *passwd, str *scen); |
53 | mal_export str RMTconnect( str *ret, str *uri, str *user, str *passwd); |
54 | mal_export str RMTconnectTable(Client cntxt, MalBlkPtr mb, MalStkPtr stk, InstrPtr pci); |
55 | |
56 | mal_export str RMTdisconnect(void *ret, str *conn); |
57 | mal_export str RMTget(Client cntxt, MalBlkPtr mb, MalStkPtr stk, InstrPtr pci); |
58 | mal_export str RMTput(Client cntxt, MalBlkPtr mb, MalStkPtr stk, InstrPtr pci); |
59 | mal_export str RMTregister(Client cntxt, MalBlkPtr mb, MalStkPtr stk, InstrPtr pci); |
60 | mal_export str RMTexec(Client cntxt, MalBlkPtr mb, MalStkPtr stk, InstrPtr pci); |
61 | mal_export str RMTbatload(Client cntxt, MalBlkPtr mb, MalStkPtr stk, InstrPtr pci); |
62 | mal_export str RMTbincopyto(Client cntxt, MalBlkPtr mb, MalStkPtr stk, InstrPtr pci); |
63 | mal_export str RMTbincopyfrom(Client cntxt, MalBlkPtr mb, MalStkPtr stk, InstrPtr pci); |
64 | mal_export str RMTbintype(Client cntxt, MalBlkPtr mb, MalStkPtr stk, InstrPtr pci); |
65 | mal_export str RMTisalive(int *ret, str *conn); |
66 | mal_export str RMTregisterSupervisor(int *ret, str *sup_uuid, str *query_uuid); |
67 | #endif /* HAVE_MAPI */ |
68 | #endif /* _REMOTE_DEF */ |
69 | |