OLD | NEW |
1 /* | 1 /* |
2 * libjingle | 2 * libjingle |
3 * Copyright 2012 Google Inc. | 3 * Copyright 2012 Google Inc. |
4 * | 4 * |
5 * Redistribution and use in source and binary forms, with or without | 5 * Redistribution and use in source and binary forms, with or without |
6 * modification, are permitted provided that the following conditions are met: | 6 * modification, are permitted provided that the following conditions are met: |
7 * | 7 * |
8 * 1. Redistributions of source code must retain the above copyright notice, | 8 * 1. Redistributions of source code must retain the above copyright notice, |
9 * this list of conditions and the following disclaimer. | 9 * this list of conditions and the following disclaimer. |
10 * 2. Redistributions in binary form must reproduce the above copyright notice, | 10 * 2. Redistributions in binary form must reproduce the above copyright notice, |
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
80 // This class represents a collection of candidates for a specific m-line. | 80 // This class represents a collection of candidates for a specific m-line. |
81 // This class is used in SessionDescriptionInterface to represent all known | 81 // This class is used in SessionDescriptionInterface to represent all known |
82 // candidates for a certain m-line. | 82 // candidates for a certain m-line. |
83 class IceCandidateCollection { | 83 class IceCandidateCollection { |
84 public: | 84 public: |
85 virtual ~IceCandidateCollection() {} | 85 virtual ~IceCandidateCollection() {} |
86 virtual size_t count() const = 0; | 86 virtual size_t count() const = 0; |
87 // Returns true if an equivalent |candidate| exist in the collection. | 87 // Returns true if an equivalent |candidate| exist in the collection. |
88 virtual bool HasCandidate(const IceCandidateInterface* candidate) const = 0; | 88 virtual bool HasCandidate(const IceCandidateInterface* candidate) const = 0; |
89 virtual const IceCandidateInterface* at(size_t index) const = 0; | 89 virtual const IceCandidateInterface* at(size_t index) const = 0; |
| 90 // Removes candidates that have a matching address and protocol. |
| 91 // Returns the number of candidates that were removed. |
| 92 virtual int remove(const IceCandidateInterface* candidate) = 0; |
90 }; | 93 }; |
91 | 94 |
92 // Class representation of a Session description. | 95 // Class representation of a Session description. |
93 // An instance of this interface is supposed to be owned by one class at | 96 // An instance of this interface is supposed to be owned by one class at |
94 // a time and is therefore not expected to be thread safe. | 97 // a time and is therefore not expected to be thread safe. |
95 class SessionDescriptionInterface { | 98 class SessionDescriptionInterface { |
96 public: | 99 public: |
97 // Supported types: | 100 // Supported types: |
98 static const char kOffer[]; | 101 static const char kOffer[]; |
99 static const char kPrAnswer[]; | 102 static const char kPrAnswer[]; |
100 static const char kAnswer[]; | 103 static const char kAnswer[]; |
101 | 104 |
102 virtual ~SessionDescriptionInterface() {} | 105 virtual ~SessionDescriptionInterface() {} |
103 virtual cricket::SessionDescription* description() = 0; | 106 virtual cricket::SessionDescription* description() = 0; |
104 virtual const cricket::SessionDescription* description() const = 0; | 107 virtual const cricket::SessionDescription* description() const = 0; |
105 // Get the session id and session version, which are defined based on | 108 // Get the session id and session version, which are defined based on |
106 // RFC 4566 for the SDP o= line. | 109 // RFC 4566 for the SDP o= line. |
107 virtual std::string session_id() const = 0; | 110 virtual std::string session_id() const = 0; |
108 virtual std::string session_version() const = 0; | 111 virtual std::string session_version() const = 0; |
109 virtual std::string type() const = 0; | 112 virtual std::string type() const = 0; |
110 // Adds the specified candidate to the description. | 113 // Adds the specified candidate to the description. |
111 // Ownership is not transferred. | 114 // Ownership is not transferred. |
112 // Returns false if the session description does not have a media section that | 115 // Returns false if the session description does not have a media section that |
113 // corresponds to the |candidate| label. | 116 // corresponds to the |candidate| label. |
114 virtual bool AddCandidate(const IceCandidateInterface* candidate) = 0; | 117 virtual bool AddCandidate(const IceCandidateInterface* candidate) = 0; |
| 118 // Removes the candidate that has a matching 5-tuple from the description. |
| 119 // Returns true if a candidate is found and removed. |
| 120 virtual bool RemoveCandidate(const IceCandidateInterface* candidate) = 0; |
115 // Returns the number of m- lines in the session description. | 121 // Returns the number of m- lines in the session description. |
116 virtual size_t number_of_mediasections() const = 0; | 122 virtual size_t number_of_mediasections() const = 0; |
117 // Returns a collection of all candidates that belong to a certain m-line | 123 // Returns a collection of all candidates that belong to a certain m-line |
118 virtual const IceCandidateCollection* candidates( | 124 virtual const IceCandidateCollection* candidates( |
119 size_t mediasection_index) const = 0; | 125 size_t mediasection_index) const = 0; |
120 // Serializes the description to SDP. | 126 // Serializes the description to SDP. |
121 virtual bool ToString(std::string* out) const = 0; | 127 virtual bool ToString(std::string* out) const = 0; |
122 }; | 128 }; |
123 | 129 |
124 // Creates a SessionDescriptionInterface based on SDP string and the type. | 130 // Creates a SessionDescriptionInterface based on SDP string and the type. |
(...skipping 21 matching lines...) Expand all Loading... |
146 virtual void OnSuccess() = 0; | 152 virtual void OnSuccess() = 0; |
147 virtual void OnFailure(const std::string& error) = 0; | 153 virtual void OnFailure(const std::string& error) = 0; |
148 | 154 |
149 protected: | 155 protected: |
150 ~SetSessionDescriptionObserver() {} | 156 ~SetSessionDescriptionObserver() {} |
151 }; | 157 }; |
152 | 158 |
153 } // namespace webrtc | 159 } // namespace webrtc |
154 | 160 |
155 #endif // TALK_APP_WEBRTC_JSEP_H_ | 161 #endif // TALK_APP_WEBRTC_JSEP_H_ |
OLD | NEW |