content: /*
   * Copyright (C) 2023 The Android Open Source Project
   *
   * Licensed under the Apache License, Version 2.0 (the "License");
   * you may not use this file except in compliance with the License.
   * You may obtain a copy of the License at
   *
   *      http://www.apache.org/licenses/LICENSE-2.0
   *
   * Unless required by applicable law or agreed to in writing, software
   * distributed under the License is distributed on an "AS IS" BASIS,
   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
   * See the License for the specific language governing permissions and
   * limitations under the License.
   */
  
  package android.net.nsd;
  import java.lang.annotation.Retention;
  import java.lang.annotation.RetentionPolicy;
  
  /**
   * OffloadEngine is an interface for mDns hardware offloading.
   *
   * An offloading engine can interact with the firmware code to instruct the hardware to
   * offload some of mDns network traffic before it reached android OS. This can improve the
   * power consumption performance of the host system by not always waking up the OS to handle
   * the mDns packet when the device is in low power mode.
   *
   * @hide
   */
  public interface OffloadEngine {
      /**
       * Indicates that the OffloadEngine can generate replies to mDns queries.
       *
       * @see OffloadServiceInfo#getOffloadPayload()
       */
      int OFFLOAD_TYPE_REPLY = 1;
      /**
       * Indicates that the OffloadEngine can filter and drop mDns queries.
       */
      int OFFLOAD_TYPE_FILTER_QUERIES = 1 << 1;
      /**
       * Indicates that the OffloadEngine can filter and drop mDns replies. It can allow mDns packets
       * to be received even when no app holds a {@link android.net.wifi.WifiManager.MulticastLock}.
       */
      int OFFLOAD_TYPE_FILTER_REPLIES = 1 << 2;
  
      /**
       * Indicates that the OffloadEngine can bypass multicast lock.
       */
      int OFFLOAD_CAPABILITY_BYPASS_MULTICAST_LOCK = 1;
  
      /**
       * @hide
       */
      @Retention(RetentionPolicy.SOURCE)
      @interface OffloadType {}
  
      /**
       * @hide
       */
      @Retention(RetentionPolicy.SOURCE)
      @interface OffloadCapability {}
  
      /**
       * To be called when the OffloadServiceInfo is added or updated.
       *
       * @param info The OffloadServiceInfo to add or update.
       */
      void onOffloadServiceUpdated(OffloadServiceInfo info);
  
      /**
       * To be called when the OffloadServiceInfo is removed.
       *
       * @param info The OffloadServiceInfo to remove.
       */
      void onOffloadServiceRemoved(OffloadServiceInfo info);
  }