1 /*
2  * Copyright 2019 Google Inc.
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 "config.h"
18 
19 #include "cleanup.hpp"
20 #include "util.hpp"
21 
22 #include <blobs-ipmid/blobs.hpp>
23 
24 #include <memory>
25 #include <string>
26 #include <vector>
27 
28 namespace ipmi_flash
29 {
30 std::vector<std::string> files = {
31     STATIC_HANDLER_STAGED_NAME, TARBALL_STAGED_NAME, HASH_FILENAME,
32     VERIFY_STATUS_FILENAME, UPDATE_STATUS_FILENAME};
33 }
34 
35 extern "C" std::unique_ptr<blobs::GenericBlobInterface> createHandler()
36 {
37     auto handler = ipmi_flash::FileCleanupHandler::CreateCleanupHandler(
38         ipmi_flash::cleanupBlobId, ipmi_flash::files);
39 
40     if (!handler)
41     {
42         std::fprintf(stderr, "Unable to create FileCleanupHandle for Firmware");
43         return nullptr;
44     }
45 
46     return handler;
47 }
48