./ct_report/coverage/mongoose_s2s_backend.COVER.html

1 -module(mongoose_s2s_backend).
2
3 -callback init(map()) -> ok.
4 -callback get_s2s_out_pids(ejabberd_s2s:fromto()) -> ejabberd_s2s:s2s_pids().
5 -callback try_register(Pid :: pid(),
6 FromTo :: ejabberd_s2s:fromto()) -> boolean().
7 -callback remove_connection(FromTo :: ejabberd_s2s:fromto(), Pid :: pid()) -> ok.
8 -callback node_cleanup(Node :: node()) -> term().
9 -callback register_secret(HostType :: mongooseim:host_type(),
10 Secret :: ejabberd_s2s:base16_secret()) -> ok.
11 -callback get_shared_secret(mongooseim:host_type()) ->
12 {ok, ejabberd_s2s:base16_secret()} | {error, not_found}.
13
14 -export([init/1,
15 get_s2s_out_pids/1,
16 try_register/2,
17 remove_connection/2,
18 node_cleanup/1]).
19
20 -export([register_secret/2,
21 get_shared_secret/1]).
22
23 -ignore_xref([behaviour_info/1]).
24
25 -define(MAIN_MODULE, mongoose_s2s).
26
27 -spec init(map()) -> ok.
28 init(Opts) ->
29 106 Args = [Opts],
30 106 mongoose_backend:init(global, ?MAIN_MODULE, [], Opts),
31 106 mongoose_backend:call(global, ?MAIN_MODULE, ?FUNCTION_NAME, Args).
32
33 -spec get_s2s_out_pids(ejabberd_s2s:fromto()) -> ejabberd_s2s:s2s_pids().
34 get_s2s_out_pids(FromTo) ->
35 183 mongoose_backend:call(global, ?MAIN_MODULE, ?FUNCTION_NAME, [FromTo]).
36
37 %% Register ejabberd_s2s_out connection
38 -spec try_register(Pid :: pid(),
39 FromTo :: ejabberd_s2s:fromto()) -> boolean().
40 try_register(Pid, FromTo) ->
41 53 mongoose_backend:call(global, ?MAIN_MODULE, ?FUNCTION_NAME, [Pid, FromTo]).
42
43 -spec remove_connection(FromTo :: ejabberd_s2s:fromto(), Pid :: pid()) -> ok.
44 remove_connection(FromTo, Pid) ->
45 39 mongoose_backend:call(global, ?MAIN_MODULE, ?FUNCTION_NAME, [FromTo, Pid]).
46
47 -spec node_cleanup(Node :: node()) -> ok.
48 node_cleanup(Node) ->
49 8 mongoose_backend:call(global, ?MAIN_MODULE, ?FUNCTION_NAME, [Node]).
50
51 -spec register_secret(HostType :: mongooseim:host_type(),
52 Secret :: ejabberd_s2s:base16_secret()) -> ok.
53 register_secret(HostType, Secret) ->
54 259 mongoose_backend:call(global, ?MAIN_MODULE, ?FUNCTION_NAME, [HostType, Secret]).
55
56 -spec get_shared_secret(mongooseim:host_type()) ->
57 {ok, ejabberd_s2s:base16_secret()} | {error, not_found}.
58 get_shared_secret(HostType) ->
59 624 mongoose_backend:call(global, ?MAIN_MODULE, ?FUNCTION_NAME, [HostType]).
Line Hits Source