blob: 7a4708af29900a0933d3d55165f8856d8f03aa7d [file] [log] [blame]
wu@webrtc.org1d1ffc92013-10-16 18:12:02 +00001/*
kjellanderb24317b2016-02-10 07:54:43 -08002 * Copyright 2013 The WebRTC project authors. All Rights Reserved.
wu@webrtc.org1d1ffc92013-10-16 18:12:02 +00003 *
kjellanderb24317b2016-02-10 07:54:43 -08004 * 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.
wu@webrtc.org1d1ffc92013-10-16 18:12:02 +00009 */
10
Mirko Bonadei92ea95e2017-09-15 06:47:31 +020011#ifndef PC_SCTPUTILS_H_
12#define PC_SCTPUTILS_H_
wu@webrtc.org1d1ffc92013-10-16 18:12:02 +000013
14#include <string>
15
Mirko Bonadei92ea95e2017-09-15 06:47:31 +020016#include "api/datachannelinterface.h"
henrika@webrtc.orgaebb1ad2014-01-14 10:00:58 +000017
buildbot@webrtc.orgd4e598d2014-07-29 17:36:52 +000018namespace rtc {
jbaucheec21bd2016-03-20 06:15:43 -070019class CopyOnWriteBuffer;
buildbot@webrtc.orgd4e598d2014-07-29 17:36:52 +000020} // namespace rtc
wu@webrtc.org1d1ffc92013-10-16 18:12:02 +000021
22namespace webrtc {
23struct DataChannelInit;
wu@webrtc.org1d1ffc92013-10-16 18:12:02 +000024
deadbeefab9b2d12015-10-14 11:33:11 -070025// Read the message type and return true if it's an OPEN message.
jbaucheec21bd2016-03-20 06:15:43 -070026bool IsOpenMessage(const rtc::CopyOnWriteBuffer& payload);
deadbeefab9b2d12015-10-14 11:33:11 -070027
jbaucheec21bd2016-03-20 06:15:43 -070028bool ParseDataChannelOpenMessage(const rtc::CopyOnWriteBuffer& payload,
wu@webrtc.org1d1ffc92013-10-16 18:12:02 +000029 std::string* label,
henrika@webrtc.orgaebb1ad2014-01-14 10:00:58 +000030 DataChannelInit* config);
31
jbaucheec21bd2016-03-20 06:15:43 -070032bool ParseDataChannelOpenAckMessage(const rtc::CopyOnWriteBuffer& payload);
wu@webrtc.org1d1ffc92013-10-16 18:12:02 +000033
34bool WriteDataChannelOpenMessage(const std::string& label,
henrika@webrtc.orgaebb1ad2014-01-14 10:00:58 +000035 const DataChannelInit& config,
jbaucheec21bd2016-03-20 06:15:43 -070036 rtc::CopyOnWriteBuffer* payload);
wu@webrtc.org1d1ffc92013-10-16 18:12:02 +000037
jbaucheec21bd2016-03-20 06:15:43 -070038void WriteDataChannelOpenAckMessage(rtc::CopyOnWriteBuffer* payload);
henrika@webrtc.orgaebb1ad2014-01-14 10:00:58 +000039} // namespace webrtc
wu@webrtc.org1d1ffc92013-10-16 18:12:02 +000040
Mirko Bonadei92ea95e2017-09-15 06:47:31 +020041#endif // PC_SCTPUTILS_H_