/* * Copyright (c) 2021 Huawei Device Co., Ltd. * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /** * @addtogroup SoftBus * @{ * * @brief Provides high-speed, secure communication between devices. * * This module implements unified distributed communication capability management between nearby devices, and provides * link-independent device discovery and transmission interfaces to support service publishing and data transmission. * * @since 1.0 * @version 1.0 */ /** @} */ /** * @file softbus_error_code.h * * @brief Declares error code * * @since 1.0 * @version 1.0 */ #ifndef SOFTBUS_ERROR_CODE_H #define SOFTBUS_ERROR_CODE_H #ifdef __cplusplus #if __cplusplus extern "C" { #endif #endif enum SoftBusModule { SOFTBUS_MOD_COMMON = 0, SOFTBUS_MOD_PLUGIN, SOFTBUS_MOD_TRANS, SOFTBUS_MOD_AUTH, SOFTBUS_MOD_LNN, SOFTBUS_MOD_CONNECT, SOFTBUS_MOD_DISCOVERY, SOFTBUS_MOD_PUBLIC, }; #define SOFTBUS_ERRNO(module) ((0xF << 28) | ((1 << (module)) << 16)) enum SoftBusErrNo { /* errno begin: 0xF0010000 */ SOFTBUS_COMMOM_ERR_BASE = SOFTBUS_ERRNO(SOFTBUS_MOD_COMMON), SOFTBUS_TIMOUT, SOFTBUS_INVALID_PARAM, SOFTBUS_MEM_ERR, SOFTBUS_NOT_IMPLEMENT, SOFTBUS_NO_URI_QUERY_KEY, SOFTBUS_NO_INIT, SOFTBUS_PARSE_JSON_ERR, SOFTBUS_PERMISSION_DENIED, SOFTBUS_ACCESS_TOKEN_DENIED, SOFTBUS_MALLOC_ERR, SOFTBUS_ENCRYPT_ERR, SOFTBUS_DECRYPT_ERR, SOFTBUS_INVALID_SESS_OPCODE, SOFTBUS_INVALID_NUM, SOFTBUS_SERVER_NAME_REPEATED, SOFTBUS_TCP_SOCKET_ERR, SOFTBUS_LOCK_ERR, SOFTBUS_GET_REMOTE_UUID_ERR, SOFTBUS_NO_ENOUGH_DATA, SOFTBUS_INVALID_DATA_HEAD, SOFTBUS_INVALID_FD, SOFTBUS_FILE_ERR, SOFTBUS_DATA_NOT_ENOUGH, SOFTBUS_SLICE_ERROR, SOFTBUS_ALREADY_EXISTED, SOFTBUS_GET_CONFIG_VAL_ERR, SOFTBUS_PEER_PROC_ERR, SOFTBUS_NOT_FIND, SOFTBUS_ALREADY_TRIGGERED, SOFTBUS_FILE_BUSY, SOFTBUS_IPC_ERR, SOFTBUS_INVALID_PKGNAME, SOFTBUS_FUNC_NOT_SUPPORT, SOFTBUS_SERVER_NOT_INIT, /* errno begin: 0xF0020000 */ SOFTBUS_PLUGIN_ERR_BASE = SOFTBUS_ERRNO(SOFTBUS_MOD_PLUGIN), /* errno begin: 0xF0040000 */ SOFTBUS_TRANS_ERR_BASE = SOFTBUS_ERRNO(SOFTBUS_MOD_TRANS), SOFTBUS_TRANS_INVALID_SESSION_ID, SOFTBUS_TRANS_INVALID_SESSION_NAME, SOFTBUS_TRANS_INVALID_CHANNEL_TYPE, SOFTBUS_TRANS_INVALID_CLOSE_CHANNEL_ID, SOFTBUS_TRANS_BUSINESS_TYPE_NOT_MATCH, SOFTBUS_TRANS_SESSION_REPEATED, SOFTBUS_TRANS_SESSION_CNT_EXCEEDS_LIMIT, SOFTBUS_TRANS_SESSIONSERVER_NOT_CREATED, SOFTBUS_TRANS_SESSION_OPENING, SOFTBUS_TRANS_GET_LANE_INFO_ERR, SOFTBUS_TRANS_CREATE_CHANNEL_ERR, SOFTBUS_TRANS_INVALID_DATA_LENGTH, SOFTBUS_TRANS_FUNC_NOT_SUPPORT, SOFTBUS_TRANS_OPEN_AUTH_CHANNANEL_FAILED, SOFTBUS_TRANS_GET_P2P_INFO_FAILED, SOFTBUS_TRANS_OPEN_AUTH_CONN_FAILED, SOFTBUS_TRANS_PROXY_PACKMSG_ERR, SOFTBUS_TRANS_PROXY_SENDMSG_ERR, SOFTBUS_TRANS_PROXY_SEND_CHANNELID_INVALID, SOFTBUS_TRANS_PROXY_CHANNLE_STATUS_INVALID, SOFTBUS_TRANS_PROXY_DEL_CHANNELID_INVALID, SOFTBUS_TRANS_PROXY_SESS_ENCRYPT_ERR, SOFTBUS_TRANS_PROXY_INVALID_SLICE_HEAD, SOFTBUS_TRANS_PROXY_ASSEMBLE_PACK_NO_INVALID, SOFTBUS_TRANS_PROXY_ASSEMBLE_PACK_EXCEED_LENGTH, SOFTBUS_TRANS_PROXY_ASSEMBLE_PACK_DATA_NULL, SOFTBUS_TRANS_UDP_CLOSE_CHANNELID_INVALID, SOFTBUS_TRANS_UDP_SERVER_ADD_CHANNEL_FAILED, SOFTBUS_TRANS_UDP_CLIENT_ADD_CHANNEL_FAILED, SOFTBUS_TRANS_UDP_SERVER_NOTIFY_APP_OPEN_FAILED, SOFTBUS_TRANS_UDP_CLIENT_NOTIFY_APP_OPEN_FAILED, SOFTBUS_TRANS_UDP_START_STREAM_SERVER_FAILED, SOFTBUS_TRANS_UDP_START_STREAM_CLIENT_FAILED, SOFTBUS_TRANS_UDP_SEND_STREAM_FAILED, SOFTBUS_TRANS_UDP_GET_CHANNEL_FAILED, SOFTBUS_TRANS_UDP_CHANNEL_DISABLE, SOFTBUS_TRANS_QOS_REPORT_FAILED, SOFTBUS_TRANS_QOS_REPORT_TOO_FREQUENT, SOFTBUS_TRANS_SESSION_SERVER_NOINIT, SOFTBUS_TRANS_SESSION_INFO_NOT_FOUND, SOFTBUS_TRANS_SESSION_CREATE_FAILED, SOFTBUS_TRANS_SESSION_ADDPKG_FAILED, SOFTBUS_TRANS_SESSION_SET_CHANNEL_FAILED, SOFTBUS_TRANS_SESSION_NO_ENABLE, SOFTBUS_TRANS_SESSION_GROUP_INVALID, SOFTBUS_TRANS_SESSION_NAME_NO_EXIST, SOFTBUS_TRANS_SESSION_GET_CHANNEL_FAILED, SOFTBUS_TRANS_PROXY_REMOTE_NULL, SOFTBUS_TRANS_PROXY_WRITETOKEN_FAILED, SOFTBUS_TRANS_PROXY_WRITECSTRING_FAILED, SOFTBUS_TRANS_PROXY_WRITERAWDATA_FAILED, SOFTBUS_TRANS_PROXY_READRAWDATA_FAILED, SOFTBUS_TRANS_PROXY_SEND_REQUEST_FAILED, SOFTBUS_TRANS_PROXY_INVOKE_FAILED, SOFTBUS_TRANS_PROXY_CHANNEL_NOT_FOUND, SOFTBUS_TRANS_SEND_LEN_BEYOND_LIMIT, SOFTBUS_TRANS_FILE_LISTENER_NOT_INIT, SOFTBUS_TRANS_STREAM_ONLY_UDP_CHANNEL, SOFTBUS_TRANS_CHANNEL_TYPE_INVALID, SOFTBUS_TRANS_TDC_CHANNEL_NOT_FOUND, SOFTBUS_TRANS_TDC_CHANNEL_ALREADY_PENDING, SOFTBUS_TRANS_TDC_PENDINGLIST_NOT_FOUND, SOFTBUS_TRANS_AUTH_CHANNEL_NOT_FOUND, SOFTBUS_TRANS_NET_STATE_CHANGED, SOFTBUS_TRANS_HANDSHAKE_TIMEOUT, SOFTBUS_TRANS_HANDSHAKE_ERROR, SOFTBUS_TRANS_PEER_SESSION_NOT_CREATED, SOFTBUS_TRANS_PROXY_DISCONNECTED, SOFTBUS_TRANS_AUTH_NOTALLOW_OPENED, SOFTBUS_TRANS_PROXY_ERROR_APP_TYPE, /* errno begin: 0xF0080000 */ SOFTBUS_AUTH_ERR_BASE = SOFTBUS_ERRNO(SOFTBUS_MOD_AUTH), SOFTBUS_AUTH_INIT_FAIL, SOFTBUS_AUTH_CONN_FAIL, SOFTBUS_AUTH_CONN_TIMEOUT, SOFTBUS_AUTH_DEVICE_DISCONNECTED, SOFTBUS_AUTH_SYNC_DEVID_FAIL, SOFTBUS_AUTH_UNPACK_DEVID_FAIL, SOFTBUS_AUTH_HICHAIN_AUTH_FAIL, SOFTBUS_AUTH_HICHAIN_PROCESS_FAIL, SOFTBUS_AUTH_HICHAIN_TRANSMIT_FAIL, SOFTBUS_AUTH_HICHAIN_AUTH_ERROR, SOFTBUS_AUTH_HICHAIN_NOT_TRUSTED, SOFTBUS_AUTH_SYNC_DEVINFO_FAIL, SOFTBUS_AUTH_UNPACK_DEVINFO_FAIL, SOFTBUS_AUTH_SEND_FAIL, SOFTBUS_AUTH_TIMEOUT, SOFTBUS_AUTH_NOT_FOUND, SOFTBUS_AUTH_INNER_ERR, /* errno begin: 0xF0100000 */ SOFTBUS_NETWORK_ERR_BASE = SOFTBUS_ERRNO(SOFTBUS_MOD_LNN), SOFTBUS_NETWORK_CONN_FSM_DEAD, SOFTBUS_NETWORK_JOIN_CANCELED, SOFTBUS_NETWORK_JOIN_LEAVING, SOFTBUS_NETWORK_JOIN_TIMEOUT, SOFTBUS_NETWORK_UNPACK_DEV_INFO_FAILED, SOFTBUS_NETWORK_DEV_NOT_TRUST, SOFTBUS_NETWORK_LEAVE_OFFLINE, SOFTBUS_NETWORK_AUTH_DISCONNECT, SOFTBUS_NETWORK_TIME_SYNC_HANDSHAKE_ERR, // time sync channel pipe broken SOFTBUS_NETWORK_TIME_SYNC_HANDSHAKE_TIMEOUT, // timeout during handshake SOFTBUS_NETWORK_TIME_SYNC_TIMEOUT, // timeout during sync SOFTBUS_NETWORK_TIME_SYNC_INTERFERENCE, // interference SOFTBUS_NETWORK_HEARTBEAT_REPEATED, SOFTBUS_NETWORK_HEARTBEAT_UNTRUSTED, SOFTBUS_NETWORK_HEARTBEAT_EMPTY_LIST, SOFTBUS_NETWORK_NODE_OFFLINE, SOFTBUS_NETWORK_NOT_INIT, SOFTBUS_NETWORK_LOOPER_ERR, SOFTBUS_NETWORK_AUTH_TCP_ERR, SOFTBUS_NETWORK_AUTH_BLE_ERR, SOFTBUS_NETWORK_AUTH_BR_ERR, SOFTBUS_NETWORK_GET_ALL_NODE_INFO_ERR, SOFTBUS_NETWORK_GET_LOCAL_NODE_INFO_ERR, SOFTBUS_NETWORK_NODE_KEY_INFO_ERR, SOFTBUS_NETWORK_ACTIVE_META_NODE_ERR, SOFTBUS_NETWORK_DEACTIVE_META_NODE_ERR, SOFTBUS_NETWORK_GET_META_NODE_INFO_ERR, /* errno begin: 0xF0200000 */ SOFTBUS_CONN_ERR_BASE = SOFTBUS_ERRNO(SOFTBUS_MOD_CONNECT), SOFTBUS_CONN_FAIL, SOFTBUS_CONN_MANAGER_TYPE_NOT_SUPPORT, SOFTBUS_CONN_MANAGER_OP_NOT_SUPPORT, SOFTBUS_CONN_MANAGER_PKT_LEN_INVALID, SOFTBUS_CONN_MANAGER_LIST_NOT_INIT, SOFTBUS_CONN_INVALID_CONN_TYPE, SOFTBUS_CONNECTION_BASE, SOFTBUS_CONNECTION_ERR_CLOSED, SOFTBUS_CONNECTION_ERR_DRIVER_CONGEST, SOFTBUS_CONNECTION_ERR_SOFTBUS_CONGEST, SOFTBUS_CONNECTION_ERR_CONNID_INVALID, SOFTBUS_CONNECTION_ERR_SENDQUEUE_FULL, SOFTBUS_BRCONNECTION_POSTBYTES_ERROR, SOFTBUS_BRCONNECTION_GETCONNINFO_ERROR, SOFTBUS_BRCONNECTION_STRNCPY_ERROR, SOFTBUS_BRCONNECTION_PACKJSON_ERROR, SOFTBUS_BRCONNECTION_CONNECTDEVICE_MALLOCFAIL, SOFTBUS_BRCONNECTION_CONNECTDEVICE_GETSOCKETIDFAIL, SOFTBUS_BRCONNECTION_DISCONNECT_NOTFIND, SOFTBUS_TCPCONNECTION_SOCKET_ERR, SOFTBUS_BLECONNECTION_REG_GATTS_CALLBACK_FAIL, SOFTBUS_BLECONNECTION_ADD_SERVICE_FAIL, SOFTBUS_BLECONNECTION_ADD_CHAR_FAIL, SOFTBUS_BLECONNECTION_ADD_DES_FAIL, SOFTBUS_BLECONNECTION_NOT_INIT, SOFTBUS_BLECONNECTION_NOT_START, SOFTBUS_BLECONNECTION_GETCONNINFO_ERROR, SOFTBUS_BLECONNECTION_MTU_OVERFLOW_ERROR, SOFTBUS_BLECONNECTION_MUTEX_LOCK_ERROR, SOFTBUS_BLECONNECTION_GATT_CLIENT_NOT_SUPPORT, SOFTBUS_GATTC_INTERFACE_FAILED, SOFTBUS_BLEGATTC_NONT_INIT, SOFTBUS_BLEGATTC_NOT_READY, SOFTBUS_GATTC_DUPLICATE_PARAM, SOFTBUS_GATTC_NONE_PARAM, SOFTBUS_BLEGATTC_NODE_NOT_EXIST, SOFTBUS_BLECONNECTION_CLIENT_RECV_DISCONNECT_MSG, SOFTBUS_BLECONNECTION_CLIENT_CONNECTED_TIMEOUT, SOFTBUS_BLECONNECTION_CLIENT_SERVICE_SEARCHED_TIMEOUT, SOFTBUS_BLECONNECTION_CLIENT_NOTIFICATED_ONCE_TIMEOUT, SOFTBUS_BLECONNECTION_CLIENT_NOTIFICATED_TWICE_TIMEOUT, SOFTBUS_BLECONNECTION_CLIENT_MTU_SETTED_TIMEOUT, SOFTBUS_BLECONNECTION_CLIENT_HANDSHAKE_TIMEOUT, SOFTBUS_BLECONNECTION_CLIENT_UPDATA_STATE_ERR, SOFTBUS_BLECONNECTION_CLIENT_CREATE_DELAY_MSG_ERR, SOFTBUS_BLECONNECTION_CLIENT_SEARCH_SERVICES_ERR, SOFTBUS_BLECONNECTION_SERVER_DISCONNECT, /* errno begin: 0xF0400000 */ SOFTBUS_DISCOVER_ERR_BASE = SOFTBUS_ERRNO(SOFTBUS_MOD_DISCOVERY), SOFTBUS_DISCOVER_NOT_INIT, SOFTBUS_DISCOVER_INVALID_PKGNAME, SOFTBUS_DISCOVER_SERVER_NO_PERMISSION, SOFTBUS_DISCOVER_MANAGER_NOT_INIT, SOFTBUS_DISCOVER_MANAGER_ITEM_NOT_CREATE, SOFTBUS_DISCOVER_MANAGER_INFO_NOT_CREATE, SOFTBUS_DISCOVER_MANAGER_INFO_NOT_DELETE, SOFTBUS_DISCOVER_MANAGER_INNERFUNCTION_FAIL, SOFTBUS_DISCOVER_MANAGER_CAPABILITY_INVALID, SOFTBUS_DISCOVER_MANAGER_DUPLICATE_PARAM, SOFTBUS_DISCOVER_MANAGER_INVALID_PARAM, SOFTBUS_DISCOVER_MANAGER_INVALID_MEDIUM, SOFTBUS_DISCOVER_MANAGER_INVALID_PKGNAME, SOFTBUS_DISCOVER_MANAGER_INVALID_MODULE, SOFTBUS_DISCOVER_COAP_NOT_INIT, SOFTBUS_DISCOVER_COAP_INIT_FAIL, SOFTBUS_DISCOVER_COAP_MERGE_CAP_FAIL, SOFTBUS_DISCOVER_COAP_CANCEL_CAP_FAIL, SOFTBUS_DISCOVER_COAP_REGISTER_CAP_FAIL, SOFTBUS_DISCOVER_COAP_SET_FILTER_CAP_FAIL, SOFTBUS_DISCOVER_COAP_REGISTER_DEVICE_FAIL, SOFTBUS_DISCOVER_COAP_START_PUBLISH_FAIL, SOFTBUS_DISCOVER_COAP_STOP_PUBLISH_FAIL, SOFTBUS_DISCOVER_COAP_START_DISCOVER_FAIL, SOFTBUS_DISCOVER_COAP_STOP_DISCOVER_FAIL, /* errno begin: 0xF0800000 */ SOFTBUS_PUBLIC_ERR_BASE = (-13000), /* internal error */ SOFTBUS_ERR = (-1), /* softbus ok */ SOFTBUS_OK = 0, }; #ifdef __cplusplus #if __cplusplus } #endif /* __cplusplus */ #endif /* __cplusplus */ #endif /* SOFTBUS_ERRCODE_H */