Compare commits

...

2 Commits

Author SHA1 Message Date
HuangXin a493f45b7c OCT 1. 更新SQLite3加密功能 2024-12-10 17:16:36 +08:00
HuangXin d407918358 OCT 1. 修正语法问题
2. 更新banner
3. 增加SQLite3
4. 更新配置文件
2024-12-10 17:16:11 +08:00
24 changed files with 294130 additions and 19361 deletions

View File

@ -1,16 +1,15 @@
CMAKE_MINIMUM_REQUIRED(VERSION 3.10 FATAL_ERROR)
INCLUDE(CMakeDependentOption)
OPTION(USED_DHCPSERVER "DHCP server for agent" OFF)
OPTION(USED_HTTP_SVR "Build-in http(s) server support" OFF)
OPTION(USED_JSON_VALIDATE "Support json protocol field validate" OFF)
OPTION(BUILD_TESTING "Enable tests" ON)
OPTION(BUILD_TESTING "Enable tests" OFF)
#
OPTION(USED_REDIS "Add redis database support for agent" OFF)
OPTION(USED_MYSQL "Add mysql database support for agent" OFF)
OPTION(USED_SQLITE "Add sqlite3 database support for agent" ON)
OPTION(USED_SQLITE_CRYPTO "Sqlite3 database support crypto" OFF)
CMAKE_DEPENDENT_OPTION(USED_HTTP_SVR "Build-in http(s) server support" OFF "USED_DHCPSERVER" OFF)
CMAKE_DEPENDENT_OPTION(USED_SQLITE "Add sqlite3 database support for agent" OFF "USED_SQLITE_CRYPTO" OFF)
LIST(APPEND CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/depend)
IF (BUILD_TESTING)
@ -86,27 +85,37 @@ ENDIF ()
IF (USED_HTTP_SVR)
LIST(APPEND COMMON_DEFINE "-DHTTPSERVER_ON")
MESSAGE("Select Option USED_HTTP_SVR")
MESSAGE("++ Select Option USED_HTTP_SVR")
ELSE ()
MESSAGE("-- Unselect Option USED_HTTP_SVR")
ENDIF ()
IF (USED_SQLITE)
MESSAGE("Select Option USED_SQLITE")
MESSAGE("++ Select Option USED_SQLITE")
LIST(APPEND COMMON_DEFINE "-DSQLITE_ON")
ELSE ()
MESSAGE("-- Unselect Option USED_SQLITE")
ENDIF ()
IF (USED_MYSQL)
MESSAGE("Select Option USED_MYSQL")
MESSAGE("++ Select Option USED_MYSQL")
LIST(APPEND COMMON_DEFINE "-DUSED_MYSQL")
ELSE ()
MESSAGE("-- Unselect Option USED_MYSQL")
ENDIF ()
IF (USED_REDIS)
MESSAGE("Select Option USED_REDIS")
MESSAGE("++ Select Option USED_REDIS")
LIST(APPEND COMMON_DEFINE "-DUSED_REDIS")
ELSE ()
MESSAGE("-- Unselect Option USED_REDIS")
ENDIF ()
IF (USED_SQLITE_CRYPTO)
LIST(APPEND COMMON_DEFINE "-DSQLITE_CRYPTO_ON")
MESSAGE("Select Option USED_SQLITE_CRYPTO")
MESSAGE("++ Select Option USED_SQLITE_CRYPTO")
ELSE ()
MESSAGE("-- Unselect Option USED_SQLITE_CRYPTO")
ENDIF ()
ADD_SUBDIRECTORY(srcs)

View File

@ -1,12 +1,15 @@
__ __ _
\ \ / ___| | ___ ___ _ __ ___ ___
\ \ /\ / / _ | |/ __/ _ \| '_ ` _ \ / _ \
\ V V | __| | (_| (_) | | | | | | __/
\_/\_/ \___|_|\___\___/|_| |_| |_|\___|
__ __ _ _
\ \ / / | | | |
\ \ /\ / / ___ | | | | ___ ___ _ __ ___ ___
\ \/ \/ / / _ \ | | | | / __| / _ \ | '_ ` _ \ / _ \
\ /\ / | __/ | | | | | (__ | (_) | | | | | | | | __/
\/ \/ \___| |_| |_| \___| \___/ |_| |_| |_| \___|
██╗ ██╗██╗██████╗ ████████╗██╗ ██╗ █████╗ ██╗ ██████╗██████╗ ███████╗
██║ ██║██║██╔══██╗╚══██╔══╝██║ ██║██╔══██╗██║ ██╔════╝██╔══██╗██╔════╝
██║ ██║██║██████╔╝ ██║ ██║ ██║███████║██║ ██║ ██████╔╝█████╗
╚██╗ ██╔╝██║██╔══██╗ ██║ ██║ ██║██╔══██║██║ ██║ ██╔═══╝ ██╔══╝
╚████╔╝ ██║██║ ██║ ██║ ╚██████╔╝██║ ██║███████╗ ╚██████╗██║ ███████╗
╚═══╝ ╚═╝╚═╝ ╚═╝ ╚═╝ ╚═════╝ ╚═╝ ╚═╝╚══════╝ ╚═════╝╚═╝ ╚══════╝
__ __ _ _ _ _ _
| \/ | (_) | | | | | | /\ | |
| \ / | _ __| | __| | | | ___ __ __ __ _ _ __ ___ / \ __ _ ___ _ __ | |_
| |\/| | | | / _` | / _` | | | / _ \ \ \ /\ / / / _` | | '__| / _ \ / /\ \ / _` | / _ \ | '_ \ | __|
| | | | | | | (_| | | (_| | | | | __/ \ V V / | (_| | | | | __/ / ____ \ | (_| | | __/ | | | | | |_
|_| |_| |_| \__,_| \__,_| |_| \___| \_/\_/ \__,_| |_| \___| /_/ \_\ \__, | \___| |_| |_| \__|
__/ |
|___/

View File

@ -7,10 +7,6 @@ PKG_SEARCH_MODULE(LIBCURL REQUIRED libcurl)
PKG_SEARCH_MODULE(LIBSSL REQUIRED libssl)
PKG_SEARCH_MODULE(LIBCRYPTO REQUIRED libcrypto)
IF (USED_SQLITE AND (NOT USED_SQLITE_CRYPTO))
PKG_SEARCH_MODULE(LIBSQLITE3 REQUIRED sqlite3)
ENDIF ()
IF ((NOT LIBCRYPTO_FOUND) OR (NOT LIBSSL_FOUND) OR (NOT LIBCURL_FOUND))
LINUX_INSTALL_SYSTEM_PACKAGE()
ENDIF ()

View File

@ -5,12 +5,13 @@ PROJECT(${LIB_PROJECT_TARGET} LANGUAGES C VERSION 1.1.0)
STRING(REPLACE ";" ", " BUILD_CONFIG_INFO "${COMMON_DEFINE}")
CONFIGURE_FILE(lib_config.h.in lib_config.h)
IF (USED_SQLITE_CRYPTO)
INCLUDE_DIRECTORIES(include/sqlite3)
IF (USED_SQLITE)
INCLUDE_DIRECTORIES(include/sqlite3_crypto)
ENDIF ()
INCLUDE_DIRECTORIES(include ./ ./include ../lwip/src/arch_linux/include ../include mongoose)
FILE(GLOB C_HEADS ./include/network/*.h include/*.h include/uthash/*.h include/s2j/*.h vector/*.h ${CMAKE_BINARY_DIR}/*.h ${PROJECT_BINARY_DIR}/*.h)
INCLUDE_DIRECTORIES(include ./ ./include ../lwip/src/arch_linux/include ../include mongoose ./database/sqlite3)
FILE(GLOB C_HEADS ./include/network/*.h include/*.h include/uthash/*.h include/s2j/*.h vector/*.h
./database/sqlite3/*.h ${CMAKE_BINARY_DIR}/*.h ${PROJECT_BINARY_DIR}/*.h)
AUX_SOURCE_DIRECTORY(json C_SRC)
AUX_SOURCE_DIRECTORY(args C_SRC)
@ -40,6 +41,8 @@ ENDIF ()
IF (USED_SQLITE)
LIST(APPEND C_SRC database/database.c)
IF (SQLITE_CRYPTO_ON)
AUX_SOURCE_DIRECTORY(database/sqlite3_crypto C_SRC)
ELSE ()
AUX_SOURCE_DIRECTORY(database/sqlite3 C_SRC)
ENDIF ()
ENDIF ()
@ -50,13 +53,23 @@ SET_SOURCE_FILES_PROPERTIES(misc/zvector.c PROPERTIES COMPILE_FLAGS "-Wall -Wext
SET_SOURCE_FILES_PROPERTIES(mongoose/mongoose.c PROPERTIES COMPILE_FLAGS "-Wall -Wextra -w")
IF (USED_SQLITE_CRYPTO)
SET_SOURCE_FILES_PROPERTIES(database/sqlite3/sqlite3.c PROPERTIES
COMPILE_FLAGS "-DSQLITE_HAS_CODEC \
SET_SOURCE_FILES_PROPERTIES(database/sqlite3_crypto/sqlite3.c PROPERTIES
COMPILE_FLAGS "-DSQLITE_HAS_CODEC \
-DSQLCIPHER_CRYPTO_OPENSSL -DSQLITE_OS_UNIX=1 \
-D_HAVE_SQLITE_CONFIG_H -DBUILD_sqlite -DNDEBUG -DSQLITE_THREADSAFE=1 \
-DSQLITE_ENABLE_MATH_FUNCTIONS -DSQLITE_ENABLE_UPDATE_DELETE_LIMIT \
-DSQLITE_ENABLE_MATH_FUNCTIONS -DSQLITE_ENABLE_UPDATE_DELETE_LIMIT \
-DSQLITE_HAVE_ZLIB=1 -DSQLITE_TEMP_STORE=2")
ELSE ()
SET_SOURCE_FILES_PROPERTIES(database/sqlite3/sqlite3.c PROPERTIES
COMPILE_FLAGS " -I. -DHAVE_STDIO_H=1 -DHAVE_STDLIB_H=1 \
-DHAVE_STRING_H=1 -DHAVE_INTTYPES_H=1 -DHAVE_STDINT_H=1 -DHAVE_STRINGS_H=1 \
-DHAVE_SYS_STAT_H=1 -DHAVE_SYS_TYPES_H=1 -DHAVE_UNISTD_H=1 -DSTDC_HEADERS=1 \
-DHAVE_DLFCN_H=1 -DHAVE_FDATASYNC=1 -DHAVE_USLEEP=1 -DHAVE_LOCALTIME_R=1 \
-DHAVE_GMTIME_R=1 -DHAVE_DECL_STRERROR_R=1 -DHAVE_STRERROR_R=1 -DHAVE_POSIX_FALLOCATE=1 \
-D_REENTRANT=1 -DSQLITE_THREADSAFE=1 -DSQLITE_ENABLE_MATH_FUNCTIONS \
-DSQLITE_ENABLE_FTS4 -DSQLITE_ENABLE_FTS5 -DSQLITE_ENABLE_RTREE -DSQLITE_ENABLE_GEOPOLY \
-DSQLITE_ENABLE_DBPAGE_VTAB -DSQLITE_ENABLE_STMTVTAB -DSQLITE_ENABLE_DBSTAT_VTAB")
ENDIF ()
ADD_DEFINITIONS(${COMMON_DEFINE})

View File

@ -67,8 +67,7 @@ static CFG_ITEM g_cfgItem[] = {
DEF_CFG_ITEM(CFG_HARDWARE_WATCH, "system.system_info_watch", VAL_BOOL, "1", "Monitor cpu, memory, disk, fan, temperature ..."),
DEF_CFG_ITEM(CFG_HARDWARE_REFRESH, "system.system_info_refresh", VAL_INT, "10", "Monitor hardware information upgrade frequency"),
// Agent 配置
DEF_CFG_ITEM(CFG_AGENT_IPTV_POST_URL, "agent.iptv_report_url", VAL_STR, "", "IPTV report URL"),
DEF_CFG_ITEM(CFG_AGENT_MONITER_URL, "agent.moniter_rep_url", VAL_STR, "", "vCPE moniter report URL"),
DEF_CFG_ITEM(CFG_AGENT_MONITER_URL, "agent.platform_server_url", VAL_STR, "", "Platform interface URL"),
/* 系统监控设备相配置 */
DEF_CFG_ITEM(CFG_WATCH_CPU, "watch_params.cpu", VAL_BOOL, "1", "Monitor cpu information"),
DEF_CFG_ITEM(CFG_WATCH_MEMORY, "watch_params.memory", VAL_BOOL, "1", "Monitor memory information"),
@ -102,12 +101,6 @@ static CFG_ITEM g_cfgItem[] = {
DEF_CFG_ITEM(CFG_MQ_SVR_PORT, "zero_mq.svr_port", VAL_INT, "6278", "ZeroMQ server port"),
DEF_CFG_ITEM(CFG_MQ_DATA_PATH, "zero_mq.agent_addr", VAL_STR, "ipc:///tmp/msg_fifo0", "ZeroMQ Agent data path"),
#endif
/* vxLan 隧道配置 */
DEF_CFG_ITEM(CFG_VXLAN_NIC_NAME, "vxlan_wan.nic", VAL_STR, "", "Network card name to send data"),
DEF_CFG_ITEM(CFG_VXLAN_SUPPORT, "vxlan_wan.enable", VAL_BOOL, "1", "Is support vxLan tune"),
DEF_CFG_ITEM(CFG_VXLAN_PEER_IP, "vxlan_wan.peer_ip", VAL_STR, "", "vxLan peer ip address"),
DEF_CFG_ITEM(CFG_VXLAN_PEER_MAC, "vxlan_wan.peer_mac", VAL_STR, "", "vxLan peer mac address"),
DEF_CFG_ITEM(CFG_VXLAN_PKG_FILTER, "vxlan_wan.pkg_filter", VAL_STR, "", "vxLan package filter"),
/*HTTP Server 配置*/
#ifdef HTTPSERVER_ON
DEF_CFG_ITEM(CFG_HTTP_SVR_URI, "http_svr.uri", VAL_STR, "http://0.0.0.0:6789", "Network address to listen on"),
@ -233,18 +226,6 @@ static int load_array_str(const char *pKeyName, PCONFIG_ITEM pValue) {
return -ERR_ITEM_UNEXISTS;
}
static int cmp_dhcp_obj(const void *a, const void *b) {
POBJ_DHCP_RNG pV1 = (POBJ_DHCP_RNG)a;
POBJ_DHCP_RNG pV2 = (POBJ_DHCP_RNG)b;
if (strcmp(pV1->rangAddr, pV2->rangAddr) == 0 && strcmp(pV1->subnet, pV2->subnet) == 0 &&
strcmp(pV1->dnsSvr, pV2->dnsSvr) == 0 && strcmp(pV1->gateway, pV2->gateway) == 0 && pV1->lease == pV2->lease) {
return 0;
}
return -1;
}
static int load_array_obj(const char *pKeyName, PCONFIG_ITEM pValue) {
int i;
config_setting_t *pItem = config_lookup(&g_cfgContent, pKeyName);

View File

@ -59,10 +59,6 @@ const char *config_get_dhcp_nic_name() {
}
#endif
const char *config_get_agent_iptv_report_url() {
return cfg_get_string_value(CFG_AGENT_IPTV_POST_URL);
}
const char *config_get_agent_moniter_report_url() {
return cfg_get_string_value(CFG_AGENT_MONITER_URL);
}

View File

@ -2,7 +2,6 @@
// Created by xajhu on 2021/7/2 0002.
//
#include <string.h>
#include <openssl/aes.h>
#include <openssl/evp.h>
#include "crypto.h"

View File

@ -149,7 +149,7 @@ static void evpLockCb(int mode, int n, const char *UNUSED(pFile), int UNUSED(lin
}
#if OPENSSL_VERSION_NUMBER >= OPENSSL_VERSION_1_0_0
void evpIdCb(CRYPTO_THREADID *tid) {
void evpIdCb(CRYPTO_THREADID *UNUSED(tid)) {
CRYPTO_THREADID_set_numeric(tid, (unsigned long)pthread_self());
}
#else

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,719 @@
/*
** 2006 June 7
**
** The author disclaims copyright to this source code. In place of
** a legal notice, here is a blessing:
**
** May you do good and not evil.
** May you find forgiveness for yourself and forgive others.
** May you share freely, never taking more than you give.
**
*************************************************************************
** This header file defines the SQLite interface for use by
** shared libraries that want to be imported as extensions into
** an SQLite instance. Shared libraries that intend to be loaded
** as extensions by SQLite should #include this file instead of
** sqlite3.h.
*/
#ifndef SQLITE3EXT_H
#define SQLITE3EXT_H
#include "sqlite3.h"
/*
** The following structure holds pointers to all of the SQLite API
** routines.
**
** WARNING: In order to maintain backwards compatibility, add new
** interfaces to the end of this structure only. If you insert new
** interfaces in the middle of this structure, then older different
** versions of SQLite will not be able to load each other's shared
** libraries!
*/
struct sqlite3_api_routines {
void * (*aggregate_context)(sqlite3_context*,int nBytes);
int (*aggregate_count)(sqlite3_context*);
int (*bind_blob)(sqlite3_stmt*,int,const void*,int n,void(*)(void*));
int (*bind_double)(sqlite3_stmt*,int,double);
int (*bind_int)(sqlite3_stmt*,int,int);
int (*bind_int64)(sqlite3_stmt*,int,sqlite_int64);
int (*bind_null)(sqlite3_stmt*,int);
int (*bind_parameter_count)(sqlite3_stmt*);
int (*bind_parameter_index)(sqlite3_stmt*,const char*zName);
const char * (*bind_parameter_name)(sqlite3_stmt*,int);
int (*bind_text)(sqlite3_stmt*,int,const char*,int n,void(*)(void*));
int (*bind_text16)(sqlite3_stmt*,int,const void*,int,void(*)(void*));
int (*bind_value)(sqlite3_stmt*,int,const sqlite3_value*);
int (*busy_handler)(sqlite3*,int(*)(void*,int),void*);
int (*busy_timeout)(sqlite3*,int ms);
int (*changes)(sqlite3*);
int (*close)(sqlite3*);
int (*collation_needed)(sqlite3*,void*,void(*)(void*,sqlite3*,
int eTextRep,const char*));
int (*collation_needed16)(sqlite3*,void*,void(*)(void*,sqlite3*,
int eTextRep,const void*));
const void * (*column_blob)(sqlite3_stmt*,int iCol);
int (*column_bytes)(sqlite3_stmt*,int iCol);
int (*column_bytes16)(sqlite3_stmt*,int iCol);
int (*column_count)(sqlite3_stmt*pStmt);
const char * (*column_database_name)(sqlite3_stmt*,int);
const void * (*column_database_name16)(sqlite3_stmt*,int);
const char * (*column_decltype)(sqlite3_stmt*,int i);
const void * (*column_decltype16)(sqlite3_stmt*,int);
double (*column_double)(sqlite3_stmt*,int iCol);
int (*column_int)(sqlite3_stmt*,int iCol);
sqlite_int64 (*column_int64)(sqlite3_stmt*,int iCol);
const char * (*column_name)(sqlite3_stmt*,int);
const void * (*column_name16)(sqlite3_stmt*,int);
const char * (*column_origin_name)(sqlite3_stmt*,int);
const void * (*column_origin_name16)(sqlite3_stmt*,int);
const char * (*column_table_name)(sqlite3_stmt*,int);
const void * (*column_table_name16)(sqlite3_stmt*,int);
const unsigned char * (*column_text)(sqlite3_stmt*,int iCol);
const void * (*column_text16)(sqlite3_stmt*,int iCol);
int (*column_type)(sqlite3_stmt*,int iCol);
sqlite3_value* (*column_value)(sqlite3_stmt*,int iCol);
void * (*commit_hook)(sqlite3*,int(*)(void*),void*);
int (*complete)(const char*sql);
int (*complete16)(const void*sql);
int (*create_collation)(sqlite3*,const char*,int,void*,
int(*)(void*,int,const void*,int,const void*));
int (*create_collation16)(sqlite3*,const void*,int,void*,
int(*)(void*,int,const void*,int,const void*));
int (*create_function)(sqlite3*,const char*,int,int,void*,
void (*xFunc)(sqlite3_context*,int,sqlite3_value**),
void (*xStep)(sqlite3_context*,int,sqlite3_value**),
void (*xFinal)(sqlite3_context*));
int (*create_function16)(sqlite3*,const void*,int,int,void*,
void (*xFunc)(sqlite3_context*,int,sqlite3_value**),
void (*xStep)(sqlite3_context*,int,sqlite3_value**),
void (*xFinal)(sqlite3_context*));
int (*create_module)(sqlite3*,const char*,const sqlite3_module*,void*);
int (*data_count)(sqlite3_stmt*pStmt);
sqlite3 * (*db_handle)(sqlite3_stmt*);
int (*declare_vtab)(sqlite3*,const char*);
int (*enable_shared_cache)(int);
int (*errcode)(sqlite3*db);
const char * (*errmsg)(sqlite3*);
const void * (*errmsg16)(sqlite3*);
int (*exec)(sqlite3*,const char*,sqlite3_callback,void*,char**);
int (*expired)(sqlite3_stmt*);
int (*finalize)(sqlite3_stmt*pStmt);
void (*free)(void*);
void (*free_table)(char**result);
int (*get_autocommit)(sqlite3*);
void * (*get_auxdata)(sqlite3_context*,int);
int (*get_table)(sqlite3*,const char*,char***,int*,int*,char**);
int (*global_recover)(void);
void (*interruptx)(sqlite3*);
sqlite_int64 (*last_insert_rowid)(sqlite3*);
const char * (*libversion)(void);
int (*libversion_number)(void);
void *(*malloc)(int);
char * (*mprintf)(const char*,...);
int (*open)(const char*,sqlite3**);
int (*open16)(const void*,sqlite3**);
int (*prepare)(sqlite3*,const char*,int,sqlite3_stmt**,const char**);
int (*prepare16)(sqlite3*,const void*,int,sqlite3_stmt**,const void**);
void * (*profile)(sqlite3*,void(*)(void*,const char*,sqlite_uint64),void*);
void (*progress_handler)(sqlite3*,int,int(*)(void*),void*);
void *(*realloc)(void*,int);
int (*reset)(sqlite3_stmt*pStmt);
void (*result_blob)(sqlite3_context*,const void*,int,void(*)(void*));
void (*result_double)(sqlite3_context*,double);
void (*result_error)(sqlite3_context*,const char*,int);
void (*result_error16)(sqlite3_context*,const void*,int);
void (*result_int)(sqlite3_context*,int);
void (*result_int64)(sqlite3_context*,sqlite_int64);
void (*result_null)(sqlite3_context*);
void (*result_text)(sqlite3_context*,const char*,int,void(*)(void*));
void (*result_text16)(sqlite3_context*,const void*,int,void(*)(void*));
void (*result_text16be)(sqlite3_context*,const void*,int,void(*)(void*));
void (*result_text16le)(sqlite3_context*,const void*,int,void(*)(void*));
void (*result_value)(sqlite3_context*,sqlite3_value*);
void * (*rollback_hook)(sqlite3*,void(*)(void*),void*);
int (*set_authorizer)(sqlite3*,int(*)(void*,int,const char*,const char*,
const char*,const char*),void*);
void (*set_auxdata)(sqlite3_context*,int,void*,void (*)(void*));
char * (*xsnprintf)(int,char*,const char*,...);
int (*step)(sqlite3_stmt*);
int (*table_column_metadata)(sqlite3*,const char*,const char*,const char*,
char const**,char const**,int*,int*,int*);
void (*thread_cleanup)(void);
int (*total_changes)(sqlite3*);
void * (*trace)(sqlite3*,void(*xTrace)(void*,const char*),void*);
int (*transfer_bindings)(sqlite3_stmt*,sqlite3_stmt*);
void * (*update_hook)(sqlite3*,void(*)(void*,int ,char const*,char const*,
sqlite_int64),void*);
void * (*user_data)(sqlite3_context*);
const void * (*value_blob)(sqlite3_value*);
int (*value_bytes)(sqlite3_value*);
int (*value_bytes16)(sqlite3_value*);
double (*value_double)(sqlite3_value*);
int (*value_int)(sqlite3_value*);
sqlite_int64 (*value_int64)(sqlite3_value*);
int (*value_numeric_type)(sqlite3_value*);
const unsigned char * (*value_text)(sqlite3_value*);
const void * (*value_text16)(sqlite3_value*);
const void * (*value_text16be)(sqlite3_value*);
const void * (*value_text16le)(sqlite3_value*);
int (*value_type)(sqlite3_value*);
char *(*vmprintf)(const char*,va_list);
/* Added ??? */
int (*overload_function)(sqlite3*, const char *zFuncName, int nArg);
/* Added by 3.3.13 */
int (*prepare_v2)(sqlite3*,const char*,int,sqlite3_stmt**,const char**);
int (*prepare16_v2)(sqlite3*,const void*,int,sqlite3_stmt**,const void**);
int (*clear_bindings)(sqlite3_stmt*);
/* Added by 3.4.1 */
int (*create_module_v2)(sqlite3*,const char*,const sqlite3_module*,void*,
void (*xDestroy)(void *));
/* Added by 3.5.0 */
int (*bind_zeroblob)(sqlite3_stmt*,int,int);
int (*blob_bytes)(sqlite3_blob*);
int (*blob_close)(sqlite3_blob*);
int (*blob_open)(sqlite3*,const char*,const char*,const char*,sqlite3_int64,
int,sqlite3_blob**);
int (*blob_read)(sqlite3_blob*,void*,int,int);
int (*blob_write)(sqlite3_blob*,const void*,int,int);
int (*create_collation_v2)(sqlite3*,const char*,int,void*,
int(*)(void*,int,const void*,int,const void*),
void(*)(void*));
int (*file_control)(sqlite3*,const char*,int,void*);
sqlite3_int64 (*memory_highwater)(int);
sqlite3_int64 (*memory_used)(void);
sqlite3_mutex *(*mutex_alloc)(int);
void (*mutex_enter)(sqlite3_mutex*);
void (*mutex_free)(sqlite3_mutex*);
void (*mutex_leave)(sqlite3_mutex*);
int (*mutex_try)(sqlite3_mutex*);
int (*open_v2)(const char*,sqlite3**,int,const char*);
int (*release_memory)(int);
void (*result_error_nomem)(sqlite3_context*);
void (*result_error_toobig)(sqlite3_context*);
int (*sleep)(int);
void (*soft_heap_limit)(int);
sqlite3_vfs *(*vfs_find)(const char*);
int (*vfs_register)(sqlite3_vfs*,int);
int (*vfs_unregister)(sqlite3_vfs*);
int (*xthreadsafe)(void);
void (*result_zeroblob)(sqlite3_context*,int);
void (*result_error_code)(sqlite3_context*,int);
int (*test_control)(int, ...);
void (*randomness)(int,void*);
sqlite3 *(*context_db_handle)(sqlite3_context*);
int (*extended_result_codes)(sqlite3*,int);
int (*limit)(sqlite3*,int,int);
sqlite3_stmt *(*next_stmt)(sqlite3*,sqlite3_stmt*);
const char *(*sql)(sqlite3_stmt*);
int (*status)(int,int*,int*,int);
int (*backup_finish)(sqlite3_backup*);
sqlite3_backup *(*backup_init)(sqlite3*,const char*,sqlite3*,const char*);
int (*backup_pagecount)(sqlite3_backup*);
int (*backup_remaining)(sqlite3_backup*);
int (*backup_step)(sqlite3_backup*,int);
const char *(*compileoption_get)(int);
int (*compileoption_used)(const char*);
int (*create_function_v2)(sqlite3*,const char*,int,int,void*,
void (*xFunc)(sqlite3_context*,int,sqlite3_value**),
void (*xStep)(sqlite3_context*,int,sqlite3_value**),
void (*xFinal)(sqlite3_context*),
void(*xDestroy)(void*));
int (*db_config)(sqlite3*,int,...);
sqlite3_mutex *(*db_mutex)(sqlite3*);
int (*db_status)(sqlite3*,int,int*,int*,int);
int (*extended_errcode)(sqlite3*);
void (*log)(int,const char*,...);
sqlite3_int64 (*soft_heap_limit64)(sqlite3_int64);
const char *(*sourceid)(void);
int (*stmt_status)(sqlite3_stmt*,int,int);
int (*strnicmp)(const char*,const char*,int);
int (*unlock_notify)(sqlite3*,void(*)(void**,int),void*);
int (*wal_autocheckpoint)(sqlite3*,int);
int (*wal_checkpoint)(sqlite3*,const char*);
void *(*wal_hook)(sqlite3*,int(*)(void*,sqlite3*,const char*,int),void*);
int (*blob_reopen)(sqlite3_blob*,sqlite3_int64);
int (*vtab_config)(sqlite3*,int op,...);
int (*vtab_on_conflict)(sqlite3*);
/* Version 3.7.16 and later */
int (*close_v2)(sqlite3*);
const char *(*db_filename)(sqlite3*,const char*);
int (*db_readonly)(sqlite3*,const char*);
int (*db_release_memory)(sqlite3*);
const char *(*errstr)(int);
int (*stmt_busy)(sqlite3_stmt*);
int (*stmt_readonly)(sqlite3_stmt*);
int (*stricmp)(const char*,const char*);
int (*uri_boolean)(const char*,const char*,int);
sqlite3_int64 (*uri_int64)(const char*,const char*,sqlite3_int64);
const char *(*uri_parameter)(const char*,const char*);
char *(*xvsnprintf)(int,char*,const char*,va_list);
int (*wal_checkpoint_v2)(sqlite3*,const char*,int,int*,int*);
/* Version 3.8.7 and later */
int (*auto_extension)(void(*)(void));
int (*bind_blob64)(sqlite3_stmt*,int,const void*,sqlite3_uint64,
void(*)(void*));
int (*bind_text64)(sqlite3_stmt*,int,const char*,sqlite3_uint64,
void(*)(void*),unsigned char);
int (*cancel_auto_extension)(void(*)(void));
int (*load_extension)(sqlite3*,const char*,const char*,char**);
void *(*malloc64)(sqlite3_uint64);
sqlite3_uint64 (*msize)(void*);
void *(*realloc64)(void*,sqlite3_uint64);
void (*reset_auto_extension)(void);
void (*result_blob64)(sqlite3_context*,const void*,sqlite3_uint64,
void(*)(void*));
void (*result_text64)(sqlite3_context*,const char*,sqlite3_uint64,
void(*)(void*), unsigned char);
int (*strglob)(const char*,const char*);
/* Version 3.8.11 and later */
sqlite3_value *(*value_dup)(const sqlite3_value*);
void (*value_free)(sqlite3_value*);
int (*result_zeroblob64)(sqlite3_context*,sqlite3_uint64);
int (*bind_zeroblob64)(sqlite3_stmt*, int, sqlite3_uint64);
/* Version 3.9.0 and later */
unsigned int (*value_subtype)(sqlite3_value*);
void (*result_subtype)(sqlite3_context*,unsigned int);
/* Version 3.10.0 and later */
int (*status64)(int,sqlite3_int64*,sqlite3_int64*,int);
int (*strlike)(const char*,const char*,unsigned int);
int (*db_cacheflush)(sqlite3*);
/* Version 3.12.0 and later */
int (*system_errno)(sqlite3*);
/* Version 3.14.0 and later */
int (*trace_v2)(sqlite3*,unsigned,int(*)(unsigned,void*,void*,void*),void*);
char *(*expanded_sql)(sqlite3_stmt*);
/* Version 3.18.0 and later */
void (*set_last_insert_rowid)(sqlite3*,sqlite3_int64);
/* Version 3.20.0 and later */
int (*prepare_v3)(sqlite3*,const char*,int,unsigned int,
sqlite3_stmt**,const char**);
int (*prepare16_v3)(sqlite3*,const void*,int,unsigned int,
sqlite3_stmt**,const void**);
int (*bind_pointer)(sqlite3_stmt*,int,void*,const char*,void(*)(void*));
void (*result_pointer)(sqlite3_context*,void*,const char*,void(*)(void*));
void *(*value_pointer)(sqlite3_value*,const char*);
int (*vtab_nochange)(sqlite3_context*);
int (*value_nochange)(sqlite3_value*);
const char *(*vtab_collation)(sqlite3_index_info*,int);
/* Version 3.24.0 and later */
int (*keyword_count)(void);
int (*keyword_name)(int,const char**,int*);
int (*keyword_check)(const char*,int);
sqlite3_str *(*str_new)(sqlite3*);
char *(*str_finish)(sqlite3_str*);
void (*str_appendf)(sqlite3_str*, const char *zFormat, ...);
void (*str_vappendf)(sqlite3_str*, const char *zFormat, va_list);
void (*str_append)(sqlite3_str*, const char *zIn, int N);
void (*str_appendall)(sqlite3_str*, const char *zIn);
void (*str_appendchar)(sqlite3_str*, int N, char C);
void (*str_reset)(sqlite3_str*);
int (*str_errcode)(sqlite3_str*);
int (*str_length)(sqlite3_str*);
char *(*str_value)(sqlite3_str*);
/* Version 3.25.0 and later */
int (*create_window_function)(sqlite3*,const char*,int,int,void*,
void (*xStep)(sqlite3_context*,int,sqlite3_value**),
void (*xFinal)(sqlite3_context*),
void (*xValue)(sqlite3_context*),
void (*xInv)(sqlite3_context*,int,sqlite3_value**),
void(*xDestroy)(void*));
/* Version 3.26.0 and later */
const char *(*normalized_sql)(sqlite3_stmt*);
/* Version 3.28.0 and later */
int (*stmt_isexplain)(sqlite3_stmt*);
int (*value_frombind)(sqlite3_value*);
/* Version 3.30.0 and later */
int (*drop_modules)(sqlite3*,const char**);
/* Version 3.31.0 and later */
sqlite3_int64 (*hard_heap_limit64)(sqlite3_int64);
const char *(*uri_key)(const char*,int);
const char *(*filename_database)(const char*);
const char *(*filename_journal)(const char*);
const char *(*filename_wal)(const char*);
/* Version 3.32.0 and later */
const char *(*create_filename)(const char*,const char*,const char*,
int,const char**);
void (*free_filename)(const char*);
sqlite3_file *(*database_file_object)(const char*);
/* Version 3.34.0 and later */
int (*txn_state)(sqlite3*,const char*);
/* Version 3.36.1 and later */
sqlite3_int64 (*changes64)(sqlite3*);
sqlite3_int64 (*total_changes64)(sqlite3*);
/* Version 3.37.0 and later */
int (*autovacuum_pages)(sqlite3*,
unsigned int(*)(void*,const char*,unsigned int,unsigned int,unsigned int),
void*, void(*)(void*));
/* Version 3.38.0 and later */
int (*error_offset)(sqlite3*);
int (*vtab_rhs_value)(sqlite3_index_info*,int,sqlite3_value**);
int (*vtab_distinct)(sqlite3_index_info*);
int (*vtab_in)(sqlite3_index_info*,int,int);
int (*vtab_in_first)(sqlite3_value*,sqlite3_value**);
int (*vtab_in_next)(sqlite3_value*,sqlite3_value**);
/* Version 3.39.0 and later */
int (*deserialize)(sqlite3*,const char*,unsigned char*,
sqlite3_int64,sqlite3_int64,unsigned);
unsigned char *(*serialize)(sqlite3*,const char *,sqlite3_int64*,
unsigned int);
const char *(*db_name)(sqlite3*,int);
/* Version 3.40.0 and later */
int (*value_encoding)(sqlite3_value*);
/* Version 3.41.0 and later */
int (*is_interrupted)(sqlite3*);
/* Version 3.43.0 and later */
int (*stmt_explain)(sqlite3_stmt*,int);
/* Version 3.44.0 and later */
void *(*get_clientdata)(sqlite3*,const char*);
int (*set_clientdata)(sqlite3*, const char*, void*, void(*)(void*));
};
/*
** This is the function signature used for all extension entry points. It
** is also defined in the file "loadext.c".
*/
typedef int (*sqlite3_loadext_entry)(
sqlite3 *db, /* Handle to the database. */
char **pzErrMsg, /* Used to set error string on failure. */
const sqlite3_api_routines *pThunk /* Extension API function pointers. */
);
/*
** The following macros redefine the API routines so that they are
** redirected through the global sqlite3_api structure.
**
** This header file is also used by the loadext.c source file
** (part of the main SQLite library - not an extension) so that
** it can get access to the sqlite3_api_routines structure
** definition. But the main library does not want to redefine
** the API. So the redefinition macros are only valid if the
** SQLITE_CORE macros is undefined.
*/
#if !defined(SQLITE_CORE) && !defined(SQLITE_OMIT_LOAD_EXTENSION)
#define sqlite3_aggregate_context sqlite3_api->aggregate_context
#ifndef SQLITE_OMIT_DEPRECATED
#define sqlite3_aggregate_count sqlite3_api->aggregate_count
#endif
#define sqlite3_bind_blob sqlite3_api->bind_blob
#define sqlite3_bind_double sqlite3_api->bind_double
#define sqlite3_bind_int sqlite3_api->bind_int
#define sqlite3_bind_int64 sqlite3_api->bind_int64
#define sqlite3_bind_null sqlite3_api->bind_null
#define sqlite3_bind_parameter_count sqlite3_api->bind_parameter_count
#define sqlite3_bind_parameter_index sqlite3_api->bind_parameter_index
#define sqlite3_bind_parameter_name sqlite3_api->bind_parameter_name
#define sqlite3_bind_text sqlite3_api->bind_text
#define sqlite3_bind_text16 sqlite3_api->bind_text16
#define sqlite3_bind_value sqlite3_api->bind_value
#define sqlite3_busy_handler sqlite3_api->busy_handler
#define sqlite3_busy_timeout sqlite3_api->busy_timeout
#define sqlite3_changes sqlite3_api->changes
#define sqlite3_close sqlite3_api->close
#define sqlite3_collation_needed sqlite3_api->collation_needed
#define sqlite3_collation_needed16 sqlite3_api->collation_needed16
#define sqlite3_column_blob sqlite3_api->column_blob
#define sqlite3_column_bytes sqlite3_api->column_bytes
#define sqlite3_column_bytes16 sqlite3_api->column_bytes16
#define sqlite3_column_count sqlite3_api->column_count
#define sqlite3_column_database_name sqlite3_api->column_database_name
#define sqlite3_column_database_name16 sqlite3_api->column_database_name16
#define sqlite3_column_decltype sqlite3_api->column_decltype
#define sqlite3_column_decltype16 sqlite3_api->column_decltype16
#define sqlite3_column_double sqlite3_api->column_double
#define sqlite3_column_int sqlite3_api->column_int
#define sqlite3_column_int64 sqlite3_api->column_int64
#define sqlite3_column_name sqlite3_api->column_name
#define sqlite3_column_name16 sqlite3_api->column_name16
#define sqlite3_column_origin_name sqlite3_api->column_origin_name
#define sqlite3_column_origin_name16 sqlite3_api->column_origin_name16
#define sqlite3_column_table_name sqlite3_api->column_table_name
#define sqlite3_column_table_name16 sqlite3_api->column_table_name16
#define sqlite3_column_text sqlite3_api->column_text
#define sqlite3_column_text16 sqlite3_api->column_text16
#define sqlite3_column_type sqlite3_api->column_type
#define sqlite3_column_value sqlite3_api->column_value
#define sqlite3_commit_hook sqlite3_api->commit_hook
#define sqlite3_complete sqlite3_api->complete
#define sqlite3_complete16 sqlite3_api->complete16
#define sqlite3_create_collation sqlite3_api->create_collation
#define sqlite3_create_collation16 sqlite3_api->create_collation16
#define sqlite3_create_function sqlite3_api->create_function
#define sqlite3_create_function16 sqlite3_api->create_function16
#define sqlite3_create_module sqlite3_api->create_module
#define sqlite3_create_module_v2 sqlite3_api->create_module_v2
#define sqlite3_data_count sqlite3_api->data_count
#define sqlite3_db_handle sqlite3_api->db_handle
#define sqlite3_declare_vtab sqlite3_api->declare_vtab
#define sqlite3_enable_shared_cache sqlite3_api->enable_shared_cache
#define sqlite3_errcode sqlite3_api->errcode
#define sqlite3_errmsg sqlite3_api->errmsg
#define sqlite3_errmsg16 sqlite3_api->errmsg16
#define sqlite3_exec sqlite3_api->exec
#ifndef SQLITE_OMIT_DEPRECATED
#define sqlite3_expired sqlite3_api->expired
#endif
#define sqlite3_finalize sqlite3_api->finalize
#define sqlite3_free sqlite3_api->free
#define sqlite3_free_table sqlite3_api->free_table
#define sqlite3_get_autocommit sqlite3_api->get_autocommit
#define sqlite3_get_auxdata sqlite3_api->get_auxdata
#define sqlite3_get_table sqlite3_api->get_table
#ifndef SQLITE_OMIT_DEPRECATED
#define sqlite3_global_recover sqlite3_api->global_recover
#endif
#define sqlite3_interrupt sqlite3_api->interruptx
#define sqlite3_last_insert_rowid sqlite3_api->last_insert_rowid
#define sqlite3_libversion sqlite3_api->libversion
#define sqlite3_libversion_number sqlite3_api->libversion_number
#define sqlite3_malloc sqlite3_api->malloc
#define sqlite3_mprintf sqlite3_api->mprintf
#define sqlite3_open sqlite3_api->open
#define sqlite3_open16 sqlite3_api->open16
#define sqlite3_prepare sqlite3_api->prepare
#define sqlite3_prepare16 sqlite3_api->prepare16
#define sqlite3_prepare_v2 sqlite3_api->prepare_v2
#define sqlite3_prepare16_v2 sqlite3_api->prepare16_v2
#define sqlite3_profile sqlite3_api->profile
#define sqlite3_progress_handler sqlite3_api->progress_handler
#define sqlite3_realloc sqlite3_api->realloc
#define sqlite3_reset sqlite3_api->reset
#define sqlite3_result_blob sqlite3_api->result_blob
#define sqlite3_result_double sqlite3_api->result_double
#define sqlite3_result_error sqlite3_api->result_error
#define sqlite3_result_error16 sqlite3_api->result_error16
#define sqlite3_result_int sqlite3_api->result_int
#define sqlite3_result_int64 sqlite3_api->result_int64
#define sqlite3_result_null sqlite3_api->result_null
#define sqlite3_result_text sqlite3_api->result_text
#define sqlite3_result_text16 sqlite3_api->result_text16
#define sqlite3_result_text16be sqlite3_api->result_text16be
#define sqlite3_result_text16le sqlite3_api->result_text16le
#define sqlite3_result_value sqlite3_api->result_value
#define sqlite3_rollback_hook sqlite3_api->rollback_hook
#define sqlite3_set_authorizer sqlite3_api->set_authorizer
#define sqlite3_set_auxdata sqlite3_api->set_auxdata
#define sqlite3_snprintf sqlite3_api->xsnprintf
#define sqlite3_step sqlite3_api->step
#define sqlite3_table_column_metadata sqlite3_api->table_column_metadata
#define sqlite3_thread_cleanup sqlite3_api->thread_cleanup
#define sqlite3_total_changes sqlite3_api->total_changes
#define sqlite3_trace sqlite3_api->trace
#ifndef SQLITE_OMIT_DEPRECATED
#define sqlite3_transfer_bindings sqlite3_api->transfer_bindings
#endif
#define sqlite3_update_hook sqlite3_api->update_hook
#define sqlite3_user_data sqlite3_api->user_data
#define sqlite3_value_blob sqlite3_api->value_blob
#define sqlite3_value_bytes sqlite3_api->value_bytes
#define sqlite3_value_bytes16 sqlite3_api->value_bytes16
#define sqlite3_value_double sqlite3_api->value_double
#define sqlite3_value_int sqlite3_api->value_int
#define sqlite3_value_int64 sqlite3_api->value_int64
#define sqlite3_value_numeric_type sqlite3_api->value_numeric_type
#define sqlite3_value_text sqlite3_api->value_text
#define sqlite3_value_text16 sqlite3_api->value_text16
#define sqlite3_value_text16be sqlite3_api->value_text16be
#define sqlite3_value_text16le sqlite3_api->value_text16le
#define sqlite3_value_type sqlite3_api->value_type
#define sqlite3_vmprintf sqlite3_api->vmprintf
#define sqlite3_vsnprintf sqlite3_api->xvsnprintf
#define sqlite3_overload_function sqlite3_api->overload_function
#define sqlite3_prepare_v2 sqlite3_api->prepare_v2
#define sqlite3_prepare16_v2 sqlite3_api->prepare16_v2
#define sqlite3_clear_bindings sqlite3_api->clear_bindings
#define sqlite3_bind_zeroblob sqlite3_api->bind_zeroblob
#define sqlite3_blob_bytes sqlite3_api->blob_bytes
#define sqlite3_blob_close sqlite3_api->blob_close
#define sqlite3_blob_open sqlite3_api->blob_open
#define sqlite3_blob_read sqlite3_api->blob_read
#define sqlite3_blob_write sqlite3_api->blob_write
#define sqlite3_create_collation_v2 sqlite3_api->create_collation_v2
#define sqlite3_file_control sqlite3_api->file_control
#define sqlite3_memory_highwater sqlite3_api->memory_highwater
#define sqlite3_memory_used sqlite3_api->memory_used
#define sqlite3_mutex_alloc sqlite3_api->mutex_alloc
#define sqlite3_mutex_enter sqlite3_api->mutex_enter
#define sqlite3_mutex_free sqlite3_api->mutex_free
#define sqlite3_mutex_leave sqlite3_api->mutex_leave
#define sqlite3_mutex_try sqlite3_api->mutex_try
#define sqlite3_open_v2 sqlite3_api->open_v2
#define sqlite3_release_memory sqlite3_api->release_memory
#define sqlite3_result_error_nomem sqlite3_api->result_error_nomem
#define sqlite3_result_error_toobig sqlite3_api->result_error_toobig
#define sqlite3_sleep sqlite3_api->sleep
#define sqlite3_soft_heap_limit sqlite3_api->soft_heap_limit
#define sqlite3_vfs_find sqlite3_api->vfs_find
#define sqlite3_vfs_register sqlite3_api->vfs_register
#define sqlite3_vfs_unregister sqlite3_api->vfs_unregister
#define sqlite3_threadsafe sqlite3_api->xthreadsafe
#define sqlite3_result_zeroblob sqlite3_api->result_zeroblob
#define sqlite3_result_error_code sqlite3_api->result_error_code
#define sqlite3_test_control sqlite3_api->test_control
#define sqlite3_randomness sqlite3_api->randomness
#define sqlite3_context_db_handle sqlite3_api->context_db_handle
#define sqlite3_extended_result_codes sqlite3_api->extended_result_codes
#define sqlite3_limit sqlite3_api->limit
#define sqlite3_next_stmt sqlite3_api->next_stmt
#define sqlite3_sql sqlite3_api->sql
#define sqlite3_status sqlite3_api->status
#define sqlite3_backup_finish sqlite3_api->backup_finish
#define sqlite3_backup_init sqlite3_api->backup_init
#define sqlite3_backup_pagecount sqlite3_api->backup_pagecount
#define sqlite3_backup_remaining sqlite3_api->backup_remaining
#define sqlite3_backup_step sqlite3_api->backup_step
#define sqlite3_compileoption_get sqlite3_api->compileoption_get
#define sqlite3_compileoption_used sqlite3_api->compileoption_used
#define sqlite3_create_function_v2 sqlite3_api->create_function_v2
#define sqlite3_db_config sqlite3_api->db_config
#define sqlite3_db_mutex sqlite3_api->db_mutex
#define sqlite3_db_status sqlite3_api->db_status
#define sqlite3_extended_errcode sqlite3_api->extended_errcode
#define sqlite3_log sqlite3_api->log
#define sqlite3_soft_heap_limit64 sqlite3_api->soft_heap_limit64
#define sqlite3_sourceid sqlite3_api->sourceid
#define sqlite3_stmt_status sqlite3_api->stmt_status
#define sqlite3_strnicmp sqlite3_api->strnicmp
#define sqlite3_unlock_notify sqlite3_api->unlock_notify
#define sqlite3_wal_autocheckpoint sqlite3_api->wal_autocheckpoint
#define sqlite3_wal_checkpoint sqlite3_api->wal_checkpoint
#define sqlite3_wal_hook sqlite3_api->wal_hook
#define sqlite3_blob_reopen sqlite3_api->blob_reopen
#define sqlite3_vtab_config sqlite3_api->vtab_config
#define sqlite3_vtab_on_conflict sqlite3_api->vtab_on_conflict
/* Version 3.7.16 and later */
#define sqlite3_close_v2 sqlite3_api->close_v2
#define sqlite3_db_filename sqlite3_api->db_filename
#define sqlite3_db_readonly sqlite3_api->db_readonly
#define sqlite3_db_release_memory sqlite3_api->db_release_memory
#define sqlite3_errstr sqlite3_api->errstr
#define sqlite3_stmt_busy sqlite3_api->stmt_busy
#define sqlite3_stmt_readonly sqlite3_api->stmt_readonly
#define sqlite3_stricmp sqlite3_api->stricmp
#define sqlite3_uri_boolean sqlite3_api->uri_boolean
#define sqlite3_uri_int64 sqlite3_api->uri_int64
#define sqlite3_uri_parameter sqlite3_api->uri_parameter
#define sqlite3_uri_vsnprintf sqlite3_api->xvsnprintf
#define sqlite3_wal_checkpoint_v2 sqlite3_api->wal_checkpoint_v2
/* Version 3.8.7 and later */
#define sqlite3_auto_extension sqlite3_api->auto_extension
#define sqlite3_bind_blob64 sqlite3_api->bind_blob64
#define sqlite3_bind_text64 sqlite3_api->bind_text64
#define sqlite3_cancel_auto_extension sqlite3_api->cancel_auto_extension
#define sqlite3_load_extension sqlite3_api->load_extension
#define sqlite3_malloc64 sqlite3_api->malloc64
#define sqlite3_msize sqlite3_api->msize
#define sqlite3_realloc64 sqlite3_api->realloc64
#define sqlite3_reset_auto_extension sqlite3_api->reset_auto_extension
#define sqlite3_result_blob64 sqlite3_api->result_blob64
#define sqlite3_result_text64 sqlite3_api->result_text64
#define sqlite3_strglob sqlite3_api->strglob
/* Version 3.8.11 and later */
#define sqlite3_value_dup sqlite3_api->value_dup
#define sqlite3_value_free sqlite3_api->value_free
#define sqlite3_result_zeroblob64 sqlite3_api->result_zeroblob64
#define sqlite3_bind_zeroblob64 sqlite3_api->bind_zeroblob64
/* Version 3.9.0 and later */
#define sqlite3_value_subtype sqlite3_api->value_subtype
#define sqlite3_result_subtype sqlite3_api->result_subtype
/* Version 3.10.0 and later */
#define sqlite3_status64 sqlite3_api->status64
#define sqlite3_strlike sqlite3_api->strlike
#define sqlite3_db_cacheflush sqlite3_api->db_cacheflush
/* Version 3.12.0 and later */
#define sqlite3_system_errno sqlite3_api->system_errno
/* Version 3.14.0 and later */
#define sqlite3_trace_v2 sqlite3_api->trace_v2
#define sqlite3_expanded_sql sqlite3_api->expanded_sql
/* Version 3.18.0 and later */
#define sqlite3_set_last_insert_rowid sqlite3_api->set_last_insert_rowid
/* Version 3.20.0 and later */
#define sqlite3_prepare_v3 sqlite3_api->prepare_v3
#define sqlite3_prepare16_v3 sqlite3_api->prepare16_v3
#define sqlite3_bind_pointer sqlite3_api->bind_pointer
#define sqlite3_result_pointer sqlite3_api->result_pointer
#define sqlite3_value_pointer sqlite3_api->value_pointer
/* Version 3.22.0 and later */
#define sqlite3_vtab_nochange sqlite3_api->vtab_nochange
#define sqlite3_value_nochange sqlite3_api->value_nochange
#define sqlite3_vtab_collation sqlite3_api->vtab_collation
/* Version 3.24.0 and later */
#define sqlite3_keyword_count sqlite3_api->keyword_count
#define sqlite3_keyword_name sqlite3_api->keyword_name
#define sqlite3_keyword_check sqlite3_api->keyword_check
#define sqlite3_str_new sqlite3_api->str_new
#define sqlite3_str_finish sqlite3_api->str_finish
#define sqlite3_str_appendf sqlite3_api->str_appendf
#define sqlite3_str_vappendf sqlite3_api->str_vappendf
#define sqlite3_str_append sqlite3_api->str_append
#define sqlite3_str_appendall sqlite3_api->str_appendall
#define sqlite3_str_appendchar sqlite3_api->str_appendchar
#define sqlite3_str_reset sqlite3_api->str_reset
#define sqlite3_str_errcode sqlite3_api->str_errcode
#define sqlite3_str_length sqlite3_api->str_length
#define sqlite3_str_value sqlite3_api->str_value
/* Version 3.25.0 and later */
#define sqlite3_create_window_function sqlite3_api->create_window_function
/* Version 3.26.0 and later */
#define sqlite3_normalized_sql sqlite3_api->normalized_sql
/* Version 3.28.0 and later */
#define sqlite3_stmt_isexplain sqlite3_api->stmt_isexplain
#define sqlite3_value_frombind sqlite3_api->value_frombind
/* Version 3.30.0 and later */
#define sqlite3_drop_modules sqlite3_api->drop_modules
/* Version 3.31.0 and later */
#define sqlite3_hard_heap_limit64 sqlite3_api->hard_heap_limit64
#define sqlite3_uri_key sqlite3_api->uri_key
#define sqlite3_filename_database sqlite3_api->filename_database
#define sqlite3_filename_journal sqlite3_api->filename_journal
#define sqlite3_filename_wal sqlite3_api->filename_wal
/* Version 3.32.0 and later */
#define sqlite3_create_filename sqlite3_api->create_filename
#define sqlite3_free_filename sqlite3_api->free_filename
#define sqlite3_database_file_object sqlite3_api->database_file_object
/* Version 3.34.0 and later */
#define sqlite3_txn_state sqlite3_api->txn_state
/* Version 3.36.1 and later */
#define sqlite3_changes64 sqlite3_api->changes64
#define sqlite3_total_changes64 sqlite3_api->total_changes64
/* Version 3.37.0 and later */
#define sqlite3_autovacuum_pages sqlite3_api->autovacuum_pages
/* Version 3.38.0 and later */
#define sqlite3_error_offset sqlite3_api->error_offset
#define sqlite3_vtab_rhs_value sqlite3_api->vtab_rhs_value
#define sqlite3_vtab_distinct sqlite3_api->vtab_distinct
#define sqlite3_vtab_in sqlite3_api->vtab_in
#define sqlite3_vtab_in_first sqlite3_api->vtab_in_first
#define sqlite3_vtab_in_next sqlite3_api->vtab_in_next
/* Version 3.39.0 and later */
#ifndef SQLITE_OMIT_DESERIALIZE
#define sqlite3_deserialize sqlite3_api->deserialize
#define sqlite3_serialize sqlite3_api->serialize
#endif
#define sqlite3_db_name sqlite3_api->db_name
/* Version 3.40.0 and later */
#define sqlite3_value_encoding sqlite3_api->value_encoding
/* Version 3.41.0 and later */
#define sqlite3_is_interrupted sqlite3_api->is_interrupted
/* Version 3.43.0 and later */
#define sqlite3_stmt_explain sqlite3_api->stmt_explain
/* Version 3.44.0 and later */
#define sqlite3_get_clientdata sqlite3_api->get_clientdata
#define sqlite3_set_clientdata sqlite3_api->set_clientdata
#endif /* !defined(SQLITE_CORE) && !defined(SQLITE_OMIT_LOAD_EXTENSION) */
#if !defined(SQLITE_CORE) && !defined(SQLITE_OMIT_LOAD_EXTENSION)
/* This case when the file really is being compiled as a loadable
** extension */
# define SQLITE_EXTENSION_INIT1 const sqlite3_api_routines *sqlite3_api=0;
# define SQLITE_EXTENSION_INIT2(v) sqlite3_api=v;
# define SQLITE_EXTENSION_INIT3 \
extern const sqlite3_api_routines *sqlite3_api;
#else
/* This case when the file is being statically linked into the
** application */
# define SQLITE_EXTENSION_INIT1 /*no-op*/
# define SQLITE_EXTENSION_INIT2(v) (void)v; /* unused parameter */
# define SQLITE_EXTENSION_INIT3 /*no-op*/
#endif
#endif /* SQLITE3EXT_H */

File diff suppressed because it is too large Load Diff

View File

@ -20,7 +20,7 @@ typedef struct {
PWATCH_CONTENT g_watchContent = NULL;
static void monitor_cb(uv_fs_event_t *handle, const char *filename, int events, int status) {
static void monitor_cb(uv_fs_event_t *handle, const char *filename, int events, int UNUSED(status)) {
PWATCH_CONTENT pCtx = (PWATCH_CONTENT)handle->data;
char path[1024];
size_t size = 1023;

View File

@ -1,5 +1,5 @@
//
// Created by xajhu on 2021/7/6 0006.
// Created by huangxin on 2021/7/6 0006.
//
#include <stdlib.h>
#include <string.h>
@ -114,10 +114,7 @@ static int get_cpu_time_info(unsigned long *pTotal, unsigned long *pIdle) {
}
static void cpuUsedRefresh() {
CPU_TIME beginTime, endTime;
memset(&beginTime, 0, sizeof(CPU_TIME));
memset(&endTime, 0, sizeof(CPU_TIME));
CPU_TIME beginTime = {0}, endTime = {0};
if (get_cpu_time_info(&beginTime.cpuTotal, &beginTime.cpuIdle) != ERR_SUCCESS) {
return;

View File

@ -37,7 +37,6 @@ typedef enum {
CFG_BANNER_SHOW,
CFG_HARDWARE_WATCH,
CFG_HARDWARE_REFRESH,
CFG_AGENT_IPTV_POST_URL,
CFG_AGENT_MONITER_URL,
CFG_WATCH_CPU,
CFG_WATCH_MEMORY,
@ -61,15 +60,6 @@ typedef enum {
CFG_DB_SQLITE_PASSWD,
#endif
#endif
#ifdef ZEROMQ_ON
CFG_MQ_SVR_PORT,
CFG_MQ_DATA_PATH,
#endif
CFG_VXLAN_NIC_NAME,
CFG_VXLAN_SUPPORT,
CFG_VXLAN_PEER_IP,
CFG_VXLAN_PEER_MAC,
CFG_VXLAN_PKG_FILTER,
#ifdef HTTPSERVER_ON
CFG_HTTP_SVR_URI,
#endif

View File

@ -27,7 +27,7 @@
**
** The name of this file under configuration management is "sqlite.h.in".
** The makefile makes some minor changes to this file (such as inserting
** the version number) and changes its name to "sqlite3.h" as
** the version number) and changes its name to "sqlite3_crypto.h" as
** part of the build process.
*/
#ifndef SQLITE3_H
@ -118,7 +118,7 @@ extern "C" {
/*
** CAPI3REF: Compile-Time Library Version Numbers
**
** ^(The [SQLITE_VERSION] C preprocessor macro in the sqlite3.h header
** ^(The [SQLITE_VERSION] C preprocessor macro in the sqlite3_crypto.h header
** evaluates to a string literal that is the SQLite version in the
** format "X.Y.Z" where X is the major version number (always 3 for
** SQLite3) and Y is the minor version number and Z is the release number.)^
@ -259,14 +259,14 @@ SQLITE_API int sqlite3_threadsafe(void);
** KEYWORDS: {sqlitecipher connection} {sqlitecipher connections}
**
** Each open SQLite sqlitecipher is represented by a pointer to an instance of
** the opaque structure named "sqlite3". It is useful to think of an sqlite3
** the opaque structure named "sqlite3_crypto". It is useful to think of an sqlite3_crypto
** pointer as an object. The [sqlite3_open()], [sqlite3_open16()], and
** [sqlite3_open_v2()] interfaces are its constructors, and [sqlite3_close()]
** and [sqlite3_close_v2()] are its destructors. There are many other
** interfaces (such as
** [sqlite3_prepare_v2()], [sqlite3_create_function()], and
** [sqlite3_busy_timeout()] to name but three) that are methods on an
** sqlite3 object.
** sqlite3_crypto object.
*/
typedef struct sqlite3 sqlite3;
@ -313,18 +313,18 @@ typedef sqlite_uint64 sqlite3_uint64;
/*
** CAPI3REF: Closing A Database Connection
** DESTRUCTOR: sqlite3
** DESTRUCTOR: sqlite3_crypto
**
** ^The sqlite3_close() and sqlite3_close_v2() routines are destructors
** for the [sqlite3] object.
** for the [sqlite3_crypto] object.
** ^Calls to sqlite3_close() and sqlite3_close_v2() return [SQLITE_OK] if
** the [sqlite3] object is successfully destroyed and all associated
** the [sqlite3_crypto] object is successfully destroyed and all associated
** resources are deallocated.
**
** Ideally, applications should [sqlite3_finalize | finalize] all
** [prepared statements], [sqlite3_blob_close | close] all [BLOB handles], and
** [sqlite3_backup_finish | finish] all [sqlite3_backup] objects associated
** with the [sqlite3] object prior to attempting to close the object.
** with the [sqlite3_crypto] object prior to attempting to close the object.
** ^If the sqlitecipher connection is associated with unfinalized prepared
** statements, BLOB handlers, and/or unfinished sqlite3_backup objects then
** sqlite3_close() will leave the sqlitecipher connection open and return
@ -338,12 +338,12 @@ typedef sqlite_uint64 sqlite3_uint64;
** is intended for use with host languages that are garbage collected, and
** where the order in which destructors are called is arbitrary.
**
** ^If an [sqlite3] object is destroyed while a transaction is open,
** ^If an [sqlite3_crypto] object is destroyed while a transaction is open,
** the transaction is automatically rolled back.
**
** The C parameter to [sqlite3_close(C)] and [sqlite3_close_v2(C)]
** must be either a NULL
** pointer or an [sqlite3] object pointer obtained
** pointer or an [sqlite3_crypto] object pointer obtained
** from [sqlite3_open()], [sqlite3_open16()], or
** [sqlite3_open_v2()], and not previously closed.
** ^Calling sqlite3_close() or sqlite3_close_v2() with a NULL pointer
@ -361,7 +361,7 @@ typedef int (*sqlite3_callback)(void *, int, char **, char **);
/*
** CAPI3REF: One-Step Query Execution Interface
** METHOD: sqlite3
** METHOD: sqlite3_crypto
**
** The sqlite3_exec() interface is a convenience wrapper around
** [sqlite3_prepare_v2()], [sqlite3_step()], and [sqlite3_finalize()],
@ -1634,7 +1634,7 @@ SQLITE_API int sqlite3_config(int, ...);
/*
** CAPI3REF: Configure sqlitecipher connections
** METHOD: sqlite3
** METHOD: sqlite3_crypto
**
** The sqlite3_db_config() interface is used to make configuration
** changes to a [sqlitecipher connection]. The interface is similar to
@ -1984,7 +1984,7 @@ struct sqlite3_mem_methods {
** <dt>SQLITE_CONFIG_SQLLOG
** <dd>This option is only available if sqlite is compiled with the
** [SQLITE_ENABLE_SQLLOG] pre-processor macro defined. The first argument should
** be a pointer to a function of type void(*)(void*,sqlite3*,const char*, int).
** be a pointer to a function of type void(*)(void*,sqlite3_crypto*,const char*, int).
** The second should be of type (void*). The callback is invoked by the library
** in three separate circumstances, identified by the value passed as the
** fourth parameter. If the fourth parameter is 0, then the sqlitecipher connection
@ -2412,7 +2412,7 @@ struct sqlite3_mem_methods {
/*
** CAPI3REF: Enable Or Disable Extended Result Codes
** METHOD: sqlite3
** METHOD: sqlite3_crypto
**
** ^The sqlite3_extended_result_codes() routine enables or disables the
** [extended result codes] feature of SQLite. ^The extended result
@ -2422,7 +2422,7 @@ SQLITE_API int sqlite3_extended_result_codes(sqlite3 *, int onoff);
/*
** CAPI3REF: Last Insert Rowid
** METHOD: sqlite3
** METHOD: sqlite3_crypto
**
** ^Each entry in most SQLite tables (except for [WITHOUT ROWID] tables)
** has a unique 64-bit signed
@ -2484,7 +2484,7 @@ SQLITE_API sqlite3_int64 sqlite3_last_insert_rowid(sqlite3 *);
/*
** CAPI3REF: Set the Last Insert Rowid value.
** METHOD: sqlite3
** METHOD: sqlite3_crypto
**
** The sqlite3_set_last_insert_rowid(D, R) method allows the application to
** set the value returned by calling sqlite3_last_insert_rowid(D) to R
@ -2494,7 +2494,7 @@ SQLITE_API void sqlite3_set_last_insert_rowid(sqlite3 *, sqlite3_int64);
/*
** CAPI3REF: Count The Number Of Rows Modified
** METHOD: sqlite3
** METHOD: sqlite3_crypto
**
** ^These functions return the number of rows modified, inserted or
** deleted by the most recently completed INSERT, UPDATE or DELETE
@ -2556,7 +2556,7 @@ SQLITE_API sqlite3_int64 sqlite3_changes64(sqlite3 *);
/*
** CAPI3REF: Total Number Of Rows Modified
** METHOD: sqlite3
** METHOD: sqlite3_crypto
**
** ^These functions return the total number of rows inserted, modified or
** deleted by all [INSERT], [UPDATE] or [DELETE] statements completed
@ -2598,7 +2598,7 @@ SQLITE_API sqlite3_int64 sqlite3_total_changes64(sqlite3 *);
/*
** CAPI3REF: Interrupt A Long-Running Query
** METHOD: sqlite3
** METHOD: sqlite3_crypto
**
** ^This function causes any pending sqlitecipher operation to abort and
** return at its earliest opportunity. This routine is typically
@ -2672,7 +2672,7 @@ SQLITE_API int sqlite3_complete16(const void *sql);
/*
** CAPI3REF: Register A Callback To Handle SQLITE_BUSY Errors
** KEYWORDS: {busy-handler callback} {busy handler}
** METHOD: sqlite3
** METHOD: sqlite3_crypto
**
** ^The sqlite3_busy_handler(D,X,P) routine sets a callback function X
** that might be invoked with argument P whenever
@ -2732,7 +2732,7 @@ SQLITE_API int sqlite3_busy_handler(sqlite3 *, int (*)(void *, int), void *);
/*
** CAPI3REF: Set A Busy Timeout
** METHOD: sqlite3
** METHOD: sqlite3_crypto
**
** ^This routine sets a [sqlite3_busy_handler | busy handler] that sleeps
** for a specified amount of time when a table is locked. ^The handler
@ -2755,7 +2755,7 @@ SQLITE_API int sqlite3_busy_timeout(sqlite3 *, int ms);
/*
** CAPI3REF: Convenience Routines For Running Queries
** METHOD: sqlite3
** METHOD: sqlite3_crypto
**
** This is a legacy interface that is preserved for backwards compatibility.
** Use of this interface is not recommended.
@ -3013,7 +3013,7 @@ SQLITE_API void sqlite3_randomness(int N, void *P);
/*
** CAPI3REF: Compile-Time Authorization Callbacks
** METHOD: sqlite3
** METHOD: sqlite3_crypto
** KEYWORDS: {authorizer callback}
**
** ^This routine registers an authorizer callback with a particular
@ -3176,7 +3176,7 @@ SQLITE_API int sqlite3_set_authorizer(sqlite3 *,
/*
** CAPI3REF: Tracing And Profiling Functions
** METHOD: sqlite3
** METHOD: sqlite3_crypto
**
** These routines are deprecated. Use the [sqlite3_trace_v2()] interface
** instead of the routines described here.
@ -3270,7 +3270,7 @@ SQLITE_API SQLITE_DEPRECATED void *sqlite3_profile(sqlite3 *,
/*
** CAPI3REF: SQL Trace Hook
** METHOD: sqlite3
** METHOD: sqlite3_crypto
**
** ^The sqlite3_trace_v2(D,M,X,P) interface registers a trace callback
** function X against [sqlitecipher connection] D, using property mask M
@ -3304,7 +3304,7 @@ SQLITE_API int sqlite3_trace_v2(sqlite3 *,
/*
** CAPI3REF: Query Progress Callbacks
** METHOD: sqlite3
** METHOD: sqlite3_crypto
**
** ^The sqlite3_progress_handler(D,N,X,P) interface causes the callback
** function X to be invoked periodically during long running calls to
@ -3338,15 +3338,15 @@ SQLITE_API void sqlite3_progress_handler(sqlite3 *, int, int (*)(void *), void *
/*
** CAPI3REF: Opening A New Database Connection
** CONSTRUCTOR: sqlite3
** CONSTRUCTOR: sqlite3_crypto
**
** ^These routines open an SQLite sqlitecipher file as specified by the
** filename argument. ^The filename argument is interpreted as UTF-8 for
** sqlite3_open() and sqlite3_open_v2() and as UTF-16 in the native byte
** order for sqlite3_open16(). ^(A [sqlitecipher connection] handle is usually
** returned in *ppDb, even if an error occurs. The only exception is that
** if SQLite is unable to allocate memory to hold the [sqlite3] object,
** a NULL will be written into *ppDb instead of a pointer to the [sqlite3]
** if SQLite is unable to allocate memory to hold the [sqlite3_crypto] object,
** a NULL will be written into *ppDb instead of a pointer to the [sqlite3_crypto]
** object.)^ ^(If the sqlitecipher is opened (and/or created) successfully, then
** [SQLITE_OK] is returned. Otherwise an [error code] is returned.)^ ^The
** [sqlite3_errmsg()] or [sqlite3_errmsg16()] routines can be used to obtain
@ -3793,7 +3793,7 @@ SQLITE_API void sqlite3_free_filename(char *);
/*
** CAPI3REF: Error Codes And Messages
** METHOD: sqlite3
** METHOD: sqlite3_crypto
**
** ^If the most recent sqlite3_* API call associated with
** [sqlitecipher connection] D failed, then the sqlite3_errcode(D) interface
@ -3886,7 +3886,7 @@ typedef struct sqlite3_stmt sqlite3_stmt;
/*
** CAPI3REF: Run-time Limits
** METHOD: sqlite3
** METHOD: sqlite3_crypto
**
** ^(This interface allows the size of various constructs to be limited
** on a connection by connection basis. The first parameter is the
@ -4037,7 +4037,7 @@ SQLITE_API int sqlite3_limit(sqlite3 *, int id, int newVal);
/*
** CAPI3REF: Compiling An SQL Statement
** KEYWORDS: {SQL statement compiler}
** METHOD: sqlite3
** METHOD: sqlite3_crypto
** CONSTRUCTOR: sqlite3_stmt
**
** To execute an SQL statement, it must first be compiled into a byte-code
@ -5143,7 +5143,7 @@ SQLITE_API int sqlite3_reset(sqlite3_stmt *pStmt);
/*
** CAPI3REF: Create Or Redefine SQL Functions
** KEYWORDS: {function creation routines}
** METHOD: sqlite3
** METHOD: sqlite3_crypto
**
** ^These functions (collectively known as "function creation routines")
** are used to add SQL functions or aggregates or to redefine the behavior
@ -5912,7 +5912,7 @@ SQLITE_API void sqlite3_result_subtype(sqlite3_context *, unsigned int);
/*
** CAPI3REF: Define New Collating Sequences
** METHOD: sqlite3
** METHOD: sqlite3_crypto
**
** ^These functions add, remove, or modify a [collation] associated
** with the [sqlitecipher connection] specified as the first argument.
@ -6010,7 +6010,7 @@ SQLITE_API int sqlite3_create_collation16(sqlite3 *,
/*
** CAPI3REF: Collation Needed Callbacks
** METHOD: sqlite3
** METHOD: sqlite3_crypto
**
** ^To avoid having to register all collation sequences before a sqlitecipher
** can be used, a single callback function may be registered with the
@ -6257,7 +6257,7 @@ SQLITE_API int sqlite3_win32_set_directory16(unsigned long type, const void *zVa
/*
** CAPI3REF: Test For Auto-Commit Mode
** KEYWORDS: {autocommit mode}
** METHOD: sqlite3
** METHOD: sqlite3_crypto
**
** ^The sqlite3_get_autocommit() interface returns non-zero or
** zero if the given sqlitecipher connection is or is not in autocommit mode,
@ -6293,7 +6293,7 @@ SQLITE_API sqlite3 *sqlite3_db_handle(sqlite3_stmt *);
/*
** CAPI3REF: Return The Schema Name For A Database Connection
** METHOD: sqlite3
** METHOD: sqlite3_crypto
**
** ^The sqlite3_db_name(D,N) interface returns a pointer to the schema name
** for the N-th sqlitecipher on sqlitecipher connection D, or a NULL pointer of N is
@ -6315,7 +6315,7 @@ SQLITE_API const char *sqlite3_db_name(sqlite3 *db, int N);
/*
** CAPI3REF: Return The Filename For A Database Connection
** METHOD: sqlite3
** METHOD: sqlite3_crypto
**
** ^The sqlite3_db_filename(D,N) interface returns a pointer to the filename
** associated with sqlitecipher N of connection D.
@ -6347,7 +6347,7 @@ SQLITE_API const char *sqlite3_db_filename(sqlite3 *db, const char *zDbName);
/*
** CAPI3REF: Determine if a sqlitecipher is read-only
** METHOD: sqlite3
** METHOD: sqlite3_crypto
**
** ^The sqlite3_db_readonly(D,N) interface returns 1 if the sqlitecipher N
** of connection D is read-only, 0 if it is read/write, or -1 if N is not
@ -6357,7 +6357,7 @@ SQLITE_API int sqlite3_db_readonly(sqlite3 *db, const char *zDbName);
/*
** CAPI3REF: Determine the transaction state of a sqlitecipher
** METHOD: sqlite3
** METHOD: sqlite3_crypto
**
** ^The sqlite3_txn_state(D,S) interface returns the current
** [transaction state] of schema S in sqlitecipher connection D. ^If S is NULL,
@ -6408,7 +6408,7 @@ SQLITE_API int sqlite3_txn_state(sqlite3 *, const char *zSchema);
/*
** CAPI3REF: Find the next prepared statement
** METHOD: sqlite3
** METHOD: sqlite3_crypto
**
** ^This interface returns a pointer to the next [prepared statement] after
** pStmt associated with the [sqlitecipher connection] pDb. ^If pStmt is NULL
@ -6424,7 +6424,7 @@ SQLITE_API sqlite3_stmt *sqlite3_next_stmt(sqlite3 *pDb, sqlite3_stmt *pStmt);
/*
** CAPI3REF: Commit And Rollback Notification Callbacks
** METHOD: sqlite3
** METHOD: sqlite3_crypto
**
** ^The sqlite3_commit_hook() interface registers a callback
** function to be invoked whenever a transaction is [COMMIT | committed].
@ -6474,7 +6474,7 @@ SQLITE_API void *sqlite3_rollback_hook(sqlite3 *, void (*)(void *), void *);
/*
** CAPI3REF: Autovacuum Compaction Amount Callback
** METHOD: sqlite3
** METHOD: sqlite3_crypto
**
** ^The sqlite3_autovacuum_pages(D,C,P,X) interface registers a callback
** function C that is invoked prior to each autovacuum of the sqlitecipher
@ -6538,7 +6538,7 @@ SQLITE_API int sqlite3_autovacuum_pages(
/*
** CAPI3REF: Data Change Notification Callbacks
** METHOD: sqlite3
** METHOD: sqlite3_crypto
**
** ^The sqlite3_update_hook() interface registers a callback function
** with the [sqlitecipher connection] identified by the first argument
@ -6648,7 +6648,7 @@ SQLITE_API int sqlite3_release_memory(int);
/*
** CAPI3REF: Free Memory Used By A Database Connection
** METHOD: sqlite3
** METHOD: sqlite3_crypto
**
** ^The sqlite3_db_release_memory(D) interface attempts to free as much heap
** memory as possible from sqlitecipher connection D. Unlike the
@ -6740,7 +6740,7 @@ SQLITE_API SQLITE_DEPRECATED void sqlite3_soft_heap_limit(int N);
/*
** CAPI3REF: Extract Metadata About A Column Of A Table
** METHOD: sqlite3
** METHOD: sqlite3_crypto
**
** ^(The sqlite3_table_column_metadata(X,D,T,C,....) routine returns
** information about column C of table T in sqlitecipher D
@ -6820,7 +6820,7 @@ SQLITE_API int sqlite3_table_column_metadata(sqlite3 *db, /* Connec
/*
** CAPI3REF: Load An Extension
** METHOD: sqlite3
** METHOD: sqlite3_crypto
**
** ^This interface loads an SQLite extension library from the named file.
**
@ -6870,7 +6870,7 @@ SQLITE_API int sqlite3_load_extension(sqlite3 *db, /* Load the extension
/*
** CAPI3REF: Enable Or Disable Extension Loading
** METHOD: sqlite3
** METHOD: sqlite3_crypto
**
** ^So as not to open security holes in older applications that are
** unprepared to deal with [extension loading], and as a means of disabling
@ -6910,7 +6910,7 @@ SQLITE_API int sqlite3_enable_load_extension(sqlite3 *db, int onoff);
**
** <blockquote><pre>
** &nbsp; int xEntryPoint(
** &nbsp; sqlite3 *db,
** &nbsp; sqlite3_crypto *db,
** &nbsp; const char **pzErrMsg,
** &nbsp; const struct sqlite3_api_routines *pThunk
** &nbsp; );
@ -7222,7 +7222,7 @@ struct sqlite3_index_info {
/*
** CAPI3REF: Register A Virtual Table Implementation
** METHOD: sqlite3
** METHOD: sqlite3_crypto
**
** ^These routines are used to register a new [virtual table module] name.
** ^Module names must be registered before
@ -7266,7 +7266,7 @@ SQLITE_API int sqlite3_create_module_v2(sqlite3 *db, /* SQLite c
/*
** CAPI3REF: Remove Unnecessary Virtual Table Implementations
** METHOD: sqlite3
** METHOD: sqlite3_crypto
**
** ^The sqlite3_drop_modules(D,L) interface removes all virtual
** table modules from sqlitecipher connection D except those named on list L.
@ -7339,7 +7339,7 @@ SQLITE_API int sqlite3_declare_vtab(sqlite3 *, const char *zSQL);
/*
** CAPI3REF: Overload A Function For A Virtual Table
** METHOD: sqlite3
** METHOD: sqlite3_crypto
**
** ^(Virtual tables can provide alternative implementations of functions
** using the [xFindFunction] method of the [virtual table module].
@ -7382,7 +7382,7 @@ typedef struct sqlite3_blob sqlite3_blob;
/*
** CAPI3REF: Open A BLOB For Incremental I/O
** METHOD: sqlite3
** METHOD: sqlite3_crypto
** CONSTRUCTOR: sqlite3_blob
**
** ^(This interfaces opens a [BLOB handle | handle] to the BLOB located
@ -7903,7 +7903,7 @@ SQLITE_API int sqlite3_mutex_notheld(sqlite3_mutex *);
/*
** CAPI3REF: Retrieve the mutex for a sqlitecipher connection
** METHOD: sqlite3
** METHOD: sqlite3_crypto
**
** ^This interface returns a pointer the [sqlite3_mutex] object that
** serializes access to the [sqlitecipher connection] given in the argument
@ -7915,7 +7915,7 @@ SQLITE_API sqlite3_mutex *sqlite3_db_mutex(sqlite3 *);
/*
** CAPI3REF: Low-Level Control Of Database Files
** METHOD: sqlite3
** METHOD: sqlite3_crypto
** KEYWORDS: {file control}
**
** ^The [sqlite3_file_control()] interface makes a direct call to the
@ -8312,7 +8312,7 @@ SQLITE_API int sqlite3_status64(int op, sqlite3_int64 *pCurrent, sqlite3_int64 *
/*
** CAPI3REF: Database Connection Status
** METHOD: sqlite3
** METHOD: sqlite3_crypto
**
** ^This interface is used to retrieve runtime status information
** about a single [sqlitecipher connection]. ^The first argument is the
@ -8997,7 +8997,7 @@ SQLITE_API int sqlite3_backup_pagecount(sqlite3_backup *p);
/*
** CAPI3REF: Unlock Notification
** METHOD: sqlite3
** METHOD: sqlite3_crypto
**
** ^When running in shared-cache mode, a sqlitecipher operation may fail with
** an [SQLITE_LOCKED] error if the required locks on the shared-cache or
@ -9191,7 +9191,7 @@ SQLITE_API void sqlite3_log(int iErrCode, const char *zFormat, ...);
/*
** CAPI3REF: Write-Ahead Log Commit Hook
** METHOD: sqlite3
** METHOD: sqlite3_crypto
**
** ^The [sqlite3_wal_hook()] function is used to register a callback that
** is invoked each time data is committed to a sqlitecipher in wal mode.
@ -9228,7 +9228,7 @@ SQLITE_API void *sqlite3_wal_hook(sqlite3 *, int (*)(void *, sqlite3 *, const ch
/*
** CAPI3REF: Configure an auto-checkpoint
** METHOD: sqlite3
** METHOD: sqlite3_crypto
**
** ^The [sqlite3_wal_autocheckpoint(D,N)] is a wrapper around
** [sqlite3_wal_hook()] that causes any sqlitecipher on [sqlitecipher connection] D
@ -9259,7 +9259,7 @@ SQLITE_API int sqlite3_wal_autocheckpoint(sqlite3 *db, int N);
/*
** CAPI3REF: Checkpoint a sqlitecipher
** METHOD: sqlite3
** METHOD: sqlite3_crypto
**
** ^(The sqlite3_wal_checkpoint(D,X) is equivalent to
** [sqlite3_wal_checkpoint_v2](D,X,[SQLITE_CHECKPOINT_PASSIVE],0,0).)^
@ -9281,7 +9281,7 @@ SQLITE_API int sqlite3_wal_checkpoint(sqlite3 *db, const char *zDb);
/*
** CAPI3REF: Checkpoint a sqlitecipher
** METHOD: sqlite3
** METHOD: sqlite3_crypto
**
** ^(The sqlite3_wal_checkpoint_v2(D,X,M,L,C) interface runs a checkpoint
** operation on sqlitecipher X of [sqlitecipher connection] D in mode M. Status
@ -9910,7 +9910,7 @@ SQLITE_API void sqlite3_stmt_scanstatus_reset(sqlite3_stmt *);
/*
** CAPI3REF: Flush caches to disk mid-transaction
** METHOD: sqlite3
** METHOD: sqlite3_crypto
**
** ^If a write-transaction is open on [sqlitecipher connection] D when the
** [sqlite3_db_cacheflush(D)] interface invoked, any dirty
@ -9943,7 +9943,7 @@ SQLITE_API int sqlite3_db_cacheflush(sqlite3 *);
/*
** CAPI3REF: The pre-update hook.
** METHOD: sqlite3
** METHOD: sqlite3_crypto
**
** ^These interfaces are only available if SQLite is compiled using the
** [SQLITE_ENABLE_PREUPDATE_HOOK] compile-time option.
@ -10054,7 +10054,7 @@ SQLITE_API int sqlite3_preupdate_blobwrite(sqlite3 *);
/*
** CAPI3REF: Low-level system error code
** METHOD: sqlite3
** METHOD: sqlite3_crypto
**
** ^Attempt to return the underlying operating system error code or error
** number that caused the most recent I/O error or failure to open a file.

View File

@ -13,7 +13,7 @@
** shared libraries that want to be imported as extensions into
** an SQLite instance. Shared libraries that intend to be loaded
** as extensions by SQLite should #include this file instead of
** sqlite3.h.
** sqlite3_crypto.h.
*/
#ifndef SQLITE3EXT_H
#define SQLITE3EXT_H

View File

@ -43,7 +43,7 @@ static void catch_system_interupt(const int sig_num) {
}
}
int user_init(const char *pAppCfgFile, const char *pCfgDirectory, const char *pKey, int logLevel) {
int user_init(const char *pAppCfgFile, const char *pCfgDirectory, const char *pKey, int UNUSED(logLevel)) {
int ret;
UT_string *pPath;
char bufCfgFile[MAX_PATH];

View File

@ -5,7 +5,6 @@
#include <time.h>
#include "uuid.h"
#include "config.h"
#define RAND_LENGTH (4)
@ -35,7 +34,7 @@ void uuid_generate_random(uuid_t out) {
out[8] = (out[8] & 0x0f) | 0xa0;
}
int _hex2dec(char c) {
static int hex2dec(char c) {
int i;
for (i = 0; i < 16; i++) {
@ -57,7 +56,7 @@ void uuid_parse(const char *in, uuid_t uuid) {
case '-':
break;
default:
uuid[j++] = (_hex2dec(in[i++]) << 4) | _hex2dec(in[i]);
uuid[j++] = (hex2dec(in[i++]) << 4) | hex2dec(in[i]);
}
i++;
@ -76,10 +75,11 @@ void uuid_unparse(const uuid_t uuid, char *out) {
case 8:
case 10:
out[i++] = '-';
default:;
}
out[i++] = hex[(uuid[j] >> 4)];
out[i++] = hex[(0xf & uuid[j])];
out[i++] = (char)hex[(uuid[j] >> 4)];
out[i++] = (char)hex[(0xf & uuid[j])];
j++;
} while (j < 16);

View File

@ -437,7 +437,7 @@ static size_t writeDataCb(void *pData, size_t size, size_t nmemb, void *pParams)
return (size * nmemb);
}
static int progressCb(void *pData, double total, double now, double UNUSED(ulTotal), double UNUSED(ulNow)) {
static int progressCb(void *pData, curl_off_t total, curl_off_t now, curl_off_t UNUSED(ulTotal), curl_off_t UNUSED(ulNow)) {
PHTTP_REQ_PARAMS pParams = (PHTTP_REQ_PARAMS)pData;
if (pParams->onPrgCb) {
@ -666,7 +666,7 @@ const char *inet_download_file_async(const char *pURL,
curl_easy_setopt(pCurl, CURLOPT_URL, pURL);
curl_easy_setopt(pCurl, CURLOPT_NOPROGRESS, 0L);
curl_easy_setopt(pCurl, CURLOPT_PROGRESSFUNCTION, progressCb);
curl_easy_setopt(pCurl, CURLOPT_XFERINFOFUNCTION, progressCb);
curl_easy_setopt(pCurl, CURLOPT_PROGRESSDATA, pParams);
//curl_easy_setopt(pCurl, CURLOPT_TIMEOUT, 1800L); // Max download times (30 minutes)1800s

View File

@ -1,3 +0,0 @@
//
// Created by xajhuang on 2023/3/17.
//

View File

@ -109,12 +109,11 @@ const char *proto_msg_validation(const char *pJsonStr, const char *msgJson, cons
#endif
const char *proto_decode_context(const char *pString, unsigned int *pVer, unsigned long long *pTm, int *pErrCode) {
cJSON *pMsgCtx;
unsigned char *pBase64;
int decodeSize;
unsigned int outSize = 0;
char *pMsgContent = NULL;
cJSON *pRoot;
cJSON *pMsgCtx;
int decodeSize;
unsigned int outSize = 0;
char *pMsgContent = NULL;
cJSON *pRoot;
#ifdef JSON_SCHEMA_ON
const char *pSchJson;
#endif
@ -183,8 +182,9 @@ const char *proto_decode_context(const char *pString, unsigned int *pVer, unsign
case CRYPTO_AES128:
case CRYPTO_AES256:
case CRYPTO_3DES: {
int cryptoType;
const char *pKey = config_get_proto_crypto_key();
unsigned char *pBase64;
int cryptoType;
const char *pKey = config_get_proto_crypto_key();
if (pCrypto->valueint == CRYPTO_AES128) {
cryptoType = AES128_ECB_PKCS7PADDING;
@ -271,10 +271,8 @@ const char *proto_create_new(cJSON *pMsgCtx, int httpCode) {
}
if (pKey == NULL || strlen(pKey) == 0) {
LOG_MOD(error,
ZLOG_MOD_PROTO,
"Cryptography key empty of algorithm %d, Used default algorithm BASE64\n",
cryptoType);
LOG_MOD(error, ZLOG_MOD_PROTO,
"Cryptography key empty of algorithm %d, Used default algorithm BASE64\n", cryptoType);
base64 = base64_encode((unsigned char *)pStrMsg, strlen(pStrMsg));
pro.cryptoType = CRYPTO_BASE64;
} else {
@ -285,10 +283,8 @@ const char *proto_create_new(cJSON *pMsgCtx, int httpCode) {
ret = symmetric_encrypto(cryptoType, (unsigned char *)pStrMsg, strlen(pStrMsg), &buf, &outSize, pKey);
if (ret != ERR_SUCCESS) {
LOG_MOD(error,
ZLOG_MOD_PROTO,
"Unsupported protocol crypto_cipher : %d, Used default algorithm BASE64\n",
cryptoType);
LOG_MOD(error, ZLOG_MOD_PROTO,
"Unsupported protocol crypto_cipher : %d, Used default algorithm BASE64\n", cryptoType);
base64 = base64_encode((unsigned char *)pStrMsg, strlen(pStrMsg));
pro.cryptoType = CRYPTO_BASE64;
} else {
@ -301,8 +297,7 @@ const char *proto_create_new(cJSON *pMsgCtx, int httpCode) {
cJSON_free(pro.msgContend);
} break;
default:
LOG_MOD(error,
ZLOG_MOD_PROTO,
LOG_MOD(error, ZLOG_MOD_PROTO,
"Unsupported protocol crypto_cipher algorithms: %d, Used default algorithm BASE64\n",
pro.cryptoType);
cJSON_free(pro.msgContend);

View File

@ -13,10 +13,8 @@
#include "prj_config.h"
#include "user_errno.h"
#include "proto.h"
int main(int argc, char **argv) {
int ret;
int main(const int argc, char **argv) {
int ret;
uv_setup_args(argc, argv);