The Etch binary protocol is illustrated using the following example NSDL:
Etch uses hashed values to identify names (such as names of parameters or functions). The values are computed by hashing the full qualified names of the elements. As an example, the computed hash values for the example above are:
Consider the following Java program for the NSDL Idl:
The request message for the call server.f(as) in the program above will be:
Lets explain this in detail:
The return message will be serialized just like that, but additionally contains a "_inReplyTo" ID. This ID is the _messageID value of the request message. This enables Etch to find the right caller for this response. Of course the message is much simpler, since it only contains a single integer return value, _inReplyTo and _messageID
The BinaryTaggedDataOutput class implements the serialization in Etch. It's code is pretty good to understand and is - at the moment - the availble specification for the whole protocol. Start with the writeMessage function.
Here are all current type codes, which Etch uses:
will be serialized directly without specifying an own type flag. Bigger or smaller Integer Values will have their own type flag before the value.