Files
ps5-payload-manager/include/sources.h
T
najdek 2189ee962d refactor: decompose main.c and payload_mgr.c into focused modules
Split two monolithic files (main.c 1538→233 lines, payload_mgr.c
2355→467 lines) into 8 single-responsibility modules:

- http_server.c: MHD request router and all route handlers
- repository.c: repo cache, download, install/commit, self-update
- sources.c: multi-source repository management
- config.c: PldmgrConfig struct, read/write, JSON config handler
- log_server.c: ring buffer, SSE streaming, pldmgr_log()
- json_helpers.c: JsonListBuilder, JSON parser, file I/O utilities
- sha256.c: SHA256 hash implementation
- process_mgr.c: process listing and kill

Introduces PldmgrConfig struct to replace the 8-out-param
read_next_config_values() pattern. Renames extracted functions to
match their new modules (e.g. repository_install_download,
sources_add, process_kill). No HTTP route changes — frontend
is unaffected.
2026-06-03 18:22:26 +02:00

28 lines
1018 B
C

#ifndef SOURCES_H
#define SOURCES_H
#include <stddef.h>
/* List all configured sources as JSON. */
int sources_list_json(char *buf, size_t size);
/* Replace the sources list from a JSON POST body. */
int sources_save(const char *json, size_t len);
/* Add a new source by URL. On success, msg_buf receives the source name. */
int sources_add(const char *url, char *msg_buf, size_t msg_size);
/* Remove a source by index. Index 0 (default) cannot be removed. */
int sources_remove(int index, char *msg_buf, size_t msg_size);
/* Build multi-source repository JSON (grouped by source).
* Returns bytes written. */
size_t sources_multi_repository_list_json(char *buf, size_t size, int force_refresh);
/* Download and install a payload from a specific source.
* source_id identifies the source; repo_url is used as fallback detail. */
int sources_multi_repository_install(const char *filename, const char *source_id,
const char *repo_url, char *msg, size_t msg_size);
#endif