1 /** 2 * Copyright (c) 2019, 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 #pragma once 18 19 #include <string> 20 #include <vector> 21 22 #include <aidl/android/net/metrics/BnNetdEventListener.h> 23 24 namespace android { 25 namespace net { 26 namespace metrics { 27 28 class BaseMetricsListener : public aidl::android::net::metrics::BnNetdEventListener { 29 public: 30 BaseMetricsListener() = default; 31 ~BaseMetricsListener() = default; 32 33 virtual ::ndk::ScopedAStatus onDnsEvent(int32_t /*netId*/, int32_t /*eventType*/, 34 int32_t /*returnCode*/, int32_t /*latencyMs*/, 35 const std::string& /*hostname*/, 36 const std::vector<std::string>& /*ipAddresses*/, 37 int32_t /*ipAddressesCount*/, int32_t /*uid*/) override; 38 virtual ::ndk::ScopedAStatus onPrivateDnsValidationEvent(int32_t /*netId*/, 39 const std::string& /*ipAddress*/, 40 const std::string& /*hostname*/, 41 bool /*validated*/) override; 42 virtual ::ndk::ScopedAStatus onConnectEvent(int32_t /*netId*/, int32_t /*error*/, 43 int32_t /*latencyMs*/, 44 const std::string& /*ipAddr*/, int32_t /*port*/, 45 int32_t /*uid*/) override; 46 virtual ::ndk::ScopedAStatus onWakeupEvent(const std::string& /*prefix*/, int32_t /*uid*/, 47 int32_t /*ethertype*/, int32_t /*ipNextHeader*/, 48 // TODO: remove build flag when mainline release branch migrates to Android S (b/168163123). 49 #ifdef __ANDROID_API_S__ 50 const std::vector<uint8_t>& /*dstHw*/, 51 #else 52 const std::vector<int8_t>& /*dstHw*/, 53 #endif 54 const std::string& /*srcIp*/, 55 const std::string& /*dstIp*/, int32_t /*srcPort*/, 56 int32_t /*dstPort*/, 57 int64_t /*timestampNs*/) override; 58 virtual ::ndk::ScopedAStatus onTcpSocketStatsEvent( 59 const std::vector<int32_t>& /*networkIds*/, const std::vector<int32_t>& /*sentPackets*/, 60 const std::vector<int32_t>& /*lostPackets*/, const std::vector<int32_t>& /*rttUs*/, 61 const std::vector<int32_t>& /*sentAckDiffMs*/) override; 62 virtual ::ndk::ScopedAStatus onNat64PrefixEvent(int32_t /*netId*/, bool /*added*/, 63 const std::string& /*prefixString*/, 64 int32_t /*prefixLength*/) override; 65 }; 66 67 } // namespace metrics 68 } // namespace net 69 } // namespace android