<?xml version="1.0"?>
<!DOCTYPE service_bundle SYSTEM "/usr/share/lib/xml/dtd/service_bundle.dtd.1">
<!--

 This file and its contents are supplied under the terms of the
 Common Development and Distribution License ("CDDL"). You may
 only use this file in accordance with the terms of the CDDL.

 A full copy of the text of the CDDL should have accompanied this
 source. A copy of the CDDL is also available via the Internet at
 http://www.illumos.org/license/CDDL.

 Copyright 2016 Adam Stevko 

-->
<service_bundle type="manifest" name="udpxy">
  <service name="network/udpxy" type="service" version="1">
    <create_default_instance enabled="false"/>
    <single_instance/>

    <!--
        Wait for network interfaces to be initialized.
    -->
    <dependency name="network" grouping="require_all" restart_on="none" type="service">
      <service_fmri value="svc:/milestone/network:default"/>
    </dependency>
    
    <!--
      Wait for all local filesystems to be mounted.
    -->
    <dependency name="filesystem-local" grouping="require_all" restart_on="none" type="service">
      <service_fmri value="svc:/system/filesystem/local:default"/>
    </dependency>
    
    <method_context>
      <method_environment>
        <envvar name="PATH" value="/usr/bin:/usr/sbin"/>
      </method_environment>
    </method_context>

    <exec_method 
      type="method" 
      name="start" 
      exec="/usr/bin/udpxy -p %{config/port} -a %{config/listen_address} -m %{config/multicast_source_address} -c %{config/max_clients} %{config/additional_flags}" 
      timeout_seconds="60">
      <method_context>
        <method_credential user='udpxy' group='udpxy' />
      </method_context>
    </exec_method>

    <exec_method type="method" name="stop" exec=":kill" timeout_seconds="60"/>

    <property_group name="config" type="application">
      <propval name="port" type="astring" value="4022"/>
      <propval name="listen_address" type="astring" value="0.0.0.0"/>
      <propval name="multicast_source_address" type="astring" value="0.0.0.0"/>
      <propval name="max_clients" type="astring" value="3"/>
      <propval name="additional_flags" type="astring" value=""/>
      <propval name="value_authorization" type="astring" value="solaris.smf.value.udpxy"/>
    </property_group>

    <property_group name="general" type="framework">
      <propval name="action_authorization" type="astring" value="solaris.smf.manage.udpxy"/>
      <propval name="value_authorization" type="astring" value="solaris.smf.manage.udpxy"/>
    </property_group>
      
    <property_group name="startd" type="framework">
      <propval name="duration" type="astring" value="child"/>
      <propval name="ignore_error" type="astring" value="core,signal"/>
    </property_group>
  
    <stability value="Unstable"/>
    
    <template>
      <common_name>
        <loctext xml:lang="C">udpxy multicast-to-HTTP relay daemon</loctext>
      </common_name>
      <documentation>
        <manpage title="udpxy" section="1"/>
      </documentation>
    </template>
 
  </service>
</service_bundle>