2013-07-10 00:45:36 +00:00
|
|
|
/*
|
2016-02-10 07:54:43 -08:00
|
|
|
* Copyright 2011 The WebRTC project authors. All Rights Reserved.
|
2013-07-10 00:45:36 +00:00
|
|
|
*
|
2016-02-10 07:54:43 -08:00
|
|
|
* Use of this source code is governed by a BSD-style license
|
|
|
|
|
* that can be found in the LICENSE file in the root of the source
|
|
|
|
|
* tree. An additional intellectual property rights grant can be found
|
|
|
|
|
* in the file PATENTS. All contributing project authors may
|
|
|
|
|
* be found in the AUTHORS file in the root of the source tree.
|
2013-07-10 00:45:36 +00:00
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
// This file contain functions for parsing and serializing SDP messages.
|
|
|
|
|
// Related RFC/draft including:
|
|
|
|
|
// * RFC 4566 - SDP
|
|
|
|
|
// * RFC 5245 - ICE
|
|
|
|
|
// * RFC 3388 - Grouping of Media Lines in SDP
|
|
|
|
|
// * RFC 4568 - SDP Security Descriptions for Media Streams
|
|
|
|
|
// * draft-lennox-mmusic-sdp-source-selection-02 -
|
|
|
|
|
// Mechanisms for Media Source Selection in SDP
|
|
|
|
|
|
2019-01-11 09:11:00 -08:00
|
|
|
#ifndef PC_WEBRTC_SDP_H_
|
|
|
|
|
#define PC_WEBRTC_SDP_H_
|
2013-07-10 00:45:36 +00:00
|
|
|
|
|
|
|
|
#include <string>
|
|
|
|
|
|
2018-10-24 16:22:04 +02:00
|
|
|
#include "rtc_base/system/rtc_export.h"
|
|
|
|
|
|
2016-03-14 11:59:18 -07:00
|
|
|
namespace cricket {
|
|
|
|
|
class Candidate;
|
|
|
|
|
} // namespace cricket
|
2016-03-11 14:05:09 -08:00
|
|
|
|
2016-03-14 11:59:18 -07:00
|
|
|
namespace webrtc {
|
2013-07-10 00:45:36 +00:00
|
|
|
class IceCandidateInterface;
|
|
|
|
|
class JsepIceCandidate;
|
|
|
|
|
class JsepSessionDescription;
|
|
|
|
|
struct SdpParseError;
|
|
|
|
|
|
|
|
|
|
// Serializes the passed in JsepSessionDescription.
|
|
|
|
|
// Serialize SessionDescription including candidates if
|
|
|
|
|
// JsepSessionDescription has candidates.
|
|
|
|
|
// jdesc - The JsepSessionDescription object to be serialized.
|
2016-02-16 17:54:10 -08:00
|
|
|
// unified_plan_sdp - If set to true, include "a=msid" lines where appropriate.
|
2013-07-10 00:45:36 +00:00
|
|
|
// return - SDP string serialized from the arguments.
|
2018-02-01 12:22:16 -08:00
|
|
|
std::string SdpSerialize(const JsepSessionDescription& jdesc);
|
2013-07-10 00:45:36 +00:00
|
|
|
|
|
|
|
|
// Serializes the passed in IceCandidateInterface to a SDP string.
|
|
|
|
|
// candidate - The candidate to be serialized.
|
|
|
|
|
std::string SdpSerializeCandidate(const IceCandidateInterface& candidate);
|
|
|
|
|
|
2016-03-14 11:59:18 -07:00
|
|
|
// Serializes a cricket Candidate.
|
|
|
|
|
// candidate - The candidate to be serialized.
|
2018-10-24 16:22:04 +02:00
|
|
|
RTC_EXPORT std::string SdpSerializeCandidate(
|
|
|
|
|
const cricket::Candidate& candidate);
|
2016-03-14 11:59:18 -07:00
|
|
|
|
2013-07-10 00:45:36 +00:00
|
|
|
// Deserializes the passed in SDP string to a JsepSessionDescription.
|
|
|
|
|
// message - SDP string to be Deserialized.
|
|
|
|
|
// jdesc - The JsepSessionDescription deserialized from the SDP string.
|
|
|
|
|
// error - The detail error information when parsing fails.
|
|
|
|
|
// return - true on success, false on failure.
|
|
|
|
|
bool SdpDeserialize(const std::string& message,
|
|
|
|
|
JsepSessionDescription* jdesc,
|
|
|
|
|
SdpParseError* error);
|
|
|
|
|
|
|
|
|
|
// Deserializes the passed in SDP string to one JsepIceCandidate.
|
|
|
|
|
// The first line must be a=candidate line and only the first line will be
|
|
|
|
|
// parsed.
|
|
|
|
|
// message - The SDP string to be Deserialized.
|
|
|
|
|
// candidates - The JsepIceCandidate from the SDP string.
|
|
|
|
|
// error - The detail error information when parsing fails.
|
|
|
|
|
// return - true on success, false on failure.
|
|
|
|
|
bool SdpDeserializeCandidate(const std::string& message,
|
|
|
|
|
JsepIceCandidate* candidate,
|
|
|
|
|
SdpParseError* error);
|
2016-03-14 11:59:18 -07:00
|
|
|
|
|
|
|
|
// Deserializes the passed in SDP string to a cricket Candidate.
|
|
|
|
|
// The first line must be a=candidate line and only the first line will be
|
|
|
|
|
// parsed.
|
|
|
|
|
// transport_name - The transport name (MID) of the candidate.
|
|
|
|
|
// message - The SDP string to be deserialized.
|
|
|
|
|
// candidate - The cricket Candidate from the SDP string.
|
|
|
|
|
// error - The detail error information when parsing fails.
|
|
|
|
|
// return - true on success, false on failure.
|
2018-10-24 16:22:04 +02:00
|
|
|
RTC_EXPORT bool SdpDeserializeCandidate(const std::string& transport_name,
|
|
|
|
|
const std::string& message,
|
|
|
|
|
cricket::Candidate* candidate,
|
|
|
|
|
SdpParseError* error);
|
2016-03-14 11:59:18 -07:00
|
|
|
|
2013-07-10 00:45:36 +00:00
|
|
|
} // namespace webrtc
|
|
|
|
|
|
2019-01-11 09:11:00 -08:00
|
|
|
#endif // PC_WEBRTC_SDP_H_
|