Documentation Index
Fetch the complete documentation index at: https://docs.oxd.sh/llms.txt
Use this file to discover all available pages before exploring further.
ox_accel_create
Allocate and initialize an Accel context.
OxAccel* ox_accel_create(const OxAccelConfig *config)
Parameters
config
const OxAccelConfig*
required
Pointer to a configuration struct. Must not be NULL.
Returns
A valid OxAccel* on success, or NULL on failure.
Configuration struct
typedef struct {
const char *api_key; // Your API key
const char *relay_host; // Relay hostname (default: "127.0.0.1")
uint16_t relay_port; // Relay port (default: 51820)
bool enable_fec; // Forward error correction
bool enable_compression; // Payload compression
bool enable_multipath; // Multi-path routing
} OxAccelConfig;
Example
OxAccelConfig config = {
.api_key = "oxd_accel_...",
.relay_host = "relay.oxd.sh",
.relay_port = 51820,
.enable_fec = true,
};
OxAccel *ctx = ox_accel_create(&config);
if (!ctx) {
// Handle allocation failure
}
ox_accel_connect
Establish a connection to the relay server.
OxAccelError ox_accel_connect(OxAccel *ctx)
Parameters
Context returned by ox_accel_create.
Returns
| Value | Meaning |
|---|
Ok | Connected successfully |
InvalidParam | ctx is NULL |
InitFailed | Could not reach relay or bind socket |
Example
OxAccelError err = ox_accel_connect(ctx);
if (err != OxAccelError_Ok) {
fprintf(stderr, "Connection failed: %d\n", err);
ox_accel_destroy(ctx);
return 1;
}
ox_accel_destroy
Free all resources associated with the context.
void ox_accel_destroy(OxAccel *ctx)
Parameters
Context to destroy. Passing NULL is a safe no-op.
Must not be called concurrently with any other ox_accel_* function on the same context. After this call, the pointer is invalid.
Example
ox_accel_destroy(ctx);
ctx = NULL; // Prevent use-after-free