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_ROUTER_H 10 #define MESSAGE_ROUTER_H 11 #include "message_config.h" 12 #include "osal_mutex.h" 13 #include "sidecar.h" 14 #define DEFAULT_DISPATCHER_ID 0 15 16 #ifdef __cplusplus 17 extern "C" { 18 #endif 19 20 enum MessageNodeType { 21 MESSAGE_NODE_CONFIG_DEFAULT = 0, 22 #ifdef KERNEL_SERVER_SUPPORT 23 MESSAGE_NODE_REMOTE_KERNEL_SERVER = 2, 24 #endif 25 #ifdef USERSPACE_CLIENT_SUPPORT 26 MESSAGE_NODE_REMOTE_USERSPACE_CLIENT = 4 27 #endif 28 }; 29 30 ErrorCode StartMessageRouter(uint8_t nodesConfig); 31 32 ErrorCode ShutdownMessageRouter(void); 33 34 ErrorCode AddDispatcher(DispatcherConfig *config); 35 36 ErrorCode EnableDefaultDispatcher(void); 37 38 ErrorCode RegistLocalService(const DispatcherId dispatcherId, struct ServiceDef *mapper); 39 40 ErrorCode UnregistLocalService(const DispatcherId dispatcherId, ServiceId serviceId); 41 42 #ifdef __cplusplus 43 } 44 #endif 45 46 #endif 47