henrike@webrtc.org | 28e2075 | 2013-07-10 00:45:36 +0000 | [diff] [blame] | 1 | /* |
kjellander | b24317b | 2016-02-10 07:54:43 -0800 | [diff] [blame] | 2 | * Copyright 2011 The WebRTC project authors. All Rights Reserved. |
henrike@webrtc.org | 28e2075 | 2013-07-10 00:45:36 +0000 | [diff] [blame] | 3 | * |
kjellander | b24317b | 2016-02-10 07:54:43 -0800 | [diff] [blame] | 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. |
henrike@webrtc.org | 28e2075 | 2013-07-10 00:45:36 +0000 | [diff] [blame] | 9 | */ |
| 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 Kjellander | 15583c1 | 2016-02-10 10:53:12 +0100 | [diff] [blame] | 20 | #ifndef WEBRTC_API_WEBRTCSDP_H_ |
| 21 | #define WEBRTC_API_WEBRTCSDP_H_ |
henrike@webrtc.org | 28e2075 | 2013-07-10 00:45:36 +0000 | [diff] [blame] | 22 | |
| 23 | #include <string> |
| 24 | |
| 25 | namespace webrtc { |
| 26 | |
| 27 | class IceCandidateInterface; |
| 28 | class JsepIceCandidate; |
| 29 | class JsepSessionDescription; |
| 30 | struct 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. |
deadbeef | 9d3584c | 2016-02-16 17:54:10 -0800 | [diff] [blame^] | 36 | // unified_plan_sdp - If set to true, include "a=msid" lines where appropriate. |
henrike@webrtc.org | 28e2075 | 2013-07-10 00:45:36 +0000 | [diff] [blame] | 37 | // return - SDP string serialized from the arguments. |
deadbeef | 9d3584c | 2016-02-16 17:54:10 -0800 | [diff] [blame^] | 38 | std::string SdpSerialize(const JsepSessionDescription& jdesc, |
| 39 | bool unified_plan_sdp); |
henrike@webrtc.org | 28e2075 | 2013-07-10 00:45:36 +0000 | [diff] [blame] | 40 | |
| 41 | // Serializes the passed in IceCandidateInterface to a SDP string. |
| 42 | // candidate - The candidate to be serialized. |
| 43 | std::string SdpSerializeCandidate(const IceCandidateInterface& candidate); |
| 44 | |
| 45 | // Deserializes the passed in SDP string to a JsepSessionDescription. |
| 46 | // message - SDP string to be Deserialized. |
| 47 | // jdesc - The JsepSessionDescription deserialized from the SDP string. |
| 48 | // error - The detail error information when parsing fails. |
| 49 | // return - true on success, false on failure. |
| 50 | bool SdpDeserialize(const std::string& message, |
| 51 | JsepSessionDescription* jdesc, |
| 52 | SdpParseError* error); |
| 53 | |
| 54 | // Deserializes the passed in SDP string to one JsepIceCandidate. |
| 55 | // The first line must be a=candidate line and only the first line will be |
| 56 | // parsed. |
| 57 | // message - The SDP string to be Deserialized. |
| 58 | // candidates - The JsepIceCandidate from the SDP string. |
| 59 | // error - The detail error information when parsing fails. |
| 60 | // return - true on success, false on failure. |
| 61 | bool SdpDeserializeCandidate(const std::string& message, |
| 62 | JsepIceCandidate* candidate, |
| 63 | SdpParseError* error); |
| 64 | } // namespace webrtc |
| 65 | |
Henrik Kjellander | 15583c1 | 2016-02-10 10:53:12 +0100 | [diff] [blame] | 66 | #endif // WEBRTC_API_WEBRTCSDP_H_ |