Line data Source code
1 : /*
2 : *
3 : * Copyright (c) 2020 Project CHIP Authors
4 : * Copyright (c) 2016-2017 Nest Labs, Inc.
5 : *
6 : * Licensed under the Apache License, Version 2.0 (the "License");
7 : * you may not use this file except in compliance with the License.
8 : * You may obtain a copy of the License at
9 : *
10 : * http://www.apache.org/licenses/LICENSE-2.0
11 : *
12 : * Unless required by applicable law or agreed to in writing, software
13 : * distributed under the License is distributed on an "AS IS" BASIS,
14 : * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 : * See the License for the specific language governing permissions and
16 : * limitations under the License.
17 : */
18 :
19 : /**
20 : * @file
21 : * Implementation of the fault-injection utilities for Inet.
22 : */
23 :
24 : #include "InetFaultInjection.h"
25 :
26 : namespace chip {
27 : namespace Inet {
28 : namespace FaultInjection {
29 :
30 : static nl::FaultInjection::Record sFaultRecordArray[kFault_NumItems];
31 : static class nl::FaultInjection::Manager sInetFaultInMgr;
32 : static const nl::FaultInjection::Name sManagerName = "Inet";
33 : static const nl::FaultInjection::Name sFaultNames[] = {
34 : "DNSResolverNew",
35 : "Send",
36 : "SendNonCritical",
37 : };
38 :
39 : /**
40 : * Get the singleton FaultInjection::Manager for Inet faults
41 : */
42 97 : nl::FaultInjection::Manager & GetManager()
43 : {
44 97 : if (0 == sInetFaultInMgr.GetNumFaults())
45 : {
46 5 : sInetFaultInMgr.Init(kFault_NumItems, sFaultRecordArray, sManagerName, sFaultNames);
47 : }
48 97 : return sInetFaultInMgr;
49 : }
50 :
51 : } // namespace FaultInjection
52 : } // namespace Inet
53 : } // namespace chip
|