1 /* 2 * Copyright (C) 2009 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; 18 19 import android.net.LinkAddress; 20 import android.net.RouteInfo; 21 22 /** 23 * Callback class for receiving events from an INetworkManagementService 24 * 25 * @hide 26 */ 27 interface INetworkManagementEventObserver { 28 /** 29 * Interface configuration status has changed. 30 * 31 * @param iface The interface. 32 * @param up True if the interface has been enabled. 33 */ interfaceStatusChanged(String iface, boolean up)34 void interfaceStatusChanged(String iface, boolean up); 35 36 /** 37 * Interface physical-layer link state has changed. For Ethernet, 38 * this method is invoked when the cable is plugged in or unplugged. 39 * 40 * @param iface The interface. 41 * @param up True if the physical link-layer connection signal is valid. 42 */ interfaceLinkStateChanged(String iface, boolean up)43 void interfaceLinkStateChanged(String iface, boolean up); 44 45 /** 46 * An interface has been added to the system 47 * 48 * @param iface The interface. 49 */ interfaceAdded(String iface)50 void interfaceAdded(String iface); 51 52 /** 53 * An interface has been removed from the system 54 * 55 * @param iface The interface. 56 */ interfaceRemoved(String iface)57 void interfaceRemoved(String iface); 58 59 60 /** 61 * An interface address has been added or updated. 62 * 63 * @param iface The interface. 64 * @param address The address. 65 */ addressUpdated(String iface, in LinkAddress address)66 void addressUpdated(String iface, in LinkAddress address); 67 68 /** 69 * An interface address has been removed. 70 * 71 * @param iface The interface. 72 * @param address The address. 73 */ addressRemoved(String iface, in LinkAddress address)74 void addressRemoved(String iface, in LinkAddress address); 75 76 /** 77 * A networking quota limit has been reached. The quota might not 78 * be specific to an interface. 79 * 80 * @param limitName The name of the limit that triggered. 81 * @param iface The interface on which the limit was detected. 82 */ limitReached(String limitName, String iface)83 void limitReached(String limitName, String iface); 84 85 /** 86 * Interface data activity status is changed. 87 * 88 * @param iface The interface. 89 * @param active True if the interface is actively transmitting data, false if it is idle. 90 * @param tsNanos Elapsed realtime in nanos when the state of the network interface changed. 91 */ interfaceClassDataActivityChanged(String label, boolean active, long tsNanos)92 void interfaceClassDataActivityChanged(String label, boolean active, long tsNanos); 93 94 /** 95 * Information about available DNS servers has been received. 96 * 97 * @param iface The interface on which the information was received. 98 * @param lifetime The time in seconds for which the DNS servers may be used. 99 * @param servers The IP addresses of the DNS servers. 100 */ interfaceDnsServerInfo(String iface, long lifetime, in String[] servers)101 void interfaceDnsServerInfo(String iface, long lifetime, in String[] servers); 102 103 /** 104 * A route has been added or updated. 105 */ routeUpdated(in RouteInfo route)106 void routeUpdated(in RouteInfo route); 107 108 /** 109 * A route has been removed. 110 */ routeRemoved(in RouteInfo route)111 void routeRemoved(in RouteInfo route); 112 } 113