15976650443d68ccfadf1dea24999ee459dd2819mflodman@webrtc.org/*
25976650443d68ccfadf1dea24999ee459dd2819mflodman@webrtc.org * libjingle
35976650443d68ccfadf1dea24999ee459dd2819mflodman@webrtc.org * Copyright 2011, Google Inc.
45976650443d68ccfadf1dea24999ee459dd2819mflodman@webrtc.org *
55976650443d68ccfadf1dea24999ee459dd2819mflodman@webrtc.org * Redistribution and use in source and binary forms, with or without
65976650443d68ccfadf1dea24999ee459dd2819mflodman@webrtc.org * modification, are permitted provided that the following conditions are met:
75976650443d68ccfadf1dea24999ee459dd2819mflodman@webrtc.org *
85976650443d68ccfadf1dea24999ee459dd2819mflodman@webrtc.org *  1. Redistributions of source code must retain the above copyright notice,
95976650443d68ccfadf1dea24999ee459dd2819mflodman@webrtc.org *     this list of conditions and the following disclaimer.
105976650443d68ccfadf1dea24999ee459dd2819mflodman@webrtc.org *  2. Redistributions in binary form must reproduce the above copyright notice,
115976650443d68ccfadf1dea24999ee459dd2819mflodman@webrtc.org *     this list of conditions and the following disclaimer in the documentation
125976650443d68ccfadf1dea24999ee459dd2819mflodman@webrtc.org *     and/or other materials provided with the distribution.
135976650443d68ccfadf1dea24999ee459dd2819mflodman@webrtc.org *  3. The name of the author may not be used to endorse or promote products
145976650443d68ccfadf1dea24999ee459dd2819mflodman@webrtc.org *     derived from this software without specific prior written permission.
155976650443d68ccfadf1dea24999ee459dd2819mflodman@webrtc.org *
165976650443d68ccfadf1dea24999ee459dd2819mflodman@webrtc.org * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
175976650443d68ccfadf1dea24999ee459dd2819mflodman@webrtc.org * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
185976650443d68ccfadf1dea24999ee459dd2819mflodman@webrtc.org * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO
195976650443d68ccfadf1dea24999ee459dd2819mflodman@webrtc.org * EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
205976650443d68ccfadf1dea24999ee459dd2819mflodman@webrtc.org * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
215976650443d68ccfadf1dea24999ee459dd2819mflodman@webrtc.org * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
225976650443d68ccfadf1dea24999ee459dd2819mflodman@webrtc.org * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
235976650443d68ccfadf1dea24999ee459dd2819mflodman@webrtc.org * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
245976650443d68ccfadf1dea24999ee459dd2819mflodman@webrtc.org * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
255976650443d68ccfadf1dea24999ee459dd2819mflodman@webrtc.org * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
265976650443d68ccfadf1dea24999ee459dd2819mflodman@webrtc.org */
275976650443d68ccfadf1dea24999ee459dd2819mflodman@webrtc.org
285976650443d68ccfadf1dea24999ee459dd2819mflodman@webrtc.org// This file contain functions for parsing and serializing SDP messages.
295976650443d68ccfadf1dea24999ee459dd2819mflodman@webrtc.org// Related RFC/draft including:
305976650443d68ccfadf1dea24999ee459dd2819mflodman@webrtc.org// * RFC 4566 - SDP
315976650443d68ccfadf1dea24999ee459dd2819mflodman@webrtc.org// * RFC 5245 - ICE
325976650443d68ccfadf1dea24999ee459dd2819mflodman@webrtc.org// * RFC 3388 - Grouping of Media Lines in SDP
335976650443d68ccfadf1dea24999ee459dd2819mflodman@webrtc.org// * RFC 4568 - SDP Security Descriptions for Media Streams
345976650443d68ccfadf1dea24999ee459dd2819mflodman@webrtc.org// * draft-lennox-mmusic-sdp-source-selection-02 -
355976650443d68ccfadf1dea24999ee459dd2819mflodman@webrtc.org//   Mechanisms for Media Source Selection in SDP
365976650443d68ccfadf1dea24999ee459dd2819mflodman@webrtc.org
375976650443d68ccfadf1dea24999ee459dd2819mflodman@webrtc.org#ifndef TALK_APP_WEBRTC_WEBRTCSDP_H_
385976650443d68ccfadf1dea24999ee459dd2819mflodman@webrtc.org#define TALK_APP_WEBRTC_WEBRTCSDP_H_
395976650443d68ccfadf1dea24999ee459dd2819mflodman@webrtc.org
405976650443d68ccfadf1dea24999ee459dd2819mflodman@webrtc.org#include <string>
415976650443d68ccfadf1dea24999ee459dd2819mflodman@webrtc.org
425976650443d68ccfadf1dea24999ee459dd2819mflodman@webrtc.orgnamespace webrtc {
435976650443d68ccfadf1dea24999ee459dd2819mflodman@webrtc.org
445976650443d68ccfadf1dea24999ee459dd2819mflodman@webrtc.orgclass IceCandidateInterface;
455976650443d68ccfadf1dea24999ee459dd2819mflodman@webrtc.orgclass JsepIceCandidate;
465976650443d68ccfadf1dea24999ee459dd2819mflodman@webrtc.orgclass JsepSessionDescription;
475976650443d68ccfadf1dea24999ee459dd2819mflodman@webrtc.orgstruct SdpParseError;
485976650443d68ccfadf1dea24999ee459dd2819mflodman@webrtc.org
495976650443d68ccfadf1dea24999ee459dd2819mflodman@webrtc.org// Serializes the passed in JsepSessionDescription.
505976650443d68ccfadf1dea24999ee459dd2819mflodman@webrtc.org// Serialize SessionDescription including candidates if
515976650443d68ccfadf1dea24999ee459dd2819mflodman@webrtc.org// JsepSessionDescription has candidates.
525976650443d68ccfadf1dea24999ee459dd2819mflodman@webrtc.org// jdesc - The JsepSessionDescription object to be serialized.
535976650443d68ccfadf1dea24999ee459dd2819mflodman@webrtc.org// return - SDP string serialized from the arguments.
545976650443d68ccfadf1dea24999ee459dd2819mflodman@webrtc.orgstd::string SdpSerialize(const JsepSessionDescription& jdesc);
555976650443d68ccfadf1dea24999ee459dd2819mflodman@webrtc.org
565976650443d68ccfadf1dea24999ee459dd2819mflodman@webrtc.org// Serializes the passed in IceCandidateInterface to a SDP string.
575976650443d68ccfadf1dea24999ee459dd2819mflodman@webrtc.org// candidate - The candidate to be serialized.
585976650443d68ccfadf1dea24999ee459dd2819mflodman@webrtc.orgstd::string SdpSerializeCandidate(const IceCandidateInterface& candidate);
595976650443d68ccfadf1dea24999ee459dd2819mflodman@webrtc.org
605976650443d68ccfadf1dea24999ee459dd2819mflodman@webrtc.org// Deserializes the passed in SDP string to a JsepSessionDescription.
615976650443d68ccfadf1dea24999ee459dd2819mflodman@webrtc.org// message - SDP string to be Deserialized.
625976650443d68ccfadf1dea24999ee459dd2819mflodman@webrtc.org// jdesc - The JsepSessionDescription deserialized from the SDP string.
635976650443d68ccfadf1dea24999ee459dd2819mflodman@webrtc.org// error - The detail error information when parsing fails.
645976650443d68ccfadf1dea24999ee459dd2819mflodman@webrtc.org// return - true on success, false on failure.
655976650443d68ccfadf1dea24999ee459dd2819mflodman@webrtc.orgbool SdpDeserialize(const std::string& message,
665976650443d68ccfadf1dea24999ee459dd2819mflodman@webrtc.org                    JsepSessionDescription* jdesc,
675976650443d68ccfadf1dea24999ee459dd2819mflodman@webrtc.org                    SdpParseError* error);
685976650443d68ccfadf1dea24999ee459dd2819mflodman@webrtc.org
695976650443d68ccfadf1dea24999ee459dd2819mflodman@webrtc.org// Deserializes the passed in SDP string to one JsepIceCandidate.
705976650443d68ccfadf1dea24999ee459dd2819mflodman@webrtc.org// The first line must be a=candidate line and only the first line will be
715976650443d68ccfadf1dea24999ee459dd2819mflodman@webrtc.org// parsed.
725976650443d68ccfadf1dea24999ee459dd2819mflodman@webrtc.org// message - The SDP string to be Deserialized.
735976650443d68ccfadf1dea24999ee459dd2819mflodman@webrtc.org// candidates - The JsepIceCandidate from the SDP string.
745976650443d68ccfadf1dea24999ee459dd2819mflodman@webrtc.org// error - The detail error information when parsing fails.
755976650443d68ccfadf1dea24999ee459dd2819mflodman@webrtc.org// return - true on success, false on failure.
765976650443d68ccfadf1dea24999ee459dd2819mflodman@webrtc.orgbool SdpDeserializeCandidate(const std::string& message,
775976650443d68ccfadf1dea24999ee459dd2819mflodman@webrtc.org                             JsepIceCandidate* candidate,
785976650443d68ccfadf1dea24999ee459dd2819mflodman@webrtc.org                             SdpParseError* error);
795976650443d68ccfadf1dea24999ee459dd2819mflodman@webrtc.org}  // namespace webrtc
805976650443d68ccfadf1dea24999ee459dd2819mflodman@webrtc.org
815976650443d68ccfadf1dea24999ee459dd2819mflodman@webrtc.org#endif  // TALK_APP_WEBRTC_WEBRTCSDP_H_
82