blob: 339ef2116338f67f4c61a76d62ca79e6ff1113c5 [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"
henrika@webrtc.orgaebb1ad2014-01-14 10:00:58 +000019
buildbot@webrtc.orgd4e598d2014-07-29 17:36:52 +000020namespace rtc {
jbaucheec21bd2016-03-20 06:15:43 -070021class CopyOnWriteBuffer;
buildbot@webrtc.orgd4e598d2014-07-29 17:36:52 +000022} // namespace rtc
wu@webrtc.org1d1ffc92013-10-16 18:12:02 +000023
24namespace webrtc {
25struct DataChannelInit;
wu@webrtc.org1d1ffc92013-10-16 18:12:02 +000026
deadbeefab9b2d12015-10-14 11:33:11 -070027// Read the message type and return true if it's an OPEN message.
jbaucheec21bd2016-03-20 06:15:43 -070028bool IsOpenMessage(const rtc::CopyOnWriteBuffer& payload);
deadbeefab9b2d12015-10-14 11:33:11 -070029
jbaucheec21bd2016-03-20 06:15:43 -070030bool ParseDataChannelOpenMessage(const rtc::CopyOnWriteBuffer& payload,
wu@webrtc.org1d1ffc92013-10-16 18:12:02 +000031 std::string* label,
henrika@webrtc.orgaebb1ad2014-01-14 10:00:58 +000032 DataChannelInit* config);
33
jbaucheec21bd2016-03-20 06:15:43 -070034bool ParseDataChannelOpenAckMessage(const rtc::CopyOnWriteBuffer& payload);
wu@webrtc.org1d1ffc92013-10-16 18:12:02 +000035
36bool WriteDataChannelOpenMessage(const std::string& label,
henrika@webrtc.orgaebb1ad2014-01-14 10:00:58 +000037 const DataChannelInit& config,
jbaucheec21bd2016-03-20 06:15:43 -070038 rtc::CopyOnWriteBuffer* payload);
wu@webrtc.org1d1ffc92013-10-16 18:12:02 +000039
jbaucheec21bd2016-03-20 06:15:43 -070040void WriteDataChannelOpenAckMessage(rtc::CopyOnWriteBuffer* payload);
Bjorn A Mellembc3eebc2019-09-23 14:53:54 -070041
42cricket::DataMessageType ToCricketDataMessageType(DataMessageType type);
43
44DataMessageType ToWebrtcDataMessageType(cricket::DataMessageType type);
45
henrika@webrtc.orgaebb1ad2014-01-14 10:00:58 +000046} // namespace webrtc
wu@webrtc.org1d1ffc92013-10-16 18:12:02 +000047
Steve Anton10542f22019-01-11 09:11:00 -080048#endif // PC_SCTP_UTILS_H_