• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (C) 2022 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 package com.android.net.module.util;
17 
18 import android.net.metrics.INetdEventListener;
19 
20 /**
21  * Base {@link INetdEventListener} that provides no-op implementations which can
22  * be overridden.
23  */
24 public class BaseNetdEventListener extends INetdEventListener.Stub {
25 
26     @Override
onDnsEvent(int netId, int eventType, int returnCode, int latencyMs, String hostname, String[] ipAddresses, int ipAddressesCount, int uid)27     public void onDnsEvent(int netId, int eventType, int returnCode,
28             int latencyMs, String hostname, String[] ipAddresses,
29             int ipAddressesCount, int uid) { }
30 
31     @Override
onPrivateDnsValidationEvent(int netId, String ipAddress, String hostname, boolean validated)32     public void onPrivateDnsValidationEvent(int netId, String ipAddress,
33             String hostname, boolean validated) { }
34 
35     @Override
onConnectEvent(int netId, int error, int latencyMs, String ipAddr, int port, int uid)36     public void onConnectEvent(int netId, int error, int latencyMs,
37             String ipAddr, int port, int uid) { }
38 
39     @Override
onWakeupEvent(String prefix, int uid, int ethertype, int ipNextHeader, byte[] dstHw, String srcIp, String dstIp, int srcPort, int dstPort, long timestampNs)40     public void onWakeupEvent(String prefix, int uid, int ethertype,
41             int ipNextHeader, byte[] dstHw, String srcIp, String dstIp,
42             int srcPort, int dstPort, long timestampNs) { }
43 
44     @Override
onTcpSocketStatsEvent(int[] networkIds, int[] sentPackets, int[] lostPackets, int[] rttUs, int[] sentAckDiffMs)45     public void onTcpSocketStatsEvent(int[] networkIds, int[] sentPackets,
46             int[] lostPackets, int[] rttUs, int[] sentAckDiffMs) { }
47 
48     @Override
onNat64PrefixEvent(int netId, boolean added, String prefixString, int prefixLength)49     public void onNat64PrefixEvent(int netId, boolean added,
50             String prefixString, int prefixLength) { }
51 
52     @Override
getInterfaceVersion()53     public int getInterfaceVersion() {
54         return INetdEventListener.VERSION;
55     }
56 
57     @Override
getInterfaceHash()58     public String getInterfaceHash() {
59         return INetdEventListener.HASH;
60     }
61 }
62