anchor.diff:  					false
   			end
   	end,
  -	{Cont, lists:filter(F, Clients)};
  -query_clients5('$end_of_table', _Identifier) ->
  +	query_clients4({lists:filter(F, Clients), Cont}, Port, Secret);
  +query_clients3('$end_of_table', _Identifier, _Port, _Secret) ->
         {eof, []}.
  +%% @hidden
  +query_clients4({Clients, Cont}, '_', Secret) ->
  +	query_clients5({Cont, Clients}, Secret);
  +query_clients4({Clients, Cont}, {like, String}, Secret) ->
  +	F = case lists:last(String) of
  +		$% ->
  +			Prefix = lists:droplast(String),
  +			fun(#client{port = Port}) ->
  +					lists:prefix(Prefix, integer_to_list(Port))
  +			end;
  +		_ ->
  +			fun(#client{port = Port}) ->
  +					String == integer_to_list(Port)
  +			end
  +	end,
  +	query_clients5({lists:filter(F, Clients), Cont}, Secret).
  +%% @hidden
  +query_clients5({Clients, Cont}, '_') ->
  +	{Cont, Clients};
  +query_clients5({Clients, Cont}, {like, String}) ->
  +	F = case lists:last(String) of
  +		$% ->
  +			Prefix = list_to_binary(lists:droplast(String)),
  +			Size = size(Prefix),
  +			fun(#client{secret = Secret}) ->
  +				case binary:part(Secret, 0, Size) of
  +					Prefix ->
  +						true;
  +					_ ->
  +						false
  +				end
  +			end;
  +		_ ->
  +			ExactMatch = list_to_binary(String),
  +			fun(#client{secret = Secret}) when Secret == ExactMatch ->
  +					true;
  +				(_) ->
  +					false
  +			end
  +	end,
  +	{Cont, lists:filter(F, Clients)}.
   
   get_products()->
   	MatchSpec = [{'_', [], ['$_']}],
  
positive.code: 			lists:prefix(String1, String2)
  	end.
  
  -spec match_prefix(String) -> Result
  	when
  		String :: string(),
  		Result ::{MatchAddress, MatchConditions},
  
negative.code: 		MatchConditions :: [tuple()].
  %% @doc Construct match specification for IP address.
  %% @hidden
  match_address(String) ->
  	Ns = [list_to_integer(N) || N <- string:tokens(String, [$.])],
  	match_address1(lists:reverse(Ns)).
  %% @hidden
  match_address1([N | T]) when N >= 100 ->
  	match_address2(T, [N], []);
  match_address1([N | T]) when N >= 10 ->
  	match_address2(T, ['$1'], [{'or', {'==', '$1', N},
  			{'and', {'>=', '$1', N * 10}, {'<', '$1', (N + 1) * 10}}}]);
  match_address1([N | T]) ->
  	match_address2(T, ['$1'], [{'or', {'==', '$1', N},
  			{'and', {'>=', '$1', N * 10}, {'<', '$1', (N + 1) * 10}},
  			{'and', {'>=', '$1', N * 100}, {'<', '$1', (N + 1) * 100}}}]).
  %% @hidden
  match_address2(T, Head, Conditions) ->
  	Head1 = lists:reverse(T) ++ Head,
  	Head2 = Head1 ++ lists:duplicate(4 - length(Head1), '_'),
  	{list_to_tuple(Head2), Conditions}.
  
  %% @hidden
  match_protocol(Prefix) ->
  	case lists:prefix(Prefix, "diameter") of
  		true ->
  			diameter;
  		false ->
  			match_protocol1(Prefix)
  	end.
  %% @hidden
  match_protocol1(Prefix) ->
  	case lists:prefix(Prefix, "DIAMETER") of
  		true ->
  			diameter;
  		false ->
  			match_protocol2(Prefix)
  	end.
  %% @hidden
  match_protocol2(Prefix) ->
  	case lists:prefix(Prefix, "radius") of
  		true ->
  			radius;
  		false ->
  			match_protocol3(Prefix)
  	end.
  %% @hidden
  match_protocol3(Prefix) ->
  	case lists:prefix(Prefix, "RADIUS") of
  		true ->
  			radius;
  		false ->
  			throw(badmatch)
  	end.
  
  