load("@rules_cc//cc:cc_library.bzl", "cc_library")

package(
    default_visibility = [
        "@//:android_cuttlefish",
    ],
)

cc_library(
    name = "libwebsockets",
    srcs = [
        "lib/abstract/private-lib-abstract.h",
        "lib/abstract/protocols/smtp/private-lib-abstract-protocols-smtp.h",
        "lib/core-net/adopt.c",
        "lib/core-net/client/client.c",
        "lib/core-net/client/conmon.c",
        "lib/core-net/client/connect.c",
        "lib/core-net/client/connect2.c",
        "lib/core-net/client/connect3.c",
        "lib/core-net/client/connect4.c",
        "lib/core-net/client/sort-dns.c",
        "lib/core-net/close.c",
        "lib/core-net/dummy-callback.c",
        "lib/core-net/network.c",
        "lib/core-net/output.c",
        "lib/core-net/pollfd.c",
        "lib/core-net/private-lib-core-net.h",
        "lib/core-net/service.c",
        "lib/core-net/sorted-usec-list.c",
        "lib/core-net/state.c",
        "lib/core-net/vhost.c",
        "lib/core-net/wsi.c",
        "lib/core-net/wsi-timeout.c",
        "lib/core/alloc.c",
        "lib/core/buflist.c",
        "lib/core/context.c",
        "lib/core/libwebsockets.c",
        "lib/core/logs.c",
        "lib/core/lws_dll2.c",
        "lib/core/lws_map.c",
        "lib/core/private-lib-core.h",
        "lib/core/vfs.c",
        "lib/cose/private-lib-cose.h",
        "lib/drivers/devices/display/ili9341.h",
        "lib/drivers/devices/display/ssd1306.h",
        "lib/drivers/led/private-lib-drivers-led.h",
        "lib/event-libs/glib/private-lib-event-libs-glib.h",
        "lib/event-libs/libev/private-lib-event-libs-libev.h",
        "lib/event-libs/libevent/private-lib-event-libs-libevent.h",
        "lib/event-libs/libuv/private-lib-event-libs-libuv.h",
        "lib/event-libs/poll/poll.c",
        "lib/event-libs/poll/private-lib-event-libs-poll.h",
        "lib/event-libs/private-lib-event-libs.h",
        "lib/event-libs/sdevent/private-lib-event-libs-sdevent.h",
        "lib/event-libs/uloop/private-lib-event-libs-uloop.h",
        "lib/jose/jwe/private-lib-jose-jwe.h",
        "lib/jose/jws/private-lib-jose-jws.h",
        "lib/jose/private-lib-jose.h",
        "lib/misc/base64-decode.c",
        "lib/misc/cache-ttl/file.c",
        "lib/misc/cache-ttl/heap.c",
        "lib/misc/cache-ttl/lws-cache-ttl.c",
        "lib/misc/cache-ttl/private-lib-misc-cache-ttl.h",
        "lib/misc/dir.c",
        "lib/misc/fts/private-lib-misc-fts.h",
        "lib/misc/getifaddrs.h",
        "lib/misc/lejp.c",
        "lib/misc/lws-ring.c",
        "lib/misc/lwsac/cached-file.c",
        "lib/misc/lwsac/lwsac.c",
        "lib/misc/lwsac/private-lib-misc-lwsac.h",
        "lib/misc/prng.c",
        "lib/misc/romfs.h",
        "lib/misc/sha-1.c",
        "lib/plat/freertos/esp32/drivers/lws-plat-gpio.h",
        "lib/plat/freertos/private-lib-plat-freertos.h",
        "lib/plat/optee/private-lib-plat-optee.h",
        "lib/plat/unix/private-lib-plat-unix.h",
        "lib/plat/unix/unix-caps.c",
        "lib/plat/unix/unix-fds.c",
        "lib/plat/unix/unix-file.c",
        "lib/plat/unix/unix-init.c",
        "lib/plat/unix/unix-misc.c",
        "lib/plat/unix/unix-pipe.c",
        "lib/plat/unix/unix-service.c",
        "lib/plat/unix/unix-sockets.c",
        "lib/plat/windows/private-lib-plat-windows.h",
        "lib/roles/cgi/private-lib-roles-cgi.h",
        "lib/roles/dbus/private-lib-roles-dbus.h",
        "lib/roles/h1/ops-h1.c",
        "lib/roles/h1/private-lib-roles-h1.h",
        "lib/roles/h2/hpack.c",
        "lib/roles/h2/http2.c",
        "lib/roles/h2/huftable.h",
        "lib/roles/h2/ops-h2.c",
        "lib/roles/h2/private-lib-roles-h2.h",
        "lib/roles/http/client/client-http.c",
        "lib/roles/http/compression/private-lib-roles-http-compression.h",
        "lib/roles/http/cookie.c",
        "lib/roles/http/date.c",
        "lib/roles/http/header.c",
        "lib/roles/http/lextable.h",
        "lib/roles/http/lextable-strings.h",
        "lib/roles/http/parsers.c",
        "lib/roles/http/private-lib-roles-http.h",
        "lib/roles/http/server/lejp-conf.c",
        "lib/roles/http/server/lws-spa.c",
        "lib/roles/http/server/server.c",
        "lib/roles/listen/ops-listen.c",
        "lib/roles/mqtt/private-lib-roles-mqtt.h",
        "lib/roles/pipe/ops-pipe.c",
        "lib/roles/private-lib-roles.h",
        "lib/roles/raw-file/ops-raw-file.c",
        "lib/roles/raw-proxy/private-lib-roles-raw-proxy.h",
        "lib/roles/raw-skt/ops-raw-skt.c",
        "lib/roles/ws/client-parser-ws.c",
        "lib/roles/ws/client-ws.c",
        "lib/roles/ws/ext/extension-permessage-deflate.h",
        "lib/roles/ws/ops-ws.c",
        "lib/roles/ws/private-lib-roles-ws.h",
        "lib/roles/ws/server-ws.c",
        "lib/secure-streams/private-lib-secure-streams.h",
        "lib/system/async-dns/private-lib-async-dns.h",
        "lib/system/dhcpclient/private-lib-system-dhcpclient.h",
        "lib/system/fault-injection/private-lib-system-fault-injection.h",
        "lib/system/metrics/private-lib-system-metrics.h",
        "lib/system/smd/private-lib-system-smd.h",
        "lib/system/smd/smd.c",
        "lib/system/system.c",
        "lib/tls/mbedtls/private-lib-tls-mbedtls.h",
        "lib/tls/mbedtls/wrapper/include/internal/ssl3.h",
        "lib/tls/mbedtls/wrapper/include/internal/ssl_cert.h",
        "lib/tls/mbedtls/wrapper/include/internal/ssl_code.h",
        "lib/tls/mbedtls/wrapper/include/internal/ssl_dbg.h",
        "lib/tls/mbedtls/wrapper/include/internal/ssl_lib.h",
        "lib/tls/mbedtls/wrapper/include/internal/ssl_methods.h",
        "lib/tls/mbedtls/wrapper/include/internal/ssl_pkey.h",
        "lib/tls/mbedtls/wrapper/include/internal/ssl_stack.h",
        "lib/tls/mbedtls/wrapper/include/internal/ssl_types.h",
        "lib/tls/mbedtls/wrapper/include/internal/ssl_x509.h",
        "lib/tls/mbedtls/wrapper/include/internal/tls1.h",
        "lib/tls/mbedtls/wrapper/include/internal/x509_vfy.h",
        "lib/tls/mbedtls/wrapper/include/openssl/ssl.h",
        "lib/tls/mbedtls/wrapper/include/platform/ssl_pm.h",
        "lib/tls/mbedtls/wrapper/include/platform/ssl_port.h",
        "lib/tls/openssl/openssl-client.c",
        "lib/tls/openssl/openssl-server.c",
        "lib/tls/openssl/openssl-session.c",
        "lib/tls/openssl/openssl-ssl.c",
        "lib/tls/openssl/openssl-tls.c",
        "lib/tls/openssl/openssl-x509.c",
        "lib/tls/openssl/private-lib-tls-openssl.h",
        "lib/tls/private-jit-trust.h",
        "lib/tls/private-lib-tls.h",
        "lib/tls/private-network.h",
        "lib/tls/tls.c",
        "lib/tls/tls-client.c",
        "lib/tls/tls-network.c",
        "lib/tls/tls-server.c",
        "lib/tls/tls-sessions.c",
        "plugins/ssh-base/crypto/fe25519.h",
        "plugins/ssh-base/crypto/ge25519.h",
        "plugins/ssh-base/crypto/sc25519.h",
        "plugins/ssh-base/include/lws-plugin-ssh.h",
        "plugins/ssh-base/include/lws-plugin-sshd-static-build-includes.h",
        "plugins/ssh-base/include/lws-ssh.h",
    ],
    hdrs = glob(["include/**/*.h"]),
    includes = [
        "include",
        "lib",
        "lib/abstract",
        "lib/abstract",
        "lib/core",
        "lib/core-net",
        "lib/event-libs",
        "lib/event-libs/glib",
        "lib/event-libs/libev",
        "lib/event-libs/libevent",
        "lib/event-libs/libuv",
        "lib/event-libs/poll",
        "lib/jose",
        "lib/jose/jwe",
        "lib/jose/jws",
        "lib/misc",
        "lib/plat/unix",
        "lib/roles",
        "lib/roles/cgi",
        "lib/roles/dbus",
        "lib/roles/h1",
        "lib/roles/h2",
        "lib/roles/http",
        "lib/roles/http/compression",
        "lib/roles/mqtt",
        "lib/roles/raw-proxy",
        "lib/roles/ws",
        "lib/system/async-dns",
        "lib/system/metrics",
        "lib/system/smd",
        "lib/tls",
        "plugins",
    ],
    deps = [
        "@//build_external/libwebsockets:libwebsockets_config",
        "@boringssl//:crypto",
        "@boringssl//:ssl",
    ],
)
