anchor.diff:  	 handle_cast/2,
   	 handle_info/2,
   	 terminate/2]).
  +
  +-export([env_to_bus_id/0,
  +	 str_to_bus_id/1,
  +	 parse_params/1,
  +	 parse_param/1]).
   
   -record(state, {
   	  conn,
  
positive.code: 	  services=[],
  	  signal_handlers=[]
  	 }).
  
  connect(BusId) when is_record(BusId, bus_id) ->
      gen_server:start_link(?MODULE, [BusId, self()], []).
  
negative.code: %% 	false ->
  %% 	    {error, not_registered, State}
  %%     end.
  
  
  env_to_bus_id() ->
      str_to_bus_id(os:getenv(?SESSION_ENV)).
  
  str_to_bus_id(Addr) when is_list(Addr) ->
      list_to_bus_id(string:tokens(Addr, [?SERVER_DELIM]), []).
  
  list_to_bus_id([], Acc) ->
      lists:reverse(Acc);
  list_to_bus_id([L|Rest], Acc) ->
      list_to_bus_id(Rest, [to_bus_id(L) | Acc]).
  
  to_bus_id(Server) when is_list(Server) ->
      {Transport, [?TRANSPORT_DELIM | Params]} =
  	lists:splitwith(fun(A) -> A =/= ?TRANSPORT_DELIM end, Server),
      #bus_id{scheme=list_to_atom(Transport),
  	    options=parse_params(Params)}.
  
  parse_params(Params) when is_list(Params) ->
      parse_params(string:tokens(Params, [?PARAM_DELIM]), []).
  
  parse_params([], Acc) ->
      Acc;
  parse_params([Param|Rest], Acc) ->
      parse_params(Rest, [parse_param(Param) | Acc]).
  
  parse_param(Param) when is_list(Param) ->
      {Key, [?KEY_DELIM | Value]} =
  	lists:splitwith(fun(A) -> A =/= ?KEY_DELIM end, Param),
      {list_to_atom(Key), Value}.
  