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

Unified Diff: ppapi/cpp/private/net_address_private.cc

Issue 9307115: PPB_NetAddress_Private: add getter methods for sockaddr. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: sync Created 8 years, 10 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 side-by-side diff with in-line comments
Download patch
Index: ppapi/cpp/private/net_address_private.cc
diff --git a/ppapi/cpp/private/net_address_private.cc b/ppapi/cpp/private/net_address_private.cc
index 3b917959266d56ce68871d2556602527505ad734..1973012408e3f2dcacf35c67bed9a9a38ead6d6e 100644
--- a/ppapi/cpp/private/net_address_private.cc
+++ b/ppapi/cpp/private/net_address_private.cc
@@ -1,4 +1,4 @@
-// Copyright (c) 2011 The Chromium Authors. All rights reserved.
+// Copyright (c) 2012 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -76,8 +76,35 @@ void NetAddressPrivate::GetAnyAddress(bool is_ipv6,
PP_NetAddress_Private* addr) {
if (!has_interface<PPB_NetAddress_Private>())
return;
- get_interface<PPB_NetAddress_Private>()->GetAnyAddress(PP_FromBool(is_ipv6),
- addr);
+ get_interface<PPB_NetAddress_Private>()->GetAnyAddress(
+ PP_FromBool(is_ipv6),
+ addr);
+}
+
+// static
+uint16_t NetAddressPrivate::GetFamily(const PP_NetAddress_Private& addr) {
+ if (!has_interface<PPB_NetAddress_Private>())
+ return 0;
+ return get_interface<PPB_NetAddress_Private>()->GetFamily(&addr);
+}
+
+// static
+uint16_t NetAddressPrivate::GetPort(const PP_NetAddress_Private& addr) {
+ if (!has_interface<PPB_NetAddress_Private>())
+ return 0;
+ return get_interface<PPB_NetAddress_Private>()->GetPort(&addr);
+}
+
+// static
+bool NetAddressPrivate::GetAddress(const PP_NetAddress_Private& addr,
+ void* address,
+ uint16_t address_size) {
+ if (!has_interface<PPB_NetAddress_Private>())
+ return false;
+ return PP_ToBool(get_interface<PPB_NetAddress_Private>()->GetAddress(
+ &addr,
+ address,
+ address_size));
}
} // namespace pp

Powered by Google App Engine
This is Rietveld 408576698