1 /*
2  * Copyright (C) 2021-2023 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 COAP_DISCOVER_H
17 #define COAP_DISCOVER_H
18 
19 #include "coap_def.h"
20 #include "nstackx_common.h"
21 
22 #ifdef __cplusplus
23 extern "C" {
24 #endif
25 
26 typedef enum {
27     COAP_BROADCAST_TYPE_DEFAULT = 0,
28     COAP_BROADCAST_TYPE_USER = 1,
29     COAP_BROADCAST_TYPE_USER_DEFINE_INTERVAL = 2
30 } CoapBroadcastType;
31 
32 int32_t CoapDiscoverInit(EpollDesc epollfd);
33 void SetCoapDiscoverType(CoapBroadcastType type);
34 void SetCoapUserDiscoverInfo(uint32_t advCount, uint32_t advDuration);
35 int32_t SetCoapDiscConfig(const DFinderDiscConfig *discConfig);
36 void HndPostServiceDiscover(const CoapPacket *pkt);
37 void CoapServiceDiscoverInner(uint8_t userRequest);
38 void CoapServiceDiscoverInnerAn(uint8_t userRequest);
39 void CoapServiceDiscoverInnerConfigurable(uint8_t userRequest);
40 void CoapServiceDiscoverStopInner(void);
41 uint8_t CoapDiscoverRequestOngoing(void);
42 void ResetCoapDiscoverTaskCount(uint8_t isBusy);
43 void SendDiscoveryRsp(const NSTACKX_ResponseSettings *responseSettings);
44 void CoapDiscoverDeinit(void);
45 
46 #ifdef __cplusplus
47 }
48 #endif
49 
50 #endif /* #ifndef COAP_DISCOVER_H */
51