anchor.diff:          _ -> more
       end;
   parse(Data) when byte_size(Data) =< 8 -> more;
  -parse(_) -> {error, <<>>}.
  +parse(_) -> {error, cant_parse_fixed_header}.
   
   parse(<<?PUBLISH:4, Dup:1, 0:2, Retain:1>>, <<TopicLen:16/big, Topic:TopicLen/binary, Payload/binary>>) ->
       LTopic = binary_to_list(Topic),
  
positive.code:     #mqtt_pingresp{};
  parse(<<?DISCONNECT:4, 0:4>>, <<>>) ->
      #mqtt_disconnect{};
  parse(_, _) -> error.
  
  parse_topics(_, <<>>, []) -> error;
  parse_topics(_, <<>>, Topics) -> Topics;
  
negative.code: parse(<<?CONNECT:4, 0:4>>, <<L:16/big, PMagic:L/binary, _/binary>>)
    when not ((PMagic == ?PROTOCOL_MAGIC_311) or
               (PMagic == ?PROTOCOL_MAGIC_31)) ->
      {error, unknown_protocol_magic};
  
  parse(<<?CONNECT:4, 0:4>>,
      <<L:16/big, _:L/binary, ProtoVersion:8,
        UserNameFlag:1, PasswordFlag:1, WillRetain:1, WillQos:2, WillFlag:1,
        CleanSession:1,
        0:1,  % reserved
        KeepAlive: 16/big,
        ClientIdLen:16/big, ClientId:ClientIdLen/binary, Rest0/binary>>) ->
  
      Conn0 = #mqtt_connect{proto_ver=ProtoVersion,
                            username = "",
                            password = "",
                            clean_session=CleanSession,
                            keep_alive=KeepAlive,
                            client_id=list(ClientId)},
  
      case parse_last_will_topic(WillFlag, WillRetain, WillQos, Rest0, Conn0) of
          {ok, Rest1, Conn1} ->
              case parse_username(UserNameFlag, Rest1, Conn1) of
                  {ok, Rest2, Conn2} ->
                      case parse_password(PasswordFlag, Rest2, Conn2) of
                          {ok, _, Conn3} ->
                              Conn3;
                          E -> E
                      end;
                  E -> E
              end;
          E -> E
      end;
  parse(<<?CONNACK:4, 0:4>>, <<0:8, ReturnCode:8/big>>) ->
      #mqtt_connack{return_code=ReturnCode};
  