Index: talk/app/webrtc/sctputils.cc |
diff --git a/talk/app/webrtc/sctputils.cc b/talk/app/webrtc/sctputils.cc |
index a64383720f85a3d86a25ef80fdba1defa51bc8f3..22395995116c5de4e01ba8b85c61906ce3f12e18 100644 |
--- a/talk/app/webrtc/sctputils.cc |
+++ b/talk/app/webrtc/sctputils.cc |
@@ -48,6 +48,19 @@ enum DataChannelOpenMessageChannelType { |
DCOMCT_UNORDERED_PARTIAL_TIME = 0x82, |
}; |
+bool IsOpenMessage(const rtc::Buffer& payload) { |
+ // Format defined at |
+ // http://tools.ietf.org/html/draft-jesup-rtcweb-data-protocol-04 |
+ |
+ rtc::ByteBuffer buffer(payload); |
+ uint8_t message_type; |
+ if (!buffer.ReadUInt8(&message_type)) { |
+ LOG(LS_WARNING) << "Could not read OPEN message type."; |
+ return false; |
+ } |
+ return message_type == DATA_CHANNEL_OPEN_MESSAGE_TYPE; |
+} |
+ |
bool ParseDataChannelOpenMessage(const rtc::Buffer& payload, |
std::string* label, |
DataChannelInit* config) { |