diff options
author | noamsml@chromium.org <noamsml@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-07-01 17:39:53 +0000 |
---|---|---|
committer | noamsml@chromium.org <noamsml@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-07-01 17:39:53 +0000 |
commit | 21df1696392acf9543ad6e3b3d3e7f0ab7120f4d (patch) | |
tree | ac58f8b6ba23a96aa1501f0ad0aeee4bd4491a13 /net/dns/mdns_cache.cc | |
parent | 69fdab209f919fd0538b2c0c0fcafe0255836f37 (diff) | |
download | chromium_src-21df1696392acf9543ad6e3b3d3e7f0ab7120f4d.zip chromium_src-21df1696392acf9543ad6e3b3d3e7f0ab7120f4d.tar.gz chromium_src-21df1696392acf9543ad6e3b3d3e7f0ab7120f4d.tar.bz2 |
Add NSEC record support for MDnsClient
Add support for NSEC records to MDnsClient, which can be used to deny the
existence of records.
BUG=255232
Review URL: https://chromiumcodereview.appspot.com/17747004
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@209452 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'net/dns/mdns_cache.cc')
-rw-r--r-- | net/dns/mdns_cache.cc | 23 |
1 files changed, 18 insertions, 5 deletions
diff --git a/net/dns/mdns_cache.cc b/net/dns/mdns_cache.cc index f210d0ab..b430f95 100644 --- a/net/dns/mdns_cache.cc +++ b/net/dns/mdns_cache.cc @@ -44,12 +44,12 @@ MDnsCache::Key::~Key() { } bool MDnsCache::Key::operator<(const MDnsCache::Key& key) const { - if (type_ != key.type_) - return type_ < key.type_; - if (name_ != key.name_) return name_ < key.name_; + if (type_ != key.type_) + return type_ < key.type_; + if (optional_ != key.optional_) return optional_ < key.optional_; return false; // keys are equal @@ -154,8 +154,8 @@ void MDnsCache::FindDnsRecords(unsigned type, RecordMap::const_iterator i = mdns_cache_.lower_bound(Key(type, name, "")); for (; i != mdns_cache_.end(); ++i) { - if (i->first.type() != type || - (!name.empty() && i->first.name() != name)) { + if (i->first.name() != name || + (type != 0 && i->first.type() != type)) { break; } @@ -168,6 +168,19 @@ void MDnsCache::FindDnsRecords(unsigned type, } } +scoped_ptr<const RecordParsed> MDnsCache::RemoveRecord( + const RecordParsed* record) { + Key key = Key::CreateFor(record); + RecordMap::iterator found = mdns_cache_.find(key); + + if (found != mdns_cache_.end() && found->second == record) { + mdns_cache_.erase(key); + return scoped_ptr<const RecordParsed>(record); + } + + return scoped_ptr<const RecordParsed>(); +} + // static std::string MDnsCache::GetOptionalFieldForRecord( const RecordParsed* record) { |