OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 "ppapi/cpp/private/net_address_private.h" | 5 #include "ppapi/cpp/private/net_address_private.h" |
6 | 6 |
7 #include "ppapi/c/pp_bool.h" | 7 #include "ppapi/c/pp_bool.h" |
8 #include "ppapi/cpp/module.h" | 8 #include "ppapi/cpp/module.h" |
9 #include "ppapi/cpp/module_impl.h" | 9 #include "ppapi/cpp/module_impl.h" |
10 #include "ppapi/cpp/var.h" | 10 #include "ppapi/cpp/var.h" |
11 #include "ppapi/c/private/ppb_net_address_private.h" | 11 #include "ppapi/c/private/ppb_net_address_private.h" |
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
69 return !!get_interface<PPB_NetAddress_Private>()->ReplacePort(&addr_in, | 69 return !!get_interface<PPB_NetAddress_Private>()->ReplacePort(&addr_in, |
70 port, | 70 port, |
71 addr_out); | 71 addr_out); |
72 } | 72 } |
73 | 73 |
74 // static | 74 // static |
75 void NetAddressPrivate::GetAnyAddress(bool is_ipv6, | 75 void NetAddressPrivate::GetAnyAddress(bool is_ipv6, |
76 PP_NetAddress_Private* addr) { | 76 PP_NetAddress_Private* addr) { |
77 if (!has_interface<PPB_NetAddress_Private>()) | 77 if (!has_interface<PPB_NetAddress_Private>()) |
78 return; | 78 return; |
79 get_interface<PPB_NetAddress_Private>()->GetAnyAddress(PP_FromBool(is_ipv6), | 79 get_interface<PPB_NetAddress_Private>()->GetAnyAddress( |
80 addr); | 80 PP_FromBool(is_ipv6), |
| 81 addr); |
| 82 } |
| 83 |
| 84 // static |
| 85 uint16_t NetAddressPrivate::GetFamily(const PP_NetAddress_Private& addr) { |
| 86 if (!has_interface<PPB_NetAddress_Private>()) |
| 87 return 0; |
| 88 return get_interface<PPB_NetAddress_Private>()->GetFamily(&addr); |
| 89 } |
| 90 |
| 91 // static |
| 92 uint16_t NetAddressPrivate::GetPort(const PP_NetAddress_Private& addr) { |
| 93 if (!has_interface<PPB_NetAddress_Private>()) |
| 94 return 0; |
| 95 return get_interface<PPB_NetAddress_Private>()->GetPort(&addr); |
| 96 } |
| 97 |
| 98 // static |
| 99 bool NetAddressPrivate::GetAddress(const PP_NetAddress_Private& addr, |
| 100 void* address, |
| 101 uint16_t address_size) { |
| 102 if (!has_interface<PPB_NetAddress_Private>()) |
| 103 return false; |
| 104 return PP_ToBool(get_interface<PPB_NetAddress_Private>()->GetAddress( |
| 105 &addr, |
| 106 address, |
| 107 address_size)); |
81 } | 108 } |
82 | 109 |
83 } // namespace pp | 110 } // namespace pp |
OLD | NEW |