summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-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_
-