load("@fbcode//quic:defs.bzl", "mvfst_cpp_library")

oncall("traffic_protocols")

mvfst_cpp_library(
    name = "client",
    srcs = [
        "QuicClientTransport.cpp",
    ],
    headers = [
        "QuicClientTransport.h",
    ],
    deps = [
        "//folly:string",
        "//quic/common:mvfst_logging",
        "//quic/happyeyeballs:happyeyeballs",
        "//quic/loss:loss",
    ],
    exported_deps = [
        ":client_lite",
        "//quic/api:transport",
        "//quic/common:expected",
    ],
)

mvfst_cpp_library(
    name = "client_lite",
    srcs = [
        "QuicClientTransportLite.cpp",
    ],
    headers = [
        "QuicClientTransportLite.h",
    ],
    deps = [
        ":client_extension",
        "//folly/portability:sockets",
        "//quic:constants",
        "//quic/api:loop_detector_callback",
        "//quic/api:transport_helpers",
        "//quic/common:mvfst_logging",
        "//quic/common:string_utils",
        "//quic/congestion_control:congestion_controller_factory",
        "//quic/fizz/client/handshake:token_cache",
        "//quic/flowcontrol:flow_control",
        "//quic/handshake:handshake",
        "//quic/happyeyeballs:happyeyeballs",
        "//quic/logging:qlogger_constants",
        "//quic/logging:qlogger_macros",
        "//quic/loss:loss",
        "//quic/state:ack_handler",
        "//quic/state:datagram_handler",
        "//quic/state:pacing_functions",
        "//quic/state:simple_frame_functions",
        "//quic/state/stream:stream",
    ],
    exported_deps = [
        ":state_and_handshake",
        "//folly:random",
        "//folly/io:socket_option_map",
        "//folly/net:net_ops",
        "//quic/api:transport_lite",
        "//quic/common:buf_accessor",
        "//quic/common:buf_util",
        "//quic/common:expected",
        "//quic/common:mvfst_check",
        "//quic/common/udpsocket:quic_async_udp_socket",
        "//quic/observer:socket_observer_macros",
        "//quic/state:quic_connection_stats",
    ],
)

mvfst_cpp_library(
    name = "state_and_handshake",
    srcs = [
        "handshake/ClientHandshake.cpp",
        "state/ClientStateMachine.cpp",
    ],
    headers = [
        "handshake/ClientHandshake.h",
        "handshake/ClientHandshakeFactory.h",
        "state/ClientStateMachine.h",
    ],
    deps = [
        ":cached_server_tp",
        ":client_extension",
        "//quic/codec:decode",
        "//quic/codec:types",
        "//quic/common:mvfst_logging",
        "//quic/common:time_util",
        "//quic/congestion_control:congestion_controller_factory",
        "//quic/logging:qlogger_macros",
        "//quic/loss:loss",
        "//quic/state:stream_functions",
    ],
    exported_deps = [
        "//fizz/protocol:certificate_base",
        "//folly:exception_wrapper",
        "//folly/io/async:delayed_destruction",
        "//quic:constants",
        "//quic:exception",
        "//quic/common:expected",
        "//quic/common:network_data",
        "//quic/common/udpsocket:quic_async_udp_socket",
        "//quic/congestion_control:cubic",
        "//quic/flowcontrol:flow_control",
        "//quic/handshake:aead",
        "//quic/handshake:handshake",
        "//quic/handshake:transport_parameters",
        "//quic/state:quic_state_machine",
        "//quic/state:state_functions",
    ],
)

mvfst_cpp_library(
    name = "client_extension",
    headers = [
        "handshake/ClientTransportParametersExtension.h",
    ],
    exported_deps = [
        "//quic:exception",
        "//quic/common:expected",
        "//quic/handshake:transport_parameters",
    ],
)

mvfst_cpp_library(
    name = "cached_server_tp",
    headers = [
        "handshake/CachedServerTransportParameters.h",
    ],
    exported_deps = [
        "//quic:constants",
    ],
)

mvfst_cpp_library(
    name = "cached_server_tp_serialization",
    srcs = [
        "handshake/CachedServerTransportParametersSerialization.cpp",
    ],
    headers = [
        "handshake/CachedServerTransportParametersSerialization.h",
    ],
    deps = [
        "//fizz/record:record",
        "//fizz/util:status",
    ],
    exported_deps = [
        ":cached_server_tp",
        "//folly:range",
        "//folly/io:iobuf",
    ],
)

mvfst_cpp_library(
    name = "client_async_transport",
    srcs = [
        "QuicClientAsyncTransport.cpp",
    ],
    headers = [
        "QuicClientAsyncTransport.h",
    ],
    deps = [
        "//folly/debugging/symbolizer:symbolizer",
        "//quic/common:mvfst_logging",
    ],
    exported_deps = [
        "//quic/api:stream_async_transport",
        "//quic/client:client",
    ],
)
