OLD | NEW |
(Empty) | |
| 1 /* |
| 2 * Copyright 2016 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 #ifndef WEBRTC_P2P_BASE_RTPPACKETUTIL_H_ |
| 12 #define WEBRTC_P2P_BASE_RTPPACKETUTIL_H_ |
| 13 |
| 14 #include <cstddef> |
| 15 #include <cstdint> |
| 16 |
| 17 namespace rtc { |
| 18 |
| 19 struct PacketOptions; |
| 20 |
| 21 // Returns true if the packet in |data| is a DTLS packet. |
| 22 bool IsDtlsPacket(const char* data, size_t length); |
| 23 |
| 24 // Returns true if the packet in |data| is an RTCP packet. |
| 25 bool IsRtcpPacket(const char* data, size_t length); |
| 26 |
| 27 // Applies specified |options| to the packet. It updates absolute send time |
| 28 // extension header if it is present present then updates HMAC. |
| 29 // If |abs_send_time| is 0 then current system time is used. |
| 30 bool ApplyPacketOptions(char* data, |
| 31 size_t length, |
| 32 const PacketOptions& options, |
| 33 uint32_t abs_send_time); |
| 34 |
| 35 // Verifies that a packet has a valid RTP header. |
| 36 bool ValidateRtpHeader(const char* rtp, size_t length, size_t* header_length); |
| 37 |
| 38 // Finds RTP offset and length if the packet is encapsulated in a TURN Channel |
| 39 // Message or TURN Send Indication message. |
| 40 bool GetRtpPacketStartPositionAndLength(const char* data, |
| 41 size_t length, |
| 42 size_t* rtp_start_pos, |
| 43 size_t* rtp_packet_length); |
| 44 |
| 45 // Helper method which updates absolute send time extension if present. |
| 46 bool UpdateRtpAbsSendTimeExtension(char* rtp, |
| 47 size_t length, |
| 48 int extension_id, |
| 49 uint32_t abs_send_time); |
| 50 |
| 51 } // namespace rtc |
| 52 |
| 53 #endif // WEBRTC_P2P_BASE_RTPPACKETUTIL_H_ |
OLD | NEW |