anchor.diff:  
   %%-----------------------------------------------------------------------------
   
  +next_xid(#?STATE{xid = XID} = State) ->
  +    {XID, State#?STATE{xid = XID + 1}}.
  +
  +maybe_ping(#?STATE{
  +                connection_init = true,
  +                ping_idle = PingIdle,
  +                last_receive = LastReceive,
  +                ping_xid = undefined} = State) ->
  +    case timer:now_diff(now(), LastReceive) > 1000 * PingIdle of
  +        false ->
  +            State;
  +        _ ->
  +            send_ping(State)
  +    end;
  +maybe_ping(State) ->
  +    % don't send until conneciton is initialized or when
  +    % another ping while one is outstanding.
  +    State.
  +
  +send_ping(#?STATE{version = Version, ping_timeout = PingTimeout} = State) ->
  +    {Xid, NewState} = next_xid(State),
  +    Echo = of_driver:set_xid(of_msg_lib:echo_request(Version, <<>>), Xid),
  +    do_send(Echo, State),
  +    {ok, TRef} = timer:apply_after(PingTimeout, ?MODULE, ping_timeout, [self()]),
  +    NewState#?STATE{ping_xid = Xid, ping_timeout_timer = TRef}.
  +
  +receive_ping(#?STATE{ping_timeout_timer = TRef} = State) ->
  +    {ok, cancel} = timer:cancel(TRef),
  +    State#?STATE{ping_timeout_timer = undefined, ping_xid = undefined}.
  +
   do_send(Msg, #?STATE{protocol = Protocol,
                        socket   = Socket} = _State) ->
       case of_protocol:encode(Msg) of
           {ok, EncodedMessage} ->
  +            ?DEBUG("Send: ~p~n", [Msg]),
               of_driver_utils:send(Protocol, Socket, EncodedMessage);
           {error, Error} ->
               {error, Error}
  
positive.code:     Protocol = tcp,
      of_driver_utils:setopts(Protocol, Socket, [{active, once}]),
      {ok, {Address, Port}} = inet:peername(Socket),
      SwitchHandler = of_driver_utils:conf_default(callback_module, of_driver_default_handler),
      Opts          = of_driver_utils:conf_default(init_opt,[ {enable_ping,false},
                                                              {ping_timeout,1000},
                                                              {ping_idle,5000},
                                                              {multipart_timeout,30000},
                                                              {callback_mod,echo_logic}
                                                            ]),
      ?INFO("Connected to Switch on ~s:~p. Connection : ~p \n",[inet_parse:ntoa(Address), Port, self()]),
      Versions = of_driver_utils:conf_default(of_compatible_versions, fun erlang:is_list/1, [3, 4]),
      ok = gen_server:cast(self(),{send,hello}),
      {ok, #?STATE{ switch_handler      = SwitchHandler,
                    switch_handler_opts = Opts,
                    socket              = Socket,
                    ctrl_versions       = Versions,
                    protocol            = Protocol,
                    address             = Address,
                    port                = Port,
                    pending_msgs        = gb_trees:empty()
                  }}.
  
  %%------------------------------------------------------------------
  
negative.code:     case ofp_parser:parse(Parser, Data) of
          {ok, NewParser, Messages} ->
              case handle_messages(Messages, State) of
                  {ok, NewState} ->
                      {noreply, NewState#?STATE{
                                          parser = NewParser,
                                          last_receive = now()}};
                  {stop, Reason, NewState} ->
                      {stop, Reason, NewState}
              end;
  