Index: webrtc/p2p/base/rtppacketutil.h |
diff --git a/webrtc/p2p/base/rtppacketutil.h b/webrtc/p2p/base/rtppacketutil.h |
new file mode 100644 |
index 0000000000000000000000000000000000000000..9108456bec83c60df782b84f88634a50cf243d19 |
--- /dev/null |
+++ b/webrtc/p2p/base/rtppacketutil.h |
@@ -0,0 +1,53 @@ |
+/* |
+ * Copyright 2016 The WebRTC Project Authors. All rights reserved. |
+ * |
+ * Use of this source code is governed by a BSD-style license |
+ * that can be found in the LICENSE file in the root of the source |
+ * tree. An additional intellectual property rights grant can be found |
+ * in the file PATENTS. All contributing project authors may |
+ * be found in the AUTHORS file in the root of the source tree. |
+ */ |
+ |
+#ifndef WEBRTC_P2P_BASE_RTPPACKETUTIL_H_ |
+#define WEBRTC_P2P_BASE_RTPPACKETUTIL_H_ |
+ |
+#include <cstddef> |
+#include <cstdint> |
+ |
+namespace rtc { |
+ |
+struct PacketOptions; |
+ |
+// Returns true if the packet in |data| is a DTLS packet. |
+bool IsDtlsPacket(const char* data, size_t length); |
+ |
+// Returns true if the packet in |data| is an RTCP packet. |
+bool IsRtcpPacket(const char* data, size_t length); |
+ |
+// Applies specified |options| to the packet. It updates absolute send time |
+// extension header if it is present present then updates HMAC. |
+// If |abs_send_time| is 0 then current system time is used. |
+bool ApplyPacketOptions(char* data, |
+ size_t length, |
+ const PacketOptions& options, |
+ uint32_t abs_send_time); |
+ |
+// Verifies that a packet has a valid RTP header. |
+bool ValidateRtpHeader(const char* rtp, size_t length, size_t* header_length); |
+ |
+// Finds RTP offset and length if the packet is encapsulated in a TURN Channel |
+// Message or TURN Send Indication message. |
+bool GetRtpPacketStartPositionAndLength(const char* data, |
+ size_t length, |
+ size_t* rtp_start_pos, |
+ size_t* rtp_packet_length); |
+ |
+// Helper method which updates absolute send time extension if present. |
+bool UpdateRtpAbsSendTimeExtension(char* rtp, |
+ size_t length, |
+ int extension_id, |
+ uint32_t abs_send_time); |
+ |
+} // namespace rtc |
+ |
+#endif // WEBRTC_P2P_BASE_RTPPACKETUTIL_H_ |