summaryrefslogtreecommitdiff
path: root/src/unit.h
diff options
context:
space:
mode:
authorauric <auric@japegames.com>2026-02-21 11:08:36 -0600
committerauric <auric@japegames.com>2026-02-21 11:08:36 -0600
commit0d706ae72ceefd74053ad6cb0900ecce6cf1f085 (patch)
tree6faf7d3919182b8838a6ae69ad1a2a0fac468740 /src/unit.h
Add Umbrella 0.1.5
Diffstat (limited to 'src/unit.h')
-rw-r--r--src/unit.h45
1 files changed, 45 insertions, 0 deletions
diff --git a/src/unit.h b/src/unit.h
new file mode 100644
index 0000000..d709b77
--- /dev/null
+++ b/src/unit.h
@@ -0,0 +1,45 @@
+#ifndef UMBRELLA_UNIT_H
+#define UMBRELLA_UNIT_H
+
+#include "umbrella.h"
+
+/*
+ * unit_load_all: scan UMBRELLA_UNITS_DIR and load all *.yaml files.
+ * Populates g.units and g.unit_count.
+ * Returns number of units loaded, -1 on fatal error.
+ */
+int unit_load_all(void);
+
+/*
+ * unit_load_file: load a single unit yaml file.
+ * Returns 0 on success, -1 on error.
+ */
+int unit_load_file(const char *path, Unit *out);
+
+/*
+ * unit_find: look up a unit by name.
+ * Returns pointer into g.units, or NULL if not found.
+ */
+Unit *unit_find(const char *name);
+
+/*
+ * unit_state_str: human-readable state name.
+ */
+const char *unit_state_str(ProcessState state);
+
+/*
+ * ring_init: allocate and zero a ring buffer.
+ */
+RingBuffer *ring_init(void);
+
+/*
+ * ring_push: append a line to the ring buffer.
+ */
+void ring_push(RingBuffer *rb, const char *line, int len);
+
+/*
+ * ring_free: free a ring buffer.
+ */
+void ring_free(RingBuffer *rb);
+
+#endif /* UMBRELLA_UNIT_H */