xref: /aosp_15_r20/external/webrtc/p2p/base/ice_switch_reason.cc (revision d9f758449e529ab9291ac668be2861e7a55c2422)
1 /*
2  *  Copyright 2022 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 #include "p2p/base/ice_switch_reason.h"
12 
13 #include <string>
14 
15 namespace cricket {
16 
IceSwitchReasonToString(IceSwitchReason reason)17 std::string IceSwitchReasonToString(IceSwitchReason reason) {
18   switch (reason) {
19     case IceSwitchReason::REMOTE_CANDIDATE_GENERATION_CHANGE:
20       return "remote candidate generation maybe changed";
21     case IceSwitchReason::NETWORK_PREFERENCE_CHANGE:
22       return "network preference changed";
23     case IceSwitchReason::NEW_CONNECTION_FROM_LOCAL_CANDIDATE:
24       return "new candidate pairs created from a new local candidate";
25     case IceSwitchReason::NEW_CONNECTION_FROM_REMOTE_CANDIDATE:
26       return "new candidate pairs created from a new remote candidate";
27     case IceSwitchReason::NEW_CONNECTION_FROM_UNKNOWN_REMOTE_ADDRESS:
28       return "a new candidate pair created from an unknown remote address";
29     case IceSwitchReason::NOMINATION_ON_CONTROLLED_SIDE:
30       return "nomination on the controlled side";
31     case IceSwitchReason::DATA_RECEIVED:
32       return "data received";
33     case IceSwitchReason::CONNECT_STATE_CHANGE:
34       return "candidate pair state changed";
35     case IceSwitchReason::SELECTED_CONNECTION_DESTROYED:
36       return "selected candidate pair destroyed";
37     case IceSwitchReason::ICE_CONTROLLER_RECHECK:
38       return "ice-controller-request-recheck";
39     default:
40       return "unknown";
41   }
42 }
43 
44 }  // namespace cricket
45