load("@fbcode_macros//build_defs:cpp_library.bzl", "cpp_library")

oncall("secure_pipes")

cpp_library(
    name = "record",
    srcs = [
        "Types.cpp",
    ],
    headers = [
        "Extensions.h",
        "Extensions-inl.h",
        "Types.h",
        "Types-inl.h",
    ],
    exported_deps = [
        "//fizz/protocol:events",
        "//folly:conv",
        "//folly:optional",
        "//folly:string",
        "//folly/io:iobuf",
    ],
)

cpp_library(
    name = "record_layer",
    srcs = [
        "RecordLayer.cpp",
    ],
    headers = [
        "RecordLayer.h",
    ],
    exported_deps = [
        ":record",
        "//fizz/crypto/aead:aead",
        "//fizz/protocol:params",
        "//folly:optional",
        "//folly/io:iobuf",
    ],
)

cpp_library(
    name = "plaintext_record_layer",
    srcs = [
        "PlaintextRecordLayer.cpp",
    ],
    headers = [
        "PlaintextRecordLayer.h",
    ],
    deps = [
        "//folly:string",
    ],
    exported_deps = [
        ":record_layer",
    ],
)

cpp_library(
    name = "encrypted_record_layer",
    srcs = [
        "EncryptedRecordLayer.cpp",
    ],
    headers = [
        "EncryptedRecordLayer.h",
    ],
    deps = [
        "//fizz/crypto/aead:iobuf",
    ],
    exported_deps = [
        ":buf_and_padding_policy",
        ":record_layer",
        "//fizz/crypto/aead:aead",
    ],
)

cpp_library(
    name = "buf_and_padding_policy",
    srcs = [
        "BufAndPaddingPolicy.cpp",
    ],
    headers = [
        "BufAndPaddingPolicy.h",
    ],
    exported_deps = [
        ":record",
        "//folly/io:iobuf",
    ],
)
