1 /* 2 * Copyright (c) 2020-2021 Huawei Device Co., Ltd. 3 * 4 * HDF is dual licensed: you can use it either under the terms of 5 * the GPL, or the BSD license, at your option. 6 * See the LICENSE file in the root of this repository for complete details. 7 */ 8 9 #ifndef MESSAGE_TYPES_H 10 #define MESSAGE_TYPES_H 11 #include "hdf_base.h" 12 13 typedef uint8_t NodeId; 14 #define LOCAL_NODE_INDEX 0 15 #define REMOTE_NODE_INDEX 1 16 #define NO_SUCH_NODE_INDEX 255 17 18 typedef uint8_t ServiceId; 19 20 typedef int32_t ErrorCode; 21 22 typedef uint8_t DispatcherId; 23 24 enum MessageEngineStatus { 25 ME_STATUS_STOPPED = 0, 26 ME_STATUS_STARTTING, 27 ME_STATUS_RUNNING, 28 ME_STATUS_STOPPING, 29 ME_STATUS_TODESTROY 30 }; 31 32 #define ME_SUCCESS 0 33 #define ME_ERROR_NULL_PTR (-1) 34 #define ME_ERROR_OPER_QUEUE_FAILED (-2) 35 #define ME_ERROR_OPER_SMSEMIPHORE_FAILED (-3) 36 #define ME_ERROR_CREATE_THREAD_FAILED (-4) 37 #define ME_ERROR_NOT_SUPPORTED (-5) 38 #define ME_ERROR_DELETE_THREAD_FAILED (-6) 39 #define ME_ERROR_OPER_MUTEX_FAILED (-7) 40 #define ME_ERROR_OPER_MEM_FAILED (-8) 41 42 #define ME_ERROR_WRONG_TYPE 1 43 #define ME_ERROR_MUTI_INIT_NOT_ALLOWED 2 44 #define ME_ERROR_INIT_QUEUE_FAILED 3 45 #define ME_ERROR_WRONG_STATUS 4 46 #define ME_ERROR_SERVICEID_CONFLICT 5 47 #define ME_ERROR_PARA_WRONG 6 48 49 #define ME_ERROR_NO_SUCH_SERVICE 8 50 #define ME_ERROR_NO_SUCH_COMMAND 9 51 #define ME_ERROR_RES_LAKE 10 52 #define ME_ERROR_DISPATCHER_NOT_RUNNING 11 53 #define ME_ERROR_NO_SUCH_DISPATCHER 12 54 #define ME_ERROR_DISPATCHERID_CONFLICT 13 55 #define ME_ERROR_DISPATCHERID_STOPPED 14 56 #define ME_ERROR_CONFIG_NOT_ALLOWED 15 57 #define ME_ERROR_COMMU_WITH_KERNEL_NODE_FAILED 16 58 #define ME_ERROR_MSG_BLOCK_TOO_LONG 17 59 #define ME_ERROR_MSG_BLOCK_MISMATCH 18 60 #define ME_ERROR_MSG_DISPATCH_FAILED 19 61 #define ME_ERROR_MSG_MISMATCH 20 62 #define ME_ERROR_COPY_MEM_FROM_USERSPACE_FAILED 21 63 #define ME_ERROR_NO_MESSAGE 22 64 #define ME_ERROR_COPY_MEM_TO_USERSPACE_FAILED 23 65 #define ME_ERROR_NO_MORE_BLOCK_VALUES 24 66 #define ME_ERROR_PARSE_DATABLOCK_FAILED 25 67 #define ME_ERROR_BAD_DISPATCHER 26 68 #define ME_ERROR_NO_SUCH_NODE 27 69 #define ME_ERROR_BAD_NODE 28 70 #define ME_ERROR_CREATE_REMOTE_SERVICE_FAILED 29 71 #define ME_ERROR_SERVICE_REQ_TIMEOUT 30 72 #define ME_ERROR_BAD_SERVICE 31 73 #define ME_ERROR_PROC_TIMEOUT 32 74 75 #define BYTE_WIDTH 8 76 77 #endif 78