1 /** 2 * Copyright (c) 2019, The Android Open Source Project 3 * 4 * Licensed under the Apache License, Version 2.0 (the "License"); 5 * you may not use this file except in compliance with the License. 6 * You may obtain a copy of the License at 7 * 8 * http://www.apache.org/licenses/LICENSE-2.0 9 * 10 * Unless required by applicable law or agreed to in writing, software 11 * distributed under the License is distributed on an "AS IS" BASIS, 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 * See the License for the specific language governing perNmissions and 14 * limitations under the License. 15 */ 16 package android.net.ip; 17 18 import android.net.Layer2PacketParcelable; 19 import android.net.LinkProperties; 20 import android.net.ip.IIpClient; 21 import android.net.networkstack.aidl.ip.ReachabilityLossInfoParcelable; 22 import android.net.DhcpResultsParcelable; 23 24 /** @hide */ 25 oneway interface IIpClientCallbacks { onIpClientCreated(in IIpClient ipClient)26 void onIpClientCreated(in IIpClient ipClient); 27 onPreDhcpAction()28 void onPreDhcpAction(); onPostDhcpAction()29 void onPostDhcpAction(); 30 31 // This is purely advisory and not an indication of provisioning 32 // success or failure. This is only here for callers that want to 33 // expose DHCPv4 results to other APIs (e.g., WifiInfo#setInetAddress). 34 // DHCPv4 or static IPv4 configuration failure or success can be 35 // determined by whether or not the passed-in DhcpResults object is 36 // null or not. onNewDhcpResults(in DhcpResultsParcelable dhcpResults)37 void onNewDhcpResults(in DhcpResultsParcelable dhcpResults); 38 onProvisioningSuccess(in LinkProperties newLp)39 void onProvisioningSuccess(in LinkProperties newLp); onProvisioningFailure(in LinkProperties newLp)40 void onProvisioningFailure(in LinkProperties newLp); 41 42 // Invoked on LinkProperties changes. onLinkPropertiesChange(in LinkProperties newLp)43 void onLinkPropertiesChange(in LinkProperties newLp); 44 45 // Called when the internal IpReachabilityMonitor (if enabled) has 46 // detected the loss of a critical number of required neighbors. onReachabilityLost(in String logMsg)47 void onReachabilityLost(in String logMsg); 48 49 // Called when the IpClient state machine terminates. onQuit()50 void onQuit(); 51 52 // Install an APF program to filter incoming packets. installPacketFilter(in byte[] filter)53 void installPacketFilter(in byte[] filter); 54 55 // Asynchronously read back the APF program & data buffer from the wifi driver. 56 // Due to Wifi HAL limitations, the current implementation only supports dumping the entire 57 // buffer. In response to this request, the driver returns the data buffer asynchronously 58 // by sending an IpClient#EVENT_READ_PACKET_FILTER_COMPLETE message. startReadPacketFilter()59 void startReadPacketFilter(); 60 61 // If multicast filtering cannot be accomplished with APF, this function will be called to 62 // actuate multicast filtering using another means. setFallbackMulticastFilter(boolean enabled)63 void setFallbackMulticastFilter(boolean enabled); 64 65 // Enabled/disable Neighbor Discover offload functionality. This is 66 // called, for example, whenever 464xlat is being started or stopped. setNeighborDiscoveryOffload(boolean enable)67 void setNeighborDiscoveryOffload(boolean enable); 68 69 // Invoked on starting preconnection process. onPreconnectionStart(in List<Layer2PacketParcelable> packets)70 void onPreconnectionStart(in List<Layer2PacketParcelable> packets); 71 72 // Called when the internal IpReachabilityMonitor (if enabled) has detected the loss of a 73 // critical number of required neighbors or DHCP roaming fails. onReachabilityFailure(in ReachabilityLossInfoParcelable lossInfo)74 void onReachabilityFailure(in ReachabilityLossInfoParcelable lossInfo); 75 76 // Reset the DTIM multiplier to the default hardware driver value. 77 const int DTIM_MULTIPLIER_RESET = 0; 78 79 // Set maximum acceptable DTIM multiplier to hardware driver. Any multiplier larger than the 80 // maximum value must not be accepted, it will cause packet loss higher than what the system 81 // can accept, which will cause unexpected behavior for apps, and may interrupt the network 82 // connection. 83 // 84 // DTIM multiplier controls how often the device should wake up to receive multicast/broadcast 85 // packets. Typically the wake up interval is decided by multiplier * AP's DTIM period if 86 // multiplier is non-zero. For example, when hardware driver sets the DTIM multiplier to 2, it 87 // means device wakes up once every 2 DTIM periods, 50% of multicast packets will be dropped. 88 // Setting DTIM multiplier to DTIM_MULTIPLIER_RESET(0) applies the hardware driver default 89 // value. setMaxDtimMultiplier(int multiplier)90 void setMaxDtimMultiplier(int multiplier); 91 } 92