xref: /aosp_15_r20/bootable/deprecated-ota/applypatch/include/applypatch/imgpatch.h (revision acea8879c968027b49a027136800575dd9783ddf)
1*acea8879SAndroid Build Coastguard Worker /*
2*acea8879SAndroid Build Coastguard Worker  * Copyright (C) 2016 The Android Open Source Project
3*acea8879SAndroid Build Coastguard Worker  *
4*acea8879SAndroid Build Coastguard Worker  * Licensed under the Apache License, Version 2.0 (the "License");
5*acea8879SAndroid Build Coastguard Worker  * you may not use this file except in compliance with the License.
6*acea8879SAndroid Build Coastguard Worker  * You may obtain a copy of the License at
7*acea8879SAndroid Build Coastguard Worker  *
8*acea8879SAndroid Build Coastguard Worker  *      http://www.apache.org/licenses/LICENSE-2.0
9*acea8879SAndroid Build Coastguard Worker  *
10*acea8879SAndroid Build Coastguard Worker  * Unless required by applicable law or agreed to in writing, software
11*acea8879SAndroid Build Coastguard Worker  * distributed under the License is distributed on an "AS IS" BASIS,
12*acea8879SAndroid Build Coastguard Worker  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13*acea8879SAndroid Build Coastguard Worker  * See the License for the specific language governing permissions and
14*acea8879SAndroid Build Coastguard Worker  * limitations under the License.
15*acea8879SAndroid Build Coastguard Worker  */
16*acea8879SAndroid Build Coastguard Worker 
17*acea8879SAndroid Build Coastguard Worker #ifndef _APPLYPATCH_IMGPATCH_H
18*acea8879SAndroid Build Coastguard Worker #define _APPLYPATCH_IMGPATCH_H
19*acea8879SAndroid Build Coastguard Worker 
20*acea8879SAndroid Build Coastguard Worker #include <sys/types.h>
21*acea8879SAndroid Build Coastguard Worker 
22*acea8879SAndroid Build Coastguard Worker #include <functional>
23*acea8879SAndroid Build Coastguard Worker 
24*acea8879SAndroid Build Coastguard Worker using SinkFn = std::function<size_t(const unsigned char*, size_t)>;
25*acea8879SAndroid Build Coastguard Worker 
26*acea8879SAndroid Build Coastguard Worker int ApplyImagePatch(const unsigned char* old_data, size_t old_size, const unsigned char* patch_data,
27*acea8879SAndroid Build Coastguard Worker                     size_t patch_size, SinkFn sink);
28*acea8879SAndroid Build Coastguard Worker 
29*acea8879SAndroid Build Coastguard Worker #endif  // _APPLYPATCH_IMGPATCH_H
30