
<!-- =================================================
     Basic network interface information
     ================================================= -->
<define name="network-interface" class="dict">
 <!-- An address assigned to a network interface -->
 <define name="assigned-address" class="dict">
   <local type="network-address-prefix" />
   <peer type="network-address"/>
   <anycast type="network-address"/>
   <broadcast type="network-address"/>
   <scope type="builtin-route-scope"/>

   <!-- currently raw flags -->
   <flags type="uint32"/>
   <!-- label is ipv4 only  -->
   <label type="string"/>

   <cache-info class="dict">
     <valid-lifetime type="valid-lifetime-type" />
     <preferred-lifetime type="pref-lifetime-type" />
   </cache-info>

   <!-- This is the addrconf method that owns this address -->
   <owner type="builtin-addrconf" />
 </define>

 <define name="assigned-address-list" class="array" element-type="assigned-address" />

 <!-- A route assigned to a network interface -->
 <define name="assigned-route" class="dict">
   <destination  type="network-address-prefix"/>
   <pref-source  type="network-address"/>
   <priority     type="uint32" />
   <flags        type="builtin-route-flag-mask" />
   <realm        type="uint32" />
   <mark         type="uint32" />
   <tos          type="uint32" />

   <nexthop class="dict">
     <gateway    type="network-address"/>
     <device     type="string" />
     <weight     type="uint32" />
     <realm      type="uint32" />
     <flags      type="builtin-route-nh-flag-mask" />
   </nexthop>

   <kern class="dict">
     <table      type="string"/>
     <type       type="builtin-route-type"/>
     <scope      type="builtin-route-scope"/>
     <protocol   type="builtin-route-protocol"/>
   </kern>

   <metrics class="dict">
     <lock       type="builtin-route-metrics-lock-mask" />
     <mtu        type="uint32" />
     <window     type="uint32" />
     <rtt        type="uint32" />
     <rttvar     type="uint32" />
     <ssthresh   type="uint32" />
     <cwdn       type="uint32" />
     <advmss     type="uint32" />
     <reordering type="uint32" />
     <hoplimit   type="uint32" />
     <initcwnd   type="uint32" />
     <features   type="uint32" />
     <rto_min    type="uint32" />
     <initrwnd   type="uint32" />
   </metrics>

   <!-- This is the addrconf method that owns this address -->
   <owner type="builtin-addrconf" />
 </define>

 <define name="assigned-route-list" class="array" element-type="assigned-route" />

 <define name="assigned-rule"  class="dict">
   <match class="dict">
     <priority     type="uint32" />
     <invert       type="boolean"/>
     <from         type="network-address-prefix"/>
     <to           type="network-address-prefix"/>
     <iif          type="string" />
     <oif          type="string" />
     <tos          type="uint32" />
     <fwmark       type="uint32" />
     <fwmask       type="uint32" />
   </match>
   <action class="dict">
    <type          type="builtin-rule-action-type" />
    <table         type="string" />
    <target        type="uint32" />
    <realm         type="uint32" />
   </action>
   <suppress      class="dict" >
    <prefix-length type="uint32" />
    <if-group      type="uint32" />
   </suppress>
 </define>

 <!-- Generic per-address family settings -->
 <define name="af-info" class="dict">
    <enabled type="boolean" />
    <forwarding type="boolean" />
 </define>

 <!-- =====================================
      Description
      ===================================== -->
 <description>
   This defines the state of a network interface from the kernel's perspective.

 </description>

 <!-- =====================================
      Properties of an interface start here
      ===================================== -->
 <name type="string" description="The kernel name of the interface" />

 <!-- These bits must match the definitions in netinfo.h -->
 <status type="builtin-ifflags" description="The interface status flags. NOTE: These are not the kernel flags"/>

 <link-type type="builtin-iftype" description="The link-layer type of this interface"/>

 <define name="client-state-control-type" class="dict">
   <persistent type="boolean" constraint="required"/>
   <usercontrol type="boolean" constraint="required"/>
 </define>

 <define name="client-state-config-type" class="dict">
   <origin type="string" constraint="required"/>
   <uuid type="uuid-type" constraint="required"/>
   <owner-uid type="uint32" constraint="required"/>
 </define>

 <define name="client-state-type" class="dict">
   <control type="client-state-control-type" constraint="required"/>
   <config type="client-state-config-type" constraint="required"/>
   <scripts type="scripts:configuration"/>
 </define>

 <client-state type="client-state-type" constraint="required"/>

 <index type="uint32" description="The interface index. The index is also used in the DBus name of the DBus netif object"/>
 <metric type="uint32"/>
 <txqlen type="uint32"/>
 <mtu type="uint32"/>
 <alias type="string"/>
 <master type="string">
   <meta:netif-reference subordinate="true" />
   <meta:require check="netif-system-state" op="linkDown" max-state="firewall-up" />
   <meta:require check="netif-system-state" op="deleteDevice" max-state="device-down" />
 </master>
 <port class="union" switch="type">
   <bond       type="bond:port-info" />
   <team       type="team:port-info" />
   <bridge     type="bridge:port-info" />
   <ovs-bridge type="ovs-bridge:port-info" />
 </port>

 <!-- General ipv4 and ipv6 specific settings -->
 <ipv4 type="af-info"/>
 <ipv6 type="af-info"/>

 <addresses type="assigned-address-list" description="The list of network addresses currently assigned to the interface"/>
 <routes type="assigned-route-list" description="The list of network routes currently assigned to the interface"/>
</define>


<!-- =================================================
     List of all network interfaces.

     This service currently doesn't have any methods, but
     we may add some in the future.
     For instance, we could have a service that maps one
     or more interface attributes to an interface object
     path. This could be used to use other means of interface
     identification that what we usually have.
     ================================================= -->
<service name="interface-list" interface="org.opensuse.Network.InterfaceList">
  <method name="identifyDevice">
    <arguments>
      <namespace type="string"/>
      <query class="dict"/>
    </arguments>
    <return>
      <string/>
    </return>
  </method>
</service>

<!-- =================================================
     Generic dbus interface to a single network interface

     Note that link-layer specific properties and methods
     are defined by overlay DBus services, such as
     org.opensuse.Network.Ethernet, etc.

     Address configuration services are provided by yet
     another set of interfaces that are attached to a network
     interface.
     ================================================= -->
<service name="interface" interface="org.opensuse.Network.Interface" object-class="netif">
  <define name="properties" type="network-interface"/>

  <define name="callback-info" class="dict">
   <!-- We can return one or more these callback elements in a single dict -->
   <description>
    Methods for network or modem devices that are unable to complete the request
    immediately (for instance, a DHCP supplicant needs to broadcast for a lease, etc),
    the server will return callback information. This is a list of one or more
    callbacks to wait for.
   </description>
   <callback class="dict">
     <uuid type="uuid-type"/>
     <event type="string"/>
   </callback>
  </define>

  <define name="link-request" class="dict">
   <description>
    This describes the requested change(s) to the link layer. It is passed to the
    linkUp() method.

    For keys that are omitted, the existing setting of the network interface
    remains unchanged.
   </description>
   <status type="builtin-ifflags"/>

   <metric type="uint32"/>
   <mtu type="uint32"/>
   <txqlen type="uint32"/>
   <alias type="string"/>
   <master type="string">
     <meta:netif-reference subordinate="true" />
     <meta:require check="netif-config-state" op="linkUp" min-state="device-up" />
   </master>
   <port class="union" switch="type">
     <bond       type="bond:port-config" />
     <team       type="team:port-config" />
     <bridge     type="bridge:port-config" />
     <ovs-bridge type="ovs-bridge:port-config" />
   </port>

   <ipv4 type="network-interface:af-info"/>
   <ipv6 type="network-interface:af-info"/>
  </define>

  <define name="addrconf-lease" class="dict">
    <lease class="dict">
      <uuid  type="uuid-type"/>
      <state type="builtin-addrconf-state"/>
      <flags type="builtin-addrconf-flags"/>
    </lease>
  </define>

  <method name="waitDeviceReady">
    <description>
     This method allows to wait until an existing device is ready to set up,
     e.g. renamed by udev.

     If the device is ready, we will return an empty callback-info dict.
     Otherwise, a callback-info dict with uuid to wait for is returned
     and a deviceReady signal is emitted when the device becomes ready.
    </description>
    <return>
      <callback-info/>
    </return>
  </method>

  <method name="linkUp">
    <description>
     This method configures link specific properties, and either enslaves to
     a given master device which takes over further steps or sets the link
     of the device administratively UP and initiaties the link negotiation.

     When the link on the device was already administratively UP (device-up),
     it returns an empty callback-info dict. When the link was was not yet UP,
     a callback-info dict is returned to wait for event providing the UP flag.
    </description>
    <arguments>
      <request type="link-request">
        <meta:mapping document-node="/link" skip-unless-present="false" />
      </request>
    </arguments>
    <return>
      <callback-info/>
    </return>
  </method>

  <method name="waitLinkUp">
  <description>
     This method allows to wait until the link negotiation finished and it
     starts to be usable for further steps like authenticaction or IP setup.

     When the link negotiation finished and e.g. carrier has been detected,
     it returns an empty callback-info dict. Otherwise a callback-info dict
     is returned to wait for a link-up event.
    </description>
    <return>
      <callback-info/>
    </return>
  </method>

  <method name="linkDown">
    <description>
     This method takes the link down by clearing its IFF_UP flag.
    </description>
    <return>
      <callback-info/>
    </return>
  </method>

  <method name="linkAuth">
    <description>
     Do not use
    </description>
    <arguments>
      <!-- to be defined -->
    </arguments>
  </method>

  <method name="networkChange">
    <description>
     Do not use
    </description>
    <arguments>
      <!-- to be defined -->
    </arguments>
    <return>
      <builtin-ifflags/>
    </return>
  </method>

  <define name="intrinsic-lease" class="dict">
    <state type="builtin-addrconf-state"/>
    <update type="builtin-addrconf-update-mask" />
    <addresses type="network-interface:assigned-address-list" />
    <routes type="network-interface:assigned-route-list" />
    <hostname type="string" />

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

    <!-- FIXME: use the real addrconf lease stuff instead. -->
  </define>

  <define name="intrinsic-lease-request" class="dict">
    <type type="builtin-addrconf" />
    <family type="builtin-address-family" />

    <!-- at some point, we should use the real addrconf lease here. For now, let's
      -- keep using what we have, however crippled it may be. -->
    <lease type="intrinsic-lease"/>
  </define>

  <method name="installLease">
    <arguments>
      <arg type="intrinsic-lease-request"/>
    </arguments>
  </method>

  <method name="setClientControl">
    <description>
      This method can be used by client to set:
	* control flags of an interface:
	  - persistent  - allowing/disallowing ifdown operation
	  - usercontrol - user control permission
    </description>
    <arguments>
      <arg type="network-interface:client-state-control-type" />
    </arguments>
  </method>

  <method name="setClientConfig">
    <description>
      This method can be used by clients to record the state of device's
      configuration. Both UUID and configuration origin are transferred.
    </description>
    <arguments>
      <arg type="network-interface:client-state-config-type" />
    </arguments>
  </method>

  <method name="setClientScripts">
    <description>
      Apply per interface scripts from configuration.
    </description>
    <arguments>
      <scripts type="scripts:configuration"/>
    </arguments>
  </method>

  <method name="linkMonitor">
    <description>
      This method sets up the device for monitoring, so that link status
      changes (for Ethernet interfaces) or changes in the wireless
      neighborhood (for Wireless interfaces) can be reported via
      signals.

      This method is primarily used by network-nanny.
    </description>
  </method>

  <!-- Signals emitted by this interface -->
  <signal name="deviceCreate">
    <description>
     This signal is emitted whenever a new device is created or discovered.
    </description>
  </signal>
  <signal name="deviceDelete">
    <description>
     This signal is emitted whenever a device is destroyed or otherwise disappeared from the system
     (for instance, by hot removal).
    </description>
  </signal>
  <signal name="deviceReady">
    <description>
      This signal is emitted whenever a new device is ready to use / configure,
      e.g. udev finished its rename work and the name is final.
    </description>
  </signal>
  <signal name="deviceRename">
    <description>
      This signal is emitted whenever the kernel emits newlink event and wickedd
      detects a rename of a device.
    </description>
  </signal>
  <signal name="deviceChange">
    <description>
      This generic signal is emitted whenever the kernel emits newlink event
      without any changes of the IFF_UP state flags of the device.
    </description>
  </signal>
  <signal name="deviceUp">
    <description>
     This signal is emitted whenever a device's IFF_UP flag is set.
    </description>
  </signal>
  <signal name="deviceDown">
    <description>
     This signal is emitted whenever a device's IFF_UP flag is cleared.
    </description>
  </signal>
  <signal name="linkUp">
    <description>
     This signal is emitted whenever a device completes link negotiation (ie when its IFF_UP and
     IFF_LOWER_UP flag is set)
    </description>
  </signal>
  <signal name="linkDown">
    <description>
     This signal is emitted whenever a device loses its link (ie when its IFF_UP and/or
     IFF_LOWER_UP flag is cleared).
    </description>
  </signal>
  <signal name="linkAssociated">
    <description>
     Emitted whenever a device (re-)associates with a different access point.
     Used by wireless devices.
    </description>
  </signal>
  <signal name="linkAssociationLost">
    <description>
     Emitted whenever a device loses its association with an access point.
    </description>
  </signal>
  <signal name="linkScanUpdated">
    <description>
     Emitted by wireless devices when a scan completed and the set of visible APs or
     networks changed.
    </description>
  </signal>
  <signal name="networkUp">
    <description>
     This signal shadows linkUp, and may be removed in the future.
    </description>
  </signal>
  <signal name="networkDown">
    <description>
     This signal shadows linkDown, and may be removed in the future.
    </description>
  </signal>
  <signal name="addressAcquired">
    <description>
     Emitted whenever an address was acquired through an addrconf service.

     Addrconf services like dhcp4 or dhcp6 are unable to grant a requested lease immediately.
     In response to a requestLease() call, they will return callback information containing
     a uuid, and the event name addressAcquired. Once the address negotiation with the DHCP
     server succeeds, wickedd will emit an addressAcquired event with the uuid specified in
     the callback info.

     If the DHCP supplicant is unable to obtain the requested lease, an addressDeferred is
     generated to trigger fallback actions and on final timeout addressLost instead.
    </description>
  </signal>
  <signal name="addressReleased">
    <description>
     Emitted whenever an address previously acquired through an addrconf service is released.

     Addrconf services like dhcp4 or dhcp6 should release their leases gracefully when the
     interface is taken down.
     In response to a dropLease() call, they will return callback information containing
     a uuid, and the event name addressReleased. Once the we have successfully informed
     the DHCP server and released the lease, wickedd will emit an addressReleased event with
     the uuid specified in the callback info.

     This signal is also emitted spontaneously when an addrconf service released a lease.
     For instance, if an interface is taken down manually using "ifconfig down", the DHCP
     supplicant will discard the lease it held for this interface, and subsequently,
     an addressReleased() event is emitted.
    </description>
  </signal>
  <signal name="addressDeferred">
    <description>
      Emitted whenever an addrconf service were unable to acquire lease inside the specified
      defer timeout to trigger fallback actions and addressLost on final acquire timeout.
    </description>
  </signal>
  <signal name="addressLost">
    <description>
      Emitted whenever an addrconf service failed to renew a previously acquired lease.
    </description>
  </signal>
</service>

<object-class name="managed-netif" base-class="netif"/>

<service name="managed-interface" interface="org.opensuse.Network.ManagedInterface" object-class="managed-netif">
  <signal name="progressInfo">
    <description>
      Emitted whenever an addrconf service failed to renew a previously acquired lease.
    </description>
  </signal>
</service>
