sctp_utils.h 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  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. #ifndef PC_SCTP_UTILS_H_
  11. #define PC_SCTP_UTILS_H_
  12. #include <string>
  13. #include "api/data_channel_interface.h"
  14. #include "api/transport/data_channel_transport_interface.h"
  15. #include "media/base/media_channel.h"
  16. namespace rtc {
  17. class CopyOnWriteBuffer;
  18. } // namespace rtc
  19. namespace webrtc {
  20. struct DataChannelInit;
  21. // Read the message type and return true if it's an OPEN message.
  22. bool IsOpenMessage(const rtc::CopyOnWriteBuffer& payload);
  23. bool ParseDataChannelOpenMessage(const rtc::CopyOnWriteBuffer& payload,
  24. std::string* label,
  25. DataChannelInit* config);
  26. bool ParseDataChannelOpenAckMessage(const rtc::CopyOnWriteBuffer& payload);
  27. bool WriteDataChannelOpenMessage(const std::string& label,
  28. const DataChannelInit& config,
  29. rtc::CopyOnWriteBuffer* payload);
  30. void WriteDataChannelOpenAckMessage(rtc::CopyOnWriteBuffer* payload);
  31. cricket::DataMessageType ToCricketDataMessageType(DataMessageType type);
  32. DataMessageType ToWebrtcDataMessageType(cricket::DataMessageType type);
  33. } // namespace webrtc
  34. #endif // PC_SCTP_UTILS_H_