• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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 permissions and
14  * limitations under the License.
15  */
16 
17 package android.net.ip;
18 
19 import android.net.DhcpResults;
20 import android.net.LinkProperties;
21 
22 /**
23  * Callbacks for handling IpClient events.
24  *
25  * This is a convenience class to allow clients not to override all methods of IIpClientCallbacks,
26  * and avoid unparceling arguments.
27  * These methods are called asynchronously on a Binder thread, as IpClient lives in a different
28  * process.
29  * @hide
30  */
31 public class IpClientCallbacks {
32 
33     /**
34      * Callback called upon IpClient creation.
35      *
36      * @param ipClient The Binder token to communicate with IpClient.
37      */
onIpClientCreated(IIpClient ipClient)38     public void onIpClientCreated(IIpClient ipClient) {}
39 
40     /**
41      * Callback called prior to DHCP discovery/renewal.
42      *
43      * <p>In order to receive onPreDhcpAction(), call #withPreDhcpAction() when constructing a
44      * ProvisioningConfiguration.
45      *
46      * <p>Implementations of onPreDhcpAction() must call IpClient#completedPreDhcpAction() to
47      * indicate that DHCP is clear to proceed.
48       */
onPreDhcpAction()49     public void onPreDhcpAction() {}
50 
51     /**
52      * Callback called after DHCP discovery/renewal.
53      */
onPostDhcpAction()54     public void onPostDhcpAction() {}
55 
56     /**
57      * Callback called when new DHCP results are available.
58      *
59      * <p>This is purely advisory and not an indication of provisioning success or failure.  This is
60      * only here for callers that want to expose DHCPv4 results to other APIs
61      * (e.g., WifiInfo#setInetAddress).
62      *
63      * <p>DHCPv4 or static IPv4 configuration failure or success can be determined by whether or not
64      * the passed-in DhcpResults object is null.
65      */
onNewDhcpResults(DhcpResults dhcpResults)66     public void onNewDhcpResults(DhcpResults dhcpResults) {}
67 
68     /**
69      * Indicates that provisioning was successful.
70      */
onProvisioningSuccess(LinkProperties newLp)71     public void onProvisioningSuccess(LinkProperties newLp) {}
72 
73     /**
74      * Indicates that provisioning failed.
75      */
onProvisioningFailure(LinkProperties newLp)76     public void onProvisioningFailure(LinkProperties newLp) {}
77 
78     /**
79      * Invoked on LinkProperties changes.
80      */
onLinkPropertiesChange(LinkProperties newLp)81     public void onLinkPropertiesChange(LinkProperties newLp) {}
82 
83     /**Called when the internal IpReachabilityMonitor (if enabled) has
84      * detected the loss of a critical number of required neighbors.
85      */
onReachabilityLost(String logMsg)86     public void onReachabilityLost(String logMsg) {}
87 
88     /**
89      * Called when the IpClient state machine terminates.
90      */
onQuit()91     public void onQuit() {}
92 
93     /**
94      * Called to indicate that a new APF program must be installed to filter incoming packets.
95      */
installPacketFilter(byte[] filter)96     public void installPacketFilter(byte[] filter) {}
97 
98     /**
99      * Called to indicate that the APF Program & data buffer must be read asynchronously from the
100      * wifi driver.
101      *
102      * <p>Due to Wifi HAL limitations, the current implementation only supports dumping the entire
103      * buffer. In response to this request, the driver returns the data buffer asynchronously
104      * by sending an IpClient#EVENT_READ_PACKET_FILTER_COMPLETE message.
105      */
startReadPacketFilter()106     public void startReadPacketFilter() {}
107 
108     /**
109      * If multicast filtering cannot be accomplished with APF, this function will be called to
110      * actuate multicast filtering using another means.
111      */
setFallbackMulticastFilter(boolean enabled)112     public void setFallbackMulticastFilter(boolean enabled) {}
113 
114     /**
115      * Enabled/disable Neighbor Discover offload functionality. This is called, for example,
116      * whenever 464xlat is being started or stopped.
117      */
setNeighborDiscoveryOffload(boolean enable)118     public void setNeighborDiscoveryOffload(boolean enable) {}
119 }
120