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 NSTACK_COMMON_H 17 #define NSTACK_COMMON_H 18 #include "nstackx.h" 19 #include "nstackx_list.h" 20 #include "nstackx_epoll.h" 21 #ifdef __cplusplus 22 extern "C" { 23 #endif 24 25 #ifdef DFINDER_SAVE_DEVICE_LIST 26 typedef struct { 27 NSTACKX_DeviceInfo *deviceList; 28 uint32_t *deviceCountPtr; 29 sem_t wait; 30 } GetDeviceListMessage; 31 #endif 32 33 struct DeviceInfo; 34 35 void NotifyDeviceListChanged(const NSTACKX_DeviceInfo *deviceList, uint32_t deviceCount); 36 void NotifyDeviceFound(const NSTACKX_DeviceInfo *deviceList, uint32_t deviceCount); 37 #ifndef DFINDER_USE_MINI_NSTACKX 38 void NotifyMsgReceived(const char *moduleName, const char *deviceId, const uint8_t *data, uint32_t len); 39 #endif /* END OF DFINDER_USE_MINI_NSTACKX */ 40 void NotifyDFinderMsgRecver(DFinderMsgType msgType); 41 EpollDesc GetMainLoopEpollFd(void); 42 List *GetMainLoopEvendChain(void); 43 uint32_t GetDefaultDiscoverInterval(uint32_t discoverCount); 44 int32_t CheckBusinessTypeReplyUnicast(uint8_t businessType); 45 int32_t GetServiceDiscoverInfo(const uint8_t *buf, size_t size, struct DeviceInfo *deviceInfo, char **remoteUrlPtr); 46 List *GetEventNodeChain(void); 47 EpollDesc GetEpollFD(void); 48 49 #ifdef __cplusplus 50 }; 51 #endif 52 53 #endif /* #ifndef NSTACK_COMMON_H */ 54