00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025 #ifndef _MS_PROXY_H_
00026 #define _MS_PROXY_H_
00027
00028 #include "stmt/statement.h"
00029
00030
00031 #if defined(_WIN32)
00032 #ifdef COMPILE_PROXY_DLL
00033 #define PROXY_STORAGE_TYPE __declspec(dllexport)
00034 #else
00035 #define PROXY_STORAGE_TYPE __declspec(dllimport)
00036 #endif
00037 #else
00038 #define PROXY_STORAGE_TYPE extern
00039 #endif
00040
00046 #define MS_PROXY_ERROR_RECV_FAIL -88001
00047 #define MS_PROXY_ERROR_CMD_FAIL -88002
00048 #define MS_PROXY_ERROR_CMD_INCORRECT -88003
00049 #define MS_PROXY_ERROR_CMD_UNKNOWN -88004
00050 #define MS_PROXY_ERROR_DATA_WRONG -88005
00051 #define MS_PROXY_ERROR_WRONG_HASH -88006
00052
00053
00054
00055 #define MS_SERVER_ERROR_TXN_EXIST -88400
00056 #define MS_SERVER_ERROR_TXN_NOT_EXIST -88401
00057
00058
00059 #ifdef __cplusplus
00060 extern "C"
00061 {
00062 #endif
00063
00065 typedef struct _client_conn client_conn;
00066
00067
00071 PROXY_STORAGE_TYPE
00072 int model_server_init();
00073
00074
00078 PROXY_STORAGE_TYPE
00079 int model_server_cleanup();
00080
00081
00082
00090 PROXY_STORAGE_TYPE
00091 int model_server_connect(const char *server_name,
00092 unsigned short server_port,
00093 client_conn **ppconn);
00094
00099 PROXY_STORAGE_TYPE
00100 void model_server_connection_close(client_conn *pconn);
00101
00102
00109 PROXY_STORAGE_TYPE
00110 int model_server_login(client_conn *pconn, const char *login, const char *password);
00111
00112
00113
00118 PROXY_STORAGE_TYPE
00119 int model_server_logout(client_conn *pconn);
00120
00122 PROXY_STORAGE_TYPE
00123 int model_server_notify( client_conn *pconn, const char *login);
00124
00125
00132 PROXY_STORAGE_TYPE
00133 int model_server_set(client_conn *pconn, const Statement *pst);
00134
00135
00136
00141 PROXY_STORAGE_TYPE
00142 int model_server_txn_begin(client_conn *pconn);
00143
00144
00149 PROXY_STORAGE_TYPE
00150 int model_server_txn_commit(client_conn *pconn);
00151
00152
00157 PROXY_STORAGE_TYPE
00158 int model_server_txn_rollback(client_conn *pconn);
00159
00160
00168 PROXY_STORAGE_TYPE
00169 int model_server_get(client_conn *pconn, const Statement *pmask,
00170 Statement **result);
00171
00172 PROXY_STORAGE_TYPE
00173 int model_server_get_count(client_conn *pconn, const Statement *pmask,
00174 unsigned long *result);
00175
00176
00183 PROXY_STORAGE_TYPE
00184 int model_server_batch_get(client_conn *pconn, const Statement *masks,
00185 Statement **result);
00186
00187
00188
00195 PROXY_STORAGE_TYPE
00196 int model_server_read_notifications(client_conn *pconn,
00197 Statement **result);
00198
00199
00200
00206 PROXY_STORAGE_TYPE
00207 int model_server_get_new_id(client_conn *pconn, Node *idnode);
00208
00209
00210
00215 PROXY_STORAGE_TYPE
00216 void model_server_result_free(Statement **result);
00217
00218
00219 #ifdef __cplusplus
00220 }
00221 #endif
00222
00223
00224
00225
00226 #endif // _MS_PROXY_