diff options
author | vitalybuka@chromium.org <vitalybuka@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2014-02-12 10:59:46 +0000 |
---|---|---|
committer | vitalybuka@chromium.org <vitalybuka@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2014-02-12 10:59:46 +0000 |
commit | 0d6b4faaa5e99c53534818df933fdc3523242e17 (patch) | |
tree | 33f812fcc45ded5b3107faa19bc328fda4c1d0b3 /cloud_print/gcp20/prototype/dns_sd_server.cc | |
parent | 1f0803412c2cfd7cf96ad9f0b857ff9cbcfb2905 (diff) | |
download | chromium_src-0d6b4faaa5e99c53534818df933fdc3523242e17.zip chromium_src-0d6b4faaa5e99c53534818df933fdc3523242e17.tar.gz chromium_src-0d6b4faaa5e99c53534818df933fdc3523242e17.tar.bz2 |
Added --extended-response to put additional information into PTR responces.
Shortened service name.
Added AAAA response.
Review URL: https://codereview.chromium.org/131103028
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@250673 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'cloud_print/gcp20/prototype/dns_sd_server.cc')
-rw-r--r-- | cloud_print/gcp20/prototype/dns_sd_server.cc | 49 |
1 files changed, 37 insertions, 12 deletions
diff --git a/cloud_print/gcp20/prototype/dns_sd_server.cc b/cloud_print/gcp20/prototype/dns_sd_server.cc index 85b3f87..f5500de 100644 --- a/cloud_print/gcp20/prototype/dns_sd_server.cc +++ b/cloud_print/gcp20/prototype/dns_sd_server.cc @@ -101,7 +101,7 @@ void DnsSdServer::UpdateMetadata(const std::vector<std::string>& metadata) { if (!CommandLine::ForCurrentProcess()->HasSwitch("no-announcement")) { DnsResponseBuilder builder(current_ttl); - builder.AppendTxt(serv_params_.service_name_, current_ttl, metadata_); + builder.AppendTxt(serv_params_.service_name_, current_ttl, metadata_, true); scoped_refptr<net::IOBufferWithSize> buffer(builder.Build()); DCHECK(buffer.get() != NULL); @@ -203,7 +203,20 @@ void DnsSdServer::ProccessQuery(uint32 current_ttl, const DnsQueryRecord& query, if (query.qname == serv_params_.service_type_ || query.qname == serv_params_.secondary_service_type_) { builder->AppendPtr(query.qname, current_ttl, - serv_params_.service_name_); + serv_params_.service_name_, true); + + if (CommandLine::ForCurrentProcess()->HasSwitch("extended-response")) { + builder->AppendSrv(serv_params_.service_name_, current_ttl, + kSrvPriority, kSrvWeight, serv_params_.http_port_, + serv_params_.service_domain_name_, false); + builder->AppendA(serv_params_.service_domain_name_, current_ttl, + serv_params_.http_ipv4_, false); + builder->AppendAAAA(serv_params_.service_domain_name_, current_ttl, + serv_params_.http_ipv6_, false); + builder->AppendTxt(serv_params_.service_name_, current_ttl, metadata_, + false); + } + responded = true; } @@ -213,7 +226,7 @@ void DnsSdServer::ProccessQuery(uint32 current_ttl, const DnsQueryRecord& query, if (query.qname == serv_params_.service_name_) { builder->AppendSrv(serv_params_.service_name_, current_ttl, kSrvPriority, kSrvWeight, serv_params_.http_port_, - serv_params_.service_domain_name_); + serv_params_.service_domain_name_, true); responded = true; } break; @@ -221,14 +234,23 @@ void DnsSdServer::ProccessQuery(uint32 current_ttl, const DnsQueryRecord& query, log = "Processing A query"; if (query.qname == serv_params_.service_domain_name_) { builder->AppendA(serv_params_.service_domain_name_, current_ttl, - serv_params_.http_ipv4_); + serv_params_.http_ipv4_, true); + responded = true; + } + break; + case net::dns_protocol::kTypeAAAA: + log = "Processing AAAA query"; + if (query.qname == serv_params_.service_domain_name_) { + builder->AppendAAAA(serv_params_.service_domain_name_, current_ttl, + serv_params_.http_ipv6_, true); responded = true; } break; case net::dns_protocol::kTypeTXT: log = "Processing TXT query"; if (query.qname == serv_params_.service_name_) { - builder->AppendTxt(serv_params_.service_name_, current_ttl, metadata_); + builder->AppendTxt(serv_params_.service_name_, current_ttl, metadata_, + true); responded = true; } break; @@ -261,15 +283,18 @@ void DnsSdServer::SendAnnouncement(uint32 ttl) { DnsResponseBuilder builder(ttl); builder.AppendPtr(serv_params_.service_type_, ttl, - serv_params_.service_name_); + serv_params_.service_name_, true); builder.AppendPtr(serv_params_.secondary_service_type_, ttl, - serv_params_.service_name_); - builder.AppendSrv(serv_params_.service_name_, ttl, kSrvPriority, kSrvWeight, - serv_params_.http_port_, - serv_params_.service_domain_name_); + serv_params_.service_name_, true); + builder.AppendSrv(serv_params_.service_name_, ttl, kSrvPriority, + kSrvWeight, serv_params_.http_port_, + serv_params_.service_domain_name_, true); builder.AppendA(serv_params_.service_domain_name_, ttl, - serv_params_.http_ipv4_); - builder.AppendTxt(serv_params_.service_name_, ttl, metadata_); + serv_params_.http_ipv4_, true); + builder.AppendAAAA(serv_params_.service_domain_name_, ttl, + serv_params_.http_ipv6_, true); + builder.AppendTxt(serv_params_.service_name_, ttl, metadata_, true); + scoped_refptr<net::IOBufferWithSize> buffer(builder.Build()); DCHECK(buffer.get() != NULL); |