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

Side by Side Diff: net/base/address_list.h

Issue 6598040: Add constructor for creating an AddressList from a struct sockaddr. This is... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 9 years, 9 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | net/base/address_list.cc » ('j') | net/base/address_list.cc » ('J')
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2010 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 #ifndef NET_BASE_ADDRESS_LIST_H_ 5 #ifndef NET_BASE_ADDRESS_LIST_H_
6 #define NET_BASE_ADDRESS_LIST_H_ 6 #define NET_BASE_ADDRESS_LIST_H_
7 #pragma once 7 #pragma once
8 8
9 #include <string> 9 #include <string>
10 10
11 #include "base/ref_counted.h" 11 #include "base/ref_counted.h"
12 #include "net/base/net_util.h" 12 #include "net/base/net_util.h"
13 13
14 struct addrinfo; 14 struct addrinfo;
15 15
16 namespace net { 16 namespace net {
17 17
18 // An AddressList object contains a linked list of addrinfo structures. This 18 // An AddressList object contains a linked list of addrinfo structures. This
19 // class is designed to be copied around by value. 19 // class is designed to be copied around by value.
20 class AddressList { 20 class AddressList {
21 public: 21 public:
22 // Constructs an empty address list. 22 // Constructs an empty address list.
23 AddressList(); 23 AddressList();
24 24
25 // Constructs an address list for a single IP literal. If 25 // Constructs an address list for a single IP literal. If
26 // |canonicalize_name| is true, fill the ai_canonname field with the 26 // |canonicalize_name| is true, fill the ai_canonname field with the
27 // canonicalized IP address. 27 // canonicalized IP address.
28 AddressList(const IPAddressNumber& address, int port, bool canonicalize_name); 28 AddressList(const IPAddressNumber& address, int port, bool canonicalize_name);
29 29
30 // Constructs an address list for a single socket address.
31 // |socket_type| is either SOCK_STREAM or SOCK_DGRAM
32 // |protocol| is either IPPROTO_TCP or IPPROTO_UDP
33 AddressList(struct sockaddr* address, socklen_t address_length,
eroman 2011/03/01 02:52:33 nit: I have a personal hatred towards constructor
eroman 2011/03/01 02:53:09 Please make it a |const struct sockaddr*| to empha
Mike Belshe 2011/03/01 19:01:33 I don't understand why - especially for a case lik
Mike Belshe 2011/03/01 19:01:33 Done.
eroman 2011/03/01 22:11:53 The problem I have with constructor overloading, i
34 int socket_type, int protocol);
35
30 AddressList(const AddressList& addresslist); 36 AddressList(const AddressList& addresslist);
31 ~AddressList(); 37 ~AddressList();
32 AddressList& operator=(const AddressList& addresslist); 38 AddressList& operator=(const AddressList& addresslist);
33 39
34 // Adopt the given addrinfo list (assumed to have been created by 40 // Adopt the given addrinfo list (assumed to have been created by
35 // the system, e.g. returned by getaddrinfo()) in place of the 41 // the system, e.g. returned by getaddrinfo()) in place of the
36 // existing one if any. This hands over responsibility for freeing 42 // existing one if any. This hands over responsibility for freeing
37 // the addrinfo list to the AddressList object. 43 // the addrinfo list to the AddressList object.
38 void Adopt(struct addrinfo* head); 44 void Adopt(struct addrinfo* head);
39 45
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
78 struct Data; 84 struct Data;
79 85
80 explicit AddressList(Data* data); 86 explicit AddressList(Data* data);
81 87
82 scoped_refptr<Data> data_; 88 scoped_refptr<Data> data_;
83 }; 89 };
84 90
85 } // namespace net 91 } // namespace net
86 92
87 #endif // NET_BASE_ADDRESS_LIST_H_ 93 #endif // NET_BASE_ADDRESS_LIST_H_
OLDNEW
« no previous file with comments | « no previous file | net/base/address_list.cc » ('j') | net/base/address_list.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698