<?xml version="1.0" encoding="latin1" ?>
<!DOCTYPE erlref SYSTEM "erlref.dtd">

<erlref>
  <header>
    <copyright>
      <year>2007</year><year>2010</year>
      <holder>Ericsson AB. All Rights Reserved.</holder>
    </copyright>
    <legalnotice>
      The contents of this file are subject to the Erlang Public License,
      Version 1.1, (the "License"); you may not use this file except in
      compliance with the License. You should have received a copy of the
      Erlang Public License along with this software. If not, it can be
      retrieved online at http://www.erlang.org/.
    
      Software distributed under the License is distributed on an "AS IS"
      basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
      the License for the specific language governing rights and limitations
      under the License.
    
    </legalnotice>

    <title>inets</title>
    <prepared>Ingela Anderton Andin</prepared>
    <responsible></responsible>
    <docno></docno>
    <date></date>
    <rev></rev>
  </header>
  <module>inets</module>
  <modulesummary>The inets services API</modulesummary>
  <description>
    <p>This module provides the most basic API to the 
      clients and servers, that are part of the Inets application,
      such as start and stop. </p>
  </description>

  <section>
    <title>COMMON DATA TYPES </title>
    <p>Type definitions that are used more than once in
      this module: </p>
    <p><c> service() = ftpc | tftp | httpc | httpd</c></p>
    <p><c> property() = atom() </c></p>
  </section>
  <funcs>
    <func>
      <name>services() -> [{Service, Pid}]</name>
      <fsummary>Returns a list of currently running services. </fsummary>
      <type>
        <v>Service = service()</v>
        <v>Pid = pid()</v>
      </type>
      <desc>
        <p>Returns a list of currently running services.</p>
        <note>
          <p>Services started as <c>stand_alone</c> will not
            be listed.</p>
        </note>
      </desc>
    </func>
    <func>
      <name>services_info() -> [{Service, Pid, Info}]</name>
      <fsummary>Returns a list of currently running services where
      each service is described by a [{Option, Value}]
      list. </fsummary>
      <type>
        <v>Service = service()</v>
        <v>Pid = pid()</v>
        <v>Info = [{Option, Value}]</v>
        <v>Option = property()</v>
        <v>Value = term()</v>
      </type>
      <desc>
        <p>Returns a list of currently running services where each
          service is described by a [{Option, Value}] list. The
          information given in the list is specific for each service
          and it is probable that each service will have its own info
          function that gives you even more details about the
          service.</p>
      </desc>
    </func>
    
    <func>
      <name>service_names() -> [Service] </name>
      <fsummary>Returns a list of available service names.</fsummary>
      <type>
	<v>Service = service()</v>
      </type>
      <desc>
        <p>Returns a list of available service names.</p>
      </desc>
    </func>
    
    <func>
      <name>start() -> </name>
      <name>start(Type) -> ok | {error, Reason}</name>
      <fsummary>Starts the Inets application. </fsummary>
      <type>
        <v>Type = permanent | transient | temporary</v>
      </type>
      <desc>
        <p>Starts the Inets application. Default type
          is temporary. See also
          <seealso marker="kernel:application">application(3)</seealso></p>
      </desc>
    </func>
    <func>
      <name>stop() -> ok </name>
      <fsummary>Stops the inets application.</fsummary>
      <desc>
        <p>Stops the inets application. See also
          <seealso marker="kernel:application">application(3)</seealso></p>
      </desc>
    </func>
    <func>
      <name>start(Service, ServiceConfig) -> {ok, Pid} | {error, Reason}</name>
      <name>start(Service, ServiceConfig, How) -> {ok, Pid} | {error, Reason}</name>
      <fsummary>Dynamically starts an inets
      service after the inets application has been started. </fsummary>
      <type>
        <v>Service = service()</v>
        <v>ServiceConfig = [{Option, Value}]</v>
	<v>Option = property()</v>
	<v>Value = term()</v>
        <v>How = inets | stand_alone - default is inets</v>
      </type>
      <desc>
        <p>Dynamically starts an inets service after the inets
          application has been started. </p>
        <note>
          <p>Dynamically started services will not be handled by
            application takeover and failover behavior when inets is
            run as a distributed application. Nor will they be
            automatically restarted when the inets application is
            restarted, but as long as the inets application is up and
            running they will be supervised and may be soft code
            upgraded. Services started as <c>stand_alone</c>,
            e.i. the service is not started as part of the inets
            application, will lose all OTP application benefits such
            as soft upgrade. The "stand_alone-service" will be linked to
            the process that started it. In most cases some of the
            supervision functionality will still be in place and in
            some sense the calling process has now become the top
            supervisor.</p>
        </note>
      </desc>
    </func>
    <func>
      <name>stop(Service, Reference) -> ok | {error, Reason} </name>
      <fsummary>Stops a started service of the inets application or takes
          down a "stand_alone-service" gracefully.</fsummary>
      <type>
	<v>Service = service() | stand_alone</v>
	<v>Reference = pid() | term() - service specified reference</v>
	<v>Reason = term()</v>
      </type>
      <desc>
        <p>Stops a started service of the inets application or takes
          down a "stand_alone-service" gracefully. When the
	  <c>stand_alone</c> option is used in start,
	  only the pid is a valid argument to stop.</p>
      </desc>
    </func>
  </funcs>

  <section>
    <title>SEE ALSO</title>
    <p><seealso marker="ftp">ftp(3)</seealso>,
      <seealso marker="httpc">httpc(3)</seealso>,
      <seealso marker="httpd">httpd(3)</seealso>,
      <seealso marker="tftp">tftp(3)</seealso></p>
  </section>
  
</erlref>


