1 /* 2 * Copyright (c) 2022 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 PARAM_CHECKER_H 17 #define PARAM_CHECKER_H 18 19 #pragma once 20 21 #include <sys/socket.h> 22 #include "selinux_parameter.h" 23 24 #ifdef __cplusplus 25 #if __cplusplus 26 extern "C" { 27 #endif 28 #endif 29 30 /** 31 * @brief set selinux log, only be called by init 32 */ 33 void SetInitSelinuxLog(void); 34 35 /** 36 * @brief for write particular paraName, check permission 37 * 38 * @param paraName the name of param 39 * @param destContext the context of paraName 40 * @param info contains sockfd, pid, uid, gid info 41 * @return 0 for success, or an error code 42 */ 43 int SetParamCheck(const char *paraName, const char *destContext, const SrcInfo *info); 44 45 #ifdef __cplusplus 46 #if __cplusplus 47 } 48 #endif /* __cplusplus */ 49 #endif /* __cplusplus */ 50 51 #endif // PARAM_CHECKER_H 52