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

Side by Side Diff: ppapi/shared_impl/private/net_address_private_impl.h

Issue 655063002: Use uint16 for port numbers more pervasively. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Revert bad change Created 6 years, 1 month 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
« no previous file with comments | « net/udp/udp_socket_win.cc ('k') | ppapi/shared_impl/private/net_address_private_impl.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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 PPAPI_SHARED_IMPL_PRIVATE_NET_ADDRESS_PRIVATE_IMPL_H_ 5 #ifndef PPAPI_SHARED_IMPL_PRIVATE_NET_ADDRESS_PRIVATE_IMPL_H_
6 #define PPAPI_SHARED_IMPL_PRIVATE_NET_ADDRESS_PRIVATE_IMPL_H_ 6 #define PPAPI_SHARED_IMPL_PRIVATE_NET_ADDRESS_PRIVATE_IMPL_H_
7 7
8 #include <string> 8 #include <string>
9 #include <vector> 9 #include <vector>
10 10
11 #include "base/basictypes.h" 11 #include "base/basictypes.h"
12 #include "ppapi/c/pp_stdint.h" 12 #include "ppapi/c/pp_stdint.h"
13 #include "ppapi/c/ppb_net_address.h" 13 #include "ppapi/c/ppb_net_address.h"
14 #include "ppapi/shared_impl/ppapi_shared_export.h" 14 #include "ppapi/shared_impl/ppapi_shared_export.h"
15 15
16 struct PP_NetAddress_Private; 16 struct PP_NetAddress_Private;
17 struct sockaddr; 17 struct sockaddr;
18 18
19 namespace ppapi { 19 namespace ppapi {
20 20
21 class PPAPI_SHARED_EXPORT NetAddressPrivateImpl { 21 class PPAPI_SHARED_EXPORT NetAddressPrivateImpl {
22 public: 22 public:
23 static bool ValidateNetAddress(const PP_NetAddress_Private& addr); 23 static bool ValidateNetAddress(const PP_NetAddress_Private& addr);
24 24
25 static bool SockaddrToNetAddress(const sockaddr* sa, 25 static bool SockaddrToNetAddress(const sockaddr* sa,
26 uint32_t sa_length, 26 uint32_t sa_length,
27 PP_NetAddress_Private* net_addr); 27 PP_NetAddress_Private* net_addr);
28 28
29 static bool IPEndPointToNetAddress(const std::vector<unsigned char>& address, 29 static bool IPEndPointToNetAddress(const std::vector<unsigned char>& address,
30 int port, 30 uint16 port,
31 PP_NetAddress_Private* net_addr); 31 PP_NetAddress_Private* net_addr);
32 32
33 static bool NetAddressToIPEndPoint(const PP_NetAddress_Private& net_addr, 33 static bool NetAddressToIPEndPoint(const PP_NetAddress_Private& net_addr,
34 std::vector<unsigned char>* address, 34 std::vector<unsigned char>* address,
35 int* port); 35 uint16* port);
36 36
37 static std::string DescribeNetAddress(const PP_NetAddress_Private& addr, 37 static std::string DescribeNetAddress(const PP_NetAddress_Private& addr,
38 bool include_port); 38 bool include_port);
39 39
40 // Conversion methods to make PPB_NetAddress resource work with 40 // Conversion methods to make PPB_NetAddress resource work with
41 // PP_NetAddress_Private. 41 // PP_NetAddress_Private.
42 // TODO(yzshen): Remove them once PPB_NetAddress resource doesn't use 42 // TODO(yzshen): Remove them once PPB_NetAddress resource doesn't use
43 // PP_NetAddress_Private as storage type. 43 // PP_NetAddress_Private as storage type.
44 static void CreateNetAddressPrivateFromIPv4Address( 44 static void CreateNetAddressPrivateFromIPv4Address(
45 const PP_NetAddress_IPv4& ipv4_addr, 45 const PP_NetAddress_IPv4& ipv4_addr,
(...skipping 12 matching lines...) Expand all
58 58
59 static const PP_NetAddress_Private kInvalidNetAddress; 59 static const PP_NetAddress_Private kInvalidNetAddress;
60 60
61 private: 61 private:
62 DISALLOW_IMPLICIT_CONSTRUCTORS(NetAddressPrivateImpl); 62 DISALLOW_IMPLICIT_CONSTRUCTORS(NetAddressPrivateImpl);
63 }; 63 };
64 64
65 } // namespace ppapi 65 } // namespace ppapi
66 66
67 #endif // PPAPI_SHARED_IMPL_PRIVATE_NET_ADDRESS_PRIVATE_IMPL_H_ 67 #endif // PPAPI_SHARED_IMPL_PRIVATE_NET_ADDRESS_PRIVATE_IMPL_H_
OLDNEW
« no previous file with comments | « net/udp/udp_socket_win.cc ('k') | ppapi/shared_impl/private/net_address_private_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698