Skip to content

Commit

Permalink
Factor out secure channel type definitions into a separate static lib…
Browse files Browse the repository at this point in the history
…rary. (#28248)

This allows us to get rid of circular includes.
  • Loading branch information
bzbarsky-apple authored and pull[bot] committed Dec 28, 2023
1 parent f02ba68 commit 1235756
Show file tree
Hide file tree
Showing 7 changed files with 31 additions and 15 deletions.
1 change: 1 addition & 0 deletions src/credentials/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,7 @@ static_library("credentials") {
"${chip_root}/src/lib/core",
"${chip_root}/src/lib/support",
"${chip_root}/src/platform",
"${chip_root}/src/protocols:type_definitions",
"${nlassert_root}:nlassert",
]
}
Expand Down
1 change: 1 addition & 0 deletions src/lib/format/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@ source_set("protocol-decoder") {
":tlv-metadata-headers",
"${chip_root}/src/lib/core",
"${chip_root}/src/lib/support",
"${chip_root}/src/protocols:type_definitions",
]

public_configs = [ "${chip_root}/src:includes" ]
Expand Down
1 change: 1 addition & 0 deletions src/messaging/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@ static_library("messaging") {
"${chip_root}/src/lib/core",
"${chip_root}/src/lib/support",
"${chip_root}/src/platform",
"${chip_root}/src/protocols/secure_channel:type_definitions",
"${chip_root}/src/transport",
"${chip_root}/src/transport/raw",
]
Expand Down
6 changes: 6 additions & 0 deletions src/protocols/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,10 @@

import("//build_overrides/chip.gni")

source_set("type_definitions") {
sources = [ "Protocols.h" ]
}

static_library("protocols") {
output_name = "libChipProtocols"

Expand All @@ -35,6 +39,7 @@ static_library("protocols") {

public_deps = [
":im_status",
":type_definitions",
"${chip_root}/src/lib/core",
"${chip_root}/src/lib/support",
"${chip_root}/src/messaging",
Expand All @@ -52,6 +57,7 @@ static_library("im_status") {
cflags = [ "-Wconversion" ]

public_deps = [
":type_definitions",
"${chip_root}/src/lib/core",
"${chip_root}/src/lib/support",
]
Expand Down
35 changes: 20 additions & 15 deletions src/protocols/secure_channel/BUILD.gn
Original file line number Diff line number Diff line change
@@ -1,5 +1,24 @@
import("//build_overrides/chip.gni")

static_library("type_definitions") {
output_name = "libSecureChannelTypes"

sources = [
"Constants.h",
"StatusReport.cpp",
"StatusReport.h",
]

cflags = [ "-Wconversion" ]

public_deps = [
"${chip_root}/src/protocols:type_definitions",
"${chip_root}/src/system",
]

deps = [ "${chip_root}/src/lib/support" ]
}

static_library("secure_channel") {
output_name = "libSecureChannel"

Expand All @@ -10,7 +29,6 @@ static_library("secure_channel") {
"CASEServer.h",
"CASESession.cpp",
"CASESession.h",
"Constants.h",
"DefaultSessionResumptionStorage.cpp",
"DefaultSessionResumptionStorage.h",
"PASESession.cpp",
Expand All @@ -24,15 +42,14 @@ static_library("secure_channel") {
"SessionResumptionStorage.h",
"SimpleSessionResumptionStorage.cpp",
"SimpleSessionResumptionStorage.h",
"StatusReport.cpp",
"StatusReport.h",
"UnsolicitedStatusHandler.cpp",
"UnsolicitedStatusHandler.h",
]

cflags = [ "-Wconversion" ]

public_deps = [
":type_definitions",
"${chip_root}/src/lib/core",
"${chip_root}/src/lib/support",
"${chip_root}/src/messaging",
Expand All @@ -41,16 +58,4 @@ static_library("secure_channel") {
"${chip_root}/src/tracing:macros",
"${chip_root}/src/transport",
]

# secure channel requires messaging so it can send messages (e.g. for
# CASE/PASE handshakes). messaging requires secure channel so that it can do
# things like send standalone acks, which are a secure channel concept.
#
# secure channel requires transport so it can deal with sessions. transport
# requires secure channel so it can detect control messages, which are a
# secure channel concept.
allow_circular_includes_from = [
"${chip_root}/src/messaging",
"${chip_root}/src/transport",
]
}
1 change: 1 addition & 0 deletions src/setup_payload/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ source_set("additional_data_payload") {
"${chip_root}/src/crypto",
"${chip_root}/src/lib/core",
"${chip_root}/src/lib/support",
"${chip_root}/src/protocols:type_definitions",
"${chip_root}/src/setup_payload:additional_data_payload_buildconfig",
]
}
Expand Down
1 change: 1 addition & 0 deletions src/transport/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@ static_library("transport") {
"${chip_root}/src/lib/dnssd",
"${chip_root}/src/lib/support",
"${chip_root}/src/platform",
"${chip_root}/src/protocols/secure_channel:type_definitions",
"${chip_root}/src/setup_payload",
"${chip_root}/src/tracing",
"${chip_root}/src/tracing:macros",
Expand Down

0 comments on commit 1235756

Please sign in to comment.