mirror of
https://github.com/SirHumza/orbisRPC.git
synced 2026-10-06 13:00:35 +02:00
app.db SQLite names, self-learning map, presence builder tests, audit fixes
This commit is contained in:
1 parent
b363a74740
commit
48500d2482
18 files changed
+314934
-34
No files matched your search
@@ -0,0 +1,147 @@
|
||||
/* appdb.c - display names from /system_data/priv/mms/app.db (read-only).
|
||||
* Method follows the proven on-console pattern (SonicLoader et al.): SQLite
|
||||
* query, never raw byte-scanning (an earlier revision byte-scanned app.db
|
||||
* and returned wrong names: the file reads fine, the parse was garbage).
|
||||
* Tiers, first hit wins:
|
||||
* 1. tbl_appbrowse.titleName (when the firmware carries it)
|
||||
* 2. tbl_appinfo val for key TITLE / TITLE_xx (localized display titles)
|
||||
* 3. /user/appmeta/<id>/param.json title fields (ShadowMountPlus pattern)
|
||||
* Every tier is schema-guarded and fail-soft: missing tables, missing keys,
|
||||
* unreadable files, and locked DBs all fall through to the next source.
|
||||
* Host-testable via appdb_title_from() with a synthetic DB path. */
|
||||
#include "appdb.h"
|
||||
#include "jsonlite.h"
|
||||
#include "log.h"
|
||||
#include <string.h>
|
||||
#include <stdio.h>
|
||||
#include <unistd.h>
|
||||
#include <fcntl.h>
|
||||
#include "sqlite3.h"
|
||||
|
||||
#define APPDB_PATH "/system_data/priv/mms/app.db"
|
||||
#define APPMETA_BASE "/user/appmeta"
|
||||
|
||||
static int valid_tid(const char *t){
|
||||
if(!t) return 0;
|
||||
size_t n = strlen(t);
|
||||
if(n != 9) return 0;
|
||||
for(size_t i = 0; i < n; i++){
|
||||
char c = t[i];
|
||||
if(!((c >= 'A' && c <= 'Z') || (c >= '0' && c <= '9'))) return 0;
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
||||
static int table_exists(sqlite3 *db, const char *name){
|
||||
sqlite3_stmt *st = NULL;
|
||||
int found = 0;
|
||||
if(sqlite3_prepare_v2(db, "SELECT 1 FROM sqlite_master WHERE type='table' AND name=?1 LIMIT 1;",
|
||||
-1, &st, NULL) != SQLITE_OK)
|
||||
return 0;
|
||||
sqlite3_bind_text(st, 1, name, -1, SQLITE_TRANSIENT);
|
||||
if(sqlite3_step(st) == SQLITE_ROW) found = 1;
|
||||
sqlite3_finalize(st);
|
||||
return found;
|
||||
}
|
||||
|
||||
/* Copy first non-empty TEXT result of a one-row query. 0 on hit. */
|
||||
static int query_name(sqlite3 *db, const char *sql, const char *titleId,
|
||||
char *out, size_t cap){
|
||||
sqlite3_stmt *st = NULL;
|
||||
int rc = -1;
|
||||
if(sqlite3_prepare_v2(db, sql, -1, &st, NULL) != SQLITE_OK) return -1;
|
||||
sqlite3_bind_text(st, 1, titleId, -1, SQLITE_TRANSIENT);
|
||||
if(sqlite3_step(st) == SQLITE_ROW){
|
||||
const unsigned char *v = sqlite3_column_text(st, 0);
|
||||
if(v && v[0]){
|
||||
strncpy(out, (const char *)v, cap - 1);
|
||||
out[cap - 1] = 0;
|
||||
if(out[0] && strlen(out) > 1) rc = 0;
|
||||
}
|
||||
}
|
||||
sqlite3_finalize(st);
|
||||
return rc;
|
||||
}
|
||||
|
||||
/* param.json title fields: small single read, jsonlite parse. Best-effort. */
|
||||
static int paramjson_title(const char *appmeta_base, const char *titleId,
|
||||
char *out, size_t cap){
|
||||
char path[256];
|
||||
int n = snprintf(path, sizeof path, "%s/%s/param.json",
|
||||
appmeta_base ? appmeta_base : APPMETA_BASE, titleId);
|
||||
if(n <= 0 || (size_t)n >= sizeof path) return -1;
|
||||
int fd = open(path, O_RDONLY);
|
||||
if(fd < 0) return -1;
|
||||
char buf[4096];
|
||||
ssize_t r = read(fd, buf, sizeof buf - 1);
|
||||
close(fd);
|
||||
if(r <= 0) return -1;
|
||||
buf[r] = 0;
|
||||
jl_val_t *root = jl_parse(buf, (size_t)r);
|
||||
if(!root) return -1;
|
||||
static const char *keys[] = { "titleName", "title", "name", NULL };
|
||||
int rc = -1;
|
||||
for(int i = 0; keys[i]; i++){
|
||||
const jl_val_t *v = jl_obj_get(root, keys[i]);
|
||||
if(v && v->type == JL_STRING && v->str && strlen(v->str) > 1){
|
||||
strncpy(out, v->str, cap - 1);
|
||||
out[cap - 1] = 0;
|
||||
rc = 0;
|
||||
break;
|
||||
}
|
||||
}
|
||||
jl_free(root);
|
||||
return rc;
|
||||
}
|
||||
|
||||
int appdb_title_from(const char *dbpath, const char *appmeta_base,
|
||||
const char *titleId, char *out, size_t cap){
|
||||
if(!out || cap == 0) return -1;
|
||||
out[0] = 0;
|
||||
if(!valid_tid(titleId)) return -1;
|
||||
if(!dbpath) dbpath = APPDB_PATH;
|
||||
|
||||
sqlite3 *db = NULL;
|
||||
int orc = sqlite3_open_v2(dbpath, &db,
|
||||
SQLITE_OPEN_READONLY | SQLITE_OPEN_NOMUTEX, NULL);
|
||||
if(orc != SQLITE_OK){
|
||||
if(db) sqlite3_close(db);
|
||||
return -1;
|
||||
}
|
||||
sqlite3_busy_timeout(db, 2000);
|
||||
|
||||
/* Tier 1: friendly browse name. */
|
||||
if(table_exists(db, "tbl_appbrowse")){
|
||||
if(query_name(db, "SELECT titleName FROM tbl_appbrowse WHERE titleId=?1 "
|
||||
"AND titleName IS NOT NULL AND titleName<>'' LIMIT 1;",
|
||||
titleId, out, cap) == 0){
|
||||
log_msg("name: %s via appdb-browse", out);
|
||||
sqlite3_close(db);
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
/* Tier 2: localized TITLE keys; ORDER BY key prefers bare TITLE
|
||||
* (system language) over TITLE_00..NN variants. */
|
||||
if(table_exists(db, "tbl_appinfo")){
|
||||
if(query_name(db, "SELECT val FROM tbl_appinfo WHERE titleId=?1 "
|
||||
"AND (key='TITLE' OR key LIKE 'TITLE\\_%' ESCAPE '\\') "
|
||||
"AND val IS NOT NULL AND val<>'' ORDER BY key LIMIT 1;",
|
||||
titleId, out, cap) == 0){
|
||||
log_msg("name: %s via appdb-info", out);
|
||||
sqlite3_close(db);
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
sqlite3_close(db);
|
||||
|
||||
/* Tier 3: staged appmeta descriptor (no DB needed). */
|
||||
if(paramjson_title(appmeta_base, titleId, out, cap) == 0){
|
||||
log_msg("name: %s via paramjson", out);
|
||||
return 0;
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
int appdb_title(const char *titleId, char *out, size_t cap){
|
||||
return appdb_title_from(NULL, NULL, titleId, out, cap);
|
||||
}
|
||||
@@ -0,0 +1,10 @@
|
||||
/* appdb.h - display names from the system app.db (read-only SQLite). */
|
||||
#ifndef APPDB_H
|
||||
#define APPDB_H
|
||||
#include <stddef.h>
|
||||
/* Resolve a display name for a 9-char title ID. 0 on success. */
|
||||
int appdb_title(const char *titleId, char *out, size_t cap);
|
||||
/* Test seam: explicit DB + appmeta paths (NULL = on-console defaults). */
|
||||
int appdb_title_from(const char *dbpath, const char *appmeta_base,
|
||||
const char *titleId, char *out, size_t cap);
|
||||
#endif
|
||||
+9
-9
@@ -107,8 +107,8 @@ static void art_disk_load(void){
|
||||
if(!m || m->type != JL_STRING || !m->str) continue;
|
||||
if(!a || a->type != JL_NUMBER) continue;
|
||||
if(now - (int64_t)a->num > ART_DISK_TTL) continue; /* prune */
|
||||
strncpy(s_disk[s_disk_n].url, u->str, 511);
|
||||
strncpy(s_disk[s_disk_n].mp, m->str, 511);
|
||||
snprintf(s_disk[s_disk_n].url, sizeof s_disk[s_disk_n].url, "%s", u->str);
|
||||
snprintf(s_disk[s_disk_n].mp, sizeof s_disk[s_disk_n].mp, "%s", m->str);
|
||||
s_disk[s_disk_n].at = (int64_t)a->num;
|
||||
s_disk_n++;
|
||||
}
|
||||
@@ -171,15 +171,15 @@ static void art_disk_put(const char *url, const char *mp){
|
||||
art_disk_load();
|
||||
for(int i = 0; i < s_disk_n; i++){
|
||||
if(!strcmp(s_disk[i].url, url)){
|
||||
strncpy(s_disk[i].mp, mp, 511);
|
||||
snprintf(s_disk[i].mp, sizeof s_disk[i].mp, "%s", mp);
|
||||
s_disk[i].at = (int64_t)time(NULL);
|
||||
art_disk_save();
|
||||
return;
|
||||
}
|
||||
}
|
||||
if(s_disk_n < ART_DISK_MAX){
|
||||
strncpy(s_disk[s_disk_n].url, url, 511);
|
||||
strncpy(s_disk[s_disk_n].mp, mp, 511);
|
||||
snprintf(s_disk[s_disk_n].url, sizeof s_disk[s_disk_n].url, "%s", url);
|
||||
snprintf(s_disk[s_disk_n].mp, sizeof s_disk[s_disk_n].mp, "%s", mp);
|
||||
s_disk[s_disk_n].at = (int64_t)time(NULL);
|
||||
s_disk_n++;
|
||||
art_disk_save();
|
||||
@@ -289,8 +289,8 @@ int art_resolve_mp(const char *app_id, const char *token, const char *url,
|
||||
/* Disk cache (7-day TTL): titles resolved on earlier boots skip the
|
||||
* round trip entirely. */
|
||||
if(art_disk_get(url, out_mp, cap)){
|
||||
strncpy(s_last_url, url, sizeof s_last_url - 1);
|
||||
strncpy(s_last_mp, out_mp, sizeof s_last_mp - 1);
|
||||
snprintf(s_last_url, sizeof s_last_url, "%s", url);
|
||||
snprintf(s_last_mp, sizeof s_last_mp, "%s", out_mp);
|
||||
log_msg("art: mp from disk cache");
|
||||
return 1;
|
||||
}
|
||||
@@ -304,8 +304,8 @@ int art_resolve_mp(const char *app_id, const char *token, const char *url,
|
||||
log_msg("art: no mp path for url (resp %zuB: %.120s)", rlen, resp);
|
||||
return 0;
|
||||
}
|
||||
strncpy(s_last_url, url, sizeof s_last_url - 1);
|
||||
strncpy(s_last_mp, out_mp, sizeof s_last_mp - 1);
|
||||
snprintf(s_last_url, sizeof s_last_url, "%s", url);
|
||||
snprintf(s_last_mp, sizeof s_last_mp, "%s", out_mp);
|
||||
art_disk_put(url, out_mp);
|
||||
log_msg("art: resolved mp (%zuB)", strlen(out_mp));
|
||||
return 1;
|
||||
|
||||
@@ -123,6 +123,40 @@ int cfg_title(const cfg_t *c, const char *titleId, char *out, size_t cap){
|
||||
return -1;
|
||||
}
|
||||
|
||||
/* Self-learning map (PC-tool "mapped" pattern): remember an authoritatively
|
||||
* resolved name so later boots resolve instantly even when every live
|
||||
* source is unreachable. Never learns raw-ID echoes or junk.
|
||||
* Returns 1 when the map changed (caller should cfg_save). */
|
||||
int cfg_learn(cfg_t *c, const char *titleId, const char *name){
|
||||
if(!c || !titleId || !name) return 0;
|
||||
size_t kl = strlen(titleId), vl = strlen(name);
|
||||
if(kl == 0 || kl >= (size_t)CFG_TITLEID_LEN) return 0;
|
||||
if(vl < 2 || vl >= (size_t)CFG_TITLENAME_LEN) return 0;
|
||||
if(!strcmp(titleId, name)) return 0; /* ID echo, not a name */
|
||||
for(size_t i = 0; i < kl; i++){
|
||||
char ch = titleId[i];
|
||||
if(!((ch >= 'A' && ch <= 'Z') || (ch >= '0' && ch <= '9') || ch == '_')) return 0;
|
||||
}
|
||||
for(int i = 0; i < c->n_titles; i++){
|
||||
if(!strcmp(c->title_ids[i], titleId)){
|
||||
if(!strcmp(c->title_names[i], name)) return 0;
|
||||
strncpy(c->title_names[i], name, CFG_TITLENAME_LEN - 1);
|
||||
c->title_names[i][CFG_TITLENAME_LEN - 1] = 0;
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
if(c->n_titles >= CFG_MAX_TITLES){
|
||||
log_msg("config: titles map full; not learning %s", titleId);
|
||||
return 0;
|
||||
}
|
||||
strncpy(c->title_ids[c->n_titles], titleId, CFG_TITLEID_LEN - 1);
|
||||
c->title_ids[c->n_titles][CFG_TITLEID_LEN - 1] = 0;
|
||||
strncpy(c->title_names[c->n_titles], name, CFG_TITLENAME_LEN - 1);
|
||||
c->title_names[c->n_titles][CFG_TITLENAME_LEN - 1] = 0;
|
||||
c->n_titles++;
|
||||
return 1;
|
||||
}
|
||||
|
||||
int cfg_save(const char *path, const cfg_t *c) {
|
||||
if(!path || !c) return -1;
|
||||
jl_val_t *r = jl_new_object();
|
||||
|
||||
@@ -43,4 +43,6 @@ int cfg_save(const char *path, const cfg_t *c);
|
||||
void cfg_defaults(cfg_t *c);
|
||||
/* User override lookup: 0 + name copied when titleId has an entry. */
|
||||
int cfg_title(const cfg_t *c, const char *titleId, char *out, size_t cap);
|
||||
/* Learn an authoritatively resolved name (1 = changed, save it). */
|
||||
int cfg_learn(cfg_t *c, const char *titleId, const char *name);
|
||||
#endif
|
||||
+18
-4
@@ -266,10 +266,14 @@ int daemon_run(const char *fixed_game_name){
|
||||
}
|
||||
int rc = discord_connect(&dc, g_cfg.token);
|
||||
if(rc == -2){
|
||||
log_msg("FATAL: token rejected by gateway (close 4004). "
|
||||
"Fix \"token\" in %s", CFG_PATH);
|
||||
health_mark_clean();
|
||||
return 2;
|
||||
/* Rejected token: do NOT exit (that would strand the daemon
|
||||
* until the next manual injection). The per-cycle config
|
||||
* reload picks up a fixed token on its own. */
|
||||
log_msg("WARN: token rejected by gateway (close 4004). "
|
||||
"Fix \"token\" in %s; retrying", CFG_PATH);
|
||||
int wait = reconnect_delay(&conn_fails, base_poll, &jctr);
|
||||
if(sleep_stop(wait)) break;
|
||||
continue;
|
||||
}
|
||||
if(rc != 0){
|
||||
int wait = reconnect_delay(&conn_fails, base_poll, &jctr);
|
||||
@@ -458,6 +462,16 @@ int daemon_run(const char *fixed_game_name){
|
||||
log_msg("GAME_DETECTED title=%s name=%s", cur_tid[0]?cur_tid:"?", name);
|
||||
art_cache_clear();
|
||||
sess_save(cur_tid, name, started);
|
||||
/* Self-learning map: persist authoritatively resolved
|
||||
* names so later boots resolve instantly, even when
|
||||
* every live source is unreachable. Raw-ID fallbacks
|
||||
* (ok=0) are never learned. */
|
||||
if(cur_tid[0] && detect_last_ok() && cfg_learn(&g_cfg, cur_tid, name)){
|
||||
if(cfg_save(CFG_PATH, &g_cfg) != 0)
|
||||
log_msg("config: learn save failed for %s", cur_tid);
|
||||
else
|
||||
log_msg("config: learned %s", cur_tid);
|
||||
}
|
||||
} else if(strncmp(name,last,sizeof last)!=0){
|
||||
strncpy(last, name, sizeof last-1);
|
||||
last[sizeof last-1] = 0;
|
||||
|
||||
@@ -19,6 +19,7 @@
|
||||
* foreground) is reliable via ShellCoreUtil.
|
||||
*/
|
||||
#include "detect.h"
|
||||
#include "appdb.h"
|
||||
#include "cfg.h"
|
||||
#include "log.h"
|
||||
#include "sfo.h"
|
||||
@@ -365,6 +366,7 @@ int detect_media_type(const char *title_id){
|
||||
}
|
||||
|
||||
const char *detect_last_titleid(void){ return s_last_titleid[0] ? s_last_titleid : NULL; }
|
||||
int detect_last_ok(void){ return s_rs_ok; }
|
||||
const char *detect_last_art(void){ return s_last_art[0] ? s_last_art : NULL; }
|
||||
static void remember_titleid(const char *ti){
|
||||
if(!ti) return;
|
||||
@@ -534,6 +536,9 @@ int detect_current_game(char *out_name, size_t cap, char *out_path, size_t p_cap
|
||||
/* cheap, game-process-safe sources first; Sony TMDB (network)
|
||||
* resolves anything local sources miss, on any console. */
|
||||
if(!named && cfg_title(&g_cfg, titleId, out_name, cap)==0){ named=1; log_msg("name: %s via config", out_name); }
|
||||
/* System app.db: the authoritative on-box title registry (SQLite,
|
||||
* read-only). Covers disc + digital where per-file sources miss. */
|
||||
if(!named && appdb_title(titleId, out_name, cap)==0){ named=1; }
|
||||
if(!named && pronunc_title(titleId, out_name, cap)==0){ named=1; log_msg("name: %s via appmeta", out_name); }
|
||||
if(!named){ if(sfo_file_title(titleId, out_name, cap)==0){ named=1; log_msg("name: %s via sfo", out_name); } }
|
||||
if(!named){ if(appxml_title(titleId, out_name, cap)==0){ named=1; log_msg("name: %s via appxml", out_name); } }
|
||||
@@ -569,6 +574,7 @@ int detect_name_for_title(const char *titleId, char *out_name, size_t cap){
|
||||
/* Game-process-safe only: small reads plus one bounded network
|
||||
* lookup; no multi-megabyte scans anywhere in this codebase. */
|
||||
if(cfg_title(&g_cfg, titleId, out_name, cap)==0){ log_msg("name: %s via config", out_name); resolve_remember(titleId, out_name, "", 1); return 0; }
|
||||
if(appdb_title(titleId, out_name, cap)==0){ resolve_remember(titleId, out_name, "", 1); return 0; }
|
||||
if(pronunc_title(titleId, out_name, cap)==0){ log_msg("name: %s via appmeta", out_name); resolve_remember(titleId, out_name, "", 1); return 0; }
|
||||
else log_msg("name: appmeta miss for %s", titleId);
|
||||
if(sfo_file_title(titleId, out_name, cap)==0){ log_msg("name: %s via sfo", out_name); resolve_remember(titleId, out_name, "", 1); return 0; }
|
||||
|
||||
+2
-1
@@ -19,7 +19,8 @@ int detect_name_for_title(const char *titleId, char *out_name, size_t cap);
|
||||
/* Last resolved titleId (e.g. "CUSA00740") or NULL if none yet.
|
||||
* Used as the Discord asset key so icons follow automatically. */
|
||||
const char *detect_last_titleid(void);
|
||||
/* Last resolved artwork URL (Sony CDN via TMDB, or empty). */
|
||||
/* 1 when the last resolve produced a real name (0 = raw-ID fallback). */
|
||||
int detect_last_ok(void);/* Last resolved artwork URL (Sony CDN via TMDB, or empty). */
|
||||
const char *detect_last_art(void);
|
||||
/* Media type for presence: 0 Playing (games), 2 Listening, 3 Watching.
|
||||
* Only known media apps map; everything else is 0. Extend freely. */
|
||||
|
||||
+38
-12
@@ -239,13 +239,15 @@ static size_t asset_key(const char *title_id, char *key, size_t cap){
|
||||
return ki;
|
||||
}
|
||||
|
||||
int discord_set_presence_ex(discord_t *d, const char *state, const char *name,
|
||||
const char *title_id, const char *application_id,
|
||||
const char *art_base_url, const char *art_url,
|
||||
int64_t started_epoch){
|
||||
if(!d || !d->connected || !name) return -1;
|
||||
/* Test seam: pure activity-JSON builder (no sockets). token may be ""
|
||||
* to skip the mp: proxy (deterministic offline tests). NULL on OOM. */
|
||||
jl_val_t *discord_build_activity(const char *state, const char *name,
|
||||
const char *title_id, const char *application_id,
|
||||
const char *art_base_url, const char *art_url,
|
||||
int64_t started_epoch, const char *token){
|
||||
if(!name) return NULL;
|
||||
jl_val_t *act=jl_new_object();
|
||||
if(!act) return -1;
|
||||
if(!act) return NULL;
|
||||
jl_obj_set(act,"name",jl_new_string(name?name:""));
|
||||
{
|
||||
/* Media apps (Netflix/YouTube/...) post Watching/Listening. */
|
||||
@@ -263,7 +265,7 @@ int discord_set_presence_ex(discord_t *d, const char *state, const char *name,
|
||||
* title_id is still used for media-type lookup and artwork below. */
|
||||
if(started_epoch>0){
|
||||
jl_val_t *ts=jl_new_object();
|
||||
if(!ts){ jl_free(act); return -1; }
|
||||
if(!ts){ jl_free(act); return NULL; }
|
||||
if(started_epoch > 0 && started_epoch < 100000000000LL)
|
||||
jl_obj_set(ts,"start",jl_new_int(started_epoch*1000LL)); /* integer ms epoch */
|
||||
jl_obj_set(act,"timestamps",ts);
|
||||
@@ -289,6 +291,17 @@ int discord_set_presence_ex(discord_t *d, const char *state, const char *name,
|
||||
* dangling key: those drop the whole activity). */
|
||||
const char *hsrc = (art_url&&art_url[0]) ? art_url : NULL;
|
||||
char home_pack[320] = "";
|
||||
if(hsrc && strchr(hsrc, '"')) hsrc = NULL; /* config garbage fails
|
||||
soft to the pack default, never a broken JSON POST */
|
||||
if(hsrc && strncmp(hsrc, "http", 4) != 0){
|
||||
for(const char *q = hsrc; *q; q++){
|
||||
char ch = *q;
|
||||
if(!((ch >= 'a' && ch <= 'z') || (ch >= '0' && ch <= '9') || ch == '_')){
|
||||
hsrc = NULL; /* not a valid asset key: pack default */
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
if(!hsrc && art_base_url&&art_base_url[0]){
|
||||
int n=snprintf(home_pack,sizeof home_pack,"%shome.png",art_base_url);
|
||||
if(n>0 && (size_t)n<sizeof home_pack) hsrc = home_pack;
|
||||
@@ -296,7 +309,7 @@ int discord_set_presence_ex(discord_t *d, const char *state, const char *name,
|
||||
char hmp[512] = "";
|
||||
const char *himg = NULL;
|
||||
if(hsrc && !strncmp(hsrc,"http",4)){
|
||||
if(d->token[0] && art_resolve_mp(application_id, d->token, hsrc, hmp, sizeof hmp))
|
||||
if(token && token[0] && art_resolve_mp(application_id, token, hsrc, hmp, sizeof hmp))
|
||||
himg = hmp;
|
||||
} else if(hsrc){
|
||||
himg = hsrc; /* operator-supplied uploaded key: trusted */
|
||||
@@ -320,12 +333,14 @@ int discord_set_presence_ex(discord_t *d, const char *state, const char *name,
|
||||
if(n>0 && (size_t)n<sizeof pack_url) src_url = pack_url;
|
||||
}
|
||||
}
|
||||
if(src_url && d->token[0] &&
|
||||
art_resolve_mp(application_id, d->token, src_url, mp, sizeof mp)){
|
||||
if(src_url && token && token[0] &&
|
||||
art_resolve_mp(application_id, token, src_url, mp, sizeof mp)){
|
||||
jl_val_t *as=jl_new_object();
|
||||
if(as){
|
||||
jl_obj_set(as,"large_image",jl_new_string(mp));
|
||||
jl_obj_set(as,"large_text",jl_new_string(name?name:""));
|
||||
/* hover carries the raw title ID (PC-tool pattern):
|
||||
* visible lines stay clean, ID one hover away. */
|
||||
jl_obj_set(as,"large_text",jl_new_string(title_id));
|
||||
jl_obj_set(act,"assets",as);
|
||||
}
|
||||
} else {
|
||||
@@ -334,12 +349,23 @@ int discord_set_presence_ex(discord_t *d, const char *state, const char *name,
|
||||
jl_val_t *as=jl_new_object();
|
||||
if(as){
|
||||
jl_obj_set(as,"large_image",jl_new_string(key));
|
||||
jl_obj_set(as,"large_text",jl_new_string(name?name:""));
|
||||
jl_obj_set(as,"large_text",jl_new_string(title_id));
|
||||
jl_obj_set(act,"assets",as);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return act;
|
||||
}
|
||||
|
||||
int discord_set_presence_ex(discord_t *d, const char *state, const char *name,
|
||||
const char *title_id, const char *application_id,
|
||||
const char *art_base_url, const char *art_url,
|
||||
int64_t started_epoch){
|
||||
if(!d || !d->connected || !name) return -1;
|
||||
jl_val_t *act = discord_build_activity(state, name, title_id,
|
||||
application_id, art_base_url, art_url, started_epoch, d->token);
|
||||
if(!act) return -1;
|
||||
jl_val_t *dd=jl_new_object();
|
||||
jl_obj_set(dd,"activities",jl_new_array());
|
||||
jl_arr_push(jl_obj_get(dd,"activities"), act);
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
#ifndef DISCORD_H
|
||||
#define DISCORD_H
|
||||
#include "ws.h"
|
||||
#include "jsonlite.h"
|
||||
typedef struct {
|
||||
ws_t ws;
|
||||
char token[512];
|
||||
@@ -26,6 +27,11 @@ int discord_set_presence_ex(discord_t *d, const char *state, const char *name,
|
||||
const char *title_id, const char *application_id,
|
||||
const char *art_base_url, const char *art_url,
|
||||
int64_t started_epoch); /* op 3 */
|
||||
/* Test seam: pure activity-JSON builder (no sockets). token "" skips mp:. */
|
||||
jl_val_t *discord_build_activity(const char *state, const char *name,
|
||||
const char *title_id, const char *application_id,
|
||||
const char *art_base_url, const char *art_url,
|
||||
int64_t started_epoch, const char *token);
|
||||
int discord_clear_presence(discord_t *d); /* clear activity, stay online */
|
||||
int discord_tick(discord_t *d); /* 0 ok; -1 drop/reconnect; -2 auth-fatal; -3 invalid session (retry promptly) */
|
||||
#endif
|
||||
@@ -13,13 +13,16 @@ export PS4_PAYLOAD_SDK="$SDK"
|
||||
export PATH="$HOME/llvmshim:$PATH"
|
||||
OUT="build-sdk"
|
||||
mkdir -p "$OUT"
|
||||
CFLAGS="-O2 -Wall -DORBISRPC_SDK_PAYLOAD -Iorbisrpc -Ithird_party/mbedtls/include"
|
||||
CFLAGS="-O2 -Wall -DORBISRPC_SDK_PAYLOAD -Iorbisrpc -Ithird_party/mbedtls/include -Ithird_party/sqlite/sqlite-amalgamation-3510100"
|
||||
SQLITE_DIR="third_party/sqlite/sqlite-amalgamation-3510100"
|
||||
echo "=== daemon sources (SDK) ==="
|
||||
for f in log cfg jsonlite b64 sfo tmdb_crypto tmdb updater updater_http updater_util tls ws detect discord daemon compat lock timesync art health manifest main; do
|
||||
for f in log cfg jsonlite b64 sfo tmdb_crypto tmdb updater updater_http updater_util tls ws detect discord daemon compat lock timesync art health manifest appdb main; do
|
||||
# clock has no .c (header-only helper lives in compat.c); skip if missing
|
||||
[ -f "orbisrpc/$f.c" ] || continue
|
||||
"$CC" $CFLAGS -c -o "$OUT/$f.o" "orbisrpc/$f.c" || { echo "FAIL: $f"; exit 1; }
|
||||
done
|
||||
echo "=== sqlite (SDK, readonly, no threads/extensions) ==="
|
||||
"$CC" $CFLAGS -Os -DSQLITE_THREADSAFE=0 -DSQLITE_OMIT_LOAD_EXTENSION -DSQLITE_OMIT_DEPRECATED -c -o "$OUT/sqlite3.o" "$SQLITE_DIR/sqlite3.c" || { echo "FAIL: sqlite"; exit 1; }
|
||||
echo "=== mbedtls (SDK, skip net_sockets/timing/entropy_poll) ==="
|
||||
for f in $(find third_party/mbedtls/library -name '*.c' ! -name 'net_sockets.c' ! -name 'timing.c' ! -name 'entropy_poll.c' | sort); do
|
||||
o="$OUT/mbed_$(echo "$f" | sed 's|third_party/mbedtls/library/||; s|\.c$||').o"
|
||||
|
||||
+15
-6
@@ -1,5 +1,5 @@
|
||||
CC ?= cc
|
||||
CFLAGS += -std=c11 -Wall -Wextra -Werror -DHEALTH_TESTABLE -I../orbisrpc -I../third_party/mbedtls/include
|
||||
CFLAGS += -std=c11 -Wall -Wextra -Werror -DHEALTH_TESTABLE -I../orbisrpc -I../third_party/mbedtls/include -I$(SQLITE_DIR)
|
||||
|
||||
TARGET := test_utils
|
||||
OBJDIR := .objs
|
||||
@@ -8,16 +8,19 @@ MBEDTLS_DIR := ../third_party/mbedtls/library
|
||||
# Same exclusion set as scripts/build.sh (POSIX-only modules).
|
||||
MBEDTLS_SRCS := $(filter-out $(MBEDTLS_DIR)/net_sockets.c $(MBEDTLS_DIR)/timing.c $(MBEDTLS_DIR)/entropy_poll.c,$(wildcard $(MBEDTLS_DIR)/*.c))
|
||||
|
||||
ORBIS_SRCS := ../orbisrpc/jsonlite.c ../orbisrpc/b64.c ../orbisrpc/sfo.c ../orbisrpc/tmdb_crypto.c ../orbisrpc/updater_util.c ../orbisrpc/art.c ../orbisrpc/log.c ../orbisrpc/health.c ../orbisrpc/manifest.c ../orbisrpc/compat.c ../orbisrpc/cfg.c
|
||||
ORBIS_SRCS := ../orbisrpc/jsonlite.c ../orbisrpc/b64.c ../orbisrpc/sfo.c ../orbisrpc/tmdb_crypto.c ../orbisrpc/updater_util.c ../orbisrpc/art.c ../orbisrpc/log.c ../orbisrpc/health.c ../orbisrpc/manifest.c ../orbisrpc/compat.c ../orbisrpc/cfg.c ../orbisrpc/appdb.c ../orbisrpc/discord.c
|
||||
# SQLite amalgamation: -O0 for host iteration speed (payload uses -O2).
|
||||
SQLITE_DIR := ../third_party/sqlite/sqlite-amalgamation-3510100
|
||||
SQLITE_FLAGS := -O0 -DSQLITE_THREADSAFE=0 -DSQLITE_OMIT_LOAD_EXTENSION -DSQLITE_OMIT_DEPRECATED -I$(SQLITE_DIR)
|
||||
|
||||
ORBIS_OBJS := $(patsubst ../orbisrpc/%.c,$(OBJDIR)/orbis_%.o,$(ORBIS_SRCS))
|
||||
MBEDTLS_OBJS := $(patsubst $(MBEDTLS_DIR)/%.c,$(OBJDIR)/mbed_%.o,$(MBEDTLS_SRCS))
|
||||
TEST_OBJS := $(OBJDIR)/test_utils.o $(ORBIS_OBJS) $(MBEDTLS_OBJS)
|
||||
TEST_OBJS := $(OBJDIR)/test_utils.o $(ORBIS_OBJS) $(MBEDTLS_OBJS) $(OBJDIR)/sqlite3.o
|
||||
|
||||
ASAN_FLAGS := -fsanitize=address,undefined -fno-omit-frame-pointer
|
||||
ASAN_ORBIS_OBJS := $(patsubst ../orbisrpc/%.c,$(ASAN_OBJDIR)/orbis_%.o,$(ORBIS_SRCS))
|
||||
ASAN_MBEDTLS_OBJS := $(patsubst $(MBEDTLS_DIR)/%.c,$(ASAN_OBJDIR)/mbed_%.o,$(MBEDTLS_SRCS))
|
||||
ASAN_OBJS := $(ASAN_OBJDIR)/test_utils.o $(ASAN_ORBIS_OBJS) $(ASAN_MBEDTLS_OBJS)
|
||||
ASAN_OBJS := $(ASAN_OBJDIR)/test_utils.o $(ASAN_ORBIS_OBJS) $(ASAN_MBEDTLS_OBJS) $(ASAN_OBJDIR)/sqlite3.o
|
||||
|
||||
.PHONY: all clean test asan
|
||||
|
||||
@@ -27,10 +30,10 @@ test: $(TARGET)
|
||||
./$(TARGET)
|
||||
|
||||
$(TARGET): $(TEST_OBJS)
|
||||
$(CC) $(CFLAGS) -o $@ $(TEST_OBJS)
|
||||
$(CC) $(CFLAGS) -o $@ $(TEST_OBJS) -lm
|
||||
|
||||
asan: $(ASAN_OBJS)
|
||||
$(CC) $(CFLAGS) $(ASAN_FLAGS) -o test_utils_asan $(ASAN_OBJS)
|
||||
$(CC) $(CFLAGS) $(ASAN_FLAGS) -o test_utils_asan $(ASAN_OBJS) -lm
|
||||
./test_utils_asan
|
||||
|
||||
$(OBJDIR):
|
||||
@@ -48,6 +51,12 @@ $(OBJDIR)/orbis_%.o: ../orbisrpc/%.c | $(OBJDIR)
|
||||
$(OBJDIR)/mbed_%.o: $(MBEDTLS_DIR)/%.c | $(OBJDIR)
|
||||
$(CC) $(CFLAGS) -Wno-unused-parameter -c -o $@ $<
|
||||
|
||||
$(OBJDIR)/sqlite3.o: $(SQLITE_DIR)/sqlite3.c | $(OBJDIR)
|
||||
$(CC) $(SQLITE_FLAGS) -c -o $@ $<
|
||||
|
||||
$(ASAN_OBJDIR)/sqlite3.o: $(SQLITE_DIR)/sqlite3.c | $(ASAN_OBJDIR)
|
||||
$(CC) $(SQLITE_FLAGS) $(ASAN_FLAGS) -c -o $@ $<
|
||||
|
||||
$(ASAN_OBJDIR)/test_utils.o: test_utils.c | $(ASAN_OBJDIR)
|
||||
$(CC) $(CFLAGS) $(ASAN_FLAGS) -c -o $@ test_utils.c
|
||||
|
||||
|
||||
@@ -7,6 +7,28 @@
|
||||
#include "../orbisrpc/health.h"
|
||||
#include "../orbisrpc/manifest.h"
|
||||
#include "../orbisrpc/cfg.h"
|
||||
#include "../orbisrpc/appdb.h"
|
||||
#include "../orbisrpc/discord.h"
|
||||
#include "../orbisrpc/detect.h"
|
||||
#include "sqlite3.h"
|
||||
#include <string.h>
|
||||
|
||||
/* discord.c host stubs: builder tests never touch the wire. */
|
||||
int detect_media_type(const char *t){
|
||||
if(t && !strcmp(t, "CUSA00127")) return 3;
|
||||
return 0;
|
||||
}
|
||||
int ws_connect(ws_t *w, const char *h, int p, const char *r, const char *k){
|
||||
(void)w; (void)h; (void)p; (void)r; (void)k; return -1;
|
||||
}
|
||||
int ws_send_text(ws_t *w, const char *m, size_t n){
|
||||
(void)w; (void)m; (void)n; return -1;
|
||||
}
|
||||
int ws_recv_frame(ws_t *w, char *b, size_t c, int *o, int *f){
|
||||
(void)w; (void)b; (void)c; (void)o; (void)f; return -1;
|
||||
}
|
||||
int ws_pong(ws_t *w){ (void)w; return -1; }
|
||||
int ws_close(ws_t *w){ (void)w; return -1; }
|
||||
#include <mbedtls/ecdsa.h>
|
||||
#include <mbedtls/ecp.h>
|
||||
#include <mbedtls/ctr_drbg.h>
|
||||
@@ -425,6 +447,129 @@ static void test_cfg_titles(void) {
|
||||
assert(c.home_art[0] == 0);
|
||||
}
|
||||
|
||||
static void test_appdb(void) {
|
||||
char dir[64], db[96], meta[96], pj[128];
|
||||
assert(make_tmpdir(dir, sizeof dir) == 0);
|
||||
snprintf(db, sizeof db, "%s/app.db", dir);
|
||||
snprintf(meta, sizeof meta, "%s/appmeta", dir);
|
||||
assert(mkdir(meta, 0700) == 0);
|
||||
sqlite3 *s = NULL;
|
||||
assert(sqlite3_open_v2(db, &s, SQLITE_OPEN_READWRITE|SQLITE_OPEN_CREATE|SQLITE_OPEN_NOMUTEX, NULL) == SQLITE_OK);
|
||||
assert(sqlite3_exec(s, "CREATE TABLE tbl_appbrowse(titleId TEXT, titleName TEXT);", 0, 0, 0) == SQLITE_OK);
|
||||
assert(sqlite3_exec(s, "INSERT INTO tbl_appbrowse VALUES('CUSA11995','Marvel''s Spider-Man');", 0, 0, 0) == SQLITE_OK);
|
||||
assert(sqlite3_exec(s, "CREATE TABLE tbl_appinfo(titleId TEXT, key TEXT, val TEXT);", 0, 0, 0) == SQLITE_OK);
|
||||
assert(sqlite3_exec(s, "INSERT INTO tbl_appinfo VALUES('CUSA00001','TITLE_01','Lang One');", 0, 0, 0) == SQLITE_OK);
|
||||
assert(sqlite3_exec(s, "INSERT INTO tbl_appinfo VALUES('CUSA00001','TITLE','Base Name');", 0, 0, 0) == SQLITE_OK);
|
||||
assert(sqlite3_exec(s, "INSERT INTO tbl_appinfo VALUES('CUSA00002','TITLE','');", 0, 0, 0) == SQLITE_OK);
|
||||
sqlite3_close(s);
|
||||
char name[128];
|
||||
/* tier 1: browse name wins */
|
||||
assert(appdb_title_from(db, meta, "CUSA11995", name, sizeof name) == 0);
|
||||
assert(!strcmp(name, "Marvel's Spider-Man"));
|
||||
/* tier 2: bare TITLE preferred over TITLE_01 */
|
||||
assert(appdb_title_from(db, meta, "CUSA00001", name, sizeof name) == 0);
|
||||
assert(!strcmp(name, "Base Name"));
|
||||
/* empty val rows never match; no param.json staged -> miss */
|
||||
assert(appdb_title_from(db, meta, "CUSA00002", name, sizeof name) != 0);
|
||||
assert(appdb_title_from(db, meta, "CUSA99999", name, sizeof name) != 0);
|
||||
/* tier 3: staged param.json */
|
||||
char gdir[128];
|
||||
snprintf(gdir, sizeof gdir, "%s/CUSA00002", meta);
|
||||
assert(mkdir(gdir, 0700) == 0);
|
||||
snprintf(pj, sizeof pj, "%s/param.json", gdir);
|
||||
FILE *f = fopen(pj, "wb");
|
||||
assert(f);
|
||||
fputs("{\"titleId\":\"CUSA00002\",\"titleName\":\"JSON Game\"}", f);
|
||||
fclose(f);
|
||||
assert(appdb_title_from(db, meta, "CUSA00002", name, sizeof name) == 0);
|
||||
assert(!strcmp(name, "JSON Game"));
|
||||
/* invalid inputs fail soft */
|
||||
assert(appdb_title_from(db, meta, NULL, name, sizeof name) != 0);
|
||||
assert(appdb_title_from(db, meta, "short", name, sizeof name) != 0);
|
||||
assert(appdb_title_from(db, meta, "cusa11995", name, sizeof name) != 0);
|
||||
assert(appdb_title_from(db, meta, "CUSA1199!", name, sizeof name) != 0);
|
||||
assert(appdb_title_from("/nonexistent/app.db", meta, "CUSA11995", name, sizeof name) != 0);
|
||||
assert(appdb_title_from(db, meta, "CUSA11995", NULL, 0) != 0);
|
||||
}
|
||||
|
||||
static void test_discord_builder(void) {
|
||||
/* game presence: name shown, raw ID nowhere visible, hover has the ID */
|
||||
jl_val_t *a = discord_build_activity("On PS4", "Marvel's Spider-Man",
|
||||
"CUSA11995", "1536977374795538532", "https://x/icons/", NULL,
|
||||
1700000000LL, "");
|
||||
assert(a);
|
||||
const jl_val_t *v = jl_obj_get(a, "name");
|
||||
assert(v && v->type == JL_STRING && !strcmp(v->str, "Marvel's Spider-Man"));
|
||||
assert(jl_obj_get(a, "details") == NULL); /* never the raw ID */
|
||||
v = jl_obj_get(a, "state");
|
||||
assert(v && v->type == JL_STRING && !strcmp(v->str, "On PS4"));
|
||||
v = jl_obj_get(a, "type");
|
||||
assert(v && v->type == JL_NUMBER && (int)v->num == 0);
|
||||
const jl_val_t *ts = jl_obj_get(a, "timestamps");
|
||||
assert(ts && ts->type == JL_OBJECT);
|
||||
v = jl_obj_get(ts, "start");
|
||||
assert(v && v->type == JL_NUMBER && v->inum == 1700000000LL * 1000LL);
|
||||
const jl_val_t *as = jl_obj_get(a, "assets");
|
||||
assert(as && as->type == JL_OBJECT);
|
||||
v = jl_obj_get(as, "large_image");
|
||||
assert(v && v->type == JL_STRING && !strcmp(v->str, "cusa11995"));
|
||||
v = jl_obj_get(as, "large_text");
|
||||
assert(v && v->type == JL_STRING && !strcmp(v->str, "CUSA11995"));
|
||||
jl_free(a);
|
||||
/* media type mapping survives */
|
||||
a = discord_build_activity(NULL, "YouTube", "CUSA01015", "app",
|
||||
NULL, NULL, 0, "");
|
||||
assert(a);
|
||||
v = jl_obj_get(a, "type");
|
||||
assert(v && (int)v->num == 0); /* stub maps only CUSA00127 */
|
||||
jl_free(a);
|
||||
a = discord_build_activity(NULL, "Netflix", "CUSA00127", "app",
|
||||
NULL, NULL, 0, "");
|
||||
assert(a);
|
||||
v = jl_obj_get(a, "type");
|
||||
assert(v && (int)v->num == 3);
|
||||
jl_free(a);
|
||||
/* home + uploaded key: trusted key used as-is */
|
||||
a = discord_build_activity("On PS4", "PlayStation 4", "home", "app",
|
||||
NULL, "pslogo", 0, "");
|
||||
assert(a);
|
||||
as = jl_obj_get(a, "assets");
|
||||
assert(as && as->type == JL_OBJECT);
|
||||
v = jl_obj_get(as, "large_image");
|
||||
assert(v && !strcmp(v->str, "pslogo"));
|
||||
v = jl_obj_get(as, "large_text");
|
||||
assert(v && !strcmp(v->str, "PlayStation 4"));
|
||||
jl_free(a);
|
||||
/* home with nothing: no assets block at all (never dangling) */
|
||||
a = discord_build_activity("On PS4", "PlayStation 4", "home", "app",
|
||||
NULL, NULL, 0, "");
|
||||
assert(a);
|
||||
assert(jl_obj_get(a, "assets") == NULL);
|
||||
jl_free(a);
|
||||
/* NULL name rejected */
|
||||
assert(discord_build_activity(NULL, NULL, "home", "app", NULL, NULL, 0, "") == NULL);
|
||||
}
|
||||
|
||||
static void test_cfg_learn(void) {
|
||||
cfg_t c;
|
||||
cfg_defaults(&c);
|
||||
assert(c.n_titles == 0);
|
||||
assert(cfg_learn(&c, "CUSA11995", "Marvel's Spider-Man") == 1);
|
||||
assert(cfg_learn(&c, "CUSA11995", "Marvel's Spider-Man") == 0); /* dup */
|
||||
assert(cfg_learn(&c, "CUSA11995", "CUSA11995") == 0); /* ID echo refused */
|
||||
assert(cfg_learn(&c, "CUSA11995", "x") == 0); /* too short */
|
||||
assert(cfg_learn(&c, "bad key!", "Name") == 0);
|
||||
assert(cfg_learn(&c, "CUSA11995", "Spider-Man 2") == 1); /* update */
|
||||
char name[128];
|
||||
assert(cfg_title(&c, "CUSA11995", name, sizeof name) == 0);
|
||||
assert(!strcmp(name, "Spider-Man 2"));
|
||||
assert(cfg_learn(NULL, "CUSA11995", "N") == 0);
|
||||
assert(cfg_learn(&c, NULL, "N") == 0);
|
||||
/* full map refuses */
|
||||
c.n_titles = CFG_MAX_TITLES;
|
||||
assert(cfg_learn(&c, "CUSA00001", "Full Game") == 0);
|
||||
}
|
||||
|
||||
int main(void) {
|
||||
test_json();
|
||||
test_gateway_op_spoof();
|
||||
@@ -440,6 +585,9 @@ int main(void) {
|
||||
test_manifest();
|
||||
test_manifest_sig();
|
||||
test_cfg_titles();
|
||||
test_cfg_learn();
|
||||
test_appdb();
|
||||
test_discord_builder();
|
||||
puts("utility tests passed");
|
||||
return 0;
|
||||
}
|
||||
+33888
File diff suppressed because it is too large.
Load diff
+265908
File diff suppressed because it is too large.
Load diff
+13968
File diff suppressed because it is too large.
Load diff
@@ -0,0 +1,730 @@
|
||||
/*
|
||||
** 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*));
|
||||
/* Version 3.50.0 and later */
|
||||
int (*setlk_timeout)(sqlite3*,int,int);
|
||||
/* Version 3.51.0 and later */
|
||||
int (*set_errmsg)(sqlite3*,int,const char*);
|
||||
int (*db_status64)(sqlite3*,int,sqlite3_int64*,sqlite3_int64*,int);
|
||||
|
||||
};
|
||||
|
||||
/*
|
||||
** 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
|
||||
/* Version 3.50.0 and later */
|
||||
#define sqlite3_setlk_timeout sqlite3_api->setlk_timeout
|
||||
/* Version 3.51.0 and later */
|
||||
#define sqlite3_set_errmsg sqlite3_api->set_errmsg
|
||||
#define sqlite3_db_status64 sqlite3_api->db_status64
|
||||
#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 */
|
||||
BIN
Binary file not shown.
Reference in new issue
Block a user