blob: 7d67fd8d72705b1501936886530a4824be7458ce [file] [log] [blame]
Steve Anton97a9f762017-10-06 10:14:03 -07001/*
2 * Copyright 2017 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
11#ifndef PC_SDPUTILS_H_
12#define PC_SDPUTILS_H_
13
14#include <functional>
15#include <memory>
16
17#include "api/jsep.h"
18#include "p2p/base/sessiondescription.h"
19
20namespace webrtc {
21
22// Returns a copy of the given session description.
23std::unique_ptr<SessionDescriptionInterface> CloneSessionDescription(
24 const SessionDescriptionInterface* sdesc);
25
26// Function that takes a single session description content with its
27// corresponding transport and produces a boolean.
28typedef std::function<bool(const cricket::ContentInfo*,
29 const cricket::TransportInfo*)>
30 SdpContentPredicate;
31
32// Returns true if the predicate returns true for all contents in the given
33// session description.
34bool SdpContentsAll(SdpContentPredicate pred,
35 const cricket::SessionDescription* desc);
36
37// Returns true if the predicate returns true for none of the contents in the
38// given session description.
39bool SdpContentsNone(SdpContentPredicate pred,
40 const cricket::SessionDescription* desc);
41
42// Function that takes a single session description content with its
43// corresponding transport and can mutate the content and/or the transport.
44typedef std::function<void(cricket::ContentInfo*, cricket::TransportInfo*)>
45 SdpContentMutator;
46
47// Applies the mutator function over all contents in the given session
48// description.
49void SdpContentsForEach(SdpContentMutator fn,
50 cricket::SessionDescription* desc);
51
52} // namespace webrtc
53
54#endif // PC_SDPUTILS_H_