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 hostname the name that was looked up.
32      * @param ipAddresses (possibly a subset of) the IP addresses returned.
33      *        At most {@link #DNS_REPORTED_IP_ADDRESSES_LIMIT} addresses are logged.
34      * @param ipAddressesCount the number of IP addresses returned. May be different from the length
35      *        of ipAddresses if there were too many addresses to log.
36      * @param timestamp the timestamp at which the query was reported by netd.
37      * @param uid the UID of the application that performed the query.
38      */
onDnsEvent(String hostname, in String[] ipAddresses, int ipAddressesCount, long timestamp, int uid)39     void onDnsEvent(String hostname, in String[] ipAddresses, int ipAddressesCount, long timestamp,
40             int uid);
41 
42     /**
43      * Represents a private DNS validation success or failure.
44      * This method must not block or perform long-running operations.
45      *
46      * @param netId the ID of the network the validation was performed on.
47      * @param ipAddress the IP address for which validation was performed.
48      * @param hostname the hostname for which validation was performed.
49      * @param validated whether or not validation was successful.
50      */
onPrivateDnsValidationEvent(int netId, String ipAddress, String hostname, boolean validated)51     void onPrivateDnsValidationEvent(int netId, String ipAddress, String hostname,
52             boolean validated);
53 
54     /**
55      * Reports a single connect library call.
56      * This method must not block or perform long-running operations.
57      *
58      * @param ipAddr destination IP address.
59      * @param port destination port number.
60      * @param timestamp the timestamp at which the call was reported by netd.
61      * @param uid the UID of the application that performed the connection.
62      */
onConnectEvent(String ipAddr, int port, long timestamp, int uid)63     void onConnectEvent(String ipAddr, int port, long timestamp, int uid);
64 }
65