Page: [root]/code/transfer | src | log | faq | css

"Transfer" data transfer protocol

This protocol can be used to transfer associative arrays with bytestrings over any byte transferring connection.

Text mode commands

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

MOD module_name

modCommand = "MOD" space *non-lf

Means start of data structure named 'module_name'. If another module have already been started, throw error.

FLD name data

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.

DAT name size

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.

END

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]


Last edited: Voker57 on 2010-06-15 12:16:52 +0000