sica-fondt/src/ichor/ichor_ada_shim.c
Claude 786d4662c9
ichor(D2): start the Pony wiring — broker + D1 barrier + envelope
Name the medium Ichor and scaffold it in Pony at src/ichor:
- Envelope {source,dest,provenance,payload} mirroring Ada Organ_Message
- Broker actor: register + perfusion route; Brain-bound traffic crosses D1
- Barrier (D1) admit: Pony provenance-law mirror + Ada FFI seam sketched
- StubOrgan + main smoke wiring (deliver internal, reject external)
- ichor_ada_shim.c: C/Fortran binding seam to Ada Trust_Guard (stub)
Not compiled in-env (no ponyc). Updates D2 spec to SCAFFOLD/Pony.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_015hmgREHNsxYCuim33yUF2c
2026-06-18 14:09:34 +00:00

31 lines
984 B
C

/* ichor_ada_shim.c
*
* The C/Fortran binding seam between Ichor (Pony) and the Ada D1 border
* (Trust_Boundary.Trust_Guard). Pony's FFI calls `ichor_ada_admit`; this shim
* is where the call crosses into Ada.
*
* Stub: returns admit=true. Replace the body with a call into an Ada export of
* Trust_Guard.Screen_Inbound (provenance + blocklist + rate), e.g. via a
* `pragma Export (C, ...)` wrapper on the Ada side.
*
* Build into a lib so Pony's `use "lib:ichor_ada"` can link it.
*/
#include <stdbool.h>
#include <stddef.h>
/* provenance codes mirror Ichor's Provenance:
* 0 system_internal, 1 user_input, 2 organ_secretion, 3 external */
bool ichor_ada_admit(unsigned char provenance,
const char *payload,
size_t len)
{
(void)payload;
(void)len;
/* TODO: cross into Ada Trust_Guard.Screen_Inbound and return its verdict. */
if (provenance == 3 /* external */) {
return false;
}
return true;
}