1 /* 2 * Copyright (c) 2023 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 16 #ifndef CONNECTIVITY_EXT_BPF_LOADER_H 17 #define CONNECTIVITY_EXT_BPF_LOADER_H 18 19 #include <string> 20 21 namespace OHOS::NetManagerStandard { 22 enum ElfLoadError { 23 ELF_LOAD_ERR_NONE = 0, 24 ELF_LOAD_ERR_PATH_INVALID, 25 ELF_LOAD_ERR_MAKE_DIR_FAIL, 26 ELF_LOAD_ERR_LOAD_FILE_FAIL, 27 ELF_LOAD_ERR_GET_VERSION_FAIL, 28 ELF_LOAD_ERR_SELECT_LICENSE_AND_VERSION_FAIL, 29 ELF_LOAD_ERR_LOAD_MAP_SECTION_FAIL, 30 ELF_LOAD_ERR_SET_RLIMIT_FAIL, 31 ELF_LOAD_ERR_CREATE_MAP_FAIL, 32 ELF_LOAD_ERR_PARSE_RELOCATION_FAIL, 33 ELF_LOAD_ERR_LOAD_PROGS_FAIL, 34 ELF_LOAD_ERR_DELETE_MAP_FAIL, 35 ELF_LOAD_ERR_UNLOAD_PROGS_FAIL, 36 }; 37 38 ElfLoadError LoadElf(const std::string &elfPath); 39 40 ElfLoadError UnloadElf(const std::string &elfPath); 41 } // namespace OHOS::NetManagerStandard 42 #endif /* CONNECTIVITY_EXT_BPF_LOADER_H */ 43