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 ******************************************************************/
24 * This file contains the common data structures between Resource, CA and
28 #ifndef __CA_COMMON_H_
29 #define __CA_COMMON_H_
40 @brief IP Address Length
42 #define CA_IPADDR_SIZE 16
45 @brief Mac Address Length for BT
47 #define CA_MACADDR_SIZE 18
50 @brief Max Header Options data length
52 #define CA_MAX_HEADER_OPTION_DATA_LENGTH 16
57 typedef char* CAPayload_t;
62 typedef char* CAURI_t;
67 typedef char* CAToken_t;
78 @brief CAConnectivityType_t
82 CA_ETHERNET = (1 << 0), CA_WIFI = (1 << 1), CA_EDR = (1 << 2), CA_LE = (1 << 3)
83 } CAConnectivityType_t;
86 @brief CANetworkStatus_t
90 CA_INTERFACE_UP, CA_INTERFACE_DOWN
94 @brief Address of the local or remote endpoint
103 /** @brief Bluettoth Mac Address **/
104 char btMacAddress[CA_MACADDR_SIZE];
107 @brief IP Information
111 /** Ip address of the interface**/
112 char ipAddress[CA_IPADDR_SIZE];
113 /** port information**/
119 @brief CAQualityOfService
123 CA_LOW_QOS = 0, CA_MEDIUM_QOS, CA_HIGH_QOS, CA_NA_QOS // No Quality is defined, let the stack decide
124 } CAQualityOfService_t;
131 CA_GET = 1, CA_POST, CA_PUT, CA_DELETE
135 @brief RemoteEndpoint information for connectivities
139 /** Resource URI information **/
141 /** Remote Endpoint address **/
142 CAAddress_t addressInfo;
143 /** Connectivity of the endpoint**/
144 CAConnectivityType_t connectivityType;
145 } CARemoteEndpoint_t;
148 @brief Local Connectivity information
152 /** address of the interface **/
153 CAAddress_t addressInfo;
154 /** Connectivity type that localconnectivity avaialble **/
155 CAConnectivityType_t type;
156 } CALocalConnectivityt_t;
159 @brief Enums for CA return values
163 /* Success status code - START HERE */
165 CA_STATUS_INVALID_PARAM,
166 CA_DESTINATION_NOT_REACHABLE,
169 CA_MEMORY_ALLOC_FAILED,
171 CA_DESTINATION_DISCONNECTED,
174 /* Error status code - END HERE */
178 @brief Enums for CA Response values
182 /* Success status code - START HERE */
190 /* Error status code - END HERE */
191 } CAResponseResult_t;
194 @brief Transport Protocol IDs
198 CA_INVALID_ID = (1 << 0), CA_COAP_ID = (1 << 1)
199 } CATransportProtocolID_t;
202 * @brief Header options structure to be filled
204 * This structure is used to hold header information.
208 /** The protocol ID this option applies to**/
209 CATransportProtocolID_t protocolID;
210 /** The header option ID which will be added to communication packets**/
212 /** its length 191**/
213 uint16_t optionLength;
214 /** optional data values**/
215 uint8_t optionData[CA_MAX_HEADER_OPTION_DATA_LENGTH];
219 * @brief Request Information to be sent
221 * This structure is used to hold request information
225 * @brief Base Information received
227 * This structure is used to hold request & response base information
231 /**Qos for the request **/
232 CAQualityOfService_t qos;
235 /** Header Options for the request **/
236 CAHeaderOption_t * options;
237 /** Number of Header options**/
239 /** payload of the request **/
245 /** Name of the Method Allowed **/
247 /** Base Information **/
252 * @brief Response Information received
254 * This structure is used to hold response information
258 /**Response Result by Resource Model**/
259 CAResponseResult_t result;
260 /**Base Information **/
268 #endif //#ifndef __CA_COMMON_H_