mirror of
https://github.com/mollyim/webrtc.git
synced 2025-05-17 23:57:59 +01:00
Fix clang style warnings in p2p/base/{session,transport}description
Bug: webrtc:163 Change-Id: Id876608c1a20bde49f0f7d1eda1b38dcb647bf3f Reviewed-on: https://webrtc-review.googlesource.com/17004 Reviewed-by: Karl Wiberg <kwiberg@webrtc.org> Commit-Queue: Steve Anton <steveanton@webrtc.org> Cr-Commit-Position: refs/heads/master@{#20507}
This commit is contained in:
parent
ee674431fb
commit
d3ea9996ed
6 changed files with 109 additions and 60 deletions
|
@ -45,6 +45,15 @@ const ContentInfo* FindContentInfoByType(
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ContentGroup::ContentGroup(const std::string& semantics)
|
||||||
|
: semantics_(semantics) {}
|
||||||
|
|
||||||
|
ContentGroup::ContentGroup(const ContentGroup&) = default;
|
||||||
|
ContentGroup::ContentGroup(ContentGroup&&) = default;
|
||||||
|
ContentGroup& ContentGroup::operator=(const ContentGroup&) = default;
|
||||||
|
ContentGroup& ContentGroup::operator=(ContentGroup&&) = default;
|
||||||
|
ContentGroup::~ContentGroup() = default;
|
||||||
|
|
||||||
const std::string* ContentGroup::FirstContentName() const {
|
const std::string* ContentGroup::FirstContentName() const {
|
||||||
return (!content_names_.empty()) ? &(*content_names_.begin()) : NULL;
|
return (!content_names_.empty()) ? &(*content_names_.begin()) : NULL;
|
||||||
}
|
}
|
||||||
|
@ -70,6 +79,31 @@ bool ContentGroup::RemoveContentName(const std::string& content_name) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
SessionDescription::SessionDescription() = default;
|
||||||
|
|
||||||
|
SessionDescription::SessionDescription(const ContentInfos& contents)
|
||||||
|
: contents_(contents) {}
|
||||||
|
|
||||||
|
SessionDescription::SessionDescription(const ContentInfos& contents,
|
||||||
|
const ContentGroups& groups)
|
||||||
|
: contents_(contents), content_groups_(groups) {}
|
||||||
|
|
||||||
|
SessionDescription::SessionDescription(const ContentInfos& contents,
|
||||||
|
const TransportInfos& transports,
|
||||||
|
const ContentGroups& groups)
|
||||||
|
: contents_(contents),
|
||||||
|
transport_infos_(transports),
|
||||||
|
content_groups_(groups) {}
|
||||||
|
|
||||||
|
SessionDescription::SessionDescription(const SessionDescription&) = default;
|
||||||
|
|
||||||
|
SessionDescription::~SessionDescription() {
|
||||||
|
for (ContentInfos::iterator content = contents_.begin();
|
||||||
|
content != contents_.end(); ++content) {
|
||||||
|
delete content->description;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
SessionDescription* SessionDescription::Copy() const {
|
SessionDescription* SessionDescription::Copy() const {
|
||||||
SessionDescription* copy = new SessionDescription(*this);
|
SessionDescription* copy = new SessionDescription(*this);
|
||||||
// Copy all ContentDescriptions.
|
// Copy all ContentDescriptions.
|
||||||
|
|
|
@ -67,8 +67,12 @@ typedef std::vector<std::string> ContentNames;
|
||||||
// MediaDescription.
|
// MediaDescription.
|
||||||
class ContentGroup {
|
class ContentGroup {
|
||||||
public:
|
public:
|
||||||
explicit ContentGroup(const std::string& semantics) :
|
explicit ContentGroup(const std::string& semantics);
|
||||||
semantics_(semantics) {}
|
ContentGroup(const ContentGroup&);
|
||||||
|
ContentGroup(ContentGroup&&);
|
||||||
|
ContentGroup& operator=(const ContentGroup&);
|
||||||
|
ContentGroup& operator=(ContentGroup&&);
|
||||||
|
~ContentGroup();
|
||||||
|
|
||||||
const std::string& semantics() const { return semantics_; }
|
const std::string& semantics() const { return semantics_; }
|
||||||
const ContentNames& content_names() const { return content_names_; }
|
const ContentNames& content_names() const { return content_names_; }
|
||||||
|
@ -96,25 +100,13 @@ const ContentInfo* FindContentInfoByType(
|
||||||
// contents are unique be name, but doesn't enforce that.
|
// contents are unique be name, but doesn't enforce that.
|
||||||
class SessionDescription {
|
class SessionDescription {
|
||||||
public:
|
public:
|
||||||
SessionDescription() {}
|
SessionDescription();
|
||||||
explicit SessionDescription(const ContentInfos& contents) :
|
explicit SessionDescription(const ContentInfos& contents);
|
||||||
contents_(contents) {}
|
SessionDescription(const ContentInfos& contents, const ContentGroups& groups);
|
||||||
SessionDescription(const ContentInfos& contents,
|
|
||||||
const ContentGroups& groups) :
|
|
||||||
contents_(contents),
|
|
||||||
content_groups_(groups) {}
|
|
||||||
SessionDescription(const ContentInfos& contents,
|
SessionDescription(const ContentInfos& contents,
|
||||||
const TransportInfos& transports,
|
const TransportInfos& transports,
|
||||||
const ContentGroups& groups) :
|
const ContentGroups& groups);
|
||||||
contents_(contents),
|
~SessionDescription();
|
||||||
transport_infos_(transports),
|
|
||||||
content_groups_(groups) {}
|
|
||||||
~SessionDescription() {
|
|
||||||
for (ContentInfos::iterator content = contents_.begin();
|
|
||||||
content != contents_.end(); ++content) {
|
|
||||||
delete content->description;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
SessionDescription* Copy() const;
|
SessionDescription* Copy() const;
|
||||||
|
|
||||||
|
@ -181,6 +173,8 @@ class SessionDescription {
|
||||||
bool msid_supported() const { return msid_supported_; }
|
bool msid_supported() const { return msid_supported_; }
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
SessionDescription(const SessionDescription&);
|
||||||
|
|
||||||
ContentInfos contents_;
|
ContentInfos contents_;
|
||||||
TransportInfos transport_infos_;
|
TransportInfos transport_infos_;
|
||||||
ContentGroups content_groups_;
|
ContentGroups content_groups_;
|
||||||
|
|
|
@ -53,4 +53,54 @@ bool ConnectionRoleToString(const ConnectionRole& role, std::string* role_str) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
TransportDescription::TransportDescription()
|
||||||
|
: ice_mode(ICEMODE_FULL), connection_role(CONNECTIONROLE_NONE) {}
|
||||||
|
|
||||||
|
TransportDescription::TransportDescription(
|
||||||
|
const std::vector<std::string>& transport_options,
|
||||||
|
const std::string& ice_ufrag,
|
||||||
|
const std::string& ice_pwd,
|
||||||
|
IceMode ice_mode,
|
||||||
|
ConnectionRole role,
|
||||||
|
const rtc::SSLFingerprint* identity_fingerprint)
|
||||||
|
: transport_options(transport_options),
|
||||||
|
ice_ufrag(ice_ufrag),
|
||||||
|
ice_pwd(ice_pwd),
|
||||||
|
ice_mode(ice_mode),
|
||||||
|
connection_role(role),
|
||||||
|
identity_fingerprint(CopyFingerprint(identity_fingerprint)) {}
|
||||||
|
|
||||||
|
TransportDescription::TransportDescription(const std::string& ice_ufrag,
|
||||||
|
const std::string& ice_pwd)
|
||||||
|
: ice_ufrag(ice_ufrag),
|
||||||
|
ice_pwd(ice_pwd),
|
||||||
|
ice_mode(ICEMODE_FULL),
|
||||||
|
connection_role(CONNECTIONROLE_NONE) {}
|
||||||
|
|
||||||
|
TransportDescription::TransportDescription(const TransportDescription& from)
|
||||||
|
: transport_options(from.transport_options),
|
||||||
|
ice_ufrag(from.ice_ufrag),
|
||||||
|
ice_pwd(from.ice_pwd),
|
||||||
|
ice_mode(from.ice_mode),
|
||||||
|
connection_role(from.connection_role),
|
||||||
|
identity_fingerprint(CopyFingerprint(from.identity_fingerprint.get())) {}
|
||||||
|
|
||||||
|
TransportDescription::~TransportDescription() = default;
|
||||||
|
|
||||||
|
TransportDescription& TransportDescription::operator=(
|
||||||
|
const TransportDescription& from) {
|
||||||
|
// Self-assignment
|
||||||
|
if (this == &from)
|
||||||
|
return *this;
|
||||||
|
|
||||||
|
transport_options = from.transport_options;
|
||||||
|
ice_ufrag = from.ice_ufrag;
|
||||||
|
ice_pwd = from.ice_pwd;
|
||||||
|
ice_mode = from.ice_mode;
|
||||||
|
connection_role = from.connection_role;
|
||||||
|
|
||||||
|
identity_fingerprint.reset(CopyFingerprint(from.identity_fingerprint.get()));
|
||||||
|
return *this;
|
||||||
|
}
|
||||||
|
|
||||||
} // namespace cricket
|
} // namespace cricket
|
||||||
|
|
|
@ -87,59 +87,26 @@ extern const char CONNECTIONROLE_PASSIVE_STR[];
|
||||||
extern const char CONNECTIONROLE_ACTPASS_STR[];
|
extern const char CONNECTIONROLE_ACTPASS_STR[];
|
||||||
extern const char CONNECTIONROLE_HOLDCONN_STR[];
|
extern const char CONNECTIONROLE_HOLDCONN_STR[];
|
||||||
|
|
||||||
constexpr auto ICE_OPTION_TRICKLE = "trickle";
|
constexpr auto* ICE_OPTION_TRICKLE = "trickle";
|
||||||
constexpr auto ICE_OPTION_RENOMINATION = "renomination";
|
constexpr auto* ICE_OPTION_RENOMINATION = "renomination";
|
||||||
|
|
||||||
bool StringToConnectionRole(const std::string& role_str, ConnectionRole* role);
|
bool StringToConnectionRole(const std::string& role_str, ConnectionRole* role);
|
||||||
bool ConnectionRoleToString(const ConnectionRole& role, std::string* role_str);
|
bool ConnectionRoleToString(const ConnectionRole& role, std::string* role_str);
|
||||||
|
|
||||||
struct TransportDescription {
|
struct TransportDescription {
|
||||||
TransportDescription()
|
TransportDescription();
|
||||||
: ice_mode(ICEMODE_FULL),
|
|
||||||
connection_role(CONNECTIONROLE_NONE) {}
|
|
||||||
|
|
||||||
TransportDescription(const std::vector<std::string>& transport_options,
|
TransportDescription(const std::vector<std::string>& transport_options,
|
||||||
const std::string& ice_ufrag,
|
const std::string& ice_ufrag,
|
||||||
const std::string& ice_pwd,
|
const std::string& ice_pwd,
|
||||||
IceMode ice_mode,
|
IceMode ice_mode,
|
||||||
ConnectionRole role,
|
ConnectionRole role,
|
||||||
const rtc::SSLFingerprint* identity_fingerprint)
|
const rtc::SSLFingerprint* identity_fingerprint);
|
||||||
: transport_options(transport_options),
|
|
||||||
ice_ufrag(ice_ufrag),
|
|
||||||
ice_pwd(ice_pwd),
|
|
||||||
ice_mode(ice_mode),
|
|
||||||
connection_role(role),
|
|
||||||
identity_fingerprint(CopyFingerprint(identity_fingerprint)) {}
|
|
||||||
TransportDescription(const std::string& ice_ufrag,
|
TransportDescription(const std::string& ice_ufrag,
|
||||||
const std::string& ice_pwd)
|
const std::string& ice_pwd);
|
||||||
: ice_ufrag(ice_ufrag),
|
TransportDescription(const TransportDescription& from);
|
||||||
ice_pwd(ice_pwd),
|
~TransportDescription();
|
||||||
ice_mode(ICEMODE_FULL),
|
|
||||||
connection_role(CONNECTIONROLE_NONE) {}
|
|
||||||
TransportDescription(const TransportDescription& from)
|
|
||||||
: transport_options(from.transport_options),
|
|
||||||
ice_ufrag(from.ice_ufrag),
|
|
||||||
ice_pwd(from.ice_pwd),
|
|
||||||
ice_mode(from.ice_mode),
|
|
||||||
connection_role(from.connection_role),
|
|
||||||
identity_fingerprint(CopyFingerprint(from.identity_fingerprint.get())) {
|
|
||||||
}
|
|
||||||
|
|
||||||
TransportDescription& operator=(const TransportDescription& from) {
|
TransportDescription& operator=(const TransportDescription& from);
|
||||||
// Self-assignment
|
|
||||||
if (this == &from)
|
|
||||||
return *this;
|
|
||||||
|
|
||||||
transport_options = from.transport_options;
|
|
||||||
ice_ufrag = from.ice_ufrag;
|
|
||||||
ice_pwd = from.ice_pwd;
|
|
||||||
ice_mode = from.ice_mode;
|
|
||||||
connection_role = from.connection_role;
|
|
||||||
|
|
||||||
identity_fingerprint.reset(CopyFingerprint(
|
|
||||||
from.identity_fingerprint.get()));
|
|
||||||
return *this;
|
|
||||||
}
|
|
||||||
|
|
||||||
// TODO(deadbeef): Rename to HasIceOption, etc.
|
// TODO(deadbeef): Rename to HasIceOption, etc.
|
||||||
bool HasOption(const std::string& option) const {
|
bool HasOption(const std::string& option) const {
|
||||||
|
|
|
@ -24,6 +24,8 @@ TransportDescriptionFactory::TransportDescriptionFactory()
|
||||||
: secure_(SEC_DISABLED) {
|
: secure_(SEC_DISABLED) {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
TransportDescriptionFactory::~TransportDescriptionFactory() = default;
|
||||||
|
|
||||||
TransportDescription* TransportDescriptionFactory::CreateOffer(
|
TransportDescription* TransportDescriptionFactory::CreateOffer(
|
||||||
const TransportOptions& options,
|
const TransportOptions& options,
|
||||||
const TransportDescription* current_description) const {
|
const TransportDescription* current_description) const {
|
||||||
|
|
|
@ -35,6 +35,8 @@ class TransportDescriptionFactory {
|
||||||
public:
|
public:
|
||||||
// Default ctor; use methods below to set configuration.
|
// Default ctor; use methods below to set configuration.
|
||||||
TransportDescriptionFactory();
|
TransportDescriptionFactory();
|
||||||
|
~TransportDescriptionFactory();
|
||||||
|
|
||||||
SecurePolicy secure() const { return secure_; }
|
SecurePolicy secure() const { return secure_; }
|
||||||
// The certificate to use when setting up DTLS.
|
// The certificate to use when setting up DTLS.
|
||||||
const rtc::scoped_refptr<rtc::RTCCertificate>& certificate() const {
|
const rtc::scoped_refptr<rtc::RTCCertificate>& certificate() const {
|
||||||
|
|
Loading…
Reference in a new issue