blob: 5997fa18d004f58a33faee6d19e341ce7316e871 [file] [log] [blame]
henrike@webrtc.org28e20752013-07-10 00:45:36 +00001/*
kjellanderb24317b2016-02-10 07:54:43 -08002 * Copyright 2011 The WebRTC project authors. All Rights Reserved.
henrike@webrtc.org28e20752013-07-10 00:45:36 +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.
henrike@webrtc.org28e20752013-07-10 00:45:36 +00009 */
10
11// This file contain functions for parsing and serializing SDP messages.
12// Related RFC/draft including:
13// * RFC 4566 - SDP
14// * RFC 5245 - ICE
15// * RFC 3388 - Grouping of Media Lines in SDP
16// * RFC 4568 - SDP Security Descriptions for Media Streams
17// * draft-lennox-mmusic-sdp-source-selection-02 -
18// Mechanisms for Media Source Selection in SDP
19
Henrik Kjellander15583c12016-02-10 10:53:12 +010020#ifndef WEBRTC_API_WEBRTCSDP_H_
21#define WEBRTC_API_WEBRTCSDP_H_
henrike@webrtc.org28e20752013-07-10 00:45:36 +000022
23#include <string>
24
25namespace webrtc {
26
27class IceCandidateInterface;
28class JsepIceCandidate;
29class JsepSessionDescription;
30struct SdpParseError;
31
32// Serializes the passed in JsepSessionDescription.
33// Serialize SessionDescription including candidates if
34// JsepSessionDescription has candidates.
35// jdesc - The JsepSessionDescription object to be serialized.
36// return - SDP string serialized from the arguments.
37std::string SdpSerialize(const JsepSessionDescription& jdesc);
38
39// Serializes the passed in IceCandidateInterface to a SDP string.
40// candidate - The candidate to be serialized.
41std::string SdpSerializeCandidate(const IceCandidateInterface& candidate);
42
43// Deserializes the passed in SDP string to a JsepSessionDescription.
44// message - SDP string to be Deserialized.
45// jdesc - The JsepSessionDescription deserialized from the SDP string.
46// error - The detail error information when parsing fails.
47// return - true on success, false on failure.
48bool SdpDeserialize(const std::string& message,
49 JsepSessionDescription* jdesc,
50 SdpParseError* error);
51
52// Deserializes the passed in SDP string to one JsepIceCandidate.
53// The first line must be a=candidate line and only the first line will be
54// parsed.
55// message - The SDP string to be Deserialized.
56// candidates - The JsepIceCandidate from the SDP string.
57// error - The detail error information when parsing fails.
58// return - true on success, false on failure.
59bool SdpDeserializeCandidate(const std::string& message,
60 JsepIceCandidate* candidate,
61 SdpParseError* error);
62} // namespace webrtc
63
Henrik Kjellander15583c12016-02-10 10:53:12 +010064#endif // WEBRTC_API_WEBRTCSDP_H_