anchor.diff:  		_ ->
   			MatchHead#client{secret = String}
   	end,
  -	query_clients4(start, MatchHead1, Identifier);
  -query_clients3(start, MatchHead, Identifier, '_') ->
  -	query_clients4(start, MatchHead, Identifier).
  -%% @hidden
  -query_clients4(start, MatchHead, Identifier) ->
  -	MatchSpec = [{MatchHead, [], ['$_']}],
  +	query_clients4(start, MatchHead1, MatchConditions, Identifier);
  +query_clients3(start, MatchHead, MatchConditions, Identifier, '_') ->
  +	query_clients4(start, MatchHead, MatchConditions, Identifier).
  +%% @hidden
  +query_clients4(start, MatchHead, MatchConditions, Identifier) ->
  +	MatchSpec = [{MatchHead, MatchConditions, ['$_']}],
   	F = fun() ->
   			mnesia:select(client, MatchSpec, ?CHUNKSIZE, read)
   	end,
   	query_clients5(mnesia:ets(F), Identifier);
  -query_clients4(Cont, _MatchHead, Identifier) ->
  +query_clients4(Cont, _MatchHead, _MatchConditions, Identifier) ->
   	F = fun() ->
   			mnesia:select(Cont)
   	end,
  
positive.code: 		_ ->
  			MatchHead#client{port = String}
  	end,
  	query_clients2(start, MatchHead1, Identifier, Protocol, Secret);
  query_clients1(start, MatchHead, Identifier, '_', Protocol, Secret) ->
  	query_clients2(start, MatchHead, Identifier, Protocol, Secret).
  %% @hidden
  query_clients2(start, MatchHead, Identifier, {like, String}, Secret) ->
  	MatchHead1 = case lists:last(String) of
  		$% ->
  			Prefix = lists:droplast(String),
  
negative.code: 		_ ->
  			lists:prefix(String1, String2)
  	end.
  
  -spec match_prefix(String) -> Result
  	when
  		String :: string(),
  		Result ::{MatchAddress, MatchConditions},
  		MatchAddress :: tuple(),
  		MatchConditions :: [tuple()].
  %% @doc Construct match specification for IP address.
  %% @hidden
  match_prefix(String) ->
  	Ns = [list_to_integer(N) || N <- string:tokens(String, [$.])],
  	match_prefix1(lists:reverse(Ns)).
  %% @hidden
  match_prefix1([N | T]) when N >= 100 ->
  	match_prefix2(T, [N], []);
  match_prefix1([N | T]) when N >= 10 ->
  	match_prefix2(T, ['$1'], [{'or', {'==', '$1', N},
  			{'and', {'>=', '$1', N * 10}, {'<', '$1', (N + 1) * 10}}}]);
  match_prefix1([N | T]) ->
  	match_prefix2(T, ['$1'], [{'or', {'==', '$1', N},
  			{'and', {'>=', '$1', N * 10}, {'<', '$1', (N + 1) * 10}},
  			{'and', {'>=', '$1', N * 100}, {'<', '$1', (N + 1) * 100}}}]).
  %% @hidden
  match_prefix2(T, Head, Conditions) ->
  	Head1 = lists:reverse(T) ++ Head,
  	Head2 = Head1 ++ lists:duplicate(4 - length(Head1), '_'),
  	{list_to_tuple(Head2), Conditions}.
  
  