Initial CAPS IPC structural encoding and decoding support. Note that the
authorMatthew Dillon <dillon@dragonflybsd.org>
Sun, 7 Mar 2004 23:36:45 +0000 (23:36 +0000)
committerMatthew Dillon <dillon@dragonflybsd.org>
Sun, 7 Mar 2004 23:36:45 +0000 (23:36 +0000)
commit9d519c94604aa52f9a530198868f4dba2bcc9dbe
tree4bdbe0355ef0fbc7f2175178d431ee9b7dde5d9e
parent2ba09803fd1e1a68a7db784fc487aae8c7e627e1
Initial CAPS IPC structural encoding and decoding support.  Note that the
kernel is uninvolved (other then in supplying the IPC mechanism).  After
careful consideration I decided that XML was just too much overkill but that
a human-readable format is still desireable.  The encoding format supports
integers, strings, opaque data, arrays, and is extensible and structural.

An example encoding of the struct passwd record for user 'nobody':

    Spasswd{F1D"nobody",F2D"%2a",F3Dfffe,F4Dfffe,F5D0,F6D"",F7D"Unprivileged%20user",F8D"/nonexistent",F9D"/sbin/nologin",FaD0}

Class elements include (S)tructure, (F)ield, (D)ata, (A)rray.  Data types are
free-form numeric (stored as hex), with the source responsible for encoding
negative numbers with a '-', and quoted opaque data (e.g. strings).  Any
class element may recurse using {}.  Structures and Arrays always recurse.
Unknown recursions are ignored by the decoder (for future backwards
compatibility).  Whitespace is allowed but most non-alpha-numeric characters
must be %-hex-escaped.

The decoder understands simple integer types, arrays, buffers, embedded
sub-structures, and string pointer structural elements.  It does not (yet)
understand multi-dimensional arrays, sparse element notation, or ** pointers.

This is a nice, compact encoding format that can be used for both packetized
messages and persistently-connected streams.  The initial commit only supports
full-messages, however.
14 files changed:
lib/libcaps/Makefile
lib/libcaps/caps_client.c [deleted file]
lib/libcaps/caps_misc.c [deleted file]
lib/libcaps/caps_msgbuf.c [new file with mode: 0644]
lib/libcaps/caps_pwent.c [copied from lib/libcaps/defs.h with 51% similarity]
lib/libcaps/caps_service.c [deleted file]
lib/libcaps/caps_struct.c [new file with mode: 0644]
lib/libcaps/caps_struct.h [new file with mode: 0644]
lib/libcaps/defs.h
lib/libcaps/globaldata.c
lib/libcaps/globaldata.h
test/caps/Makefile
test/caps/decoder.c [new file with mode: 0644]
test/caps/encoder.c [new file with mode: 0644]