xref: /aosp_15_r20/external/webrtc/p2p/base/ice_switch_reason.cc (revision d9f758449e529ab9291ac668be2861e7a55c2422)
1*d9f75844SAndroid Build Coastguard Worker /*
2*d9f75844SAndroid Build Coastguard Worker  *  Copyright 2022 The WebRTC Project Authors. All rights reserved.
3*d9f75844SAndroid Build Coastguard Worker  *
4*d9f75844SAndroid Build Coastguard Worker  *  Use of this source code is governed by a BSD-style license
5*d9f75844SAndroid Build Coastguard Worker  *  that can be found in the LICENSE file in the root of the source
6*d9f75844SAndroid Build Coastguard Worker  *  tree. An additional intellectual property rights grant can be found
7*d9f75844SAndroid Build Coastguard Worker  *  in the file PATENTS.  All contributing project authors may
8*d9f75844SAndroid Build Coastguard Worker  *  be found in the AUTHORS file in the root of the source tree.
9*d9f75844SAndroid Build Coastguard Worker  */
10*d9f75844SAndroid Build Coastguard Worker 
11*d9f75844SAndroid Build Coastguard Worker #include "p2p/base/ice_switch_reason.h"
12*d9f75844SAndroid Build Coastguard Worker 
13*d9f75844SAndroid Build Coastguard Worker #include <string>
14*d9f75844SAndroid Build Coastguard Worker 
15*d9f75844SAndroid Build Coastguard Worker namespace cricket {
16*d9f75844SAndroid Build Coastguard Worker 
IceSwitchReasonToString(IceSwitchReason reason)17*d9f75844SAndroid Build Coastguard Worker std::string IceSwitchReasonToString(IceSwitchReason reason) {
18*d9f75844SAndroid Build Coastguard Worker   switch (reason) {
19*d9f75844SAndroid Build Coastguard Worker     case IceSwitchReason::REMOTE_CANDIDATE_GENERATION_CHANGE:
20*d9f75844SAndroid Build Coastguard Worker       return "remote candidate generation maybe changed";
21*d9f75844SAndroid Build Coastguard Worker     case IceSwitchReason::NETWORK_PREFERENCE_CHANGE:
22*d9f75844SAndroid Build Coastguard Worker       return "network preference changed";
23*d9f75844SAndroid Build Coastguard Worker     case IceSwitchReason::NEW_CONNECTION_FROM_LOCAL_CANDIDATE:
24*d9f75844SAndroid Build Coastguard Worker       return "new candidate pairs created from a new local candidate";
25*d9f75844SAndroid Build Coastguard Worker     case IceSwitchReason::NEW_CONNECTION_FROM_REMOTE_CANDIDATE:
26*d9f75844SAndroid Build Coastguard Worker       return "new candidate pairs created from a new remote candidate";
27*d9f75844SAndroid Build Coastguard Worker     case IceSwitchReason::NEW_CONNECTION_FROM_UNKNOWN_REMOTE_ADDRESS:
28*d9f75844SAndroid Build Coastguard Worker       return "a new candidate pair created from an unknown remote address";
29*d9f75844SAndroid Build Coastguard Worker     case IceSwitchReason::NOMINATION_ON_CONTROLLED_SIDE:
30*d9f75844SAndroid Build Coastguard Worker       return "nomination on the controlled side";
31*d9f75844SAndroid Build Coastguard Worker     case IceSwitchReason::DATA_RECEIVED:
32*d9f75844SAndroid Build Coastguard Worker       return "data received";
33*d9f75844SAndroid Build Coastguard Worker     case IceSwitchReason::CONNECT_STATE_CHANGE:
34*d9f75844SAndroid Build Coastguard Worker       return "candidate pair state changed";
35*d9f75844SAndroid Build Coastguard Worker     case IceSwitchReason::SELECTED_CONNECTION_DESTROYED:
36*d9f75844SAndroid Build Coastguard Worker       return "selected candidate pair destroyed";
37*d9f75844SAndroid Build Coastguard Worker     case IceSwitchReason::ICE_CONTROLLER_RECHECK:
38*d9f75844SAndroid Build Coastguard Worker       return "ice-controller-request-recheck";
39*d9f75844SAndroid Build Coastguard Worker     default:
40*d9f75844SAndroid Build Coastguard Worker       return "unknown";
41*d9f75844SAndroid Build Coastguard Worker   }
42*d9f75844SAndroid Build Coastguard Worker }
43*d9f75844SAndroid Build Coastguard Worker 
44*d9f75844SAndroid Build Coastguard Worker }  // namespace cricket
45