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 #include "BaseTestMetricsListener.h"
18
19 namespace android {
20 namespace net {
21 namespace metrics {
22
notify()23 void BaseTestMetricsListener::notify() {
24 std::lock_guard lock(mCvMutex);
25 mCv.notify_one();
26 }
27
setVerified(EventFlag event)28 void BaseTestMetricsListener::setVerified(EventFlag event) {
29 mVerified |= event;
30 }
31
onDnsEvent(int32_t,int32_t,int32_t,int32_t,const std::string &,const::std::vector<std::string> &,int32_t,int32_t)32 android::binder::Status BaseTestMetricsListener::onDnsEvent(
33 int32_t /*netId*/, int32_t /*eventType*/, int32_t /*returnCode*/, int32_t /*latencyMs*/,
34 const std::string& /*hostname*/, const ::std::vector<std::string>& /*ipAddresses*/,
35 int32_t /*ipAddressesCount*/, int32_t /*uid*/) {
36 // default no-op
37 return android::binder::Status::ok();
38 };
39
onPrivateDnsValidationEvent(int32_t,const::android::String16 &,const::android::String16 &,bool)40 android::binder::Status BaseTestMetricsListener::onPrivateDnsValidationEvent(
41 int32_t /*netId*/, const ::android::String16& /*ipAddress*/,
42 const ::android::String16& /*hostname*/, bool /*validated*/) {
43 // default no-op
44 return android::binder::Status::ok();
45 };
46
onConnectEvent(int32_t,int32_t,int32_t,const::android::String16 &,int32_t,int32_t)47 android::binder::Status BaseTestMetricsListener::onConnectEvent(
48 int32_t /*netId*/, int32_t /*error*/, int32_t /*latencyMs*/,
49 const ::android::String16& /*ipAddr*/, int32_t /*port*/, int32_t /*uid*/) {
50 // default no-op
51 return android::binder::Status::ok();
52 };
53
onWakeupEvent(const::android::String16 &,int32_t,int32_t,int32_t,const::std::vector<uint8_t> &,const::android::String16 &,const::android::String16 &,int32_t,int32_t,int64_t)54 android::binder::Status BaseTestMetricsListener::onWakeupEvent(
55 const ::android::String16& /*prefix*/, int32_t /*uid*/, int32_t /*ethertype*/,
56 int32_t /*ipNextHeader*/, const ::std::vector<uint8_t>& /*dstHw*/,
57 const ::android::String16& /*srcIp*/, const ::android::String16& /*dstIp*/,
58 int32_t /*srcPort*/, int32_t /*dstPort*/, int64_t /*timestampNs*/) {
59 // default no-op
60 return android::binder::Status::ok();
61 };
62
onTcpSocketStatsEvent(const::std::vector<int32_t> &,const::std::vector<int32_t> &,const::std::vector<int32_t> &,const::std::vector<int32_t> &,const::std::vector<int32_t> &)63 android::binder::Status BaseTestMetricsListener::onTcpSocketStatsEvent(
64 const ::std::vector<int32_t>& /*networkIds*/, const ::std::vector<int32_t>& /*sentPackets*/,
65 const ::std::vector<int32_t>& /*lostPackets*/, const ::std::vector<int32_t>& /*rttUs*/,
66 const ::std::vector<int32_t>& /*sentAckDiffMs*/) {
67 // default no-op
68 return android::binder::Status::ok();
69 };
70
onNat64PrefixEvent(int32_t,bool,const::std::string &,int32_t)71 android::binder::Status BaseTestMetricsListener::onNat64PrefixEvent(
72 int32_t /*netId*/, bool /*added*/, const ::std::string& /*prefixString*/,
73 int32_t /*prefixLength*/) {
74 // default no-op
75 return android::binder::Status::ok();
76 };
77
78 } // namespace metrics
79 } // namespace net
80 } // namespace android