aboutsummaryrefslogtreecommitdiffhomepage
path: root/docs
diff options
context:
space:
mode:
authorwinter Sparkles2026-04-23 22:30:04 +0100
committerwinter Sparkles2026-04-23 22:30:04 +0100
commit05a9d192ee17c503172e785fd1383a62f2feb20b (patch)
tree5afd3c7ec13fe80a6bc461bef30d0437c7c0fbf9 /docs
initial commit
we have a few basic data structures so far! (and a bunch of other non-code stuff like doxygen)
Diffstat (limited to 'docs')
-rw-r--r--docs/examples.md9
-rw-r--r--docs/index.md13
-rw-r--r--docs/read-service.example.c11
-rw-r--r--docs/sample.servicebin0 -> 259 bytes
-rw-r--r--docs/sample.service.responsebin0 -> 271 bytes
-rw-r--r--docs/write-service.example.c25
6 files changed, 58 insertions, 0 deletions
diff --git a/docs/examples.md b/docs/examples.md
new file mode 100644
index 0000000..b517053
--- /dev/null
+++ b/docs/examples.md
@@ -0,0 +1,9 @@
+\page examples Examples of usage
+
+All of these are subject to change, as the API isn't remotely stable yet.
+
+Example of constructing a service and writing it out:
+\include write-service.example.c
+
+Example of reading a service in and printing it for debugging:
+\include read-service.example.c
diff --git a/docs/index.md b/docs/index.md
new file mode 100644
index 0000000..cf8fe99
--- /dev/null
+++ b/docs/index.md
@@ -0,0 +1,13 @@
+\mainpage
+
+**libsparklepaw** is a C library implementing large parts of the
+[PawSD](https://pawpub.entities.org.uk/pawsd/) network protocol. It's intended
+to be used by other software to easily add support for PawSD, or as part of
+bigger PawSD software such as daemons or zone administration tools.
+
+See \ref examples.
+
+\warning This is still in development and therefore will have a very high
+bug-to-feature ratio! Don't use it for anything serious yet.
+
+\author [winter Sparkles](https://зима.net/)
diff --git a/docs/read-service.example.c b/docs/read-service.example.c
new file mode 100644
index 0000000..41062ca
--- /dev/null
+++ b/docs/read-service.example.c
@@ -0,0 +1,11 @@
+#include <libsparklepaw/service.h>
+#include <stdlib.h>
+
+void main() {
+ struct sprkl_service* service = malloc(sizeof(struct sprkl_service));
+
+ sprkl_service_read(service, stdin);
+ sprkl_service_printdebug(service, stderr);
+
+ sprkl_service_freeall(service);
+}
diff --git a/docs/sample.service b/docs/sample.service
new file mode 100644
index 0000000..7858cb1
--- /dev/null
+++ b/docs/sample.service
Binary files differ
diff --git a/docs/sample.service.response b/docs/sample.service.response
new file mode 100644
index 0000000..06370ae
--- /dev/null
+++ b/docs/sample.service.response
Binary files differ
diff --git a/docs/write-service.example.c b/docs/write-service.example.c
new file mode 100644
index 0000000..45283e1
--- /dev/null
+++ b/docs/write-service.example.c
@@ -0,0 +1,25 @@
+#include <libsparklepaw/service.h>
+
+void main() {
+ struct sprkl_tagval_pair pair = {
+ .tag = { .upper = 0xFFFFFFFFFFFFFFFF, .lower = 0 },
+ .valuesz = 8,
+ .value = "hello!!!"
+ };
+ struct sprkl_record record = {
+ .paircnt = 1,
+ .pairs = &pair
+ };
+ uint8_t signature[4] = { 0x12, 0x34, 0x56, 0x78 };
+ struct sprkl_service service = {
+ .sigsz = sizeof(signature),
+ .signature = signature,
+ .index = 0x6969,
+ .flags = 0,
+ .reccnt = 1,
+ .records = &record
+ };
+
+ int n = sprkl_service_write(&service, stdout);
+ fprintf(stderr, "\nWrote %d bytes\n", n);
+}