Imported Upstream version 1.0.0
[platform/upstream/iotivity.git] / resource / csdk / connectivity / common / inc / caremotehandler.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  * This file contains common utility function for remote endpoints.
25  */
26
27 #ifndef CA_REMOTE_HANDLER_H_
28 #define CA_REMOTE_HANDLER_H_
29
30 #include "cacommon.h"
31
32 #ifdef __cplusplus
33 extern "C"
34 {
35 #endif
36
37 /**
38  * Creates a new remote endpoint from the input endpoint.
39  * @param[in]   endpoint           endpoint information where the data has to be sent.
40  * @return  remote endpoint created.
41  */
42 CAEndpoint_t *CACloneEndpoint(const CAEndpoint_t *endpoint);
43
44 /**
45  * Allocate CAEndpoint_t instance.
46  * @param[in]   flags          Transport flag.
47  * @param[in]   adapter        Adapter type.
48  * @param[in]   address        Address.
49  * @param[in]   port           Port.
50  * @return  ::CA_STATUS_OK or Appropriate error code.
51  */
52 CAEndpoint_t *CACreateEndpointObject(CATransportFlags_t flags, CATransportAdapter_t adapter,
53                                      const char *address, uint16_t port);
54 /**
55  * Destroy remote endpoint.
56  * @param[in]   endpoint           endpoint information where the data has to be sent.
57  */
58 void CAFreeEndpoint(CAEndpoint_t *rep);
59
60 /**
61  * duplicates the given info.
62  * @param[in]   info    info object to be duplicated.
63  * @param[out]  clone   info object to be modified.
64  * @return      ::CA_STATUS_OK or Appropriate error code if fail to clone.
65  */
66 CAResult_t CACloneInfo(const CAInfo_t *info, CAInfo_t *clone);
67
68 /**
69  * Creates a new request information.
70  * @param[in]   request           request information that needs to be duplicated.
71  * @return  duplicated request info object.
72  */
73 CARequestInfo_t *CACloneRequestInfo(const CARequestInfo_t *request);
74
75 /**
76  * Destroy the request information.
77  * @param[in]   request           request information that needs to be destroyed.
78  */
79 void CADestroyRequestInfoInternal(CARequestInfo_t *request);
80
81 /**
82  * Creates a new response information.
83  * @param[in]   response           response information that needs to be duplicated.
84  * @return  duplicated response info object.
85  */
86 CAResponseInfo_t *CACloneResponseInfo(const CAResponseInfo_t *response);
87
88 /**
89  * Destroy the response information.
90  * @param[in]   response           response information that needs to be destroyed.
91  */
92 void CADestroyResponseInfoInternal(CAResponseInfo_t *response);
93
94 /**
95  * Free the error information.
96  * @param[in]   errorInfo           error information to be freed.
97  */
98 void CADestroyErrorInfoInternal(CAErrorInfo_t *errorInfo);
99
100 #ifdef __cplusplus
101 } /* extern "C" */
102 #endif
103
104 #endif /* CA_REMOTE_HANDLER_H_ */
105