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 ******************************************************************/
23 * @brief This file contains the common data structures between Resource , CA and adapters
25 #ifndef __CA_COMMON_H_
26 #define __CA_COMMON_H_
37 @brief IP Address Length
39 #define CA_IPADDR_SIZE 16
42 @brief Mac Address Length for BT
44 #define CA_MACADDR_SIZE 18
47 @brief Max Header Options data length
49 #define CA_MAX_HEADER_OPTION_DATA_LENGTH 16
54 typedef char* CAPayload_t;
59 typedef char* CAURI_t;
64 typedef char* CAToken_t;
75 @brief CAConnectivityType_t
79 CA_ETHERNET = (1 << 0), CA_WIFI = (1 << 1), CA_EDR = (1 << 2), CA_LE = (1 << 3)
80 } CAConnectivityType_t;
83 @brief CANetworkStatus_t
87 CA_INTERFACE_UP, CA_INTERFACE_DOWN
91 @brief Address of the local or remote endpoint
100 /** @brief Bluettoth Mac Address **/
101 char btMacAddress[CA_MACADDR_SIZE];
104 @brief IP Information
108 /** Ip address of the interface**/
109 char ipAddress[CA_IPADDR_SIZE];
110 /** port information**/
116 @brief CAQualityOfService
120 CA_LOW_QOS = 0, CA_MEDIUM_QOS, CA_HIGH_QOS, CA_NA_QOS // No Quality is defined, let the stack decide
121 } CAQualityOfService_t;
128 CA_GET = 1, CA_POST, CA_PUT, CA_DELETE
132 @brief RemoteEndpoint information for connectivities
136 /** Resource URI information **/
138 /** Remote Endpoint address **/
139 CAAddress_t addressInfo;
140 /** Connectivity of the endpoint**/
141 CAConnectivityType_t connectivityType;
142 } CARemoteEndpoint_t;
145 @brief Local Connectivity information
149 /** address of the interface **/
150 CAAddress_t addressInfo;
151 /** Connectivity type that localconnectivity avaialble **/
152 CAConnectivityType_t type;
153 } CALocalConnectivityt_t;
156 @brief Enums for CA return values
160 /* Success status code - START HERE */
162 CA_STATUS_INVALID_PARAM,
163 CA_DESTINATION_NOT_REACHABLE,
166 CA_MEMORY_ALLOC_FAILED,
168 CA_DESTINATION_DISCONNECTED,
171 /* Error status code - END HERE */
175 @brief Enums for CA Response values
179 /* Success status code - START HERE */
187 /* Error status code - END HERE */
188 } CAResponseResult_t;
191 @brief Transport Protocol IDs
195 CA_INVALID_ID = (1 << 0), CA_COAP_ID = (1 << 1)
196 } CATransportProtocolID_t;
199 * @brief Header options structure to be filled
201 * This structure is used to hold header information.
205 /** The protocol ID this option applies to**/
206 CATransportProtocolID_t protocolID;
207 /** The header option ID which will be added to communication packets**/
209 /** its length 191**/
210 uint16_t optionLength;
211 /** optional data values**/
212 uint8_t optionData[CA_MAX_HEADER_OPTION_DATA_LENGTH];
216 * @brief Request Information to be sent
218 * This structure is used to hold request information
222 * @brief Base Information received
224 * This structure is used to hold request & response base information
228 /**Qos for the request **/
229 CAQualityOfService_t qos;
232 /** Header Options for the request **/
233 CAHeaderOption_t * options;
234 /** Number of Header options**/
236 /** payload of the request **/
242 /** Name of the Method Allowed **/
244 /** Base Information **/
249 * @brief Response Information received
251 * This structure is used to hold response information
255 /**Response Result by Resource Model**/
256 CAResponseResult_t result;
257 /**Base Information **/
265 #endif //#ifndef __CA_COMMON_H_