From 6eea614d6c9383338e02c6d980d8593ff8a901cb Mon Sep 17 00:00:00 2001 From: Alexander Vdolainen Date: Thu, 9 Oct 2025 23:23:03 +0300 Subject: [PATCH] README refined --- README | 46 ++++++++++++++++++++++------------------------ 1 file changed, 22 insertions(+), 24 deletions(-) diff --git a/README b/README index 66e9e89..33d3199 100644 --- a/README +++ b/README @@ -1,30 +1,28 @@ -libndbuf: Network designed buffer ops library ----------------------------------------------- +libndbuf: Network-oriented buffer operations library +---------------------------------------------------- -1. What the shit is that ? -This is a quite small library to manipulate with binary packed buffers -in a normal network manner (i.e. bigendian). It might be useful to -apply for network packet creating/parsing. -Anyway, originally this code was resided in my different other *small* -projects - and i hate copy-paste -- well, that's why it gone to -this quite small library. +1. What is it? +A small C library providing a simple API to read and write typed values +to/from buffers with correct endianness handling. -2. API -Check out include directory... -btw, might be later i will write manpages, but for now didn't see any -sense for those effort. -Generally speaking - all is quite simple - create ndbuf_t structure fill -it in printf() style, read with sscanf() style, take raw data pointer and ... -send it somewhere whatever bla bla - you get a point. +2. Purpose +Make parsing and building network packets easy and concise. The API is +intended to act like a binary printf/scanf for packet fields. + +Example: + +Packet layout: +<16-bit><8-bit><32-bit> + +Reading with a single call: +ndbuf_escan(buf, "wbdR", &a16, &a8, &a32, &data_ptr) + +The same style is used to build packets. 3. Future plans -Fix bugs (but ... there are no bugs found, since this code was heavly used -already, but ... report me if found). -Write manpages (in my few projects those API is like a part of POSIX - -still cannot remember all). -Maybe will add a new functions (useful ones). + * Improve the API ergonomics (better support for preallocated buffers). + * Add convenience helpers and safer bounds checks. + * Possibly extend format specifiers and documentation. 4. Contact -That's simple - -Email/XMPP: alex@vapaa.xyz - +Email: alex@vapaa.xyz