root / trunk / standards / protocol-details.txt

Revision 19, 3.6 kB (checked in by ocmathew, 4 years ago)

Add protocol-details.txt, giving definations of primitives, functions, and containers allowing a human-readable format which can be encoded and giving single-line functions.
Update protocol.txt and protocol-containers.txt to use the new functions and formats
Update protocol-containers.txt to allow RepeatableExtraNames?
Fix spelling mistakes and extra accidental characters from messages/

Line 
1"#string(blah)"
2blank
3"Reason"
4#key_id(blind_blah)
5#key_identifier_blah
6#key_id_of_DSDB
7#encrypted_serialBLAH
8ISCertificate
9DSDBCertificate
10MINT_CERTIFICATE
11Blind
12ObfuscatedBlind
13Coin
14
15
16Details of the protocol implementation (including messages and containers)
17
18---------------------------------------------------
19
20The following primitives are used to encode all appropriate details.
21
22#hex_string(foo) encodes the natural integer value of foo as a string.
23The integer value of foo is changed to a base-16 0-9a-f representation in lowercase.
24The value is encoded without leading zeros.
25
26#base64(foo) encodes the natural integer value of foo as a string.
27The integer value of foo is changed to a base-64 representation.
28The actual implementation of this may change, but for now I'm working with the following
29scheme:
30ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789!- for the encoding
31and = for padding
32
33#string(foo) places restrictions on the string. The string cannot contain any
34unprintable characters, any control character, or the " character.
35The string cannot begin with a space character
36The string must be ASCII. The string, when encoded, will be placed in a set of ""'s
37e.g. #string(foo) is encoded as "foo"
38
39TIME(foo) encodes a literal time in a strict ISO8601 encoding. The encoding is:
40YYYYMMDDThhmmssZ.
41The character 'T' seperates the two fields between the date and the time.
42The character 'Z' encodes the time zone for the time (which must always be UTC)
43The date is encoded in YYYYMMDD where YYYY is the year, MM is the decimal month (01-12)
44and DD is the day (01-31)
45The time is encoded in hhmmss where hh is the hour (00-23), mm is the minutes (00-59)
46and ss is the seconds (00-60) (60 is only permissiable for leap seconds)
47
48---------------------------------------------------
49
50The following complex types are built using primitives.
51
52(foo, bar, baz) is a tuple containing foo, bar, and baz. The tuple can be of any length,
53but each message defines the tuple length it is looking for.
54The tuple is encoded as [foo] [bar] [baz]. That is, the value of foo, a single space,
55the value of bar, a single space, and the value of baz. No following spaces are required.
56This primitive is used to allow a concise list defination (see below)
57
58list(foo, bar) is a length-deliminated list. It can be of any length.
59The list is encoded as #hex_string(list_length) [foo] [bar]. That is, the length of the list
60encoded as a hex string and then the elements of the string are given seperated by spaces.
61All types have a length of one, including tuples.
62
63emptylist is a placeholder for a list when no list actually appears. This is only used to give
64a single reason for an action rather than for each element in a list.
65
66strlist(foo, bar, baz) is a list of strings. The strings in the list must follow the same
67restrictions as #string, and have no space characters. The list is encoded as
68#hex_string(list_length) [foo], [bar], [baz]
69
70---------------------------------------------------
71
72The following containers are built using primitives and additional encoding.
73
74Certificates, blanks, obfuscated blanks, coins are all made up of key=value pairs.
75Some keys are optional and some can be repeated. The exact semantics of which are
76described in protocol-containers.txt.
77
78When the container is encoded, it is encoded with the values in the exact order given
79from protocol-containers.txt.
80
81The encoding is as follows:
82{name=value;name=value;name=value....;name=value}
83
84The encoding of the ContentPart of the container is as follows:
85{name=value;name=value;name=value....;name=value} of only the ContentNames.
86
87[Note: this gives a human readable format while forcing all messages to be on
88 a single line]
89 
Note: See TracBrowser for help on using the browser.