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"
35 * @def VERIFY_NON_NULL
36 * @brief Macro to verify the validity of input argument
38 #define VERIFY_NON_NULL(arg, log_tag, log_message) \
40 OIC_LOG_V(ERROR, log_tag, "Invalid input:%s", log_message); \
41 return CA_STATUS_INVALID_PARAM; \
45 * @def VERIFY_NON_NULL_RET
46 * @brief Macro to verify the validity of input argument
48 #define VERIFY_NON_NULL_RET(arg, log_tag, log_message,ret) \
50 OIC_LOG_V(ERROR, log_tag, "Invalid input:%s", log_message); \
55 * @def VERIFY_NON_NULL_VOID
56 * @brief Macro to verify the validity of input argument
58 #define VERIFY_NON_NULL_VOID(arg, log_tag, log_message) \
60 OIC_LOG_V(ERROR, log_tag, "Invalid input:%s", log_message); \
65 * @fn CAAdapterCreateLocalEndpoint
66 * @brief Create CALocalConnectivity_t instance.
68 CALocalConnectivity_t *CAAdapterCreateLocalEndpoint(CAConnectivityType_t type, const char *address,
69 const char *interfaceName);
72 * @fn CAAdapterCopyLocalEndpoint
73 * @brief Create CALocalConnectivity_t duplicate instance.
75 CALocalConnectivity_t *CAAdapterCopyLocalEndpoint(CALocalConnectivity_t *connectivity);
78 * @fn CAAdapterFreeLocalEndpoint
79 * @brief Deallocate CALocalConnectivity_t instance.
81 void CAAdapterFreeLocalEndpoint(CALocalConnectivity_t *localEndPoint);
84 * @fn CAAdapterCreateRemoteEndpoint
85 * @brief Allocate CARemoteEndpoint_t instance.
87 CARemoteEndpoint_t *CAAdapterCreateRemoteEndpoint(CAConnectivityType_t type, const char *address,
88 const char *resourceUri);
91 * @fn CAAdapterCopyRemoteEndpoint
92 * @brief Create CARemoteEndpoint_t duplicate instance.
94 CARemoteEndpoint_t *CAAdapterCopyRemoteEndpoint(const CARemoteEndpoint_t *remoteEndpoint);
97 * @fn CAAdapterFreeRemoteEndpoint
98 * @brief Deallocate CARemoteEndpoint_t instance.
100 void CAAdapterFreeRemoteEndpoint(CARemoteEndpoint_t *remoteEndPoint);
102 #endif // _CA_ADAPTER_UTILS_H_