| 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 SERVER_H |
| 10 | #define SERVER_H |
| 11 | #ifdef HAVE_MAPI |
| 12 | /* #define DEBUG_SERVER */ |
| 13 | |
| 14 | #include "mal_client.h" |
| 15 | #include "mal_session.h" |
| 16 | #include "mal_exception.h" |
| 17 | #include "mal_interpreter.h" |
| 18 | #include "mal_authorize.h" |
| 19 | #include "msabaoth.h" |
| 20 | #include "mcrypt.h" |
| 21 | #include "stream.h" |
| 22 | #include "streams.h" /* for Stream */ |
| 23 | |
| 24 | |
| 25 | #define NEW_ARRAY( type, size ) (type*)GDKmalloc((size)*sizeof(type)) |
| 26 | #define STREQ(a, b) (strcmp(a, b)==0) |
| 27 | |
| 28 | #define SERVERPORT 50000 |
| 29 | #define SERVERMAXUSERS 5 |
| 30 | |
| 31 | mal_export str SERVERlisten_default(int *ret); |
| 32 | mal_export str SERVERlisten_port(int *ret, int *pid); |
| 33 | mal_export str SERVERlisten_usock(int *ret, str *usock); |
| 34 | mal_export str SERVERstop(void *ret); |
| 35 | mal_export str SERVERsuspend(void *ret); |
| 36 | mal_export str SERVERresume(void *ret); |
| 37 | |
| 38 | mal_export str SERVERconnect(Client cntxt, MalBlkPtr mb, MalStkPtr stk, InstrPtr pc); |
| 39 | mal_export str SERVERdisconnectWithAlias(int *ret, str *db_alias); |
| 40 | mal_export str SERVERdisconnectALL(int *ret); |
| 41 | mal_export str SERVERreconnectAlias(Client cntxt, MalBlkPtr mb, MalStkPtr stk, InstrPtr pc); |
| 42 | mal_export str SERVERreconnectWithoutAlias(Client cntxt, MalBlkPtr mb, MalStkPtr stk, InstrPtr pc); |
| 43 | mal_export str SERVERtrace(void *ret, int *mid, int *flag); |
| 44 | mal_export str SERVERdisconnect(void *ret, int *mid); |
| 45 | mal_export str SERVERsetAlias(void *ret, int *mid, str *dbalias); |
| 46 | mal_export str SERVERlookup(int *ret, str *dbalias); |
| 47 | mal_export str SERVERdestroy(void *ret, int *mid); |
| 48 | mal_export str SERVERreconnect(void *ret, int *mid); |
| 49 | mal_export str SERVERping(int *ret, int *mid); |
| 50 | mal_export str SERVERquery(int *ret, int *mid, str *qry); |
| 51 | mal_export str SERVERquery_handle(int *ret, int *mid, str *qry); |
| 52 | mal_export str SERVERquery_array(Client cntxt, MalBlkPtr mb, MalStkPtr stk, InstrPtr pc); |
| 53 | mal_export str SERVERprepare(int *ret, int *key, str *qry); |
| 54 | mal_export str SERVERfinish(int *ret, int *idx); |
| 55 | mal_export str SERVERrows_affected(lng *ret, int *idx); |
| 56 | mal_export str SERVERget_row_count(lng *ret, int *idx); |
| 57 | mal_export str SERVERget_field_count(int *ret, int *idx); |
| 58 | mal_export str SERVERfetch_row(int *ret, int *idx); |
| 59 | mal_export str SERVERfetch_all_rows(lng *ret, int *idx); |
| 60 | mal_export str SERVERfetch_field_str(str *ret, int *idx, int *fnr); |
| 61 | mal_export str SERVERfetch_field_int(int *ret, int *idx, int *fnr); |
| 62 | mal_export str SERVERfetch_field_lng(lng *ret, int *idx, int *fnr); |
| 63 | #ifdef HAVE_HGE |
| 64 | mal_export str SERVERfetch_field_hge(hge *ret, int *idx, int *fnr); |
| 65 | #endif |
| 66 | mal_export str SERVERfetch_field_sht(sht *ret, int *idx, int *fnr); |
| 67 | mal_export str SERVERfetch_field_void(void *ret, int *idx, int *fnr); |
| 68 | mal_export str SERVERfetch_field_oid(oid *ret, int *idx, int *fnr); |
| 69 | mal_export str SERVERfetch_field_bte(bte *ret, int *idx, int *fnr); |
| 70 | mal_export str SERVERfetch_line(str *ret, int *key); |
| 71 | mal_export str SERVERnext_result(int *ret, int *key); |
| 72 | mal_export str SERVERfetch_reset(int *ret, int *key); |
| 73 | mal_export str SERVERfetch_field_bat(bat *bid, int *idx); |
| 74 | mal_export str SERVERerror(int *ret, int *idx); |
| 75 | mal_export str SERVERgetError(str *ret, int *idx); |
| 76 | mal_export str SERVERexplain(str *ret, int *idx); |
| 77 | mal_export str SERVERmapi_rpc_single_row(Client cntxt, MalBlkPtr mb, MalStkPtr stk, InstrPtr pci); |
| 78 | mal_export str SERVERmapi_rpc_single_bat(Client cntxt, MalBlkPtr mb, MalStkPtr stk, InstrPtr pci); |
| 79 | mal_export str SERVERput(Client cntxt, MalBlkPtr mb, MalStkPtr stk, InstrPtr pci); |
| 80 | mal_export str SERVERputLocal(Client cntxt, MalBlkPtr mb, MalStkPtr stk, InstrPtr pci); |
| 81 | mal_export str SERVERbindBAT(Client cntxt, MalBlkPtr mb, MalStkPtr stk, InstrPtr pci); |
| 82 | mal_export str SERVERclient(void *res, const Stream *In, const Stream *Out); |
| 83 | mal_export str SERVERmapi_rpc_bat(Client cntxt, MalBlkPtr mb, MalStkPtr stk, InstrPtr pci); |
| 84 | |
| 85 | #endif /* HAVE_MAPI */ |
| 86 | #endif /* SERVER_H */ |
| 87 | |