skip to content
==> include/mesh/abi/view_http.h <==
1/* @ajax/mesh-abi-view-http: programs/http's view: a GPU HTTP server's counters, load request and windows.
2 *
3 * Part of alpha-c-mesh, a C port of alpha-rust-mesh (README.md says from where). */
4#ifndef MESH_ABI_VIEW_HTTP_H
5#define MESH_ABI_VIEW_HTTP_H
6
7#include <stdbool.h>
8#include <stddef.h>
9#include <stdint.h>
10
11/* programs/http: an HTTP/1.0 GET server computed on the GPU, generic over the
12 * program table (`reads = ["*"]`).  Request window "0x100:0x100,0x400:0x4000".
13 *
14 * The load request (`GET /load/<name>`): when HV_LOAD_SEQ == HV_LOAD_ACK
15 * (none pending) the warp writes the name (NUL padded) at HV_LOAD_NAME, then
16 * HV_LOAD_SEQ += 1 (release); otherwise it answers 503.  meshd, seeing
17 * HV_LOAD_SEQ != HV_LOAD_ACK in the slot of the program named "http", loads
18 * `<--programs DIR>/<name>` (the same checks as the control `load`), writes
19 * HV_LOAD_RESULT (LOAD_OK or 1 + an index into LOAD_REASONS), then
20 * HV_LOAD_ACK = HV_LOAD_SEQ (release). */
21#define MESH_HTTP_HV_SERVED 0x00u /* u32 responses written */
22#define MESH_HTTP_HV_LAST_CODE 0x04u /* u32 the last status code */
23#define MESH_HTTP_HV_LOAD_SEQ 0x08u /* u32 GPU */
24#define MESH_HTTP_HV_LOAD_ACK 0x0cu /* u32 meshd */
25#define MESH_HTTP_HV_LOAD_RESULT 0x10u /* u32 meshd */
26#define MESH_HTTP_HV_LOAD_NAME 0x14u /* [u8; 16] GPU */
27/* Per slot {P_DONE u32, pad, globaltimer u64} at the last page that showed
28 * rates: tasks/s between two requests. */
29#define MESH_HTTP_HV_SAMPLES 0x200u
30#define MESH_HTTP_SAMPLE_BYTES 16u
31#define MESH_HTTP_REQ_OFF 0x100u
32#define MESH_HTTP_REQ_MAX 0x100u
33#define MESH_HTTP_RESP_OFF 0x400u
34/* Room for /render.bmp of a 640x360 pathtrace image (54 + 691200 bytes) and its head. */
35#define MESH_HTTP_RESP_MAX 0xa9000u
36#define MESH_HTTP_VIEW_BYTES 0xa9400u
37#define MESH_HTTP_LOAD_OK 0u
38/* /doom: rows of the ASCII frame. */
39#define MESH_HTTP_DOOM_ROWS 24u
40
41/* The Rust const asserts that only involve this package. */
42_Static_assert(MESH_HTTP_HV_LOAD_NAME + 16 <= MESH_HTTP_REQ_OFF, "http::HV_LOAD_NAME + 16 <= http::REQ_OFF");
43_Static_assert(MESH_HTTP_REQ_OFF + MESH_HTTP_REQ_MAX <= MESH_HTTP_HV_SAMPLES, "http::REQ_OFF + http::REQ_MAX <= http::HV_SAMPLES");
44_Static_assert(MESH_HTTP_RESP_OFF + MESH_HTTP_RESP_MAX <= MESH_HTTP_VIEW_BYTES, "http::RESP_OFF + http::RESP_MAX <= http::VIEW_BYTES");
45
46#endif