diff --git a/src/lib.rs b/src/lib.rs index 9829951..9382596 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -1 +1,27 @@ +//! The Home Assistant protocol is structured as a simple +//! TCP socket with short binary messages encoded in the protocol buffers format. +//! First, a message in this protocol has a specific format: +//! +//! * A zero byte. +//! * VarInt denoting the size of the message object. (type is not part of this) +//! * VarInt denoting the type of message. +//! * The message object encoded as a ProtoBuf message +//! +//! The connection is established in 4 steps: +//! +//! * First, the client connects to the server and sends a [Hello Request](api::HelloRequest) +//! identifying itself +//! * The server responds with a [Hello Response](api::HelloResponse) and selects the +//! protocol version +//! * After receiving this message, the client attempts to authenticate itself using +//! the password and a [Connect Request](api::ConnectRequest) +//! * The server responds with a [Connect Response](api::ConnectResponse) and notifies +//! of invalid password if necessary. +//! +//! If anything in this initial process fails, the connection must immediately closed +//! by both sides and _no_ disconnection message is to be sent. + mod generated; + +pub use generated::api; +pub use generated::api_options;