<!--
     Schema definition for wicked addrconf services

     Copyright (C) 2012, Olaf Kirch <okir@suse.de>
  -->

<!-- =================================================
     Generic Addrconf facilities
     ================================================= -->
<service name="addrconf" interface="org.opensuse.Network.Addrconf" object-class="addrconf-device">
  <define name="nis-domain" class="dict">
      <domainname type="string" />
      <binding type="uint32" />
      <servers class="array" element-type="string" element-name="server" />
  </define>

  <define name="lease-type" class="dict">
    <description>
      This type describes an address configuration obtained by one of
      the addrconf services (such as DHCP), which is also what the name of
      this type is derived from.

      When an addrconf service acquires a lease, it emits a "LeaseAcquired"
      signal and passes along this lease data.
    </description>
    <uuid type="uuid-type" />
    <flags type="builtin-addrconf-flags" />
    <state type="builtin-addrconf-state"
    		description="State of the lease - usually GRANTED or RELEASED"/>

    <acquired type="int64"
    		description="Timestamp when the lease was acquired"/>
    <update type="builtin-addrconf-update-mask"
    		description="This is a bitmap describing which system services should be configured through this lease" />

    <hostname type="string" />
    <addresses type="network-interface:assigned-address-list" />
    <routes type="network-interface:assigned-route-list" />

    <resolver class="dict">
      <default-domain type="string" />
      <search class="array" element-type="string" element-name="domain" />
      <servers class="array" element-type="string" element-name="server" />
    </resolver>

    <nis class="dict" extends="nis-domain">
      <domains class="array" element-type="nis-domain" element-name="domain" />
    </nis>

    <log-servers class="array" element-type="string" />
    <ntp-servers class="array" element-type="string" />
    <slp-servers class="array" element-type="string" />
    <slp-scopes class="array" element-type="string" />
    <sip-servers class="array" element-type="string" />
    <lpr-servers class="array" element-type="string" />

    <netbios-name-servers class="array" element-type="string" />
    <netbios-dd-servers class="array" element-type="string" />
    <netbios-node-type type="string" />
    <netbios-scope type="string" />
  </define>
  <define name="callback-info" class="dict" extends="interface:callback-info">
    <lease class="dict">
      <type   type="uint32"/>
      <family type="uint32"/>
      <uuid   type="uuid-type"/>
      <state  type="builtin-addrconf-state"/>
      <flags  type="builtin-addrconf-flags"/>
    </lease>
  </define>

  <signal name="LeaseAcquired">
    <arguments>
      <uuid type="uuid-type"/>
      <lease type="lease-type" />
    </arguments>
  </signal>

  <signal name="LeaseReleased">
    <arguments>
      <uuid type="uuid-type"/>
      <lease type="lease-type" />
    </arguments>
  </signal>

  <signal name="LeaseDeferred">
    <arguments>
      <uuid type="uuid-type"/>
      <lease type="lease-type" />
    </arguments>
  </signal>

  <signal name="LeaseLost">
    <arguments>
      <uuid type="uuid-type"/>
      <lease type="lease-type" />
    </arguments>
  </signal>
</service>

<!-- =================================================
     Static IPv4 Address configuration service
     ================================================= -->
<service name="ipv4:static" interface="org.opensuse.Network.Addrconf.ipv4.static" object-class="netif">
  <define name="request" class="dict">
    <address type="network-interface:assigned-address" />
    <route type="network-interface:assigned-route" />
    <rule type="network-interface:assigned-rule" />
    <hostname type="string" />
    <resolver class="dict">
      <default-domain type="string" />
      <servers class="array" element-type="string" />
      <search class="array" element-type="string" />
    </resolver>
  </define>
  <define name="properties" type="interface:addrconf-lease"/>

  <method name="requestLease">
    <arguments>
      <!-- Note: all addresses are expected to be IPv4 -->
      <config type="request">
        <meta:mapping document-node="ipv4:static" skip-unless-present="true"/>
      </config>
    </arguments>
    <return>
      <addrconf:callback-info/>
    </return>
  </method>

  <method name="dropLease">
    <return>
      <addrconf:callback-info/>
    </return>
  </method>
</service>


<!-- =================================================
     Static IPv6 Address configuration service
     ================================================= -->
<service name="ipv6:static" interface="org.opensuse.Network.Addrconf.ipv6.static" object-class="netif">
  <define name="request" class="dict">
    <address type="network-interface:assigned-address" />
    <route type="network-interface:assigned-route" />
    <rule type="network-interface:assigned-rule" />
    <hostname type="string" />
    <resolver class="dict">
      <default-domain type="string" />
      <servers class="array" element-type="string" />
      <search class="array" element-type="string" />
    </resolver>
  </define>
  <define name="properties" type="interface:addrconf-lease"/>

  <method name="requestLease">
    <arguments>
      <!-- Note: all addresses are expected to be IPv6 -->
      <config type="request">
        <meta:mapping document-node="ipv6:static" skip-unless-present="true"/>
      </config>
    </arguments>
    <return>
      <addrconf:callback-info/>
    </return>
  </method>

  <method name="dropLease">
    <return>
      <addrconf:callback-info/>
    </return>
  </method>
</service>


<!-- =================================================
     IPv4 DHCP Address configuration service
     ================================================= -->
<service name="ipv4:dhcp" interface="org.opensuse.Network.Addrconf.ipv4.dhcp" object-class="netif">
  <define name="request" class="dict">
    <enabled type="boolean"/>
    <uuid type="uuid-type"/>
    <flags type="builtin-addrconf-flags" />

    <client-id type="string" />
    <create-cid type="uint32" constraint="enum">
      <rfc2132  value="1"/>
      <hwaddr   value="1"/>
      <rfc4361  value="2"/>
      <dhcpv6   value="2"/>
      <dhcp6    value="2"/>
      <disable  value="3"/>
      <none     value="3"/>
    </create-cid>
    <vendor-class type="string" />
    <user-class class="dict">
      <format type="uint32" constraint="enum">
	<rfc3004 value="0"/>
	<string value="1"/>
      </format>
      <identifier type="string"/>
    </user-class>

    <start-delay type="seconds-type" />
    <defer-timeout type="seconds-type" />
    <acquire-timeout type="seconds-type" />

    <lease-time type="seconds-type" />
    <recover-lease type="boolean" />
    <release-lease type="boolean" />
    <broadcast type="tristate" />

    <update type="builtin-addrconf-update-mask" />
    <hostname type="string" />
    <fqdn class="dict">
      <enabled type="tristate"/>
      <update  type="uint32" constraint="enum">
        <none  value="8"/>
        <both  value="1"/>
        <ptr   value="0"/>
      </update>
      <encode type="boolean"/>
      <qualify type="boolean"/>
    </fqdn>
    <route-priority type="uint32" />
    <route-set-src type="boolean" />

    <request-options class="array" element-type="string" element-name="option" />
  </define>
  <define name="drop-options" class="dict">
      <release type="boolean"/>
  </define>
  <define name="properties" type="interface:addrconf-lease"/>

  <method name="requestLease">
    <arguments>
      <config type="request">
        <meta:mapping document-node="ipv4:dhcp" skip-unless-present="true"/>
      </config>
    </arguments>
    <return>
      <addrconf:callback-info/>
    </return>
  </method>

  <method name="dropLease">
    <arguments>
      <options type="drop-options">
        <meta:mapping document-node="ipv4:dhcp/options" generate="true"/>
      </options>
    </arguments>
    <return>
      <addrconf:callback-info/>
    </return>
  </method>
</service>

<!-- =================================================
     IPv6 DHCP Address configuration service
     ================================================= -->
<service name="ipv6:dhcp" interface="org.opensuse.Network.Addrconf.ipv6.dhcp" object-class="netif">
  <define name="request" class="dict">
    <enabled type="boolean"/>
    <uuid type="uuid-type"/>
    <flags type="builtin-addrconf-flags" />

    <mode type="builtin-dhcp6-mode"/>
    <rapid-commit type="boolean"/>
    <address-length type="uint32"/>

    <client-id type="string" />
    <!-- vendor-class type="string" / -->

    <start-delay type="seconds-type" />
    <defer-timeout type="seconds-type" />
    <acquire-timeout type="seconds-type" />

    <lease-time type="seconds-type" />
    <recover-lease type="boolean" />
    <refresh-lease type="boolean" />
    <release-lease type="boolean" />

    <update type="builtin-addrconf-update-mask" />
    <hostname type="string" />
    <fqdn class="dict">
      <enabled type="tristate"/>
      <update  type="uint32" constraint="enum">
        <none  value="8"/>
        <both  value="1"/>
        <ptr   value="0"/>
      </update>
      <qualify type="boolean"/>
    </fqdn>

    <request-prefix class="dict">
      <hint type="network-address-prefix"/>
    </request-prefix>

    <request-options class="array" element-type="string" element-name="option" />
  </define>
  <define name="drop-options" class="dict">
    <release type="boolean"/>
  </define>
  <define name="properties" type="interface:addrconf-lease"/>

  <method name="requestLease">
    <arguments>
      <config type="request">
        <meta:mapping document-node="ipv6:dhcp" skip-unless-present="true"/>
      </config>
    </arguments>
    <return>
      <addrconf:callback-info/>
    </return>
  </method>

  <method name="dropLease">
    <arguments>
      <options type="drop-options">
        <meta:mapping document-node="ipv6:dhcp/options" generate="true"/>
      </options>
    </arguments>
    <return>
      <addrconf:callback-info/>
    </return>
  </method>
</service>

<!-- =================================================
     IPv4 zeroconf Address configuration service
     ================================================= -->
<service name="ipv4:auto" interface="org.opensuse.Network.Addrconf.ipv4.auto" object-class="netif">
  <define name="request" class="dict">
    <enabled type="boolean"/>
    <uuid type="uuid-type"/>
    <flags type="builtin-addrconf-flags" />
  </define>
  <define name="properties" type="interface:addrconf-lease"/>

  <method name="requestLease">
    <arguments>
      <config type="request">
        <meta:mapping document-node="ipv4:auto" skip-unless-present="true"/>
      </config>
    </arguments>
    <return>
      <addrconf:callback-info/>
    </return>
  </method>

  <method name="dropLease">
    <return>
      <addrconf:callback-info/>
    </return>
  </method>
</service>

<!-- =================================================
     IPv6 autoconf address configuration service
     ================================================= -->
<service name="ipv6:auto" interface="org.opensuse.Network.Addrconf.ipv6.auto" object-class="netif">
  <define name="request" class="dict">
    <enabled type="boolean"/>
    <defer-timeout type="seconds-type" />
    <update type="builtin-addrconf-update-mask" />
  </define>
  <define name="properties" type="interface:addrconf-lease"/>

  <method name="requestLease">
    <arguments>
      <config type="request">
	<meta:mapping document-node="ipv6:auto" skip-unless-present="true"/>
      </config>
    </arguments>
    <return>
      <addrconf:callback-info/>
    </return>
  </method>

  <method name="dropLease">
    <return>
      <addrconf:callback-info/>
    </return>
  </method>
</service>
