1 /** 2 * Copyright (c) 2018, 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 /** 20 * Unsolicited netd events which are reported by the kernel via netlink. 21 * This one-way interface groups asynchronous notifications sent 22 * by netd to any process that registered itself via INetd.registerUnsolEventListener. 23 * 24 * {@hide} 25 */ 26 oneway interface INetdUnsolicitedEventListener { 27 28 /** 29 * Notifies that an interface has been idle/active for a certain period of time. 30 * It is the event for idletimer. 31 * 32 * @param isActive true for active status, false for idle 33 * @param timerLabel unique identifier of the idletimer. 34 * Since NMS only set the identifier as int, only report event with int label. 35 * @param timestampNs kernel timestamp of this event, 0 for no timestamp 36 * @param uid uid of this event, -1 for no uid. 37 * It represents the uid that was responsible for waking the radio. 38 */ onInterfaceClassActivityChanged( boolean isActive, int timerLabel, long timestampNs, int uid)39 void onInterfaceClassActivityChanged( 40 boolean isActive, 41 int timerLabel, 42 long timestampNs, 43 int uid); 44 45 /** 46 * Notifies that a specific interface reached its quota limit. 47 * 48 * @param alertName alert name of the quota limit 49 * @param ifName interface which reached the limit 50 */ onQuotaLimitReached(@tf8InCpp String alertName, @utf8InCpp String ifName)51 void onQuotaLimitReached(@utf8InCpp String alertName, @utf8InCpp String ifName); 52 53 /** 54 * Provides information on IPv6 DNS servers on a specific interface. 55 * 56 * @param ifName interface name 57 * @param lifetimeS lifetime for the DNS servers in seconds 58 * @param servers the address of servers. 59 * e.g. IpV6: "2001:4860:4860::6464" 60 * 61 */ onInterfaceDnsServerInfo( @tf8InCpp String ifName, long lifetimeS, in @utf8InCpp String[] servers)62 void onInterfaceDnsServerInfo( 63 @utf8InCpp String ifName, long lifetimeS, in @utf8InCpp String[] servers); 64 65 /** 66 * Notifies that an address has updated on a specific interface. 67 * 68 * @param addr address that is being updated 69 * @param ifName the name of the interface on which the address is configured 70 * @param flags address flags, see ifa_flags in if_addr.h 71 * @param scope current scope of the address 72 */ onInterfaceAddressUpdated( @tf8InCpp String addr, @utf8InCpp String ifName, int flags, int scope)73 void onInterfaceAddressUpdated( 74 @utf8InCpp String addr, 75 @utf8InCpp String ifName, 76 int flags, 77 int scope); 78 79 /** 80 * Notifies that an address has been removed on a specific interface. 81 * 82 * @param addr address of this change 83 * @param ifName the name of the interface that changed addresses 84 * @param flags address flags, see ifa_flags in if_addr.h 85 * @param scope address address scope 86 */ onInterfaceAddressRemoved( @tf8InCpp String addr, @utf8InCpp String ifName, int flags, int scope)87 void onInterfaceAddressRemoved( 88 @utf8InCpp String addr, 89 @utf8InCpp String ifName, 90 int flags, 91 int scope); 92 93 /** 94 * Notifies that an interface has been added. 95 * 96 * @param ifName the name of the added interface 97 */ onInterfaceAdded(@tf8InCpp String ifName)98 void onInterfaceAdded(@utf8InCpp String ifName); 99 100 /** 101 * Notifies that an interface has been removed. 102 * 103 * @param ifName the name of the removed interface 104 */ onInterfaceRemoved(@tf8InCpp String ifName)105 void onInterfaceRemoved(@utf8InCpp String ifName); 106 107 /** 108 * Notifies that the status of the specific interface has changed. 109 * 110 * @param ifName the name of the interface that changed status 111 * @param up true for interface up, false for down 112 */ onInterfaceChanged(@tf8InCpp String ifName, boolean up)113 void onInterfaceChanged(@utf8InCpp String ifName, boolean up); 114 115 /** 116 * Notifies that the link state of the specific interface has changed. 117 * 118 * @param ifName the name of the interface whose link state has changed 119 * @param up true for interface link state up, false for link state down 120 */ onInterfaceLinkStateChanged(@tf8InCpp String ifName, boolean up)121 void onInterfaceLinkStateChanged(@utf8InCpp String ifName, boolean up); 122 123 /** 124 * Notifies that an IP route has changed. 125 * 126 * @param updated true for update, false for remove 127 * @param route destination prefix of this route, e.g., "2001:db8::/64" 128 * @param gateway address of gateway, empty string for no gateway 129 * @param ifName interface name of this route, empty string for no interface 130 */ onRouteChanged( boolean updated, @utf8InCpp String route, @utf8InCpp String gateway, @utf8InCpp String ifName)131 void onRouteChanged( 132 boolean updated, 133 @utf8InCpp String route, 134 @utf8InCpp String gateway, 135 @utf8InCpp String ifName); 136 137 /** 138 * Notifies that kernel has detected a socket sending data not wrapped 139 * inside a layer of SSL/TLS encryption. 140 * 141 * @param uid uid of this event 142 * @param hex packet content in hex format 143 */ onStrictCleartextDetected(int uid, @utf8InCpp String hex)144 void onStrictCleartextDetected(int uid, @utf8InCpp String hex); 145 } 146