OLD | NEW |
---|---|
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 #ifndef PPAPI_CPP_DEV_NET_ADDRESS_DEV_H_ | 5 #ifndef PPAPI_CPP_DEV_NET_ADDRESS_DEV_H_ |
6 #define PPAPI_CPP_DEV_NET_ADDRESS_DEV_H_ | 6 #define PPAPI_CPP_DEV_NET_ADDRESS_DEV_H_ |
7 | 7 |
8 #include "ppapi/c/dev/ppb_net_address_dev.h" | 8 #include "ppapi/c/dev/ppb_net_address_dev.h" |
9 #include "ppapi/cpp/pass_ref.h" | 9 #include "ppapi/cpp/pass_ref.h" |
10 #include "ppapi/cpp/resource.h" | 10 #include "ppapi/cpp/resource.h" |
11 #include "ppapi/cpp/var.h" | 11 #include "ppapi/cpp/var.h" |
12 | 12 |
13 namespace pp { | 13 namespace pp { |
14 | 14 |
15 class InstanceHandle; | 15 class InstanceHandle; |
16 | 16 |
17 /// The <code>NetAddress_Dev</code> class represents a network address. | |
17 class NetAddress_Dev : public Resource { | 18 class NetAddress_Dev : public Resource { |
18 public: | 19 public: |
20 /// Default constructor for creating an is_null() <code>NetAddress_Dev</code> | |
21 /// object. | |
19 NetAddress_Dev(); | 22 NetAddress_Dev(); |
20 | 23 |
24 /// A constructor used when you have received a <code>PP_Resource</code> as a | |
25 /// return value that has already been added 1 ref for you. | |
bbudge
2013/06/20 21:02:32
s/been added 1 ref for you/has had 1 ref added for
yzshen1
2013/06/20 22:20:48
Done.
| |
26 /// | |
27 /// @param[in] resource A <code>PPB_NetAddress_Dev</code> resource. | |
21 NetAddress_Dev(PassRef, PP_Resource resource); | 28 NetAddress_Dev(PassRef, PP_Resource resource); |
22 | 29 |
30 /// A contructor used to create a <code>NetAddress_Dev</code> object with the | |
bbudge
2013/06/20 21:02:32
s/contructor/constructor
yzshen1
2013/06/20 22:20:48
Done.
| |
31 /// specified IPv4 address. | |
32 /// | |
33 /// @param[in] instance The instance with which this resource will be | |
34 /// associated. | |
35 /// @param[in] ipv4_addr An IPv4 address. | |
23 NetAddress_Dev(const InstanceHandle& instance, | 36 NetAddress_Dev(const InstanceHandle& instance, |
24 const PP_NetAddress_IPv4_Dev& ipv4_addr); | 37 const PP_NetAddress_IPv4_Dev& ipv4_addr); |
25 | 38 |
39 /// A contructor used to create a <code>NetAddress_Dev</code> object with the | |
bbudge
2013/06/20 21:02:32
s/contructor/constructor
yzshen1
2013/06/20 22:20:48
Done.
| |
40 /// specified IPv6 address. | |
41 /// | |
42 /// @param[in] instance The instance with which this resource will be | |
43 /// associated. | |
44 /// @param[in] ipv6_addr An IPv6 address. | |
26 NetAddress_Dev(const InstanceHandle& instance, | 45 NetAddress_Dev(const InstanceHandle& instance, |
27 const PP_NetAddress_IPv6_Dev& ipv6_addr); | 46 const PP_NetAddress_IPv6_Dev& ipv6_addr); |
28 | 47 |
48 /// The copy constructor for <code>NetAddress_Dev</code>. | |
49 /// | |
50 /// @param[in] other A reference to another <code>NetAddress_Dev</code>. | |
29 NetAddress_Dev(const NetAddress_Dev& other); | 51 NetAddress_Dev(const NetAddress_Dev& other); |
30 | 52 |
53 /// The destructor. | |
31 virtual ~NetAddress_Dev(); | 54 virtual ~NetAddress_Dev(); |
32 | 55 |
56 /// The assign operator for <code>NetAddress_Dev</code>. | |
bbudge
2013/06/20 21:02:32
s/assign/assignment
yzshen1
2013/06/20 22:20:48
Done.
| |
57 /// | |
58 /// @param[in] other A reference to another <code>NetAddress_Dev</code>. | |
59 /// | |
60 /// @return A reference to this <code>NetAddress_Dev</code> object. | |
33 NetAddress_Dev& operator=(const NetAddress_Dev& other); | 61 NetAddress_Dev& operator=(const NetAddress_Dev& other); |
34 | 62 |
35 /// Static function for determining whether the browser supports the required | 63 /// Static function for determining whether the browser supports the required |
bbudge
2013/06/20 21:02:32
s/required//
yzshen1
2013/06/20 22:20:48
Done.
| |
36 /// NetAddress interface. | 64 /// <code>PPB_NetAddress_Dev</code> interface. |
37 /// | 65 /// |
38 /// @return true if the interface is available, false otherwise. | 66 /// @return true if the interface is available, false otherwise. |
39 static bool IsAvailable(); | 67 static bool IsAvailable(); |
40 | 68 |
69 /// Gets the address family. | |
70 /// | |
71 /// @return The address family on success; | |
72 /// <code>PP_NETADDRESS_FAMILY_UNSPECIFIED</code> on failure. | |
41 PP_NetAddress_Family_Dev GetFamily() const; | 73 PP_NetAddress_Family_Dev GetFamily() const; |
42 | 74 |
75 /// Returns a human-readable description of the network address. The | |
76 /// description is in the form of host [ ":" port ] and conforms to | |
77 /// http://tools.ietf.org/html/rfc3986#section-3.2 for IPv4 and IPv6 addresses | |
78 /// (e.g., "192.168.0.1", "192.168.0.1:99", or "[::1]:80"). | |
79 /// | |
80 /// @param[in] include_port Whether to include the port number in the | |
81 /// description. | |
82 /// | |
83 /// @return A string <code>Var</code> on success; an undefined | |
84 /// <code>Var</code> on failure. | |
43 Var DescribeAsString(bool include_port) const; | 85 Var DescribeAsString(bool include_port) const; |
44 | 86 |
87 /// Fills a <code>PP_NetAddress_IPv4_Dev</code> structure if the network | |
88 /// address is of <code>PP_NETADDRESS_FAMILY_IPV4</code> address family. | |
89 /// Note that passing a network address of | |
90 /// <code>PP_NETADDRESS_FAMILY_IPV6</code> address family will fail even if | |
91 /// the address is an IPv4-mapped IPv6 address. | |
92 /// | |
93 /// @param[out] ipv4_addr A <code>PP_NetAddress_IPv4_Dev</code> structure to | |
94 /// store the result. | |
95 /// | |
96 /// @return A boolean value indicating whether the operation succeeded. | |
45 bool DescribeAsIPv4Address(PP_NetAddress_IPv4_Dev* ipv4_addr) const; | 97 bool DescribeAsIPv4Address(PP_NetAddress_IPv4_Dev* ipv4_addr) const; |
46 | 98 |
99 /// Fills a <code>PP_NetAddress_IPv6_Dev</code> structure if the network | |
100 /// address is of <code>PP_NETADDRESS_FAMILY_IPV6</code> address family. | |
101 /// Note that passing a network address of | |
102 /// <code>PP_NETADDRESS_FAMILY_IPV4</code> address family will fail - this | |
103 /// method doesn't map it to an IPv6 address. | |
104 /// | |
105 /// @param[out] ipv6_addr A <code>PP_NetAddress_IPv6_Dev</code> structure to | |
106 /// store the result. | |
107 /// | |
108 /// @return A boolean value indicating whether the operation succeeded. | |
47 bool DescribeAsIPv6Address(PP_NetAddress_IPv6_Dev* ipv6_addr) const; | 109 bool DescribeAsIPv6Address(PP_NetAddress_IPv6_Dev* ipv6_addr) const; |
48 }; | 110 }; |
49 | 111 |
50 } // namespace pp | 112 } // namespace pp |
51 | 113 |
52 #endif // PPAPI_CPP_DEV_NET_ADDRESS_DEV_H_ | 114 #endif // PPAPI_CPP_DEV_NET_ADDRESS_DEV_H_ |
OLD | NEW |