1 /* 2 * Copyright 2013 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 PC_SCTP_UTILS_H_ 12 #define PC_SCTP_UTILS_H_ 13 14 #include <string> 15 16 #include "api/data_channel_interface.h" 17 #include "api/transport/data_channel_transport_interface.h" 18 #include "media/base/media_channel.h" 19 #include "rtc_base/copy_on_write_buffer.h" 20 21 namespace rtc { 22 class CopyOnWriteBuffer; 23 } // namespace rtc 24 25 namespace webrtc { 26 struct DataChannelInit; 27 28 // Read the message type and return true if it's an OPEN message. 29 bool IsOpenMessage(const rtc::CopyOnWriteBuffer& payload); 30 31 bool ParseDataChannelOpenMessage(const rtc::CopyOnWriteBuffer& payload, 32 std::string* label, 33 DataChannelInit* config); 34 35 bool ParseDataChannelOpenAckMessage(const rtc::CopyOnWriteBuffer& payload); 36 37 bool WriteDataChannelOpenMessage(const std::string& label, 38 const DataChannelInit& config, 39 rtc::CopyOnWriteBuffer* payload); 40 41 void WriteDataChannelOpenAckMessage(rtc::CopyOnWriteBuffer* payload); 42 43 } // namespace webrtc 44 45 #endif // PC_SCTP_UTILS_H_ 46