1 /******************************************************************
3 * Copyright 2014 Samsung Electronics All Rights Reserved.
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
11 * http://www.apache.org/licenses/LICENSE-2.0
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.
19 ******************************************************************/
22 * @file caadapterutils.h
23 * @brief This file contains common utility function for CA transport adaptors.
26 #ifndef _CA_ADAPTER_UTILS_H_
27 #define _CA_ADAPTER_UTILS_H_
31 #include "oic_malloc.h"
32 #include "oic_string.h"
40 * @def VERIFY_NON_NULL
41 * @brief Macro to verify the validity of input argument
43 #define VERIFY_NON_NULL(arg, log_tag, log_message) \
45 OIC_LOG_V(ERROR, log_tag, "Invalid input:%s", log_message); \
46 return CA_STATUS_INVALID_PARAM; \
50 * @def VERIFY_NON_NULL_RET
51 * @brief Macro to verify the validity of input argument
53 #define VERIFY_NON_NULL_RET(arg, log_tag, log_message,ret) \
55 OIC_LOG_V(ERROR, log_tag, "Invalid input:%s", log_message); \
60 * @def VERIFY_NON_NULL_VOID
61 * @brief Macro to verify the validity of input argument
63 #define VERIFY_NON_NULL_VOID(arg, log_tag, log_message) \
65 OIC_LOG_V(ERROR, log_tag, "Invalid input:%s", log_message); \
70 * @fn CAAdapterCreateLocalEndpoint
71 * @brief Create CALocalConnectivity_t instance.
73 CALocalConnectivity_t *CAAdapterCreateLocalEndpoint(CAConnectivityType_t type,
77 * @fn CAAdapterCopyLocalEndpoint
78 * @brief Create CALocalConnectivity_t duplicate instance.
80 CALocalConnectivity_t *CAAdapterCopyLocalEndpoint(CALocalConnectivity_t *connectivity);
83 * @fn CAAdapterFreeLocalEndpoint
84 * @brief Deallocate CALocalConnectivity_t instance.
86 void CAAdapterFreeLocalEndpoint(CALocalConnectivity_t *localEndPoint);
89 * @fn CAAdapterCreateRemoteEndpoint
90 * @brief Allocate CARemoteEndpoint_t instance.
92 CARemoteEndpoint_t *CAAdapterCreateRemoteEndpoint(CAConnectivityType_t type,
93 const char *address, const char *resourceUri);
96 * @fn CAAdapterCopyRemoteEndpoint
97 * @brief Create CARemoteEndpoint_t duplicate instance.
99 CARemoteEndpoint_t *CAAdapterCopyRemoteEndpoint(
100 const CARemoteEndpoint_t *remoteEndpoint);
103 * @fn CAAdapterFreeRemoteEndpoint
104 * @brief Deallocate CARemoteEndpoint_t instance.
106 void CAAdapterFreeRemoteEndpoint(CARemoteEndpoint_t *remoteEndPoint);
111 #endif // _CA_ADAPTER_UTILS_H_