summaryrefslogtreecommitdiffstats
path: root/cloud_print
diff options
context:
space:
mode:
authornoamsml@chromium.org <noamsml@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-10-31 09:00:40 +0000
committernoamsml@chromium.org <noamsml@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-10-31 09:00:40 +0000
commitb18498d8895b8c86b7e9d2b5a08a360639b920f8 (patch)
tree667c7bec61a2664778ed9d6cae86b822f667d7c6 /cloud_print
parent269c2e84b46cb72986f60775efbfd5022fc75c9d (diff)
downloadchromium_src-b18498d8895b8c86b7e9d2b5a08a360639b920f8.zip
chromium_src-b18498d8895b8c86b7e9d2b5a08a360639b920f8.tar.gz
chromium_src-b18498d8895b8c86b7e9d2b5a08a360639b920f8.tar.bz2
Make gcp20_device respond to _printer._sub._privet.local queries
Make the GCP2.0 prototype respond to printer subtype queries and announce itself using the printer subtype record. BUG= Review URL: https://codereview.chromium.org/52113004 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@232051 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'cloud_print')
-rw-r--r--cloud_print/gcp20/prototype/dns_sd_server.cc9
-rw-r--r--cloud_print/gcp20/prototype/printer.cc5
-rw-r--r--cloud_print/gcp20/prototype/service_parameters.cc4
-rw-r--r--cloud_print/gcp20/prototype/service_parameters.h3
4 files changed, 13 insertions, 8 deletions
diff --git a/cloud_print/gcp20/prototype/dns_sd_server.cc b/cloud_print/gcp20/prototype/dns_sd_server.cc
index 4ef9bb3..66df9e6 100644
--- a/cloud_print/gcp20/prototype/dns_sd_server.cc
+++ b/cloud_print/gcp20/prototype/dns_sd_server.cc
@@ -200,11 +200,13 @@ void DnsSdServer::ProccessQuery(uint32 current_ttl, const DnsQueryRecord& query,
// TODO(maksymb): Add IPv6 support.
case net::dns_protocol::kTypePTR:
log = "Processing PTR query";
- if (query.qname == serv_params_.service_type_) {
- builder->AppendPtr(serv_params_.service_type_, current_ttl,
+ if (query.qname == serv_params_.service_type_ ||
+ query.qname == serv_params_.secondary_service_type_) {
+ builder->AppendPtr(query.qname, current_ttl,
serv_params_.service_name_);
responded = true;
}
+
break;
case net::dns_protocol::kTypeSRV:
log = "Processing SRV query";
@@ -260,6 +262,8 @@ void DnsSdServer::SendAnnouncement(uint32 ttl) {
builder.AppendPtr(serv_params_.service_type_, ttl,
serv_params_.service_name_);
+ 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_);
@@ -296,4 +300,3 @@ uint32 DnsSdServer::GetCurrentTLL() const {
}
return current_ttl;
}
-
diff --git a/cloud_print/gcp20/prototype/printer.cc b/cloud_print/gcp20/prototype/printer.cc
index 9513979..7c4141e 100644
--- a/cloud_print/gcp20/prototype/printer.cc
+++ b/cloud_print/gcp20/prototype/printer.cc
@@ -32,6 +32,7 @@ const uint16 kHttpPortDefault = 10101;
const uint32 kTtlDefault = 60*60; // in seconds
const char kServiceType[] = "_privet._tcp.local";
+const char kSecondaryServiceType[] = "_printer._sub._privet._tcp.local";
const char kServiceNamePrefixDefault[] = "first_gcp20_device";
const char kServiceDomainNameDefault[] = "my-privet-device.local";
@@ -825,7 +826,8 @@ bool Printer::StartDnsServer() {
std::string service_domain_name =
command_line_reader::ReadDomainName(kServiceDomainNameDefault);
- ServiceParameters params(kServiceType, service_name_prefix,
+ ServiceParameters params(kServiceType, kSecondaryServiceType,
+ service_name_prefix,
service_domain_name, ip, port);
return dns_server_.Start(params,
@@ -911,4 +913,3 @@ bool Printer::ChangeState(ConnectionState new_state) {
return true;
}
-
diff --git a/cloud_print/gcp20/prototype/service_parameters.cc b/cloud_print/gcp20/prototype/service_parameters.cc
index 7433a89..85ba83c 100644
--- a/cloud_print/gcp20/prototype/service_parameters.cc
+++ b/cloud_print/gcp20/prototype/service_parameters.cc
@@ -11,15 +11,15 @@ ServiceParameters::~ServiceParameters() {
}
ServiceParameters::ServiceParameters(const std::string& service_type,
+ const std::string& secondary_service_type,
const std::string& service_name_prefix,
const std::string& service_domain_name,
const net::IPAddressNumber& http_ipv4,
uint16 http_port)
: service_type_(service_type),
+ secondary_service_type_(secondary_service_type),
service_name_(service_name_prefix + "." + service_type),
service_domain_name_(service_domain_name),
http_ipv4_(http_ipv4),
http_port_(http_port) {
}
-
-
diff --git a/cloud_print/gcp20/prototype/service_parameters.h b/cloud_print/gcp20/prototype/service_parameters.h
index f86f870..881e15f 100644
--- a/cloud_print/gcp20/prototype/service_parameters.h
+++ b/cloud_print/gcp20/prototype/service_parameters.h
@@ -16,12 +16,14 @@ struct ServiceParameters {
~ServiceParameters();
ServiceParameters(const std::string& service_type,
+ const std::string& secondary_service_type,
const std::string& service_name_prefix,
const std::string& service_domain_name,
const net::IPAddressNumber& http_ipv4,
uint16 http_port);
std::string service_type_;
+ std::string secondary_service_type_;
std::string service_name_;
std::string service_domain_name_;
net::IPAddressNumber http_ipv4_;
@@ -29,4 +31,3 @@ struct ServiceParameters {
};
#endif // CLOUD_PRINT_GCP20_PROTOTYPE_SERVICE_PARAMETERS_H_
-