blob: 0877a1a47e2bea054916f66f9a26fb5d2f6e7659 [file] [log] [blame]
Michal Karpinskidd9bb4f2016-10-12 14:59:26 +01001/*
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
17package android.net;
18
19/** {@hide} */
20oneway interface INetdEventCallback {
21
Ricky Wai77518fb2017-10-27 14:46:01 +010022 // Possible addNetdEventCallback callers.
dalyk99c50292018-03-08 16:25:48 -050023 const int CALLBACK_CALLER_CONNECTIVITY_SERVICE = 0;
24 const int CALLBACK_CALLER_DEVICE_POLICY = 1;
25 const int CALLBACK_CALLER_NETWORK_WATCHLIST = 2;
Ricky Wai77518fb2017-10-27 14:46:01 +010026
Michal Karpinskidd9bb4f2016-10-12 14:59:26 +010027 /**
28 * Reports a single DNS lookup function call.
29 * This method must not block or perform long-running operations.
30 *
junyulai4c2d2d52018-10-16 22:58:07 +080031 * @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.
Michal Karpinskidd9bb4f2016-10-12 14:59:26 +010036 * @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 */
junyulai4c2d2d52018-10-16 22:58:07 +080044 void onDnsEvent(int netId, int eventType, int returnCode, String hostname,
45 in String[] ipAddresses, int ipAddressesCount, long timestamp, int uid);
Michal Karpinskidd9bb4f2016-10-12 14:59:26 +010046
47 /**
nuccachen6e81f2a2018-07-30 17:29:45 +080048 * 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 /**
dalyk99c50292018-03-08 16:25:48 -050062 * 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 /**
Michal Karpinskidd9bb4f2016-10-12 14:59:26 +010074 * 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}