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 16 #ifndef NETMANAGER_CONSTANTS_H 17 #define NETMANAGER_CONSTANTS_H 18 19 #include <errors.h> 20 21 namespace OHOS { 22 namespace NetManagerStandard { 23 constexpr int NETMANAGER_ERROR = -1; 24 constexpr int NETMANAGER_SUCCESS = 0; 25 26 enum { 27 NETMANAGER_COMMON = 0x00, 28 NETMANAGER_DNS_RESOLVER_MANAGER = 0x01, 29 NETMANAGER_NET_CONN_MANAGER = 0x03, 30 NETMANAGER_NET_POLICY_MANAGER = 0x04, 31 }; 32 33 // Error code for common 34 constexpr ErrCode COMMON_ERR_OFFSET = ErrCodeOffset(SUBSYS_COMMUNICATION, NETMANAGER_COMMON); 35 36 enum { 37 NETMANAGER_ERR_FAIL = COMMON_ERR_OFFSET, 38 NETMANAGER_ERR_MEMCPY_FAIL, 39 NETMANAGER_ERR_MEMSET_FAIL, 40 NETMANAGER_ERR_STRCPY_FAIL, 41 NETMANAGER_ERR_STRING_EMPTY, 42 NETMANAGER_ERR_LOCAL_PTR_NULL, 43 NETMANAGER_ERR_PERMISSION_ERR, 44 NETMANAGER_ERR_DESCRIPTOR_MISMATCH, 45 NETMANAGER_ERR_WRITE_DESCRIPTOR_TOKEN_FAIL, 46 NETMANAGER_ERR_WRITE_DATA_FAIL, 47 NETMANAGER_ERR_WRITE_REPLY_FAIL, 48 NETMANAGER_ERR_READ_DATA_FAIL, 49 NETMANAGER_ERR_READ_REPLY_FAIL, 50 NETMANAGER_ERR_IPC_CONNECT_STUB_FAIL, 51 NETMANAGER_ERR_ADD_DEATH_RECIPIENT_FAIL, 52 NETMANAGER_ERR_REGISTER_CALLBACK_FAIL, 53 NETMANAGER_ERR_UNINIT, 54 }; 55 56 // Error code for netmanager dns resolver 57 constexpr ErrCode DNS_ERR_OFFSET = ErrCodeOffset(SUBSYS_COMMUNICATION, NETMANAGER_DNS_RESOLVER_MANAGER); 58 // Error code for netmanager conn manager 59 constexpr ErrCode CONN_MANAGER_ERR_OFFSET = ErrCodeOffset(SUBSYS_COMMUNICATION, NETMANAGER_NET_CONN_MANAGER); 60 // Error code for netmanager policy manager 61 constexpr ErrCode POLICY_MANAGER_ERR_OFFSET = ErrCodeOffset(SUBSYS_COMMUNICATION, NETMANAGER_NET_POLICY_MANAGER); 62 } // namespace NetManagerStandard 63 } // namespace OHOS 64 #endif // NETMANAGER_CONSTANTS_H