aienux
Aienux, the AienOS kernel: boot, scheduling, IPC and capability boundaries. Pre-alpha; host, emulator and physical evidence are labelled separately.
Brought by drakestapleton
aienux / native / kernel / core / osc_admit.h
| 1 | /* SPDX-License-Identifier: Apache-2.0 |
| 2 | * Copyright 2026 Drake Stapleton (AIEN / aien-dev) |
| 3 | * |
| 4 | * Licensed under the Apache License, Version 2.0 (the "License"); |
| 5 | * you may not use this file except in compliance with the License. |
| 6 | * You may obtain a copy of the License at |
| 7 | * |
| 8 | * http://www.apache.org/licenses/LICENSE-2.0 |
| 9 | * |
| 10 | * Unless required by applicable law or agreed to in writing, software |
| 11 | * distributed under the License is distributed on an "AS IS" BASIS, |
| 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 13 | * See the License for the specific language governing permissions and |
| 14 | * limitations under the License. |
| 15 | */ |
| 16 | |
| 17 | /* osc_admit.h -- kernel-side use of artifact/osc_unit.c: admission verdict |
| 18 | * for OSCUNIT containers that arrive through the artifact candidate path |
| 19 | * (boot disk Store), and the realization receipts (artifact/osc_receipt.h, |
| 20 | * aienos#383) that arrive the same way. Admission only: nothing is mapped or |
| 21 | * launched here; a launch (core/osc_task.c) verifies its receipt. */ |
| 22 | #ifndef AIENOS_CK_OSC_ADMIT_H |
| 23 | #define AIENOS_CK_OSC_ADMIT_H |
| 24 | #include <stddef.h> |
| 25 | #include <stdint.h> |
| 26 | #include "osc_unit.h" |
| 27 | |
| 28 | /* Nonzero if the bytes begin with the container magic "OSCUNIT\0". */ |
| 29 | int ck_osc_is_unit(const uint8_t *b, size_t len); |
| 30 | /* Admit one container and print its machine-readable "osc_unit:" line. Returns 0 accepted, |
| 31 | * else the refusal code. */ |
| 32 | unsigned ck_osc_candidate(const char *name, const uint8_t *b, size_t len); |
| 33 | /* A Store entry the Store refused as too large (RESOURCE_UNAVAILABLE) is never read, so its format is |
| 34 | * unknown: print an "osc_unit:" refusal line for it and count it as oversize. The refusal itself stays |
| 35 | * with the old firmware path. */ |
| 36 | void ck_osc_oversize(const char *name, uint64_t len); |
| 37 | /* Print the "osc_units:" summary line if any OSC candidate or oversize entry was seen. */ |
| 38 | void ck_osc_summary(void); |
| 39 | |
| 40 | /* The kernel's local admission and receipt policy (release or qualification build). */ |
| 41 | void ck_osc_policy(struct osc_policy *p); |
| 42 | /* Nonzero if the bytes begin with the receipt magic "OMRCPT1\0" (omega receipt v1). */ |
| 43 | int ck_osc_is_receipt(const uint8_t *b, size_t len); |
| 44 | /* Keep a receipt by its Store name (it is verified later, against the unit a launch presents it with) and |
| 45 | * print its "osc_receipt:" line. */ |
| 46 | void ck_osc_receipt_candidate(const char *name, const uint8_t *b, size_t len); |
| 47 | /* The kept receipt of that name (*len its length), or NULL (*len 0) if none arrived. */ |
| 48 | const uint8_t *ck_osc_receipt_find(const char *name, size_t *len); |
| 49 | #ifdef CK_OSC_LAUNCH_TEST |
| 50 | extern int ck_osc_rcpt_variant; /* TEST ONLY: receipt policy variant of the next launch (osc_admit.c) */ |
| 51 | #endif |
| 52 | #endif |