test rules
This commit is contained in:
parent
9351cabdee
commit
b009a324bd
@ -26,6 +26,7 @@
|
||||
%% API
|
||||
-export([start_link/2]).
|
||||
-export([send_event/3, stop/2]).
|
||||
-export([test_rules/2]).
|
||||
|
||||
%% gen_statem callbacks
|
||||
-export([init/1, handle_event/4, terminate/3, code_change/4, callback_mode/0]).
|
||||
@ -59,6 +60,12 @@
|
||||
%%% API
|
||||
%%%===================================================================
|
||||
|
||||
%% 测试规则函数
|
||||
test_rules(SrcIdentityId, DstIdentityId) when is_integer(SrcIdentityId), is_integer(DstIdentityId) ->
|
||||
{ok, Rules} = get_rules(SrcIdentityId, DstIdentityId),
|
||||
logger:debug("[sdlan_channel] policy_request src_identity_id: ~p, dst_identity_id: ~p, rules: ~p", [SrcIdentityId, DstIdentityId, Rules]),
|
||||
iolist_to_binary(lists:map(fun({Proto, Port}) -> <<Proto:8, Port:16>> end, Rules)).
|
||||
|
||||
-spec send_event(Pid :: pid(), EventType :: integer(), Event :: binary()) -> no_return().
|
||||
send_event(Pid, EventType, Event) when is_pid(Pid), is_integer(EventType), is_binary(Event) ->
|
||||
gen_statem:cast(Pid, {send_event, EventType, Event}).
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user