Protocol Buffers » History » Version 1
Version 1/4
-
Next » -
Current version
Nevcairiel, 05/06/2010 02:54 PM
Protocol Buffers¶
Google Protocol Buffers is an open binary serialization format created by Google.
This page describes an attempt to create an alternate language and platform neutral protocol for Quassel using the Protocol Buffers format.
Why Protocol Buffers?¶
Protocol buffers are Google's language-neutral, platform-neutral, extensible mechanism for serializing structured data – think XML, but smaller, faster, and simpler
Protocol buffers are not just a format definition, but also include code generation for many different languages.
This offers several advantages, one being a absolutely clear defined, self-describing protocol, instead of protocol based on conventions and possibly outdated documentation.
Additionally, protocol buffers are a binary protocol, with highly optimized implementations in several languages. Official support by Google for C++, Java and Python, as well as third party extension for many other popular languages, including PHP, Obj-C, Perl, JS, and many more.
Protocol definition¶
Note: The protocol is still being actively worked on.
The outlined protocol definitions are not final, and just listed here for documentation.
Message Container¶
Every Message has to be wrapped in a container, since we otherwise can't determine the message type. This is done by the "QuasselServerMessage" and "QuasselClientMessage" message types. This design is modeled around the Protocol Buffers Union Types example.
QuasselServerMessage are messages the server sends, while QuasselClientMessage are messages the client sends.
message QuasselServerMessage { enum MessageType { ERROR = 0, // Generic message for errors SUCCESS = 1, // Generic message for success SESSION_STATE = 2, // State of current session, sent after init ... } required MessageType type = 1; optional ErrorMessage errorMessage = 100; optional SuccessMessage successMessage = 101; optional SessionState sessionState = 102; ... }
message QuasselClientMessage { enum MessageType { REQUEST = 0, // Generic Request message (request init, request login, request backlog, etc..) ... } required MessageType type = 1; optional RequestMessage request = 2; ... }
Once the protocol is better defined, the full protocol files will be available here.