Coverage Report

Created: 2026-01-17 06:53

next uncovered line (L), next uncovered region (R), next uncovered branch (B)
/src/opendnp3/cpp/lib/src/outstation/FreezeRequestHandler.cpp
Line
Count
Source
1
/*
2
 * Copyright 2013-2022 Step Function I/O, LLC
3
 *
4
 * Licensed to Green Energy Corp (www.greenenergycorp.com) and Step Function I/O
5
 * LLC (https://stepfunc.io) under one or more contributor license agreements.
6
 * See the NOTICE file distributed with this work for additional information
7
 * regarding copyright ownership. Green Energy Corp and Step Function I/O LLC license
8
 * this file to you under the Apache License, Version 2.0 (the "License"); you
9
 * may not use this file except in compliance with the License. You may obtain
10
 * a copy of the License at:
11
 *
12
 * http://www.apache.org/licenses/LICENSE-2.0
13
 *
14
 * Unless required by applicable law or agreed to in writing, software
15
 * distributed under the License is distributed on an "AS IS" BASIS,
16
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17
 * See the License for the specific language governing permissions and
18
 * limitations under the License.
19
 */
20
#include "outstation/FreezeRequestHandler.h"
21
22
#include "gen/objects/Group12.h"
23
#include "gen/objects/Group41.h"
24
25
#include <ser4cpp/serialization/LittleEndian.h>
26
27
namespace opendnp3
28
{
29
30
142
FreezeRequestHandler::FreezeRequestHandler(bool clear, Database& database) : clear(clear), database(database) {}
31
32
bool FreezeRequestHandler::IsAllowed(uint32_t headerCount, GroupVariation gv, QualifierCode qc)
33
2.71k
{
34
2.71k
    if (gv != GroupVariation::Group20Var0)
35
16
        return false;
36
37
2.69k
    switch (qc)
38
2.69k
    {
39
1.53k
    case QualifierCode::ALL_OBJECTS:
40
2.67k
    case QualifierCode::UINT8_START_STOP:
41
2.69k
    case QualifierCode::UINT16_START_STOP:
42
2.69k
        return true;
43
4
    default:
44
4
        return false;
45
2.69k
    }
46
2.69k
}
47
48
IINField FreezeRequestHandler::ProcessHeader(const AllObjectsHeader& record)
49
1.53k
{
50
1.53k
    this->database.SelectAll(record.enumeration);
51
1.53k
    this->database.FreezeSelectedCounters(clear);
52
1.53k
    return IINField::Empty();
53
1.53k
}
54
55
IINField FreezeRequestHandler::ProcessHeader(const RangeHeader& header)
56
1.15k
{
57
1.15k
    this->database.SelectRange(header.enumeration, header.range);
58
1.15k
    this->database.FreezeSelectedCounters(clear);
59
1.15k
    return IINField::Empty();
60
1.15k
}
61
62
} // namespace opendnp3