libsood

Zig library for Roon Core discovery message, with C-compatible API and WebAssembly.

Commits at 2d44191302558a61b7a978ec30764098003d3d99

  1. 2d441913 Fix example-c using incorrect UDP dest address I don't know what happened, but when I tested this time, it uses host byte order. Shota FUJI authored at Shota FUJI comitted at
  2. 8080245c Remove copyright text from Zero-Clause BSD license text It's not mandatory. Presense of the copyright text brings nothing but trouble. This also make copying single file easier, because the header has a link to license text. I modified every file's header text with the following script, using Bun: --- import * as path from "node:path" import { opendir } from "node:fs/promises" async function list(p) { const dir = await opendir(p) const files = [] for await (const entry of dir) { let ignore = false; switch (entry.name) { case ".git": case ".jj": case ".zig-cache": case "LICENSES": ignore = true; } if (ignore) { continue; } if (entry.isFile()) { files.push(path.join(entry.parentPath, entry.name)) continue; } files.push(...(await list(path.join(entry.parentPath, entry.name)))) } return files } const files = await list(new URL("./libsood", import.meta.url)) const pattern = /^(([\S]+)\s+)?Version 2.0 at LICENSES\/Apache-2.0/ for (const file of files) { const text = await Bun.file(file).text() const lines = text.split("\n") for (let i = 0, l = Math.min(lines.length, 15); i < l; i++) { const match = lines[i].match(pattern) if (match) { const prefix = match[1] || "" const updated = [ ...lines.slice(0, i), `${prefix}Version 2.0 at LICENSES/Apache-2.0.txt. You may also obtain a copy of the Zero-Clause BSD License`, `${prefix}at <https://opensource.org/license/0bsd> and a copy of the Apache License, Version 2.0 at`, `${prefix}<https://www.apache.org/licenses/LICENSE-2.0>`, ...lines.slice(i + 2), ] await Bun.write(file, updated.join("\n")) break; } } } Shota FUJI authored at Shota FUJI comitted at
  3. 27c5ca96 Fix importing of this library crashes zig build `build.zig` reads contents of `man/` but that directory is missing from the `paths`, which results in NOENT error. Shota FUJI authored at Shota FUJI comitted at
  4. fe94ee3d Add README.md to Zig distribution I have no idea how it's useful, though. Shota FUJI authored at Shota FUJI comitted at
  5. c41485ec Create README.md It's ready. Shota FUJI authored at Shota FUJI comitted at
  6. f9fac3cf Make a module installable Shota FUJI authored at Shota FUJI comitted at
  7. ad054a51 Man pages for C API and overview Shota FUJI authored at Shota FUJI comitted at
  8. 4819312d Single enum for C API result code There were many duplicates and it was difficult to review. Shota FUJI authored at Shota FUJI comitted at
  9. 70e48bbd WebAssembly API Shota FUJI authored at Shota FUJI comitted at
  10. 6bbc2d16 Make C API constants UPPER_SNAKE_CASE Why did I make them lower_snake_case? Probably failed to perform context switch in my brain. Zig uses lower_snake_case. Shota FUJI authored at Shota FUJI comitted at
  11. 3a5fbaab Delete ipv4_subnet module This is not this library's responsibility. OSes and/or language library (std or network one) should provide this. Shota FUJI authored at Shota FUJI comitted at
  12. 3f331393 Simplify Message module Both for efficienty and for simplicity. Message struct is less bloated now. Shota FUJI authored at Shota FUJI comitted at
  13. 0dfcedf8 Simpler to use API for Zig and C `parse` and property iterator is simple, but it's error-prone in the case user is processing illegal message that has invalid payload at tail. Most of the time this library is used, payload is SOOD response message sent by Roon server, with fixed set of properties. Validating it and returning typed-struct is secure and easy to use. Shota FUJI authored at Shota FUJI comitted at
  14. b2a4e65e C API for discovery I'm not including ipv4_subnet because IPv4 address handling differs between OSes (I found out during writing examples/basic.c) and I have no idea how I design the API. Zig's std uses `[4]u8` across platforms. Perhaps it's better to remove the module entirely? This library offloads transport things to users so this "get broadcast address for the interface" does not fit here, maybe. Shota FUJI authored at Shota FUJI comitted at
  15. 7cbca911 Simplify build file Shota FUJI authored at Shota FUJI comitted at
  16. ea2be90d Zig API for discovery and IPv4 helpers Shota FUJI authored at Shota FUJI comitted at
  17. 664805ab Message parser/serializer Shota FUJI authored at Shota FUJI comitted at
  18. 049ec8e5 WebAssembly build setup As a more secure and portable way. Shota FUJI authored at Shota FUJI comitted at
  19. cbcb4aad Foundation for Zig project with C library generation Shota FUJI authored at Shota FUJI comitted at
  20. 84eec46f Base style for text files Shota FUJI authored at Shota FUJI comitted at
  21. cbc149a3 Create license files New files to be added require license text. By creating license files beforehand, later commits will be more concise by having only files relavant to the change. Shota FUJI authored at Shota FUJI comitted at