/* * spiptv.h — scorpiox-scorpioplayer-iptv-m3u-source-client public API. * * The handler itself is the sprch_handler returned by sprch_get() (sprch.h). * The spiptv_* exports are the flat P/Invoke surface; they call through * sprch_get() with the installed scorpiox_io backend (libcurl by default). * See SPEC.md for every decision. */ #ifndef SPIPTV_H #define SPIPTV_H #include "sprch.h" #ifdef __cplusplus extern "C" { #endif #if defined(_WIN32) # if defined(SPIPTV_BUILD) # define SPIPTV_API __declspec(dllexport) # else # define SPIPTV_API __declspec(dllimport) # endif #else # define SPIPTV_API __attribute__((visibility("default"))) #endif #define SPIPTV_VERSION "1.0.0" #define SPIPTV_DEFAULT_URL "https://iptv-org.github.io/iptv/index.category.m3u" /* ---- sprch ops through the installed backend ---- */ SPIPTV_API int spiptv_validate(const char *settings_json, char *out_json, int cap); SPIPTV_API int spiptv_list(const char *settings_json, const char *folder_id, char *out_json, int cap); SPIPTV_API int spiptv_stream_url(const char *settings_json, const char *entry_json, char *out_json, int cap); SPIPTV_API int spiptv_download(const char *settings_json, const char *config_json, char *out_json, int cap); /* ---- results / identity ---- */ SPIPTV_API const char *spiptv_last_error(void); /* "" after a successful call; never a secret */ SPIPTV_API const char *spiptv_result_json(void); /* full JSON of the last call, even after E_BUFFER */ SPIPTV_API const char *spiptv_version(void); SPIPTV_API const char *spiptv_runtime_type(void); SPIPTV_API int spiptv_caps(void); /* ---- backend selection ---- */ SPIPTV_API int spiptv_set_io(const scorpiox_io *io); /* NULL restores the default */ SPIPTV_API int spiptv_use_curl(void); /* SPRCH_E_NOTSUPPORTED if built without */ SPIPTV_API int spiptv_use_fake(void); /* ---- fake backend (tests; never touches the network) ---- */ SPIPTV_API void spiptv_fake_reset(void); SPIPTV_API int spiptv_fake_set(const char *url, int http_code, const char *body); /* int: same width on every ABI */ SPIPTV_API int spiptv_fake_fail(const char *url, const char *transport_error); SPIPTV_API int spiptv_fake_calls(const char *url); /* NULL = total */ /* ---- cache ---- */ SPIPTV_API void spiptv_cache_clear(void); SPIPTV_API int spiptv_cache_set_max_age(int seconds); /* default 21600; 0 = always revalidate */ SPIPTV_API const char *spiptv_stats_json(void); /* {"cache":{...},"http":{...}} */ /* ---- internal (static builds, tests, CLI) ---- */ const scorpiox_io *spiptv_io_curl(void); const scorpiox_io *spiptv_io_fake(void); const scorpiox_io *spiptv_io_current(void); #ifdef __cplusplus } #endif #endif /* SPIPTV_H */