skip to content
==> include/mesh/http_relay.h <==
1/* @ajax/mesh-http-relay: the HTTP port (http.rs).
2 *
3 * The host only moves bytes: routing and responses are the GPU http
4 * program's (`req http` through its request window), except the fleet's views
5 * `/fleet`, `/jobs` and `/pipes`, GPT-2 inference (`/infer?prompt=..`) and a
6 * fleet-rendered image (`/render?job=..`, `/render.bmp?job=..`,
7 * `/render.ppm?job=..`), which meshd answers itself -- also where the http
8 * program cannot run. A request head must arrive within 2 s; at most 64
9 * clients are served at once. */
10#ifndef MESH_HTTP_RELAY_H
11#define MESH_HTTP_RELAY_H
12
13#include "mesh/shared.h"
14
15#include <stdbool.h>
16#include <stddef.h>
17
18/* Serves clients from a listening socket until the process exits. */
19void mesh_http_serve(mesh_shared *sh, int listen_fd);
20/* One client on a connected socket; closes it. */
21void mesh_http_client(mesh_shared *sh, int fd);
22
23/* `GET /fleet|/jobs|/pipes[?query]`: the view and the query (pointing into first). */
24bool mesh_http_view_route(const char *first, const char **view, const char **query, size_t *qlen);
25/* `GET /render[.bmp|.ppm]?job=<id|latest>`: the format ("status", "bmp", "ppm") and the job (malloc'd). */
26bool mesh_http_render_route(const char *first, const char **what, char **job);
27
28#endif