Quellcodebibliothek Statistik Leitseite products/Sources/formale Sprachen/C/Android/tools/tools/rootcanal/   (Android Betriebssystem Version 17©)  Datei vom 26.5.2026 mit Größe 8 kB image not shown  

Quelle  BUILD.bazel   Sprache: unbekannt

 
Spracherkennung für: .bazel vermutete Sprache: Unknown {[0] [0] [0]} [Methode: Schwerpunktbildung, einfache Gewichte, sechs Dimensionen]

# Copyright 2025 - The Android Open Source Project
#
# Licensed under the Apache License, Version 2.0 (the',  help='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',  help='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.

"""rootcanal bazel build rule"""

load("@protobuf//bazel:cc_proto_library.bzl", "cc_proto_library")
load("@rules_cc//cc:cc_library.bzl", "cc_library")
load("@rules_proto//proto:defs.bzl", "proto_library")
load("@rules_rust//rust:defs.bzl", "rust_library")

exports_files([
    "packets/link_layer_packets.pdl",
    "proto/rootcanal/configuration.proto",
])

proto_library(
    name = "rootcanal-configuration-proto",
    srcs = [
        "proto/rootcanal/configuration.proto",
    ],
    strip_import_prefix = "proto",
    visibility = ["//visibility:public"],
)

cc_proto_library(
    name = "rootcanal_configuration_cc_proto",
    deps = [":rootcanal-configuration-proto"],
)

cc_library(
    name = "rootcanal_defaults",
    copts = [
        "-DGOOGLE_PROTOBUF_NO_RTTI",
        "-Wall",
        "-Werror",
        "-Wextra",
        "-fvisibility=hidden",
    ],
    includes = ["packages/modules/Bluetooth/tools/rootcanal/include"],
    local_defines = ["-std=c++20"],
)

cc_library(
    name = "lib_rootcanal_ffi",
    srcs = [
        "model/controller/ffi.cc",
        "model/controller/ffi.h",
    ],
    hdrs = ["rust/include/rootcanal_rs.h"],
    visibility = ["//visibility:public"],
    deps = [
        ":libbt-rootcanal",
        ":rootcanal_configuration_cc_proto",
        ":rootcanal_defaults",
        ":rootcanal_rs",
        "@boringssl//:crypto",
    ],
)

rust_library(
    name = "rootcanal_rs",
    srcs = glob(["rust/src/**/*.rs"]) + [
        ":hci_packets_rust_gen",
        ":ll_packets_rust_gen",
        ":llcp_packets_rust_gen",
        ":lmp_packets_rust_gen",
    ],
    edition = "2021",
    proc_macro_deps = ["@num-derive"],
    rustc_env = {"OUT_DIR": "../../packets"},
    visibility = ["//visibility:public"],
    deps = [
        "@bytes",
        "@num-bigint",
        "@num-integer",
        "@num-traits",
        "@pdl-runtime",
        "@pin-utils",
        "@rand",
        "@thiserror",
    ],
)

cc_library(
    name = "libbt-rootcanal",
    srcs = [
        "model/controller/acl_connection.cc",
        "model/controller/acl_connection.h",
        "model/controller/acl_connection_handler.cc",
        "model/controller/acl_connection_handler.h",
        "model/controller/bredr_controller.cc",
        "model/controller/bredr_controller.h",
        "model/controller/connection_handle.h",
        "model/controller/controller_properties.cc",
        "model/controller/controller_properties.h",
        "model/controller/dual_mode_controller.cc",
        "model/controller/dual_mode_controller.h",
        "model/controller/le_acl_connection.cc",
        "model/controller/le_acl_connection.h",
        "model/controller/le_advertiser.cc",
        "model/controller/le_advertiser.h",
        "model/controller/le_controller.cc",
        "model/controller/le_controller.h",
        "model/controller/le_cs_parameters.h",
        "model/controller/sco_connection.cc",
        "model/controller/sco_connection.h",
        "model/controller/vendor_commands/csr.h",
        "model/controller/vendor_commands/le_apcf.cc",
        "model/controller/vendor_commands/le_apcf.h",
        "model/devices/baseband_sniffer.cc",
        "model/devices/baseband_sniffer.h",
        "model/devices/beacon.cc",
        "model/devices/beacon.h",
        "model/devices/device.cc",
        "model/devices/device.h",
        "model/devices/hci_device.cc",
        "model/devices/hci_device.h",
        "model/devices/link_layer_socket_device.cc",
        "model/devices/link_layer_socket_device.h",
        "model/devices/sniffer.cc",
        "model/devices/sniffer.h",
        "model/hci/h4.h",
        "model/hci/h4_data_channel_packetizer.cc",
        "model/hci/h4_data_channel_packetizer.h",
        "model/hci/h4_parser.cc",
        "model/hci/h4_parser.h",
        "model/hci/hci_sniffer.cc",
        "model/hci/hci_sniffer.h",
        "model/hci/hci_socket_transport.cc",
        "model/hci/hci_socket_transport.h",
        "model/hci/hci_transport.h",
        "model/setup/async_manager.h",
        "model/setup/device_boutique.cc",
        "model/setup/device_boutique.h",
        "model/setup/phy_device.cc",
        "model/setup/phy_device.h",
        "model/setup/phy_layer.cc",
        "model/setup/phy_layer.h",
        "model/setup/test_channel_transport.cc",
        "model/setup/test_channel_transport.h",
        "model/setup/test_command_handler.cc",
        "model/setup/test_command_handler.h",
        "model/setup/test_model.cc",
        "model/setup/test_model.h",
        "net/async_data_channel.h",
        "net/async_data_channel_connector.h",
        "net/async_data_channel_server.h",
    ] + select({
        "@bazel_tools//src/conditions:windows": [],
        "//conditions:default": [
            "model/setup/async_manager.cc",
            "net/posix/posix_async_socket.cc",
            "net/posix/posix_async_socket.h",
            "net/posix/posix_async_socket_connector.cc",
            "net/posix/posix_async_socket_connector.h",
            "net/posix/posix_async_socket_server.cc",
            "net/posix/posix_async_socket_server.h",
        ],
    }),
    hdrs = ["rust/include/rootcanal_rs.h"],
    visibility = ["//visibility:public"],
    deps = [
        ":lib",
        ":rootcanal_configuration_cc_proto",
        ":rootcanal_rs",
    ],
)

cc_library(
    name = "lib",
    srcs = [
        "lib/crypto/crypto.cc",
        "lib/hci/address.cc",
        "lib/hci/pcap_filter.cc",
        "lib/log.cc",
    ],
    hdrs = [
        "include/crypto/crypto.h",
        "include/hci/address.h",
        "include/hci/address_with_type.h",
        "include/hci/pcap_filter.h",
        "include/log.h",
        "include/pcap.h",
        "include/phy.h",
    ],
    includes = ["include"],
    deps = [
        ":generated_headers",
        "@boringssl//:crypto",
        "@fmt",
    ],
)

cc_library(
    name = "generated_headers",
    hdrs = [
        ":rootcanal_bredr_bb_cxx_gen",
        ":rootcanal_hci_packets_cxx_gen",
        ":rootcanal_link_layer_packets_cxx_gen",
    ],
    deps = ["@pdl-compiler//:pdl_cxx_packet_runtime"],
)

genrule(
    name = "rootcanal_hci_packets_cxx_gen",
    srcs = ["packets/hci_packets.pdl"],
    outs = ["packets/hci_packets.h"],
    cmd = "set -o pipefail; $(location @pdl-compiler//:pdlc) $(SRCS) | $(location @pdl-compiler//:pdl_cxx_generator) --namespace bluetooth::hci --include-header hci/address.h --output $(OUTS)",
    tools = [
        "@pdl-compiler//:pdl_cxx_generator",
        "@pdl-compiler//:pdlc",
    ],
)

genrule(
    name = "rootcanal_link_layer_packets_cxx_gen",
    srcs = ["packets/link_layer_packets.pdl"],
    outs = ["packets/link_layer_packets.h"],
    cmd = "set -o pipefail; $(location @pdl-compiler//:pdlc) $(SRCS) | $(location @pdl-compiler//:pdl_cxx_generator) --namespace model::packets --include-header hci/address.h --using-namespace bluetooth::hci --output $(OUTS)",
    tools = [
        "@pdl-compiler//:pdl_cxx_generator",
        "@pdl-compiler//:pdlc",
    ],
)

genrule(
    name = "rootcanal_bredr_bb_cxx_gen",
    srcs = ["packets/bredr_bb_packets.pdl"],
    outs = ["packets/bredr_bb_packets.h"],
    cmd = "set -o pipefail; $(location @pdl-compiler//:pdlc) $(SRCS) | $(location @pdl-compiler//:pdl_cxx_generator) --namespace bredr_bb --include-header hci/address.h --using-namespace bluetooth::hci --output $(OUTS)",
    tools = [
        "@pdl-compiler//:pdl_cxx_generator",
        "@pdl-compiler//:pdlc",
    ],
)

genrule(
    name = "hci_packets_rust_gen",
    srcs = ["packets/hci_packets.pdl"],
    outs = ["packets/hci_packets.rs"],
    cmd = "$(location @pdl-compiler//:pdlc) --output-format rust $(SRCS) > $(OUTS)",
    tools = ["@pdl-compiler//:pdlc"],
)

genrule(
    name = "lmp_packets_rust_gen",
    srcs = ["rust/lmp_packets.pdl"],
    outs = ["packets/lmp_packets.rs"],
    cmd = "$(location @pdl-compiler//:pdlc) --output-format rust $(SRCS) > $(OUTS)",
    tools = ["@pdl-compiler//:pdlc"],
)

genrule(
    name = "llcp_packets_rust_gen",
    srcs = ["rust/llcp_packets.pdl"],
    outs = ["packets/llcp_packets.rs"],
    cmd = "$(location @pdl-compiler//:pdlc) --output-format rust $(SRCS) > $(OUTS)",
    tools = ["@pdl-compiler//:pdlc"],
)

genrule(
    name = "ll_packets_rust_gen",
    srcs = ["packets/link_layer_packets.pdl"],
    outs = ["packets/link_layer_packets.rs"],
    cmd = "$(location @pdl-compiler//:pdlc) --output-format rust $(SRCS) > $(OUTS)",
    tools = ["@pdl-compiler//:pdlc"],
)

[Dauer der Verarbeitung: 0.14 Sekunden, vorverarbeitet 2026-06-27]