Corrected @file tags and restored 'Files' section.
[platform/upstream/iotivity.git] / resource / csdk / connectivity / inc / camessagehandler.h
1 /* ****************************************************************
2  *
3  * Copyright 2014 Samsung Electronics All Rights Reserved.
4  *
5  *
6  *
7  * Licensed under the Apache License, Version 2.0 (the "License");
8  * you may not use this file except in compliance with the License.
9  * You may obtain a copy of the License at
10  *
11  *      http://www.apache.org/licenses/LICENSE-2.0
12  *
13  * Unless required by applicable law or agreed to in writing, software
14  * distributed under the License is distributed on an "AS IS" BASIS,
15  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16  * See the License for the specific language governing permissions and
17  * limitations under the License.
18  *
19  ******************************************************************/
20
21 /**
22  * @file
23  *
24  * @brief This file contains message functionality.
25  */
26
27 #ifndef __CA_MESSAGE_HANDLER_H_
28 #define __CA_MESSAGE_HANDLER_H_
29
30 #include <stdint.h>
31 #include "cacommon.h"
32
33 #ifdef __cplusplus
34 extern "C"
35 {
36 #endif
37
38 /**
39  * @brief   Detaches control from the caller for sending unicast request
40  * @param   endpoint       [IN]    endpoint information where the data has to be sent
41  * @param   request        [IN]    request that needs to be sent
42  * @return  CA_STATUS_OK or ERROR CODES ( CAResult_t error codes in cacommon.h)
43  */
44 CAResult_t CADetachRequestMessage(const CARemoteEndpoint_t *endpoint,
45                                   const CARequestInfo_t *request);
46
47 /**
48  * @brief   Detaches control from the caller for sending multicast request
49  * @param   endpoint       [IN]    endpoint information where the data has to be sent
50  * @param   request        [IN]    request that needs to be sent
51  * @return  CA_STATUS_OK or ERROR CODES ( CAResult_t error codes in cacommon.h)
52  */
53 CAResult_t CADetachRequestToAllMessage(const CAGroupEndpoint_t *object,
54                                        const CARequestInfo_t *request);
55
56 /**
57  * @brief   Detaches control from the caller for sending response
58  * @param   endpoint       [IN]    endpoint information where the data has to be sent
59  * @param   response       [IN]    request that needs to be sent
60  * @return  CA_STATUS_OK or ERROR CODES ( CAResult_t error codes in cacommon.h)
61  */
62 CAResult_t CADetachResponseMessage(const CARemoteEndpoint_t *endpoint,
63                                    const CAResponseInfo_t *response);
64
65 /**
66  * @brief   Detaches control from the caller for sending request
67  * @param   resourceUri    [IN]   resource uri that needs to  be sent in the request
68  * @param   token          [IN]    token information of the request
69  * @param   options        [IN]    header options that need to be append in the request
70  * @param   numOptions     [IN]    number of options be appended
71  * @return  CA_STATUS_OK or ERROR CODES ( CAResult_t error codes in cacommon.h)
72  */
73 CAResult_t CADetachMessageResourceUri(const CAURI_t resourceUri, const CAToken_t token,
74                                       const CAHeaderOption_t *options, const uint8_t numOptions);
75
76 /**
77  * @brief   Setting the request and response callbacks for network packets
78  * @param   ReqHandler     [IN]    callback for receiving the requests
79  * @param   RespHandler    [IN]    callback for receiving the response
80  * @return  void
81  */
82 void CASetRequestResponseCallbacks(CARequestCallback ReqHandler,
83                                    CAResponseCallback RespHandler);
84
85 /**
86  * @brief  Initialize the message handler by starting thread pool and initializing the send and reive queue
87  * @return  CA_STATUS_OK or ERROR CODES ( CAResult_t error codes in cacommon.h)
88  */
89 CAResult_t CAInitializeMessageHandler();
90
91 /**
92  * @brief Terminate the message handler by stopping  the thread pool and destroying the queues
93  * @return  CA_STATUS_OK or ERROR CODES ( CAResult_t error codes in cacommon.h)
94  */
95 void CATerminateMessageHandler();
96
97 /**
98  * @brief Handler for receiving request and response callback in singled thread model
99  */
100 void CAHandleRequestResponseCallbacks();
101
102 #ifdef __cplusplus
103 } /* extern "C" */
104 #endif
105
106 #endif //#ifndef __CA_MESSAGE_HANDLER_H_
107