ombrac-client 0.6.0

Safe, fast, small TCP tunnel using Rust
/* Generated by cbindgen */

#include <stdarg.h>
#include <stdbool.h>
#include <stdint.h>
#include <stdlib.h>

/**
 * Initializes and starts the service with a given JSON configuration.
 *
 * This function sets up the asynchronous runtime, parses the configuration,
 * and launches the main service. It must be called before any other service
 * operations. The service must be shut down via `ombrac_client_service_shutdown` to ensure
 * a clean exit.
 *
 * # Arguments
 *
 * * `config_json` - A pointer to a null-terminated UTF-8 string containing the
 *   service configuration in JSON format.
 *
 * # Returns
 *
 * * `0` on success.
 * * `-1` on failure (e.g., invalid configuration, service already running, or
 *   runtime initialization failed).
 *
 * # Safety
 *
 * The caller must ensure that `config_json` is a valid pointer to a
 * null-terminated C string. This function is not thread-safe and should not be
 * called concurrently with `ombrac_client_service_shutdown`.
 */
int32_t ombrac_client_service_startup(const char *config_json);

/**
 * Shuts down the running service and releases all associated resources.
 *
 * This function will gracefully stop the service and terminate the asynchronous
 * runtime. It is safe to call even if the service was not started or has
 * already been stopped.
 *
 * # Returns
 *
 * * `0` on completion.
 *
 * # Safety
 *
 * This function is not thread-safe and should not be called concurrently with
 * `ombrac_client_service_startup`.
 */
int32_t ombrac_client_service_shutdown(void);