gnunet-developers
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Let BIO also handle already allocated buffers


From: Alessio Vanni
Subject: Let BIO also handle already allocated buffers
Date: Sat, 18 Apr 2020 16:34:38 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/26.3 (gnu/linux)

Hello,

aside from working on files by buffering I/O, the BIO library also does
*formatted* I/O, like serializing strings or integers.

I found myself in a situation where my client and my service are
communicating using variable-length messages (containing a sequence of
variable-length strings, mostly), so I'd have to parse the messages "by
hand" using some kind of serialization.  Since BIO has this formatted
I/O, I thought I could "offload" this de/serialization to the library,
but it works only on files and writing the message to a file and reading
it back again is suboptimal.

As such, I hacked together a set of functions in BIO to work with
already allocated buffers, such as when dealing with messages received
from a message queue.  The patch is attached with this mail.  Right now
the API is written to cover my needs, so it might be lacking in some
parts.

Thanks,
A.V.

Attachment: 0001-Add-formatted-I-O-to-buffers-allocated-in-memory.patch
Description: Patch for BIO


reply via email to

[Prev in Thread] Current Thread [Next in Thread]