Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(101)

Side by Side Diff: cloud_print/gcp20/prototype/dns_sd_server.cc

Issue 19468002: Added confirmation for printer registration. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@new-api-availability-check
Patch Set: Deleted <iostream> Created 7 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "cloud_print/gcp20/prototype/dns_sd_server.h" 5 #include "cloud_print/gcp20/prototype/dns_sd_server.h"
6 6
7 #include <string.h> 7 #include <string.h>
8 8
9 #include "base/basictypes.h" 9 #include "base/basictypes.h"
10 #include "base/bind.h" 10 #include "base/bind.h"
11 #include "base/command_line.h" 11 #include "base/command_line.h"
12 #include "base/message_loop.h" 12 #include "base/message_loop.h"
13 #include "base/strings/stringprintf.h" 13 #include "base/strings/stringprintf.h"
14 #include "cloud_print/gcp20/prototype/dns_packet_parser.h" 14 #include "cloud_print/gcp20/prototype/dns_packet_parser.h"
15 #include "cloud_print/gcp20/prototype/dns_response_builder.h" 15 #include "cloud_print/gcp20/prototype/dns_response_builder.h"
16 #include "net/base/big_endian.h" 16 #include "net/base/big_endian.h"
17 #include "net/base/dns_util.h" 17 #include "net/base/dns_util.h"
18 #include "net/base/net_errors.h" 18 #include "net/base/net_errors.h"
19 #include "net/base/net_util.h" 19 #include "net/base/net_util.h"
20 #include "net/dns/dns_protocol.h" 20 #include "net/dns/dns_protocol.h"
21 21
22 namespace { 22 namespace {
23 23
24 const char* kDefaultIpAddressMulticast = "224.0.0.251"; 24 const char kDefaultIpAddressMulticast[] = "224.0.0.251";
25 const uint16 kDefaultPortMulticast = 5353; 25 const uint16 kDefaultPortMulticast = 5353;
26 26
27 const double kTimeToNextAnnouncement = 0.8; // relatively to TTL 27 const double kTimeToNextAnnouncement = 0.8; // relatively to TTL
28 const int kDnsBufSize = 65537; 28 const int kDnsBufSize = 65537;
29 29
30 const uint16 kSrvPriority = 0; 30 const uint16 kSrvPriority = 0;
31 const uint16 kSrvWeight = 0; 31 const uint16 kSrvWeight = 0;
32 32
33 void DoNothingAfterSendToSocket(int /*val*/) { 33 void DoNothingAfterSendToSocket(int /*val*/) {
34 NOTREACHED(); 34 NOTREACHED();
(...skipping 256 matching lines...) Expand 10 before | Expand all | Expand 10 after
291 uint32 DnsSdServer::GetCurrentTLL() const { 291 uint32 DnsSdServer::GetCurrentTLL() const {
292 uint32 current_ttl = (time_until_live_ - base::Time::Now()).InSeconds(); 292 uint32 current_ttl = (time_until_live_ - base::Time::Now()).InSeconds();
293 if (time_until_live_ < base::Time::Now() || current_ttl == 0) { 293 if (time_until_live_ < base::Time::Now() || current_ttl == 0) {
294 // This should not be reachable. But still we don't need to fail. 294 // This should not be reachable. But still we don't need to fail.
295 current_ttl = 1; // Service is still alive. 295 current_ttl = 1; // Service is still alive.
296 LOG(ERROR) << "|current_ttl| was equal to zero."; 296 LOG(ERROR) << "|current_ttl| was equal to zero.";
297 } 297 }
298 return current_ttl; 298 return current_ttl;
299 } 299 }
300 300
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698