1 /* 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 11 #include "p2p/base/p2p_constants.h" 12 13 namespace cricket { 14 15 const char CN_AUDIO[] = "audio"; 16 const char CN_VIDEO[] = "video"; 17 const char CN_DATA[] = "data"; 18 const char CN_OTHER[] = "main"; 19 20 const char GROUP_TYPE_BUNDLE[] = "BUNDLE"; 21 22 // Minimum ufrag length is 4 characters as per RFC5245. 23 const int ICE_UFRAG_LENGTH = 4; 24 // Minimum password length of 22 characters as per RFC5245. We chose 24 because 25 // some internal systems expect password to be multiple of 4. 26 const int ICE_PWD_LENGTH = 24; 27 const size_t ICE_UFRAG_MIN_LENGTH = 4; 28 const size_t ICE_PWD_MIN_LENGTH = 22; 29 const size_t ICE_UFRAG_MAX_LENGTH = 256; 30 const size_t ICE_PWD_MAX_LENGTH = 256; 31 32 // This is media-specific, so might belong 33 // somewhere like media/base/mediaconstants.h 34 const int ICE_CANDIDATE_COMPONENT_RTP = 1; 35 const int ICE_CANDIDATE_COMPONENT_RTCP = 2; 36 const int ICE_CANDIDATE_COMPONENT_DEFAULT = 1; 37 38 // From RFC 4145, SDP setup attribute values. 39 const char CONNECTIONROLE_ACTIVE_STR[] = "active"; 40 const char CONNECTIONROLE_PASSIVE_STR[] = "passive"; 41 const char CONNECTIONROLE_ACTPASS_STR[] = "actpass"; 42 const char CONNECTIONROLE_HOLDCONN_STR[] = "holdconn"; 43 44 const char LOCAL_TLD[] = ".local"; 45 46 const int MIN_CHECK_RECEIVING_INTERVAL = 50; 47 const int RECEIVING_TIMEOUT = MIN_CHECK_RECEIVING_INTERVAL * 50; 48 const int RECEIVING_SWITCHING_DELAY = 1000; 49 const int BACKUP_CONNECTION_PING_INTERVAL = 25 * 1000; 50 const 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. 57 const int STUN_PING_PACKET_SIZE = 60 * 8; 58 const int STRONG_PING_INTERVAL = 1000 * STUN_PING_PACKET_SIZE / 1000; // 480ms. 59 const int WEAK_PING_INTERVAL = 1000 * STUN_PING_PACKET_SIZE / 10000; // 48ms. 60 const int WEAK_OR_STABILIZING_WRITABLE_CONNECTION_PING_INTERVAL = 900; 61 const int STRONG_AND_STABLE_WRITABLE_CONNECTION_PING_INTERVAL = 2500; 62 const int CONNECTION_WRITE_CONNECT_TIMEOUT = 5 * 1000; // 5 seconds 63 const uint32_t CONNECTION_WRITE_CONNECT_FAILURES = 5; // 5 pings 64 65 const int STUN_KEEPALIVE_INTERVAL = 10 * 1000; // 10 seconds 66 67 const int MIN_CONNECTION_LIFETIME = 10 * 1000; // 10 seconds. 68 const int DEAD_CONNECTION_RECEIVE_TIMEOUT = 30 * 1000; // 30 seconds. 69 const int WEAK_CONNECTION_RECEIVE_TIMEOUT = 2500; // 2.5 seconds 70 const 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. 73 const int CONNECTION_RESPONSE_TIMEOUT = 60 * 1000; // 60 seconds 74 75 } // namespace cricket 76