1 /*
2  * Copyright (C) 2015-2018 Alibaba Group Holding Limited
3  */
4 
5 #ifndef __COAP_SERVER_H__
6 #define __COAP_SERVER_H__
7 
8 #include "CoAPExport.h"
9 
10 #ifdef __cplusplus
11 extern "C" {
12 #endif /* __cplusplus */
13 #define COAP_SERV_MULTITHREAD
14 
15 CoAPContext *CoAPServer_init();
16 
17 void CoAPServer_add_timer(void (*on_timer)(void *));
18 void CoAPServer_loop(CoAPContext *context);
19 
20 void CoAPServer_deinit(CoAPContext *context);
21 
22 int CoAPServer_register(CoAPContext *context, const char *uri,
23                         CoAPRecvMsgHandler callback);
24 
25 int CoAPServerMultiCast_send(CoAPContext *context, NetworkAddr *remote,
26                              const char *uri, unsigned char *buff,
27                              unsigned short len, CoAPSendMsgHandler callback,
28                              unsigned short *msgid);
29 
30 int CoAPServerResp_send(CoAPContext *context, NetworkAddr *remote,
31                         unsigned char *buff, unsigned short len, void *req,
32                         const char *paths, CoAPSendMsgHandler callback,
33                         unsigned short *msgid, char qos);
34 
35 void CoAPServer_thread_leave();
36 #ifdef __cplusplus
37 }
38 #endif /* __cplusplus */
39 
40 #endif
41