1/*
2 * Copyright (c) 2021 Huawei Device Co., Ltd.
3 * Licensed under the Apache License, Version 2.0 (the "License");
4 * you may not use this file except in compliance with the License.
5 * You may obtain a copy of the License at
6 *
7 * http://www.apache.org/licenses/LICENSE-2.0
8 *
9 * Unless required by applicable law or agreed to in writing, software
10 * distributed under the License is distributed on an "AS IS" BASIS,
11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 * See the License for the specific language governing permissions and
13 * limitations under the License.
14 */
15#ifndef UPDATER_COMMAND_PROCESS_H
16#define UPDATER_COMMAND_PROCESS_H
17
18#include "applypatch/command.h"
19#include "applypatch/command_function.h"
20
21namespace Updater {
22class AbortCommandFn : public CommandFunction {
23public:
24    AbortCommandFn() {}
25    ~AbortCommandFn() override {}
26    CommandResult Execute(const Command &params) override;
27};
28
29class NewCommandFn : public CommandFunction {
30public:
31    NewCommandFn() {}
32    ~NewCommandFn() override {}
33    CommandResult Execute(const Command &params) override;
34};
35
36class ZeroAndEraseCommandFn : public CommandFunction {
37public:
38    ZeroAndEraseCommandFn() {}
39    ~ZeroAndEraseCommandFn() override {}
40    CommandResult Execute(const Command &params) override;
41};
42
43class FreeCommandFn : public CommandFunction {
44public:
45    FreeCommandFn() {}
46    ~FreeCommandFn() override {}
47    CommandResult Execute(const Command &params) override;
48};
49
50class StashCommandFn : public CommandFunction {
51public:
52    StashCommandFn() {}
53    ~StashCommandFn() override {}
54    CommandResult Execute(const Command &params) override;
55};
56
57class DiffAndMoveCommandFn : public CommandFunction {
58public:
59    DiffAndMoveCommandFn() {}
60    ~DiffAndMoveCommandFn() override {}
61    CommandResult Execute(const Command &params) override;
62    virtual int32_t WriteDiffToBlock(const Command &params, std::vector<uint8_t> &srcBuffer,
63                                     uint8_t *patchBuffer, size_t patchLength, BlockSet &targetBlock);
64};
65}
66#endif // UPDATER_COMMAND_PROCESS_H
67