This protocol can be used to transfer associative arrays with bytestrings over any byte transferring connection.
All fields are separated with single space, 'data' in FLD may contain spaces though.
I will use pseudo-abnf here, because plain abnf sucks. (something) in parentheses denotes "something" field, $something later refers to its value
Definitions:
space = ASCII 32
lf = ASCII 10
non-lf = anything but lf
non-space = anything but space
modCommand = "MOD" space *non-lf
Means start of data structure named 'module_name'. If another module have already been started, throw error.
fldCommand = "FLD" space *non-space space *non-lf
Textual field 'name' with 'data' as content. 'data' may contain any character except of \n. Used for transferring small amount of data without linebreaks.
datCommand = "DAT" space *non-space(name) space *digit(size) lf *<$size>any-byte(data)
Initiates data mode for field 'name'. Right after delimiting \n recipient should start reading data and switch back to lines mode after exactly 'size' bytes of data.
Ends a module
Example of correct structure transfer:
MOD query
FLD hops 1
FLD query hash
DAT args 64
�d��W��uu&f(�69��須��?K4{u��@�����Ӌ*�yT��O;��|ÑZT}����Kn��
END
Example of protocol implementation in Haskell can be seen here: [http://git.bitcheese.net/?a=summary&p=transfer]