summaryrefslogtreecommitdiff
path: root/core/java
diff options
context:
space:
mode:
authorRemi NGUYEN VAN <reminv@google.com>2019-10-31 21:50:40 -0700
committerandroid-build-merger <android-build-merger@google.com>2019-10-31 21:50:40 -0700
commit7919e04f5b290f5592b9de4c8a5642224d861fad (patch)
treeac2150905177b60cc1da0d4e0f4dded0fcbdfc91 /core/java
parent0e50b2c926a8f41612a2b0d2bf00100bcbb6a5c9 (diff)
parent0d6c308c39e3c53225f2db0e9e25a52d4a281abd (diff)
Merge "Add API to set the sll_protocol on PacketSocket"
am: 0d6c308c39 Change-Id: I203f26229dcd580704665f7a07a391facef49a17
Diffstat (limited to 'core/java')
-rw-r--r--core/java/android/net/util/SocketUtils.java14
1 files changed, 14 insertions, 0 deletions
diff --git a/core/java/android/net/util/SocketUtils.java b/core/java/android/net/util/SocketUtils.java
index 489a2922f70e..e9ea99f84f90 100644
--- a/core/java/android/net/util/SocketUtils.java
+++ b/core/java/android/net/util/SocketUtils.java
@@ -77,7 +77,9 @@ public final class SocketUtils {
/**
* Make a socket address that packet socket can send packets to.
+ * @deprecated Use {@link #makePacketSocketAddress(int, int, byte[])} instead.
*/
+ @Deprecated
@NonNull
public static SocketAddress makePacketSocketAddress(int ifIndex, @NonNull byte[] hwAddr) {
return new PacketSocketAddress(
@@ -87,6 +89,18 @@ public final class SocketUtils {
}
/**
+ * Make a socket address that packet socket can send packets to.
+ */
+ @NonNull
+ public static SocketAddress makePacketSocketAddress(int protocol, int ifIndex,
+ @NonNull byte[] hwAddr) {
+ return new PacketSocketAddress(
+ protocol /* sll_protocol */,
+ ifIndex /* sll_ifindex */,
+ hwAddr /* sll_addr */);
+ }
+
+ /**
* @see IoBridge#closeAndSignalBlockedThreads(FileDescriptor)
*/
public static void closeSocket(@Nullable FileDescriptor fd) throws IOException {