| 1 |
/* |
| 2 |
* Copyright (C) 2016 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 |
/** {@hide} */ |
| 20 |
oneway interface INetdEventCallback { |
| 21 |
|
| 22 |
// Possible addNetdEventCallback callers. |
| 23 |
const int CALLBACK_CALLER_CONNECTIVITY_SERVICE = 0; |
| 24 |
const int CALLBACK_CALLER_DEVICE_POLICY = 1; |
| 25 |
const int CALLBACK_CALLER_NETWORK_WATCHLIST = 2; |
| 26 |
|
| 27 |
/** |
| 28 |
* Reports a single DNS lookup function call. |
| 29 |
* This method must not block or perform long-running operations. |
| 30 |
* |
| 31 |
* @param netId the ID of the network the lookup was performed on. |
| 32 |
* @param eventType one of the EVENT_* constants in {@link INetdEventListener}. |
| 33 |
* @param returnCode the return value of the query, may vary based on {@code eventType}. See |
| 34 |
* {@code getaddrinfo()}, {@code gethostbyaddr()} and {@code gethostbyname()} section in |
| 35 |
* bionic/libc/include/netdb.h. |
| 36 |
* @param hostname the name that was looked up. |
| 37 |
* @param ipAddresses (possibly a subset of) the IP addresses returned. |
| 38 |
* At most {@link #DNS_REPORTED_IP_ADDRESSES_LIMIT} addresses are logged. |
| 39 |
* @param ipAddressesCount the number of IP addresses returned. May be different from the length |
| 40 |
* of ipAddresses if there were too many addresses to log. |
| 41 |
* @param timestamp the timestamp at which the query was reported by netd. |
| 42 |
* @param uid the UID of the application that performed the query. |
| 43 |
*/ |
| 44 |
void onDnsEvent(int netId, int eventType, int returnCode, String hostname, |
| 45 |
in String[] ipAddresses, int ipAddressesCount, long timestamp, int uid); |
| 46 |
|
| 47 |
/** |
| 48 |
* Represents adding or removing a NAT64 prefix. |
| 49 |
* This method must not block or perform long-running operations. |
| 50 |
* |
| 51 |
* @param netId the ID of the network the prefix was performed on. |
| 52 |
* @param added true if the NAT64 prefix was added, or false if the NAT64 prefix was removed. |
| 53 |
* There is only one prefix at a time for each netId. If a prefix is added, it replaces |
| 54 |
* the previous-added prefix. |
| 55 |
* @param prefixString the detected NAT64 prefix as a string literal. |
| 56 |
* @param prefixLength the prefix length associated with this NAT64 prefix. |
| 57 |
*/ |
| 58 |
void onNat64PrefixEvent(int netId, boolean added, @utf8InCpp String prefixString, |
| 59 |
int prefixLength); |
| 60 |
|
| 61 |
/** |
| 62 |
* Represents a private DNS validation success or failure. |
| 63 |
* This method must not block or perform long-running operations. |
| 64 |
* |
| 65 |
* @param netId the ID of the network the validation was performed on. |
| 66 |
* @param ipAddress the IP address for which validation was performed. |
| 67 |
* @param hostname the hostname for which validation was performed. |
| 68 |
* @param validated whether or not validation was successful. |
| 69 |
*/ |
| 70 |
void onPrivateDnsValidationEvent(int netId, String ipAddress, String hostname, |
| 71 |
boolean validated); |
| 72 |
|
| 73 |
/** |
| 74 |
* Reports a single connect library call. |
| 75 |
* This method must not block or perform long-running operations. |
| 76 |
* |
| 77 |
* @param ipAddr destination IP address. |
| 78 |
* @param port destination port number. |
| 79 |
* @param timestamp the timestamp at which the call was reported by netd. |
| 80 |
* @param uid the UID of the application that performed the connection. |
| 81 |
*/ |
| 82 |
void onConnectEvent(String ipAddr, int port, long timestamp, int uid); |
| 83 |
} |