Initial merge-commit of the OIC code. Should successfully do discovery for single...
[platform/upstream/iotivity.git] / csdk / occoap / include / occoap.h
1 //******************************************************************
2 ///
3 // Copyright 2014 Intel Corporation All Rights Reserved.
4 //-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
5
6 #ifndef OCCOAP_H_
7 #define OCCOAP_H_
8
9 //-----------------------------------------------------------------------------
10 // Includes
11 //-----------------------------------------------------------------------------
12 #include "ocstack.h"
13 #include "ocstackinternal.h"
14 #include <stdint.h>
15
16 //-----------------------------------------------------------------------------
17 // Typedefs
18 //-----------------------------------------------------------------------------
19
20
21 typedef enum {
22     OC_COAP_OK = 0,
23     OC_COAP_ERR
24 } OCCoAPResult;
25
26 //-----------------------------------------------------------------------------
27 // Function Prototypes
28 //-----------------------------------------------------------------------------
29
30 /**
31  * Initialize the CoAP client or server with the its IPv4 address and CoAP port
32  *
33  * @param ipAddr
34  *     IP Address of host device
35  * @param port
36  *     Port of host device
37  * @param mode
38  *     Host device is client, server, or client-server
39  *
40   * @return
41  *   0   - success
42  *   TBD - TBD error
43  */
44 int OCInitCoAP(const char *address, uint16_t port, OCMode mode);
45
46 /**
47  * Discover OC resources
48  *
49  * @param method          - method to perform on the resource
50  * @param Uri             - URI of the resource to interact with
51  * @param asyncReturnFunc - asynchronous callback function that is invoked
52  *                          by the stack when discovery or resource interaction is complete
53  * @return
54  *   0   - success
55  *   TBD - TBD error
56  */
57 int OCDoCoAPResource(OCMethod method, OCQualityOfService qos, OCToken * token, const char *Uri);
58
59
60 /**
61  * Stop the CoAP client or server processing
62  *
63  * @return 0 - success, else - TBD error
64  */
65 int OCStopCoAP();
66
67 /**
68  * Called in main loop of CoAP client or server.  Allows low-level CoAP processing of
69  * send, receive, timeout, discovery, callbacks, etc.
70  *
71  * @return 0 - success, else - TBD error
72  */
73 int OCProcessCoAP();
74
75
76 #endif /* OCCOAP_H_ */