xref: /aosp_15_r20/external/webrtc/sdk/objc/native/src/network_monitor_observer.h (revision d9f758449e529ab9291ac668be2861e7a55c2422)
1 /*
2  *  Copyright 2020 The WebRTC Project Authors. All rights reserved.
3  *
4  *  Use of this source code is governed by a BSD-style license
5  *  that can be found in the LICENSE file in the root of the source
6  *  tree. An additional intellectual property rights grant can be found
7  *  in the file PATENTS.  All contributing project authors may
8  *  be found in the AUTHORS file in the root of the source tree.
9  */
10 
11 #ifndef SDK_OBJC_NATIVE_SRC_NETWORK_MONITOR_OBSERVER_H_
12 #define SDK_OBJC_NATIVE_SRC_NETWORK_MONITOR_OBSERVER_H_
13 
14 #include <map>
15 #include <string>
16 
17 #include "absl/strings/string_view.h"
18 #include "rtc_base/network_constants.h"
19 #include "rtc_base/string_utils.h"
20 #include "rtc_base/thread.h"
21 
22 namespace webrtc {
23 
24 // Observer interface for listening to NWPathMonitor updates.
25 class NetworkMonitorObserver {
26  public:
27   // Called when a path update occurs, on network monitor dispatch queue.
28   //
29   // `adapter_type_by_name` is a map from interface name (i.e. "pdp_ip0") to
30   // adapter type, for all available interfaces on the current path. If an
31   // interface name isn't present it can be assumed to be unavailable.
32   virtual void OnPathUpdate(
33       std::map<std::string, rtc::AdapterType, rtc::AbslStringViewCmp>
34           adapter_type_by_name) = 0;
35 
36  protected:
~NetworkMonitorObserver()37   virtual ~NetworkMonitorObserver() {}
38 };
39 
40 }  // namespace webrtc
41 
42 #endif  //  SDK_OBJC_NATIVE_SRC_AUDIO_AUDIO_SESSION_OBSERVER_H_
43