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 | |
| 27 | -define(MSC_LOCAL_IP, any). |
| 28 | -define(MSC_LOCAL_PORT, 2904). |
| 29 | -define(MSC_REMOTE_IP, {172,16,1,81}). |
| 30 | -define(STP_REMOTE_IP, {172,16,249,20}). |
| 31 | -define(STP_REMOTE_PORT, 2904). |
| 32 | |
| 33 | -define(SCTP_HDLR_ARGS, [?MSC_LOCAL_IP, ?MSC_LOCAL_PORT, ?MSC_REMOTE_IP, |
| 34 | ?STP_REMOTE_IP, ?STP_REMOTE_PORT]). |
| 35 | |
| 36 | start_link() -> |
| 37 | supervisor:start_link({local, ?MODULE}, ?MODULE, []). |
| 38 | |
| 39 | init(_Arg) -> |
| 40 | MgwChild = {mgw_nat_usr, {mgw_nat_usr, start_link, ?SCTP_HDLR_ARGS}, |
| 41 | permanent, 2000, worker, [mgw_nat_usr, sctp_handler, mgw_nat]}, |
| 42 | {ok,{{one_for_all,1,1}, [MgwChild]}}. |