blob: ee5f06c9cde8aa2d1e6f2e999372e7165035b823 [file] [log] [blame]
Harald Weltefbd4f732012-05-06 23:29:42 +02001% SIGTRAN SGW AS supervisor
2
3% (C) 2012 by Harald Welte <laforge@gnumonks.org>
4%
5% All Rights Reserved
6%
7% This program is free software; you can redistribute it and/or modify
8% it under the terms of the GNU Affero General Public License as
9% published by the Free Software Foundation; either version 3 of the
10% License, or (at your option) any later version.
11%
12% This program is distributed in the hope that it will be useful,
13% but WITHOUT ANY WARRANTY; without even the implied warranty of
14% MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15% GNU General Public License for more details.
16%
17% You should have received a copy of the GNU Affero General Public License
18% along with this program. If not, see <http://www.gnu.org/licenses/>.
19%
20% Additional Permission under GNU AGPL version 3 section 7:
21%
22% If you modify this Program, or any covered work, by linking or
23% combining it with runtime libraries of Erlang/OTP as released by
24% Ericsson on http://www.erlang.org (or a modified version of these
25% libraries), containing parts covered by the terms of the Erlang Public
26% License (http://www.erlang.org/EPLICENSE), the licensors of this
27% Program grant you additional permission to convey the resulting work
28% without the need to license the runtime libraries of Erlang/OTP under
29% the GNU Affero General Public License. Corresponding Source for a
30% non-source form of such a combination shall include the source code
31% for the parts of the runtime libraries of Erlang/OTP used as well as
32% that of the covered work.
33
34-module(sg_as_sup).
35-author('Harald Welte <laforge@gnumonks.org>').
36-behaviour(supervisor).
37
38-export([init/1, start_link/2]).
39
40init([Name, Options]) ->
41 AsName = list_to_atom("sg_as_" ++ Name ++ "_fsm"),
Harald Welteee7964c2012-05-07 23:55:02 +020042 StartArgs = [{local, AsName}, xua_as_fsm, [self()], Options],
Harald Weltefbd4f732012-05-06 23:29:42 +020043 StartFunc = {gen_fsm, start_link, StartArgs},
44 ChildSpec = {as_fsm, StartFunc, permanent, 4000, worker, [xua_as_fsm]},
45
46 AspsName = list_to_atom("sg_asp_" ++ Name ++ "_sup"),
47 StartFuncASPS = {supervisor, start_link, [{local, AspsName}, sg_asp_sup, [Name, self()]]},
48 ChildSpecASPS = {asp_sup, StartFuncASPS, permanent, 4000, worker, [asp_sup]},
49 {ok, {{one_for_all, 1, 1}, [ChildSpec, ChildSpecASPS]}}.
50
51start_link(Name, Options) ->
52 supervisor:start_link(?MODULE, [Name, Options]).