anchor.diff:              end;
           E -> E
       end;
  -parse(<<?CONNACK:4, 0:4>>, <<0:7, SP:1, ReturnCode:8/big>>) ->
  +variable(<<?CONNACK:4, 0:4>>, <<0:7, SP:1, ReturnCode:8/big>>) ->
       #mqtt_connack{session_present=SP, return_code=ReturnCode};
  -parse(<<?PINGREQ:4, 0:4>>, <<>>) ->
  +variable(<<?PINGREQ:4, 0:4>>, <<>>) ->
       #mqtt_pingreq{};
  -parse(<<?PINGRESP:4, 0:4>>, <<>>) ->
  +variable(<<?PINGRESP:4, 0:4>>, <<>>) ->
       #mqtt_pingresp{};
  -parse(<<?DISCONNECT:4, 0:4>>, <<>>) ->
  +variable(<<?DISCONNECT:4, 0:4>>, <<>>) ->
       #mqtt_disconnect{};
  -parse(_, _) -> {error, cant_parse_variable_header}.
  +variable(_, _) -> {error, cant_parse_variable_header}.
   
   parse_last_will_topic(Rest, 0, 0, 0, Conn) -> {ok, Rest, Conn};
   parse_last_will_topic(<<WillTopicLen:16/big, WillTopic:WillTopicLen/binary,
  
positive.code:         E ->
              E
      end;
  parse(<<?SUBACK:4, 0:4>>, <<MessageId:16/big, Acks/binary>>) ->
      #mqtt_suback{qos_table=parse_acks(Acks, []),
                   message_id=MessageId};
  parse(<<?UNSUBACK:4, 0:4>>, <<MessageId:16/big>>) ->
      #mqtt_unsuback{message_id=MessageId};
  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,
  
negative.code: 
      compare_frame("pingreq", gen_pingreq()),
      compare_frame("pingresp", gen_pingresp()),
      compare_frame("disconnect", gen_disconnect()),
  
  
      P = gen_publish("test-topic", 2, crypto:rand_bytes(100), []),
      {error, packet_exceeds_max_size} = parse(P, byte_size(P) - 3),
  
      <<Part:128, _/binary>> = P,
      more = parse(Part).
  
  compare_frame(Test, Frame) ->
      io:format(user, "---- compare test: ~p~n", [Test]),
  