xref: /aosp_15_r20/external/webrtc/pc/ice_server_parsing.h (revision d9f758449e529ab9291ac668be2861e7a55c2422)
1*d9f75844SAndroid Build Coastguard Worker /*
2*d9f75844SAndroid Build Coastguard Worker  *  Copyright 2017 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 #ifndef PC_ICE_SERVER_PARSING_H_
12*d9f75844SAndroid Build Coastguard Worker #define PC_ICE_SERVER_PARSING_H_
13*d9f75844SAndroid Build Coastguard Worker 
14*d9f75844SAndroid Build Coastguard Worker #include <vector>
15*d9f75844SAndroid Build Coastguard Worker 
16*d9f75844SAndroid Build Coastguard Worker #include "api/peer_connection_interface.h"
17*d9f75844SAndroid Build Coastguard Worker #include "api/rtc_error.h"
18*d9f75844SAndroid Build Coastguard Worker #include "p2p/base/port.h"
19*d9f75844SAndroid Build Coastguard Worker #include "p2p/base/port_allocator.h"
20*d9f75844SAndroid Build Coastguard Worker #include "rtc_base/system/rtc_export.h"
21*d9f75844SAndroid Build Coastguard Worker 
22*d9f75844SAndroid Build Coastguard Worker namespace webrtc {
23*d9f75844SAndroid Build Coastguard Worker 
24*d9f75844SAndroid Build Coastguard Worker // Parses the URLs for each server in `servers` to build `stun_servers` and
25*d9f75844SAndroid Build Coastguard Worker // `turn_servers`. Can return SYNTAX_ERROR if the URL is malformed, or
26*d9f75844SAndroid Build Coastguard Worker // INVALID_PARAMETER if a TURN server is missing `username` or `password`.
27*d9f75844SAndroid Build Coastguard Worker //
28*d9f75844SAndroid Build Coastguard Worker // Intended to be used to convert/validate the servers passed into a
29*d9f75844SAndroid Build Coastguard Worker // PeerConnection through RTCConfiguration.
30*d9f75844SAndroid Build Coastguard Worker RTC_EXPORT RTCError
31*d9f75844SAndroid Build Coastguard Worker ParseIceServersOrError(const PeerConnectionInterface::IceServers& servers,
32*d9f75844SAndroid Build Coastguard Worker                        cricket::ServerAddresses* stun_servers,
33*d9f75844SAndroid Build Coastguard Worker                        std::vector<cricket::RelayServerConfig>* turn_servers);
34*d9f75844SAndroid Build Coastguard Worker 
35*d9f75844SAndroid Build Coastguard Worker [[deprecated("use ParseIceServersOrError")]] RTC_EXPORT RTCErrorType
36*d9f75844SAndroid Build Coastguard Worker ParseIceServers(const PeerConnectionInterface::IceServers& servers,
37*d9f75844SAndroid Build Coastguard Worker                 cricket::ServerAddresses* stun_servers,
38*d9f75844SAndroid Build Coastguard Worker                 std::vector<cricket::RelayServerConfig>* turn_servers);
39*d9f75844SAndroid Build Coastguard Worker 
40*d9f75844SAndroid Build Coastguard Worker }  // namespace webrtc
41*d9f75844SAndroid Build Coastguard Worker 
42*d9f75844SAndroid Build Coastguard Worker #endif  // PC_ICE_SERVER_PARSING_H_
43