./ct_report/coverage/mod_jingle_sip_backend.COVER.html

1 %% @doc Backend module for mod_jingle_sip
2 -module(mod_jingle_sip_backend).
3
4 -export([init/2]).
5 -export([read_session/1]).
6 -export([write_new_session/2]).
7 -export([update_session/2]).
8 -export([remove_session/1]).
9
10 -include("mongoose.hrl").
11
12 -type call_id() :: mod_jingle_sip_session:call_id().
13 -type session() :: mod_jingle_sip_session:session().
14 -type update_fun() :: mod_jingle_sip_session:update_fun().
15
16 -define(MAIN_MODULE, mod_jingle_sip).
17
18 -callback init(mongooseim:host_type(), gen_mod:module_opts()) -> ok.
19
20 -callback read_session(call_id()) -> [session()].
21
22 -callback write_new_session(call_id(), session()) ->
23 ok | {error, conflict}.
24
25 -callback update_session(call_id(), update_fun()) -> ok | {error, _}.
26
27 -callback remove_session(call_id()) -> ok.
28
29 -spec init(mongooseim:host_type(), gen_mod:module_opts()) -> ok.
30 init(Host, Opts) ->
31 2 Args = [Host, Opts],
32 2 mongoose_backend:init(global, ?MAIN_MODULE, [], Opts),
33 2 mongoose_backend:call(global, ?MAIN_MODULE, ?FUNCTION_NAME, Args).
34
35 -spec read_session(call_id()) -> [session()].
36 read_session(CallID) ->
37 21 Args = [CallID],
38 21 mongoose_backend:call(global, ?MAIN_MODULE, ?FUNCTION_NAME, Args).
39
40 -spec write_new_session(call_id(), session()) ->
41 ok | {error, conflict}.
42 write_new_session(CallID, Session) ->
43 33 Args = [CallID, Session],
44 33 mongoose_backend:call(global, ?MAIN_MODULE, ?FUNCTION_NAME, Args).
45
46 -spec update_session(call_id(), update_fun()) -> ok | {error, _}.
47 update_session(CallID, F) ->
48 52 Args = [CallID, F],
49 52 mongoose_backend:call(global, ?MAIN_MODULE, ?FUNCTION_NAME, Args).
50
51 -spec remove_session(call_id()) -> ok.
52 remove_session(CallID) ->
53 18 Args = [CallID],
54 18 mongoose_backend:call(global, ?MAIN_MODULE, ?FUNCTION_NAME, Args).
Line Hits Source