Skip to content

Commit

Permalink
Use AddressResolve in CASE (#15934)
Browse files Browse the repository at this point in the history
* Squash merge: use address resolve for case

* Add dependencies to compile on darwin (using xcode)

* Updates for ESP32 compile: ensure the address resolve impl header is defined everywhere

* Working through fixing Cirque.

Fixes:
  - add proper CloseSession instead of a 'establish then close' since
    address resolve is not instant anymore
  - added retries and timeouts during the resolve test (since resolve
    may take a while)
  - Made GetPeerAddress to NOT rely exclusively on the dns cache and
    added a TODO to fix it
  - removed noisy logging for node resolution (address resolver also
    logs)
  - added extra logging to figure out what we connect to during CASE
    session establishment.

Still not fully passing, but progress

* Restyle

* Fix compile, address code review comments

* Add back node id resolve logging on progress

* Add comment that CloseSession is TEMPORARY

* Restyle

* Fix double-free during CASE session cleanup (cleanup methods do case cleanup)

* Add ordering issue on freeing commissionee to fix use after free error

* Update comment: I did test both negative test cases under valgrind

* Apply suggestions from code review

* Apply suggestions from code review

* Fix potential use-after-free issue in OperationalDeviceProxy::HandleCASEConnected.

Co-authored-by: Boris Zbarsky <[email protected]>
  • Loading branch information
2 people authored and pull[bot] committed Apr 1, 2022
1 parent e27aa32 commit 1145924
Show file tree
Hide file tree
Showing 46 changed files with 448 additions and 301 deletions.
6 changes: 3 additions & 3 deletions .github/workflows/examples-cyw30739.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ jobs:
run: |
./scripts/run_in_build_env.sh \
"./scripts/build/build_examples.py \
--target-glob 'cyw30739-cyw930739m2evb_01-{light,lock,ota-requestor}' \
--target-glob 'cyw30739-cyw930739m2evb_01-{light,lock,ota-requestor-no-progress-logging}' \
build \
--copy-artifacts-to out/artifacts \
"
Expand All @@ -89,8 +89,8 @@ jobs:
timeout-minutes: 5
run: |
.environment/pigweed-venv/bin/python3 scripts/tools/memory/gh_sizes.py \
cyw30739 cyw930739m2evb_01 ota-requestor \
out/artifacts/cyw30739-cyw930739m2evb_01-ota-requestor/chip-cyw30739-ota-requestor-example.elf \
cyw30739 cyw930739m2evb_01 ota-requestor-no-progress-logging \
out/artifacts/cyw30739-cyw930739m2evb_01-ota-requestor-no-progress-logging/chip-cyw30739-ota-requestor-example.elf \
/tmp/bloat_reports/
- name: Uploading Size Reports
uses: actions/upload-artifact@v2
Expand Down
3 changes: 3 additions & 0 deletions examples/all-clusters-app/esp32/main/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,9 @@ idf_component_register(PRIV_INCLUDE_DIRS ${PRIV_INCLUDE_DIRS_LIST}

set_property(TARGET ${COMPONENT_LIB} PROPERTY CXX_STANDARD 17)
target_compile_options(${COMPONENT_LIB} PRIVATE "-DLWIP_IPV6_SCOPES=0" "-DCHIP_HAVE_CONFIG_H")
target_compile_options(${COMPONENT_LIB} PUBLIC
"-DCHIP_ADDRESS_RESOLVE_IMPL_INCLUDE_HEADER=<lib/address_resolve/AddressResolve_DefaultImpl.h>"
)

if (CONFIG_ENABLE_PW_RPC)

Expand Down
5 changes: 4 additions & 1 deletion examples/bridge-app/esp32/main/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ idf_component_register(PRIV_INCLUDE_DIRS
"${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/src/app/clusters/localization-configuration-server"
"${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/src/app/clusters/time-format-localization-server"
"${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/src/app/clusters/fixed-label-server"
"${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/src/app/clusters/user-label-server"
"${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/src/app/clusters/user-label-server"
"${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/src/app/clusters/thread-network-diagnostics-server"
"${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/src/app/clusters/wifi-network-diagnostics-server"
"${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/src/app/clusters/software-diagnostics-server"
Expand All @@ -52,3 +52,6 @@ idf_component_register(PRIV_INCLUDE_DIRS

set_property(TARGET ${COMPONENT_LIB} PROPERTY CXX_STANDARD 14)
target_compile_options(${COMPONENT_LIB} PRIVATE "-DLWIP_IPV6_SCOPES=0" "-DCHIP_HAVE_CONFIG_H")
target_compile_options(${COMPONENT_LIB} PUBLIC
"-DCHIP_ADDRESS_RESOLVE_IMPL_INCLUDE_HEADER=<lib/address_resolve/AddressResolve_DefaultImpl.h>"
)
4 changes: 4 additions & 0 deletions examples/lighting-app/esp32/main/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -64,3 +64,7 @@ idf_component_register(PRIV_INCLUDE_DIRS

set_property(TARGET ${COMPONENT_LIB} PROPERTY CXX_STANDARD 17)
target_compile_options(${COMPONENT_LIB} PRIVATE "-DLWIP_IPV6_SCOPES=0" "-DCHIP_HAVE_CONFIG_H")
target_compile_options(${COMPONENT_LIB} PUBLIC
"-DCHIP_ADDRESS_RESOLVE_IMPL_INCLUDE_HEADER=<lib/address_resolve/AddressResolve_DefaultImpl.h>"
)

5 changes: 5 additions & 0 deletions examples/lighting-app/telink/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,11 @@ target_include_directories(app PRIVATE
${NLIO_ROOT}
${TELINK_COMMON}/util/include
${TELINK_COMMON}/app/include)

add_definitions(
"-DCHIP_ADDRESS_RESOLVE_IMPL_INCLUDE_HEADER=<lib/address_resolve/AddressResolve_DefaultImpl.h>"
)

# TODO - re-use chip_data_model.cmake to add cluster implementations.
target_sources(app PRIVATE
src/AppTask.cpp
Expand Down
3 changes: 3 additions & 0 deletions examples/lock-app/esp32/main/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -176,5 +176,8 @@ idf_component_register(PRIV_INCLUDE_DIRS

set_property(TARGET ${COMPONENT_LIB} PROPERTY CXX_STANDARD 17)
target_compile_options(${COMPONENT_LIB} PRIVATE "-DLWIP_IPV6_SCOPES=0" "-DCHIP_HAVE_CONFIG_H")
target_compile_options(${COMPONENT_LIB} PUBLIC
"-DCHIP_ADDRESS_RESOLVE_IMPL_INCLUDE_HEADER=<lib/address_resolve/AddressResolve_DefaultImpl.h>"
)

endif (CONFIG_ENABLE_PW_RPC)
11 changes: 7 additions & 4 deletions examples/ota-provider-app/esp32/main/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -38,13 +38,13 @@ idf_component_register(PRIV_INCLUDE_DIRS
"${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/src/app/clusters/localization-configuration-server"
"${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/src/app/clusters/time-format-localization-server"
"${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/src/app/clusters/fixed-label-server"
"${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/src/app/clusters/user-label-server"
"${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/src/app/clusters/user-label-server"
"${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/src/app/clusters/thread-network-diagnostics-server"
"${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/src/app/clusters/wifi-network-diagnostics-server"
"${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/src/app/clusters/software-diagnostics-server"
"${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/src/app/clusters/switch-server"
"${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/src/app/clusters/general-diagnostics-server"
"${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/src/app/clusters/group-key-mgmt-server"
"${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/src/app/clusters/general-diagnostics-server"
"${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/src/app/clusters/group-key-mgmt-server"
"${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/src/app/clusters/general-commissioning-server"
"${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/src/app/clusters/network-commissioning"
"${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/src/app/clusters/operational-credentials-server"
Expand All @@ -56,5 +56,8 @@ idf_component_register(PRIV_INCLUDE_DIRS
PRIV_REQUIRES chip QRCode bt console spiffs)

spiffs_create_partition_image(img_storage ../spiffs_image FLASH_IN_PROJECT)
set_property(TARGET ${COMPONENT_LIB} PROPERTY CXX_STANDARD 14)
set_property(TARGET ${COMPONENT_LIB} PROPERTY CXX_STANDARD 14)
target_compile_options(${COMPONENT_LIB} PRIVATE "-DLWIP_IPV6_SCOPES=0" "-DCHIP_HAVE_CONFIG_H")
target_compile_options(${COMPONENT_LIB} PUBLIC
"-DCHIP_ADDRESS_RESOLVE_IMPL_INCLUDE_HEADER=<lib/address_resolve/AddressResolve_DefaultImpl.h>"
)
13 changes: 8 additions & 5 deletions examples/ota-requestor-app/esp32/main/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -36,20 +36,23 @@ idf_component_register(PRIV_INCLUDE_DIRS
"${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/src/app/clusters/diagnostic-logs-server"
"${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/src/app/clusters/ethernet-network-diagnostics-server"
"${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/src/app/clusters/localization-configuration-server"
"${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/src/app/clusters/time-format-localization-server"
"${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/src/app/clusters/time-format-localization-server"
"${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/src/app/clusters/fixed-label-server"
"${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/src/app/clusters/user-label-server"
"${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/src/app/clusters/user-label-server"
"${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/src/app/clusters/thread-network-diagnostics-server"
"${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/src/app/clusters/wifi-network-diagnostics-server"
"${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/src/app/clusters/software-diagnostics-server"
"${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/src/app/clusters/switch-server"
"${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/src/app/clusters/general-diagnostics-server"
"${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/src/app/clusters/group-key-mgmt-server"
"${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/src/app/clusters/general-diagnostics-server"
"${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/src/app/clusters/group-key-mgmt-server"
"${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/src/app/clusters/general-commissioning-server"
"${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/src/app/clusters/network-commissioning"
"${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/src/app/clusters/operational-credentials-server"
"${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/src/app/clusters/ota-requestor"
PRIV_REQUIRES chip QRCode bt console app_update)

set_property(TARGET ${COMPONENT_LIB} PROPERTY CXX_STANDARD 14)
set_property(TARGET ${COMPONENT_LIB} PROPERTY CXX_STANDARD 14)
target_compile_options(${COMPONENT_LIB} PRIVATE "-DLWIP_IPV6_SCOPES=0" "-DCHIP_HAVE_CONFIG_H")
target_compile_options(${COMPONENT_LIB} PUBLIC
"-DCHIP_ADDRESS_RESOLVE_IMPL_INCLUDE_HEADER=<lib/address_resolve/AddressResolve_DefaultImpl.h>"
)
2 changes: 1 addition & 1 deletion examples/persistent-storage/esp32/main/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
# limitations under the License.
#

idf_component_register(PRIV_INCLUDE_DIRS
idf_component_register(PRIV_INCLUDE_DIRS
"${CMAKE_CURRENT_LIST_DIR}"
"${CMAKE_SOURCE_DIR}/.."
SRC_DIRS
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,9 @@ idf_component_register(PRIV_INCLUDE_DIRS ${PRIV_INCLUDE_DIRS_LIST}

set_property(TARGET ${COMPONENT_LIB} PROPERTY CXX_STANDARD 17)
target_compile_options(${COMPONENT_LIB} PRIVATE "-DLWIP_IPV6_SCOPES=0" "-DCHIP_HAVE_CONFIG_H")
target_compile_options(${COMPONENT_LIB} PUBLIC
"-DCHIP_ADDRESS_RESOLVE_IMPL_INCLUDE_HEADER=<lib/address_resolve/AddressResolve_DefaultImpl.h>"
)

if (CONFIG_ENABLE_PW_RPC)

Expand Down
3 changes: 2 additions & 1 deletion scripts/build/build/targets.py
Original file line number Diff line number Diff line change
Expand Up @@ -376,7 +376,8 @@ def K32WTargets():
def Cyw30739Targets():
yield Target('cyw30739-cyw930739m2evb_01-light', Cyw30739Builder, board=Cyw30739Board.CYW930739M2EVB_01, app=Cyw30739App.LIGHT)
yield Target('cyw30739-cyw930739m2evb_01-lock', Cyw30739Builder, board=Cyw30739Board.CYW930739M2EVB_01, app=Cyw30739App.LOCK)
yield Target('cyw30739-cyw930739m2evb_01-ota-requestor', Cyw30739Builder, board=Cyw30739Board.CYW930739M2EVB_01, app=Cyw30739App.OTA_REQUESTOR)
yield Target('cyw30739-cyw930739m2evb_01-ota-requestor', Cyw30739Builder, board=Cyw30739Board.CYW930739M2EVB_01, app=Cyw30739App.OTA_REQUESTOR).GlobBlacklist("Running out of XIP flash space")
yield Target('cyw30739-cyw930739m2evb_01-ota-requestor-no-progress-logging', Cyw30739Builder, board=Cyw30739Board.CYW930739M2EVB_01, app=Cyw30739App.OTA_REQUESTOR, progress_logging=False)


def QorvoTargets():
Expand Down
15 changes: 15 additions & 0 deletions scripts/build/builders/cyw30739.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,11 +64,26 @@ def __init__(
runner,
app: Cyw30739App = Cyw30739App.LIGHT,
board: Cyw30739Board = Cyw30739Board.CYW930739M2EVB_01,
release: bool = False,
progress_logging: bool = True
):
super(Cyw30739Builder, self).__init__(
root=app.BuildRoot(root), runner=runner)
self.app = app
self.board = board
self.release = release
self.progress_logging = progress_logging

def GnBuildArgs(self):
args = []

if not self.progress_logging:
args.append('chip_progress_logging=false')

if self.release:
args.append('is_debug=false')

return args

def build_outputs(self):
items = {}
Expand Down
3 changes: 2 additions & 1 deletion scripts/build/testdata/all_targets_except_host.txt
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,8 @@ android-x64-chip-tool
android-x86-chip-tool
cyw30739-cyw930739m2evb_01-light
cyw30739-cyw930739m2evb_01-lock
cyw30739-cyw930739m2evb_01-ota-requestor
cyw30739-cyw930739m2evb_01-ota-requestor (NOGLOB: Running out of XIP flash space)
cyw30739-cyw930739m2evb_01-ota-requestor-no-progress-logging
efr32-brd4161a-light
efr32-brd4161a-light-rpc
efr32-brd4161a-lock
Expand Down
6 changes: 6 additions & 0 deletions scripts/build/testdata/build_all_except_host.txt
Original file line number Diff line number Diff line change
Expand Up @@ -175,6 +175,9 @@ gn gen --check --fail-on-unused-args --export-compile-commands --root={root}/exa
# Generating cyw30739-cyw930739m2evb_01-ota-requestor
gn gen --check --fail-on-unused-args --export-compile-commands --root={root}/examples/ota-requestor-app/cyw30739 {out}/cyw30739-cyw930739m2evb_01-ota-requestor

# Generating cyw30739-cyw930739m2evb_01-ota-requestor-no-progress-logging
gn gen --check --fail-on-unused-args --export-compile-commands --root={root}/examples/ota-requestor-app/cyw30739 --args=chip_progress_logging=false {out}/cyw30739-cyw930739m2evb_01-ota-requestor-no-progress-logging

# Generating efr32-brd4161a-light
gn gen --check --fail-on-unused-args --export-compile-commands --root={root}/examples/lighting-app/efr32 '--args=efr32_board="BRD4161A"' {out}/efr32-brd4161a-light

Expand Down Expand Up @@ -938,6 +941,9 @@ ninja -C {out}/cyw30739-cyw930739m2evb_01-lock
# Building cyw30739-cyw930739m2evb_01-ota-requestor
ninja -C {out}/cyw30739-cyw930739m2evb_01-ota-requestor

# Building cyw30739-cyw930739m2evb_01-ota-requestor-no-progress-logging
ninja -C {out}/cyw30739-cyw930739m2evb_01-ota-requestor-no-progress-logging

# Building efr32-brd4161a-light
ninja -C {out}/efr32-brd4161a-light

Expand Down
2 changes: 1 addition & 1 deletion scripts/build/testdata/glob_star_targets_except_host.txt
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ android-x64-chip-tool
android-x86-chip-tool
cyw30739-cyw930739m2evb_01-light
cyw30739-cyw930739m2evb_01-lock
cyw30739-cyw930739m2evb_01-ota-requestor
cyw30739-cyw930739m2evb_01-ota-requestor-no-progress-logging
efr32-brd4161a-light
efr32-brd4161a-light-rpc
efr32-brd4161a-lock
Expand Down
1 change: 1 addition & 0 deletions src/app/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -156,6 +156,7 @@ static_library("app") {
public_deps = [
":app_buildconfig",
"${chip_root}/src/access",
"${chip_root}/src/lib/address_resolve",
"${chip_root}/src/lib/support",
"${chip_root}/src/messaging",
"${chip_root}/src/protocols/secure_channel",
Expand Down
53 changes: 6 additions & 47 deletions src/app/CASESessionManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,19 +17,13 @@
*/

#include <app/CASESessionManager.h>
#include <platform/CHIPDeviceLayer.h>
#include <lib/address_resolve/AddressResolve.h>

namespace chip {

CHIP_ERROR CASESessionManager::Init()
CHIP_ERROR CASESessionManager::Init(chip::System::Layer * systemLayer)
{
if (mConfig.dnsResolver == nullptr)
{
ReturnErrorOnFailure(mDNSResolver.Init(DeviceLayer::UDPEndPointManager()));
mDNSResolver.SetOperationalDelegate(this);
mConfig.dnsResolver = &mDNSResolver;
}
return CHIP_NO_ERROR;
return AddressResolve::Resolver::Instance().Init(systemLayer);
}

CHIP_ERROR CASESessionManager::FindOrEstablishSession(PeerId peerId, Callback::Callback<OnDeviceConnected> * onConnection,
Expand Down Expand Up @@ -68,7 +62,7 @@ CHIP_ERROR CASESessionManager::FindOrEstablishSession(PeerId peerId, Callback::C
session->OnNodeIdResolved(resolutionData);
}

CHIP_ERROR err = session->Connect(onConnection, onFailure, mConfig.dnsResolver);
CHIP_ERROR err = session->Connect(onConnection, onFailure);
if (err != CHIP_NO_ERROR)
{
// Release the peer rather than the pointer in case the failure handler has already released the session.
Expand All @@ -93,49 +87,14 @@ void CASESessionManager::ReleaseAllSessions()
mConfig.devicePool->ReleaseAllDevices();
}

CHIP_ERROR CASESessionManager::ResolveDeviceAddress(FabricInfo * fabric, NodeId nodeId)
{
VerifyOrReturnError(fabric != nullptr, CHIP_ERROR_INCORRECT_STATE);
return mConfig.dnsResolver->ResolveNodeId(fabric->GetPeerIdForNode(nodeId), Inet::IPAddressType::kAny);
}

void CASESessionManager::OnOperationalNodeResolved(const Dnssd::ResolvedNodeData & nodeData)
{
ChipLogProgress(Controller, "Address resolved for node: 0x" ChipLogFormatX64, ChipLogValueX64(nodeData.mPeerId.GetNodeId()));

#if CHIP_CONFIG_MDNS_CACHE_SIZE > 0
if (mConfig.dnsCache != nullptr)
{
CHIP_ERROR err = mConfig.dnsCache->Insert(nodeData);
if (err != CHIP_NO_ERROR)
{
ChipLogError(Controller, "DNS Cache insert: %" CHIP_ERROR_FORMAT, err.Format());
}
}
#endif

OperationalDeviceProxy * session = FindExistingSession(nodeData.mPeerId);
VerifyOrReturn(session != nullptr,
ChipLogDetail(Controller, "OnNodeIdResolved was called for a device with no active sessions, ignoring it."));

CHIP_ERROR err = session->UpdateDeviceData(OperationalDeviceProxy::ToPeerAddress(nodeData), nodeData.GetMRPConfig());
if (err != CHIP_NO_ERROR)
{
ChipLogError(Controller, "Update Service Data: %" CHIP_ERROR_FORMAT, err.Format());
}
}

void CASESessionManager::OnOperationalNodeResolutionFailed(const PeerId & peer, CHIP_ERROR error)
{
ChipLogError(Controller, "Error resolving node id: %s", ErrorStr(error));
}

CHIP_ERROR CASESessionManager::GetPeerAddress(PeerId peerId, Transport::PeerAddress & addr)
{
#if CHIP_CONFIG_MDNS_CACHE_SIZE > 0
if (mConfig.dnsCache != nullptr)
{
Dnssd::ResolvedNodeData resolutionData;
// TODO(andy31415): DNS caching is generally not populated, need to move
// caching into a the address resolve layer and not have a global one anymore.
if (mConfig.dnsCache->Lookup(peerId, resolutionData) == CHIP_NO_ERROR)
{
addr = OperationalDeviceProxy::ToPeerAddress(resolutionData);
Expand Down
18 changes: 2 additions & 16 deletions src/app/CASESessionManager.h
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,6 @@ struct CASESessionManagerConfig
Dnssd::DnssdCache<CHIP_CONFIG_MDNS_CACHE_SIZE> * dnsCache = nullptr;
#endif
OperationalDeviceProxyPoolDelegate * devicePool = nullptr;
Dnssd::ResolverProxy * dnsResolver = nullptr;
};

/**
Expand All @@ -50,7 +49,7 @@ struct CASESessionManagerConfig
* 4. During session establishment, trigger node ID resolution (if needed), and update the DNS-SD cache (if resolution is
* successful)
*/
class CASESessionManager : public Dnssd::OperationalResolveDelegate
class CASESessionManager
{
public:
CASESessionManager() = delete;
Expand All @@ -64,7 +63,7 @@ class CASESessionManager : public Dnssd::OperationalResolveDelegate

virtual ~CASESessionManager() { mDNSResolver.Shutdown(); }

CHIP_ERROR Init();
CHIP_ERROR Init(chip::System::Layer * systemLayer);
void Shutdown() { mDNSResolver.Shutdown(); }

/**
Expand All @@ -84,15 +83,6 @@ class CASESessionManager : public Dnssd::OperationalResolveDelegate

void ReleaseAllSessions();

/**
* This API triggers the DNS-SD resolution for the given node ID. The node ID will be looked up
* on the fabric that was configured for the CASESessionManager object.
*
* The results of the DNS-SD resolution request is provided to the class via `OperationalResolveDelegate`
* implementation of CASESessionManager.
*/
CHIP_ERROR ResolveDeviceAddress(FabricInfo * fabric, NodeId nodeId);

/**
* This API returns the address for the given node ID.
* If the CASESessionManager is configured with a DNS-SD cache, the cache is looked up
Expand All @@ -103,10 +93,6 @@ class CASESessionManager : public Dnssd::OperationalResolveDelegate
*/
CHIP_ERROR GetPeerAddress(PeerId peerId, Transport::PeerAddress & addr);

//////////// OperationalResolveDelegate Implementation ///////////////
void OnOperationalNodeResolved(const Dnssd::ResolvedNodeData & nodeData) override;
void OnOperationalNodeResolutionFailed(const PeerId & peerId, CHIP_ERROR error) override;

private:
OperationalDeviceProxy * FindSession(const SessionHandle & session);
void ReleaseSession(OperationalDeviceProxy * device);
Expand Down
Loading

0 comments on commit 1145924

Please sign in to comment.