4
%% Copyright Ericsson AB 2010-2011. All Rights Reserved.
6
%% The contents of this file are subject to the Erlang Public License,
7
%% Version 1.1, (the "License"); you may not use this file except in
8
%% compliance with the License. You should have received a copy of the
9
%% Erlang Public License along with this software. If not, it can be
10
%% retrieved online at http://www.erlang.org/.
12
%% Software distributed under the License is distributed on an "AS IS"
13
%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
14
%% the License for the specific language governing rights and limitations
21
%% Top supervisor for transport processes.
24
-module(diameter_transport_sup).
26
-behaviour(supervisor).
28
-export([start_link/0, %% supervisor start
31
%% supervisor callback
34
%% ---------------------------------------------------------------------------
38
%% Start the transport top supervisor. This is started as a child at
39
%% at application start, from diameter_sup.erl. Protocol-specific
40
%% supervisors are started as children of this supervisor dynamically
41
%% by calling start_child/2. (Eg. diameter_tcp_sup:start/0, which
42
%% is called from diameter_tcp:start/3 to start supervisors the
43
%% first time a TCP transport process is started.)
46
SupName = {local, ?MODULE},
47
supervisor:start_link(SupName, ?MODULE, []).
51
%% Start a protocol-specific supervisor under the top supervisor.
53
start_child(Name, Module) ->
55
{Module, start_link, [Name]},
60
supervisor:start_child(?MODULE, Spec).
62
%% ---------------------------------------------------------------------------
64
%% Top supervisor callback.
66
Flags = {one_for_one, 0, 1},
67
Workers = [], %% Each protocol starts its supervisor on demand.
68
{ok, {Flags, Workers}}.