Harald Welte | e895c9b | 2011-01-22 20:55:56 +0000 | [diff] [blame] | 1 | % OTP Supervisor for MGW NAT |
| 2 | |
| 3 | % (C) 2011 by Harald Welte <laforge@gnumonks.org> |
| 4 | % (C) 2011 OnWaves |
| 5 | % |
| 6 | % All Rights Reserved |
| 7 | % |
| 8 | % This program is free software; you can redistribute it and/or modify |
| 9 | % it under the terms of the GNU Affero General Public License as |
| 10 | % published by the Free Software Foundation; either version 3 of the |
| 11 | % License, or (at your option) any later version. |
| 12 | % |
| 13 | % This program is distributed in the hope that it will be useful, |
| 14 | % but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 15 | % MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 16 | % GNU General Public License for more details. |
| 17 | % |
| 18 | % You should have received a copy of the GNU Affero General Public License |
| 19 | % along with this program. If not, see <http://www.gnu.org/licenses/>. |
| 20 | |
| 21 | -module(mgw_nat_sup). |
| 22 | -behavior(supervisor). |
| 23 | |
| 24 | -export([start_link/0]). |
| 25 | -export([init/1]). |
| 26 | |
Harald Welte | e895c9b | 2011-01-22 20:55:56 +0000 | [diff] [blame] | 27 | start_link() -> |
| 28 | supervisor:start_link({local, ?MODULE}, ?MODULE, []). |
| 29 | |
| 30 | init(_Arg) -> |
Harald Welte | 790f364 | 2011-02-03 17:44:50 +0100 | [diff] [blame] | 31 | {ok, MscLocalIp} = application:get_env(msc_local_ip), |
| 32 | {ok, MscLocalPort} = application:get_env(msc_local_port), |
| 33 | {ok, MscRemoteIp} = application:get_env(msc_remote_ip), |
| 34 | {ok, StpRemoteIp} = application:get_env(stp_remote_ip), |
| 35 | {ok, StpRemotePort} = application:get_env(stp_remote_port), |
| 36 | SctpHdlrArgs = [MscLocalIp, MscLocalPort, MscRemoteIp, |
| 37 | StpRemoteIp, StpRemotePort], |
| 38 | MgwChild = {mgw_nat_usr, {mgw_nat_usr, start_link, [SctpHdlrArgs]}, |
Harald Welte | e895c9b | 2011-01-22 20:55:56 +0000 | [diff] [blame] | 39 | permanent, 2000, worker, [mgw_nat_usr, sctp_handler, mgw_nat]}, |
| 40 | {ok,{{one_for_all,1,1}, [MgwChild]}}. |