1
%% ``The contents of this file are subject to the Erlang Public License,
2
%% Version 1.1, (the "License"); you may not use this file except in
3
%% compliance with the License. You should have received a copy of the
4
%% Erlang Public License along with this software. If not, it can be
5
%% retrieved via the world wide web at http://www.erlang.org/.
7
%% Software distributed under the License is distributed on an "AS IS"
8
%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
9
%% the License for the specific language governing rights and limitations
12
%% The Initial Developer of the Original Code is Ericsson Utvecklings AB.
13
%% Portions created by Ericsson are Copyright 1999, Ericsson Utvecklings
14
%% AB. All Rights Reserved.''
18
%%----------------------------------------------------------------------
19
%% Purpose: The top supervisor for the inets application
20
%%----------------------------------------------------------------------
24
-behaviour(supervisor).
28
%%%=========================================================================
29
%%% Supervisor callback
30
%%%=========================================================================
32
SupFlags = {one_for_one, 10, 3600},
33
Children = children(),
34
{ok, {SupFlags, Children}}.
36
%%%=========================================================================
37
%%% Internal functions
38
%%%=========================================================================
40
case (catch application:get_env(inets, services)) of
48
Services = get_services(),
49
HttpdServices = [Service || Service <- Services, is_httpd(Service)],
50
HttpcServices = [Service || Service <- Services, is_httpc(Service)],
51
TftpdServices = [Service || Service <- Services, is_tftpd(Service)],
52
[ftp_child_spec(), httpc_child_spec(HttpcServices),
53
httpd_child_spec(HttpdServices), tftpd_child_spec(TftpdServices)].
57
StartFunc = {ftp_sup, start_link, []},
62
{Name, StartFunc, Restart, Shutdown, Type, Modules}.
64
httpc_child_spec(HttpcServices) ->
66
StartFunc = {httpc_sup, start_link, [HttpcServices]},
69
Modules = [httpc_sup],
71
{Name, StartFunc, Restart, Shutdown, Type, Modules}.
73
httpd_child_spec(HttpdServices) ->
75
StartFunc = {httpd_sup, start_link, [HttpdServices]},
78
Modules = [httpd_sup],
80
{Name, StartFunc, Restart, Shutdown, Type, Modules}.
82
tftpd_child_spec(TftpServices) ->
84
StartFunc = {tftp_sup, start_link, [TftpServices]},
89
{Name, StartFunc, Restart, Shutdown, Type, Modules}.
91
is_httpd({httpd, _}) ->
93
is_httpd({httpd, _, _}) ->
98
is_httpc({httpc, _}) ->
103
is_tftpd({tftpd, _}) ->