Zhi Huang | 942bc2e | 2017-11-13 21:26:07 | [diff] [blame] | 1 | /* |
| 2 | * Copyright 2017 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 | */ |
Steve Anton | 10542f2 | 2019-01-11 17:11:00 | [diff] [blame] | 10 | #ifndef RTC_BASE_NET_HELPER_H_ |
| 11 | #define RTC_BASE_NET_HELPER_H_ |
Zhi Huang | 942bc2e | 2017-11-13 21:26:07 | [diff] [blame] | 12 | |
Zhi Huang | 942bc2e | 2017-11-13 21:26:07 | [diff] [blame] | 13 | #include <string> |
| 14 | |
Ali Tofigh | 7fa9057 | 2022-03-17 14:47:49 | [diff] [blame] | 15 | #include "absl/strings/string_view.h" |
Mirko Bonadei | 62ba379 | 2023-01-20 17:32:07 | [diff] [blame] | 16 | #include "rtc_base/system/rtc_export.h" |
Ali Tofigh | 7fa9057 | 2022-03-17 14:47:49 | [diff] [blame] | 17 | |
Zhi Huang | 942bc2e | 2017-11-13 21:26:07 | [diff] [blame] | 18 | // This header contains helper functions and constants used by different types |
| 19 | // of transports. |
| 20 | namespace cricket { |
| 21 | |
Mirko Bonadei | 62ba379 | 2023-01-20 17:32:07 | [diff] [blame] | 22 | RTC_EXPORT extern const char UDP_PROTOCOL_NAME[]; |
| 23 | RTC_EXPORT extern const char TCP_PROTOCOL_NAME[]; |
Zhi Huang | 942bc2e | 2017-11-13 21:26:07 | [diff] [blame] | 24 | extern const char SSLTCP_PROTOCOL_NAME[]; |
| 25 | extern const char TLS_PROTOCOL_NAME[]; |
| 26 | |
Sebastian Jansson | db5d7e4 | 2020-03-02 10:32:23 | [diff] [blame] | 27 | constexpr int kTcpHeaderSize = 20; |
| 28 | constexpr int kUdpHeaderSize = 8; |
Zhi Huang | 942bc2e | 2017-11-13 21:26:07 | [diff] [blame] | 29 | |
| 30 | // Get the transport layer overhead per packet based on the protocol. |
Ali Tofigh | 7fa9057 | 2022-03-17 14:47:49 | [diff] [blame] | 31 | int GetProtocolOverhead(absl::string_view protocol); |
Zhi Huang | 942bc2e | 2017-11-13 21:26:07 | [diff] [blame] | 32 | |
| 33 | } // namespace cricket |
| 34 | |
Steve Anton | 10542f2 | 2019-01-11 17:11:00 | [diff] [blame] | 35 | #endif // RTC_BASE_NET_HELPER_H_ |