# Copyright (c) 2020 Project CHIP Authors
#
# 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.

import("//build_overrides/build.gni")
import("//build_overrides/chip.gni")
import("//build_overrides/nlassert.gni")
import("//build_overrides/nlfaultinjection.gni")
import("//build_overrides/nlio.gni")

import("${build_root}/chip/buildconfig_header.gni")
import("${build_root}/chip/tests.gni")
import("${chip_root}/src/lwip/lwip.gni")
import("${chip_root}/src/platform/device.gni")
import("inet.gni")

declare_args() {
  # Extra header to include in SystemConfig.h for project.
  chip_inet_project_config_include = ""
}

buildconfig_header("inet_buildconfig") {
  header = "InetBuildConfig.h"
  header_dir = "inet"

  defines = [
    "INET_CONFIG_TEST=${chip_build_tests}",
    "INET_CONFIG_ENABLE_IPV4=${chip_inet_config_enable_ipv4}",
    "INET_CONFIG_ENABLE_DNS_RESOLVER=${chip_inet_config_enable_dns_resolver}",
    "INET_CONFIG_ENABLE_ASYNC_DNS_SOCKETS=${chip_inet_config_enable_async_dns_sockets}",
    "INET_CONFIG_ENABLE_RAW_ENDPOINT=${chip_inet_config_enable_raw_endpoint}",
    "INET_CONFIG_ENABLE_TCP_ENDPOINT=${chip_inet_config_enable_tcp_endpoint}",
    "INET_CONFIG_ENABLE_UDP_ENDPOINT=${chip_inet_config_enable_udp_endpoint}",
    "HAVE_LWIP_RAW_BIND_NETIF=true",
  ]

  if (chip_inet_project_config_include != "") {
    defines +=
        [ "INET_PROJECT_CONFIG_INCLUDE=${chip_inet_project_config_include}" ]
  }
  if (chip_inet_platform_config_include != "") {
    defines +=
        [ "INET_PLATFORM_CONFIG_INCLUDE=${chip_inet_platform_config_include}" ]
  }
}

source_set("inet_config_header") {
  sources = [ "InetConfig.h" ]

  public_configs = [ "${chip_root}/src:includes" ]

  public_deps = [
    ":inet_buildconfig",
    "${chip_root}/src/system:system_config_header",
  ]
}

static_library("inet") {
  output_name = "libInetLayer"

  sources = [
    "EndPointBasis.cpp",
    "EndPointBasis.h",
    "IANAConstants.h",
    "IPAddress-StringFuncts.cpp",
    "IPAddress.cpp",
    "IPAddress.h",
    "IPEndPointBasis.cpp",
    "IPEndPointBasis.h",
    "IPPrefix.cpp",
    "IPPrefix.h",
    "Inet.h",
    "InetArgParser.cpp",
    "InetArgParser.h",
    "InetError.cpp",
    "InetError.h",
    "InetFaultInjection.h",
    "InetInterface.cpp",
    "InetInterface.h",
    "InetLayer.cpp",
    "InetLayer.h",
    "InetLayerBasis.cpp",
    "InetLayerBasis.h",
    "InetLayerEvents.h",
    "InetUtils.cpp",
    "arpa-inet-compatibility.h",
  ]

  public_deps = [
    ":inet_config_header",
    "${chip_root}/src/lib/support",
    "${chip_root}/src/system",
    "${nlio_root}:nlio",
  ]

  if (chip_with_lwip) {
    public_deps += [ "${chip_root}/src/lwip" ]
  }

  if (chip_inet_config_enable_raw_endpoint) {
    sources += [
      "RawEndPoint.cpp",
      "RawEndPoint.h",
    ]
  }

  if (chip_inet_config_enable_tcp_endpoint) {
    sources += [
      "TCPEndPoint.cpp",
      "TCPEndPoint.h",
    ]
  }

  if (chip_inet_config_enable_udp_endpoint) {
    sources += [
      "UDPEndPoint.cpp",
      "UDPEndPoint.h",
    ]
  }

  if (chip_inet_config_enable_dns_resolver) {
    sources += [
      "DNSResolver.cpp",
      "DNSResolver.h",
    ]
  }

  if (chip_inet_config_enable_async_dns_sockets) {
    sources += [
      "AsyncDNSResolverSockets.cpp",
      "AsyncDNSResolverSockets.h",
    ]
  }

  if (chip_with_nlfaultinjection) {
    sources += [ "InetFaultInjection.cpp" ]
    public_deps += [ "${nlfaultinjection_root}:nlfaultinjection" ]
  }

  cflags = [ "-Wconversion" ]

  include_dirs = []
  if (current_os == "android") {
    include_dirs += [
      "${chip_root}/third_party/android/platform-libcore/android-platform-libcore/luni/src/main/native",
      "${chip_root}/third_party/android/platform-libcore/android-platform-libcore/include",
    ]
  }
}
