aboutsummaryrefslogtreecommitdiffstats
path: root/lib/inets/src/inets_app/inets_service.erl
diff options
context:
space:
mode:
authorHenrik Nord <[email protected]>2011-10-07 17:17:27 +0200
committerHenrik Nord <[email protected]>2011-10-07 17:17:32 +0200
commita5abe96590ec22779f796fc67e5afbbf99a3a922 (patch)
treeb22eb07f52606bc7ab5c7339026d007784aef0a4 /lib/inets/src/inets_app/inets_service.erl
parent00202339445daae6ed931f28f932089d5c3dd455 (diff)
parented72d05e27fcf1d4f649014ffd7a1c2878b5b010 (diff)
downloadotp-a5abe96590ec22779f796fc67e5afbbf99a3a922.tar.gz
otp-a5abe96590ec22779f796fc67e5afbbf99a3a922.tar.bz2
otp-a5abe96590ec22779f796fc67e5afbbf99a3a922.zip
Merge branch 'sa/callback-attr'
* sa/callback-attr: Add callback specs into 'application' module in kernel Add callback specs to tftp module following internet documentation Add callback specs to inets_service module following possibly deprecated comments Add '-callback' attributes in stdlib's behaviours Update primary bootstrap Update the documentation with information on the callback attribute Automatically generate 'behaviour_info' function from '-callback' attributes Add '-callback' attribute to language syntax OTP-9621
Diffstat (limited to 'lib/inets/src/inets_app/inets_service.erl')
-rw-r--r--lib/inets/src/inets_app/inets_service.erl28
1 files changed, 16 insertions, 12 deletions
diff --git a/lib/inets/src/inets_app/inets_service.erl b/lib/inets/src/inets_app/inets_service.erl
index e9eb9892f2..f89dac195c 100644
--- a/lib/inets/src/inets_app/inets_service.erl
+++ b/lib/inets/src/inets_app/inets_service.erl
@@ -20,24 +20,20 @@
-module(inets_service).
--export([behaviour_info/1]).
-
-behaviour_info(callbacks) ->
- [{start_standalone, 1},
- {start_service, 1},
- {stop_service, 1},
- {services, 0},
- {service_info, 1}];
-behaviour_info(_) ->
- undefined.
-
%% Starts service stand-alone
%% start_standalone(Config) -> % {ok, Pid} | {error, Reason}
%% <service>:start_link(Config).
+-callback start_standalone(Config :: term()) ->
+ {ok, pid()} | {error, Reason :: term()}.
+
%% Starts service as part of inets
%% start_service(Config) -> % {ok, Pid} | {error, Reason}
%% <service_sup>:start_child(Config).
+
+-callback start_service(Config :: term()) ->
+ {ok, pid()} | {error, Reason :: term()}.
+
%% Stop service
%% stop_service(Pid) -> % ok | {error, Reason}
%% <service_sup>:stop_child(maybe_map_pid_to_other_ref(Pid)).
@@ -51,6 +47,9 @@ behaviour_info(_) ->
%% Error
%% end.
+-callback stop_service(Service :: term()) ->
+ ok | {error, Reason :: term()}.
+
%% Returns list of running services. Services started as stand alone
%% are not listed
%% services() -> % [{Service, Pid}]
@@ -59,7 +58,12 @@ behaviour_info(_) ->
%% [{httpc, Pid} || {_, Pid, _, _} <-
%% supervisor:which_children(httpc_profile_sup)].
+-callback services() ->
+ [{Service :: term(), pid()}].
-%% service_info() -> [{Property, Value}] | {error, Reason}
+%% service_info() -> {ok, [{Property, Value}]} | {error, Reason}
%% ex: httpc:service_info() -> [{profile, ProfileName}]
%% httpd:service_info() -> [{host, Host}, {port, Port}]
+
+-callback service_info(Service :: term()) ->
+ {ok, [{Property :: term(), Value :: term()}]} | {error, Reason :: term()}.