-
Notifications
You must be signed in to change notification settings - Fork 4.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
PR #13330 from Eran: DDS netword-adapter watcher monitoring IP changes
- Loading branch information
Showing
11 changed files
with
667 additions
and
56 deletions.
There are no files selected for viewing
40 changes: 40 additions & 0 deletions
40
third-party/realdds/include/realdds/dds-network-adapter-watcher.h
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
// License: Apache 2.0. See LICENSE file in root directory. | ||
// Copyright(c) 2024 Intel Corporation. All Rights Reserved. | ||
#pragma once | ||
|
||
#include <rsutils/os/network-adapter-watcher.h> | ||
#include <set> | ||
#include <string> | ||
|
||
|
||
namespace realdds { | ||
|
||
|
||
namespace detail { | ||
class network_adapter_watcher_singleton; | ||
} | ||
|
||
|
||
// Watch for changes to network adapter IPs | ||
// | ||
// Unlike rsutils::os::network_adapter_watcher, we only call the callbacks when actual changes to IPs are made, which | ||
// can sometimes be seconds after adapter-change notifications are sent | ||
// | ||
// All you have to do is create a watcher and keep a pointer to it to get notifications | ||
// | ||
class dds_network_adapter_watcher | ||
{ | ||
std::shared_ptr< detail::network_adapter_watcher_singleton > _singleton; | ||
rsutils::subscription _subscription; | ||
|
||
public: | ||
using callback = std::function< void() >; | ||
|
||
dds_network_adapter_watcher( callback && ); | ||
|
||
using ip_set = std::set< std::string >; | ||
static ip_set current_ips(); | ||
}; | ||
|
||
|
||
} // namespace realdds |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.