Loading core/java/android/net/KeepalivePacketData.java +1 −1 Original line number Diff line number Diff line Loading @@ -96,7 +96,7 @@ public class KeepalivePacketData implements Parcelable { out.writeByteArray(mPacket); } private KeepalivePacketData(Parcel in) { protected KeepalivePacketData(Parcel in) { srcAddress = NetworkUtils.numericToInetAddress(in.readString()); dstAddress = NetworkUtils.numericToInetAddress(in.readString()); srcPort = in.readInt(); Loading core/java/android/net/NattKeepalivePacketData.java +5 −2 Original line number Diff line number Diff line Loading @@ -16,6 +16,9 @@ package android.net; import static android.net.SocketKeepalive.ERROR_INVALID_IP_ADDRESS; import static android.net.SocketKeepalive.ERROR_INVALID_PORT; import android.net.SocketKeepalive.InvalidPacketException; import android.net.util.IpUtils; import android.system.OsConstants; Loading Loading @@ -44,11 +47,11 @@ public final class NattKeepalivePacketData extends KeepalivePacketData { throws InvalidPacketException { if (!(srcAddress instanceof Inet4Address) || !(dstAddress instanceof Inet4Address)) { throw new InvalidPacketException(SocketKeepalive.ERROR_INVALID_IP_ADDRESS); throw new InvalidPacketException(ERROR_INVALID_IP_ADDRESS); } if (dstPort != NattSocketKeepalive.NATT_PORT) { throw new InvalidPacketException(SocketKeepalive.ERROR_INVALID_PORT); throw new InvalidPacketException(ERROR_INVALID_PORT); } int length = IPV4_HEADER_LENGTH + UDP_HEADER_LENGTH + 1; Loading core/java/android/net/NetworkUtils.java +22 −0 Original line number Diff line number Diff line Loading @@ -70,6 +70,18 @@ public class NetworkUtils { public native static void attachControlPacketFilter(FileDescriptor fd, int packetType) throws SocketException; /** * Attaches a socket filter that drops all of incoming packets. * @param fd the socket's {@link FileDescriptor}. */ public static native void attachDropAllBPFFilter(FileDescriptor fd) throws SocketException; /** * Detaches a socket filter. * @param fd the socket's {@link FileDescriptor}. */ public static native void detachBPFFilter(FileDescriptor fd) throws SocketException; /** * Configures a socket for receiving ICMPv6 router solicitations and sending advertisements. * @param fd the socket's {@link FileDescriptor}. Loading Loading @@ -170,6 +182,16 @@ public class NetworkUtils { private static native void addArpEntry(byte[] ethAddr, byte[] netAddr, String ifname, FileDescriptor fd) throws IOException; /** * Get the tcp repair window associated with the {@code fd}. * * @param fd the tcp socket's {@link FileDescriptor}. * @return a {@link TcpRepairWindow} object indicates tcp window size. */ public static native TcpRepairWindow getTcpRepairWindow(FileDescriptor fd) throws ErrnoException; /** * @see Inet4AddressUtils#intToInet4AddressHTL(int) * @deprecated Use either {@link Inet4AddressUtils#intToInet4AddressHTH(int)} Loading core/java/android/net/SocketKeepalive.java +32 −4 Original line number Diff line number Diff line Loading @@ -110,15 +110,43 @@ public abstract class SocketKeepalive implements AutoCloseable { public static final int MAX_INTERVAL_SEC = 3600; /** * This packet is invalid. * See the error code for details. * An exception that embarks an error code. * @hide */ public static class InvalidPacketException extends Exception { public static class ErrorCodeException extends Exception { public final int error; public InvalidPacketException(int error) { public ErrorCodeException(final int error, final Throwable e) { super(e); this.error = error; } public ErrorCodeException(final int error) { this.error = error; } } /** * This socket is invalid. * See the error code for details, and the optional cause. * @hide */ public static class InvalidSocketException extends ErrorCodeException { public InvalidSocketException(final int error, final Throwable e) { super(error, e); } public InvalidSocketException(final int error) { super(error); } } /** * This packet is invalid. * See the error code for details. * @hide */ public static class InvalidPacketException extends ErrorCodeException { public InvalidPacketException(final int error) { super(error); } } @NonNull final IConnectivityManager mService; Loading core/java/android/net/TcpKeepalivePacketData.aidl 0 → 100644 +20 −0 Original line number Diff line number Diff line /* * Copyright (C) 2019 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package android.net; parcelable TcpKeepalivePacketData; Loading
core/java/android/net/KeepalivePacketData.java +1 −1 Original line number Diff line number Diff line Loading @@ -96,7 +96,7 @@ public class KeepalivePacketData implements Parcelable { out.writeByteArray(mPacket); } private KeepalivePacketData(Parcel in) { protected KeepalivePacketData(Parcel in) { srcAddress = NetworkUtils.numericToInetAddress(in.readString()); dstAddress = NetworkUtils.numericToInetAddress(in.readString()); srcPort = in.readInt(); Loading
core/java/android/net/NattKeepalivePacketData.java +5 −2 Original line number Diff line number Diff line Loading @@ -16,6 +16,9 @@ package android.net; import static android.net.SocketKeepalive.ERROR_INVALID_IP_ADDRESS; import static android.net.SocketKeepalive.ERROR_INVALID_PORT; import android.net.SocketKeepalive.InvalidPacketException; import android.net.util.IpUtils; import android.system.OsConstants; Loading Loading @@ -44,11 +47,11 @@ public final class NattKeepalivePacketData extends KeepalivePacketData { throws InvalidPacketException { if (!(srcAddress instanceof Inet4Address) || !(dstAddress instanceof Inet4Address)) { throw new InvalidPacketException(SocketKeepalive.ERROR_INVALID_IP_ADDRESS); throw new InvalidPacketException(ERROR_INVALID_IP_ADDRESS); } if (dstPort != NattSocketKeepalive.NATT_PORT) { throw new InvalidPacketException(SocketKeepalive.ERROR_INVALID_PORT); throw new InvalidPacketException(ERROR_INVALID_PORT); } int length = IPV4_HEADER_LENGTH + UDP_HEADER_LENGTH + 1; Loading
core/java/android/net/NetworkUtils.java +22 −0 Original line number Diff line number Diff line Loading @@ -70,6 +70,18 @@ public class NetworkUtils { public native static void attachControlPacketFilter(FileDescriptor fd, int packetType) throws SocketException; /** * Attaches a socket filter that drops all of incoming packets. * @param fd the socket's {@link FileDescriptor}. */ public static native void attachDropAllBPFFilter(FileDescriptor fd) throws SocketException; /** * Detaches a socket filter. * @param fd the socket's {@link FileDescriptor}. */ public static native void detachBPFFilter(FileDescriptor fd) throws SocketException; /** * Configures a socket for receiving ICMPv6 router solicitations and sending advertisements. * @param fd the socket's {@link FileDescriptor}. Loading Loading @@ -170,6 +182,16 @@ public class NetworkUtils { private static native void addArpEntry(byte[] ethAddr, byte[] netAddr, String ifname, FileDescriptor fd) throws IOException; /** * Get the tcp repair window associated with the {@code fd}. * * @param fd the tcp socket's {@link FileDescriptor}. * @return a {@link TcpRepairWindow} object indicates tcp window size. */ public static native TcpRepairWindow getTcpRepairWindow(FileDescriptor fd) throws ErrnoException; /** * @see Inet4AddressUtils#intToInet4AddressHTL(int) * @deprecated Use either {@link Inet4AddressUtils#intToInet4AddressHTH(int)} Loading
core/java/android/net/SocketKeepalive.java +32 −4 Original line number Diff line number Diff line Loading @@ -110,15 +110,43 @@ public abstract class SocketKeepalive implements AutoCloseable { public static final int MAX_INTERVAL_SEC = 3600; /** * This packet is invalid. * See the error code for details. * An exception that embarks an error code. * @hide */ public static class InvalidPacketException extends Exception { public static class ErrorCodeException extends Exception { public final int error; public InvalidPacketException(int error) { public ErrorCodeException(final int error, final Throwable e) { super(e); this.error = error; } public ErrorCodeException(final int error) { this.error = error; } } /** * This socket is invalid. * See the error code for details, and the optional cause. * @hide */ public static class InvalidSocketException extends ErrorCodeException { public InvalidSocketException(final int error, final Throwable e) { super(error, e); } public InvalidSocketException(final int error) { super(error); } } /** * This packet is invalid. * See the error code for details. * @hide */ public static class InvalidPacketException extends ErrorCodeException { public InvalidPacketException(final int error) { super(error); } } @NonNull final IConnectivityManager mService; Loading
core/java/android/net/TcpKeepalivePacketData.aidl 0 → 100644 +20 −0 Original line number Diff line number Diff line /* * Copyright (C) 2019 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package android.net; parcelable TcpKeepalivePacketData;