Merge "Add API to set the sll_protocol on PacketSocket"
This commit is contained in:
@@ -4432,7 +4432,8 @@ package android.net.util {
|
||||
method public static void closeSocket(@Nullable java.io.FileDescriptor) throws java.io.IOException;
|
||||
method @NonNull public static java.net.SocketAddress makeNetlinkSocketAddress(int, int);
|
||||
method @NonNull public static java.net.SocketAddress makePacketSocketAddress(int, int);
|
||||
method @NonNull public static java.net.SocketAddress makePacketSocketAddress(int, @NonNull byte[]);
|
||||
method @Deprecated @NonNull public static java.net.SocketAddress makePacketSocketAddress(int, @NonNull byte[]);
|
||||
method @NonNull public static java.net.SocketAddress makePacketSocketAddress(int, int, @NonNull byte[]);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -1654,7 +1654,8 @@ package android.net.util {
|
||||
method public static void closeSocket(@Nullable java.io.FileDescriptor) throws java.io.IOException;
|
||||
method @NonNull public static java.net.SocketAddress makeNetlinkSocketAddress(int, int);
|
||||
method @NonNull public static java.net.SocketAddress makePacketSocketAddress(int, int);
|
||||
method @NonNull public static java.net.SocketAddress makePacketSocketAddress(int, @NonNull byte[]);
|
||||
method @Deprecated @NonNull public static java.net.SocketAddress makePacketSocketAddress(int, @NonNull byte[]);
|
||||
method @NonNull public static java.net.SocketAddress makePacketSocketAddress(int, int, @NonNull byte[]);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -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(
|
||||
@@ -86,6 +88,18 @@ public final class SocketUtils {
|
||||
hwAddr /* sll_addr */);
|
||||
}
|
||||
|
||||
/**
|
||||
* 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)
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user