blob: 3414939a6f9163e52148a64f8f5b6e8ecf16cd96 [file] [log] [blame]
henrike@webrtc.org269fb4b2014-10-28 22:20:11 +00001/*
2 * Copyright 2004 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
Steve Anton10542f22019-01-11 09:11:00 -080011#include "p2p/base/p2p_constants.h"
henrike@webrtc.org269fb4b2014-10-28 22:20:11 +000012
henrike@webrtc.org269fb4b2014-10-28 22:20:11 +000013namespace cricket {
14
henrike@webrtc.org269fb4b2014-10-28 22:20:11 +000015const char CN_AUDIO[] = "audio";
16const char CN_VIDEO[] = "video";
17const char CN_DATA[] = "data";
18const char CN_OTHER[] = "main";
pthatcher@webrtc.org5ad41782014-12-23 22:14:15 +000019
henrike@webrtc.org269fb4b2014-10-28 22:20:11 +000020const char GROUP_TYPE_BUNDLE[] = "BUNDLE";
21
zhihuang6d0d4bf2016-05-24 10:13:32 -070022// Minimum ufrag length is 4 characters as per RFC5245.
23const int ICE_UFRAG_LENGTH = 4;
henrike@webrtc.org269fb4b2014-10-28 22:20:11 +000024// Minimum password length of 22 characters as per RFC5245. We chose 24 because
25// some internal systems expect password to be multiple of 4.
26const int ICE_PWD_LENGTH = 24;
27const size_t ICE_UFRAG_MIN_LENGTH = 4;
28const size_t ICE_PWD_MIN_LENGTH = 22;
Steve Antonf1c6db12017-10-13 11:13:35 -070029const size_t ICE_UFRAG_MAX_LENGTH = 256;
henrike@webrtc.org269fb4b2014-10-28 22:20:11 +000030const size_t ICE_PWD_MAX_LENGTH = 256;
pthatcher@webrtc.org5ad41782014-12-23 22:14:15 +000031
kjellanderf4752772016-03-02 05:42:30 -080032// This is media-specific, so might belong
33// somewhere like media/base/mediaconstants.h
henrike@webrtc.org269fb4b2014-10-28 22:20:11 +000034const int ICE_CANDIDATE_COMPONENT_RTP = 1;
35const int ICE_CANDIDATE_COMPONENT_RTCP = 2;
36const int ICE_CANDIDATE_COMPONENT_DEFAULT = 1;
37
henrike@webrtc.org269fb4b2014-10-28 22:20:11 +000038// From RFC 4145, SDP setup attribute values.
39const char CONNECTIONROLE_ACTIVE_STR[] = "active";
40const char CONNECTIONROLE_PASSIVE_STR[] = "passive";
41const char CONNECTIONROLE_ACTPASS_STR[] = "actpass";
42const char CONNECTIONROLE_HOLDCONN_STR[] = "holdconn";
43
Qingsi Wangfdf54f22019-10-18 15:51:40 -070044const char LOCAL_TLD[] = ".local";
45
Qingsi Wang866e08d2018-03-22 17:54:23 -070046const int MIN_CHECK_RECEIVING_INTERVAL = 50;
47const int RECEIVING_TIMEOUT = MIN_CHECK_RECEIVING_INTERVAL * 50;
48const int RECEIVING_SWITCHING_DELAY = 1000;
49const int BACKUP_CONNECTION_PING_INTERVAL = 25 * 1000;
50const int REGATHER_ON_FAILED_NETWORKS_INTERVAL = 5 * 60 * 1000;
51
52// When the socket is unwritable, we will use 10 Kbps (ignoring IP+UDP headers)
53// for pinging. When the socket is writable, we will use only 1 Kbps because we
54// don't want to degrade the quality on a modem. These numbers should work well
55// on a 28.8K modem, which is the slowest connection on which the voice quality
56// is reasonable at all.
57const int STUN_PING_PACKET_SIZE = 60 * 8;
58const int STRONG_PING_INTERVAL = 1000 * STUN_PING_PACKET_SIZE / 1000; // 480ms.
59const int WEAK_PING_INTERVAL = 1000 * STUN_PING_PACKET_SIZE / 10000; // 48ms.
60const int WEAK_OR_STABILIZING_WRITABLE_CONNECTION_PING_INTERVAL = 900;
61const int STRONG_AND_STABLE_WRITABLE_CONNECTION_PING_INTERVAL = 2500;
62const int CONNECTION_WRITE_CONNECT_TIMEOUT = 5 * 1000; // 5 seconds
63const uint32_t CONNECTION_WRITE_CONNECT_FAILURES = 5; // 5 pings
64
65const int STUN_KEEPALIVE_INTERVAL = 10 * 1000; // 10 seconds
66
67const int MIN_CONNECTION_LIFETIME = 10 * 1000; // 10 seconds.
68const int DEAD_CONNECTION_RECEIVE_TIMEOUT = 30 * 1000; // 30 seconds.
69const int WEAK_CONNECTION_RECEIVE_TIMEOUT = 2500; // 2.5 seconds
70const int CONNECTION_WRITE_TIMEOUT = 15 * 1000; // 15 seconds
71// There is no harm to keep this value high other than a small amount
72// of increased memory, but in some networks (2G), we observe up to 60s RTTs.
73const int CONNECTION_RESPONSE_TIMEOUT = 60 * 1000; // 60 seconds
74
henrike@webrtc.org269fb4b2014-10-28 22:20:11 +000075} // namespace cricket