blob: da854458f492f5e40927be3d84e4fec76c16038a [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
Steve Anton10542f22019-01-11 09:11:00 -080011#ifndef PC_SCTP_UTILS_H_
12#define PC_SCTP_UTILS_H_
wu@webrtc.org1d1ffc92013-10-16 18:12:02 +000013
14#include <string>
15
Steve Anton10542f22019-01-11 09:11:00 -080016#include "api/data_channel_interface.h"
Niels Möllerbfcec4c2019-09-25 10:00:34 +020017#include "api/transport/data_channel_transport_interface.h"
Bjorn A Mellembc3eebc2019-09-23 14:53:54 -070018#include "media/base/media_channel.h"
Harald Alvestrand5761e7b2021-01-29 14:45:08 +000019#include "rtc_base/copy_on_write_buffer.h"
henrika@webrtc.orgaebb1ad2014-01-14 10:00:58 +000020
buildbot@webrtc.orgd4e598d2014-07-29 17:36:52 +000021namespace rtc {
jbaucheec21bd2016-03-20 06:15:43 -070022class CopyOnWriteBuffer;
buildbot@webrtc.orgd4e598d2014-07-29 17:36:52 +000023} // namespace rtc
wu@webrtc.org1d1ffc92013-10-16 18:12:02 +000024
25namespace webrtc {
26struct DataChannelInit;
wu@webrtc.org1d1ffc92013-10-16 18:12:02 +000027
deadbeefab9b2d12015-10-14 11:33:11 -070028// Read the message type and return true if it's an OPEN message.
jbaucheec21bd2016-03-20 06:15:43 -070029bool IsOpenMessage(const rtc::CopyOnWriteBuffer& payload);
deadbeefab9b2d12015-10-14 11:33:11 -070030
jbaucheec21bd2016-03-20 06:15:43 -070031bool ParseDataChannelOpenMessage(const rtc::CopyOnWriteBuffer& payload,
wu@webrtc.org1d1ffc92013-10-16 18:12:02 +000032 std::string* label,
henrika@webrtc.orgaebb1ad2014-01-14 10:00:58 +000033 DataChannelInit* config);
34
jbaucheec21bd2016-03-20 06:15:43 -070035bool ParseDataChannelOpenAckMessage(const rtc::CopyOnWriteBuffer& payload);
wu@webrtc.org1d1ffc92013-10-16 18:12:02 +000036
37bool WriteDataChannelOpenMessage(const std::string& label,
henrika@webrtc.orgaebb1ad2014-01-14 10:00:58 +000038 const DataChannelInit& config,
jbaucheec21bd2016-03-20 06:15:43 -070039 rtc::CopyOnWriteBuffer* payload);
wu@webrtc.org1d1ffc92013-10-16 18:12:02 +000040
jbaucheec21bd2016-03-20 06:15:43 -070041void WriteDataChannelOpenAckMessage(rtc::CopyOnWriteBuffer* payload);
Bjorn A Mellembc3eebc2019-09-23 14:53:54 -070042
henrika@webrtc.orgaebb1ad2014-01-14 10:00:58 +000043} // namespace webrtc
wu@webrtc.org1d1ffc92013-10-16 18:12:02 +000044
Steve Anton10542f22019-01-11 09:11:00 -080045#endif // PC_SCTP_UTILS_H_