Loading src/android/net/apf/ApfFilter.java +24 −0 Original line number Diff line number Diff line Loading @@ -38,6 +38,7 @@ import android.content.Intent; import android.content.IntentFilter; import android.net.LinkAddress; import android.net.LinkProperties; import android.net.TcpKeepalivePacketDataParcelable; import android.net.apf.ApfGenerator.IllegalInstructionException; import android.net.apf.ApfGenerator.Register; import android.net.ip.IpClient.IpClientCallbacksWrapper; Loading Loading @@ -1489,6 +1490,29 @@ public class ApfFilter { installNewProgramLocked(); } /** * Add keepalive packet filter. * * @param slot The index used to access the filter. * @param pkt Parameters needed to compose the filter. */ public synchronized void addKeepalivePacketFilter(int slot, TcpKeepalivePacketDataParcelable pkt) { // TODO: implement this. Log.e(TAG, "APF function is not implemented: addKeepalivePacketFilter(" + slot + ", " + pkt + ")"); } /** * Remove keepalive packet filter. * * @param slot The index used to access the filter. */ public synchronized void removeKeepalivePacketFilter(int slot) { // TODO: implement this. Log.e(TAG, "APF function is not implemented: removeKeepalivePacketFilter(" + slot + ")"); } static public long counterValue(byte[] data, Counter counter) throws ArrayIndexOutOfBoundsException { // Follow the same wrap-around addressing scheme of the interpreter. Loading src/android/net/ip/IpClient.java +47 −0 Original line number Diff line number Diff line Loading @@ -23,6 +23,7 @@ import static android.net.shared.LinkPropertiesParcelableUtil.toStableParcelable import static com.android.server.util.PermissionUtil.checkNetworkStackCallingPermission; import android.annotation.NonNull; import android.content.Context; import android.net.ConnectivityManager; import android.net.DhcpResults; Loading @@ -34,6 +35,7 @@ import android.net.ProvisioningConfigurationParcelable; import android.net.ProxyInfo; import android.net.ProxyInfoParcelable; import android.net.RouteInfo; import android.net.TcpKeepalivePacketDataParcelable; import android.net.apf.ApfCapabilities; import android.net.apf.ApfFilter; import android.net.dhcp.DhcpClient; Loading Loading @@ -292,6 +294,8 @@ public class IpClient extends StateMachine { private static final int EVENT_PROVISIONING_TIMEOUT = 10; private static final int EVENT_DHCPACTION_TIMEOUT = 11; private static final int EVENT_READ_PACKET_FILTER_COMPLETE = 12; private static final int CMD_ADD_KEEPALIVE_PACKET_FILTER_TO_APF = 13; private static final int CMD_REMOVE_KEEPALIVE_PACKET_FILTER_FROM_APF = 14; // Internal commands to use instead of trying to call transitionTo() inside // a given State's enter() method. Calling transitionTo() from enter/exit Loading Loading @@ -522,6 +526,16 @@ public class IpClient extends StateMachine { checkNetworkStackCallingPermission(); IpClient.this.setMulticastFilter(enabled); } @Override public void addKeepalivePacketFilter(int slot, TcpKeepalivePacketDataParcelable pkt) { checkNetworkStackCallingPermission(); IpClient.this.addKeepalivePacketFilter(slot, pkt); } @Override public void removeKeepalivePacketFilter(int slot) { checkNetworkStackCallingPermission(); IpClient.this.removeKeepalivePacketFilter(slot); } } public String getInterfaceName() { Loading Loading @@ -643,6 +657,22 @@ public class IpClient extends StateMachine { sendMessage(CMD_SET_MULTICAST_FILTER, enabled); } /** * Called by WifiStateMachine to add keepalive packet filter before setting up * keepalive offload. */ public void addKeepalivePacketFilter(int slot, @NonNull TcpKeepalivePacketDataParcelable pkt) { sendMessage(CMD_ADD_KEEPALIVE_PACKET_FILTER_TO_APF, slot, 0 /* Unused */, pkt); } /** * Called by WifiStateMachine to remove keepalive packet filter after stopping keepalive * offload. */ public void removeKeepalivePacketFilter(int slot) { sendMessage(CMD_REMOVE_KEEPALIVE_PACKET_FILTER_FROM_APF, slot, 0 /* Unused */); } /** * Dump logs of this IpClient. */ Loading Loading @@ -1512,6 +1542,23 @@ public class IpClient extends StateMachine { break; } case CMD_ADD_KEEPALIVE_PACKET_FILTER_TO_APF: { final int slot = msg.arg1; if (mApfFilter != null) { mApfFilter.addKeepalivePacketFilter(slot, (TcpKeepalivePacketDataParcelable) msg.obj); } break; } case CMD_REMOVE_KEEPALIVE_PACKET_FILTER_FROM_APF: { final int slot = msg.arg1; if (mApfFilter != null) { mApfFilter.removeKeepalivePacketFilter(slot); } break; } case EVENT_DHCPACTION_TIMEOUT: stopDhcpAction(); break; Loading tests/Android.bp +1 −0 Original line number Diff line number Diff line Loading @@ -49,6 +49,7 @@ android_test { "libhidlbase", "libhidltransport", "libhwbinder", "libjsoncpp", "liblog", "liblzma", "libnativehelper", Loading Loading
src/android/net/apf/ApfFilter.java +24 −0 Original line number Diff line number Diff line Loading @@ -38,6 +38,7 @@ import android.content.Intent; import android.content.IntentFilter; import android.net.LinkAddress; import android.net.LinkProperties; import android.net.TcpKeepalivePacketDataParcelable; import android.net.apf.ApfGenerator.IllegalInstructionException; import android.net.apf.ApfGenerator.Register; import android.net.ip.IpClient.IpClientCallbacksWrapper; Loading Loading @@ -1489,6 +1490,29 @@ public class ApfFilter { installNewProgramLocked(); } /** * Add keepalive packet filter. * * @param slot The index used to access the filter. * @param pkt Parameters needed to compose the filter. */ public synchronized void addKeepalivePacketFilter(int slot, TcpKeepalivePacketDataParcelable pkt) { // TODO: implement this. Log.e(TAG, "APF function is not implemented: addKeepalivePacketFilter(" + slot + ", " + pkt + ")"); } /** * Remove keepalive packet filter. * * @param slot The index used to access the filter. */ public synchronized void removeKeepalivePacketFilter(int slot) { // TODO: implement this. Log.e(TAG, "APF function is not implemented: removeKeepalivePacketFilter(" + slot + ")"); } static public long counterValue(byte[] data, Counter counter) throws ArrayIndexOutOfBoundsException { // Follow the same wrap-around addressing scheme of the interpreter. Loading
src/android/net/ip/IpClient.java +47 −0 Original line number Diff line number Diff line Loading @@ -23,6 +23,7 @@ import static android.net.shared.LinkPropertiesParcelableUtil.toStableParcelable import static com.android.server.util.PermissionUtil.checkNetworkStackCallingPermission; import android.annotation.NonNull; import android.content.Context; import android.net.ConnectivityManager; import android.net.DhcpResults; Loading @@ -34,6 +35,7 @@ import android.net.ProvisioningConfigurationParcelable; import android.net.ProxyInfo; import android.net.ProxyInfoParcelable; import android.net.RouteInfo; import android.net.TcpKeepalivePacketDataParcelable; import android.net.apf.ApfCapabilities; import android.net.apf.ApfFilter; import android.net.dhcp.DhcpClient; Loading Loading @@ -292,6 +294,8 @@ public class IpClient extends StateMachine { private static final int EVENT_PROVISIONING_TIMEOUT = 10; private static final int EVENT_DHCPACTION_TIMEOUT = 11; private static final int EVENT_READ_PACKET_FILTER_COMPLETE = 12; private static final int CMD_ADD_KEEPALIVE_PACKET_FILTER_TO_APF = 13; private static final int CMD_REMOVE_KEEPALIVE_PACKET_FILTER_FROM_APF = 14; // Internal commands to use instead of trying to call transitionTo() inside // a given State's enter() method. Calling transitionTo() from enter/exit Loading Loading @@ -522,6 +526,16 @@ public class IpClient extends StateMachine { checkNetworkStackCallingPermission(); IpClient.this.setMulticastFilter(enabled); } @Override public void addKeepalivePacketFilter(int slot, TcpKeepalivePacketDataParcelable pkt) { checkNetworkStackCallingPermission(); IpClient.this.addKeepalivePacketFilter(slot, pkt); } @Override public void removeKeepalivePacketFilter(int slot) { checkNetworkStackCallingPermission(); IpClient.this.removeKeepalivePacketFilter(slot); } } public String getInterfaceName() { Loading Loading @@ -643,6 +657,22 @@ public class IpClient extends StateMachine { sendMessage(CMD_SET_MULTICAST_FILTER, enabled); } /** * Called by WifiStateMachine to add keepalive packet filter before setting up * keepalive offload. */ public void addKeepalivePacketFilter(int slot, @NonNull TcpKeepalivePacketDataParcelable pkt) { sendMessage(CMD_ADD_KEEPALIVE_PACKET_FILTER_TO_APF, slot, 0 /* Unused */, pkt); } /** * Called by WifiStateMachine to remove keepalive packet filter after stopping keepalive * offload. */ public void removeKeepalivePacketFilter(int slot) { sendMessage(CMD_REMOVE_KEEPALIVE_PACKET_FILTER_FROM_APF, slot, 0 /* Unused */); } /** * Dump logs of this IpClient. */ Loading Loading @@ -1512,6 +1542,23 @@ public class IpClient extends StateMachine { break; } case CMD_ADD_KEEPALIVE_PACKET_FILTER_TO_APF: { final int slot = msg.arg1; if (mApfFilter != null) { mApfFilter.addKeepalivePacketFilter(slot, (TcpKeepalivePacketDataParcelable) msg.obj); } break; } case CMD_REMOVE_KEEPALIVE_PACKET_FILTER_FROM_APF: { final int slot = msg.arg1; if (mApfFilter != null) { mApfFilter.removeKeepalivePacketFilter(slot); } break; } case EVENT_DHCPACTION_TIMEOUT: stopDhcpAction(); break; Loading
tests/Android.bp +1 −0 Original line number Diff line number Diff line Loading @@ -49,6 +49,7 @@ android_test { "libhidlbase", "libhidltransport", "libhwbinder", "libjsoncpp", "liblog", "liblzma", "libnativehelper", Loading