X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;f=resource%2Fcsdk%2Fconnectivity%2Fapi%2Fcacommon.h;h=f2369680085837d657a9e280618b5d07e5c02fff;hb=d386e3797794d970b5e96c25fc00780c80b2a6fe;hp=e42f75a6d5cb2fe3c2a7a2941f86b88f6e8d98aa;hpb=eabd9d6003a85cf6834ce70d78ca8c80a70445a2;p=platform%2Fupstream%2Fiotivity.git diff --git a/resource/csdk/connectivity/api/cacommon.h b/resource/csdk/connectivity/api/cacommon.h index e42f75a..f236968 100644 --- a/resource/csdk/connectivity/api/cacommon.h +++ b/resource/csdk/connectivity/api/cacommon.h @@ -26,6 +26,11 @@ #ifndef CA_COMMON_H_ #define CA_COMMON_H_ +#include "iotivity_config.h" +#ifdef WITH_PROCESS_EVENT +#include "ocevent.h" +#endif + #ifndef WITH_ARDUINO #ifdef TCP_ADAPTER #define HAVE_SYS_POLL_H @@ -36,9 +41,13 @@ #include #include +#ifdef __TIZENRT__ +#include +#else #ifdef HAVE_SYS_POLL_H #include #endif +#endif #ifdef HAVE_WINSOCK2_H #include @@ -51,6 +60,15 @@ extern "C" #endif /** + * TAG of Analyzer log. + */ +#define ANALYZER_TAG "OIC_CA_ANALYZER_102301" +#define BLE_CLIENT_TAG "OIC_CA_LE_CLIENT_1023" +#define BLE_SERVER_MCD_TAG "OIC_CA_LE_SER_MC_1023" +#define IP_SERVER_TAG "OIC_CA_IP_SERVER_1023" +#define TCP_SERVER_TAG "OIC_CA_TCP_SERVER_1023" + +/** * IP address Length. */ #define CA_IPADDR_SIZE 16 @@ -68,7 +86,11 @@ extern "C" /** * Max header options data length. */ +#if defined(ARDUINO) || defined(__TIZENRT__) #define CA_MAX_HEADER_OPTION_DATA_LENGTH 20 +#else +#define CA_MAX_HEADER_OPTION_DATA_LENGTH 1024 +#endif /** * Max token length. @@ -76,6 +98,11 @@ extern "C" #define CA_MAX_TOKEN_LEN (8) /** +* Max interface name length. +*/ +#define CA_MAX_INTERFACE_NAME_LEN (16) + +/** * Max URI length. */ #ifdef ARDUINO @@ -100,7 +127,12 @@ extern "C" /** *Maximum length of the remoteEndpoint identity. */ -#define CA_MAX_ENDPOINT_IDENTITY_LEN (32) +#define CA_MAX_ENDPOINT_IDENTITY_LEN CA_MAX_IDENTITY_SIZE + +/** + * Max identity size. + */ +#define CA_MAX_IDENTITY_SIZE (37) /** * option types - the highest option number 63. @@ -204,6 +236,17 @@ typedef enum CA_SCOPE_GLOBAL = 0xE, // IPv6 Global scope } CATransportFlags_t; +typedef enum +{ + CA_DEFAULT_BT_FLAGS = 0, + // flags for BLE transport + CA_LE_ADV_DISABLE = 0x1, // disable BLE advertisement. + CA_LE_ADV_ENABLE = 0x2, // enable BLE advertisement. + CA_LE_SERVER_DISABLE = (1 << 4), // disable gatt server. + // flags for EDR transport + CA_EDR_SERVER_DISABLE = (1 << 7) // disable rfcomm server. +} CATransportBTFlags_t; + #define CA_IPFAMILY_MASK (CA_IPV6|CA_IPV4) #define CA_SCOPE_MASK 0xf // mask scope bits above @@ -274,6 +317,7 @@ typedef struct uint16_t port; // for IP char addr[MAX_ADDR_STR_SIZE_CA]; // address for all uint32_t ifindex; // usually zero for default interface + char remoteId[CA_MAX_IDENTITY_SIZE]; // device ID of remote device #if defined (ROUTING_GATEWAY) || defined (ROUTING_EP) char routeData[MAX_ADDR_STR_SIZE_CA]; /**< GatewayId:ClientId of destination. **/ @@ -286,7 +330,9 @@ typedef struct typedef struct { CAEndpoint_t endpoint; /**< endpoint */ - CARemoteId_t identity; /**< endpoint identity */ + // TODO change name to deviceId + CARemoteId_t identity; /**< endpoint device uuid */ + CARemoteId_t userId; /**< endpoint user uuid */ } CASecureEndpoint_t; /** @@ -336,8 +382,13 @@ typedef enum CA_NOT_ACCEPTABLE = 406, /**< Not Acceptable */ CA_REQUEST_ENTITY_INCOMPLETE = 408, /**< Request Entity Incomplete */ CA_REQUEST_ENTITY_TOO_LARGE = 413, /**< Request Entity Too Large */ + CA_TOO_MANY_REQUESTS = 429, /**< Too Many Requests */ CA_INTERNAL_SERVER_ERROR = 500, /**< Internal Server Error */ - CA_RETRANSMIT_TIMEOUT = 504 /**< Retransmit timeout */ + CA_NOT_IMPLEMENTED = 501, /**< Not Implenented */ + CA_BAD_GATEWAY = 502, /**< Bad Gateway */ + CA_SERVICE_UNAVAILABLE = 503, /**< Server Unavailable */ + CA_RETRANSMIT_TIMEOUT = 504, /**< Retransmit timeout */ + CA_PROXY_NOT_SUPPORTED = 505 /**< Proxy not enabled to service a request */ /* Response status code - END HERE */ } CAResponseResult_t; @@ -351,9 +402,19 @@ typedef enum CA_REQUEST_DATA = 1, CA_RESPONSE_DATA, CA_ERROR_DATA, - CA_RESPONSE_FOR_RES + CA_RESPONSE_FOR_RES, + CA_NETWORK_COMMAND, + CA_REQUEST_DATA_SERVER_INIT, + CA_RESPONSE_DATA_CLIENT_INIT } CADataType_t; +typedef enum +{ + CA_DISCONNECTED = 0, + CA_CONNECTED, + CA_REQ_DISCONNECT +} CAConnectEvent_t; + /** * Transport Protocol IDs for additional options. */ @@ -429,6 +490,7 @@ typedef struct CAURI_t resourceUri; /**< Resource URI information **/ CARemoteId_t identity; /**< endpoint identity */ CADataType_t dataType; /**< data type */ + CAConnectEvent_t event; /**< network request message / event type */ } CAInfo_t; /** @@ -485,6 +547,7 @@ typedef struct uint16_t messageId; char token[CA_MAX_TOKEN_LEN]; uint8_t tokenLength; + uint32_t ifindex; } CAHistoryItem_t; typedef struct @@ -518,7 +581,9 @@ typedef struct struct tcpports { uint16_t u4; /**< unicast IPv4 socket port */ + uint16_t u4s; /**< unicast IPv6 socket secure port */ uint16_t u6; /**< unicast IPv6 socket port */ + uint16_t u6s; /**< unicast IPv6 socket secure port */ } tcp; #endif } CAPorts_t; @@ -547,10 +612,11 @@ typedef struct #if defined(_WIN32) WSAEVENT shutdownEvent; /**< Event used to signal threads to stop */ #else +#ifndef __TIZENRT__ int shutdownFds[2]; /**< fds used to signal threads to stop */ #endif +#endif int selectTimeout; /**< in seconds */ - int maxfd; /**< highest fd (for select) */ bool started; /**< the IP adapter has started */ bool terminate; /**< the IP adapter needs to stop */ bool ipv6enabled; /**< IPv6 enabled by OCInit flags */ @@ -581,23 +647,34 @@ typedef struct { void *threadpool; /**< threadpool between Initialize and Start */ CASocket_t ipv4; /**< IPv4 accept socket */ + CASocket_t ipv4s; /**< IPv4 accept socket secure */ CASocket_t ipv6; /**< IPv6 accept socket */ + CASocket_t ipv6s; /**< IPv6 accept socket secure */ void *svrlist; /**< unicast IPv4 TCP server information*/ int selectTimeout; /**< in seconds */ int listenBacklog; /**< backlog counts*/ +#ifndef __TIZENRT__ int shutdownFds[2]; /**< shutdown pipe */ +#endif int connectionFds[2]; /**< connection pipe */ - int maxfd; /**< highest fd (for select) */ bool started; /**< the TCP adapter has started */ bool terminate; /**< the TCP adapter needs to stop */ + bool bindenabled; /**< binding of TCP socket enabled */ bool ipv4tcpenabled; /**< IPv4 TCP enabled by OCInit flags */ bool ipv6tcpenabled; /**< IPv6 TCP enabled by OCInit flags */ } tcp; #endif + CATransportBTFlags_t bleFlags; } CAGlobals_t; extern CAGlobals_t caglobals; +typedef enum +{ + CA_LOG_LEVEL_ALL = 1, // all logs. + CA_LOG_LEVEL_INFO, // debug level is disabled +} CAUtilLogLevel_t; + /** * Callback function type for request delivery. * @param[out] object Endpoint object from which the request is received. @@ -630,6 +707,14 @@ typedef void (*CAErrorCallback)(const CAEndpoint_t *object, */ typedef void (*CANetworkMonitorCallback)(const CAEndpoint_t *info, CANetworkStatus_t status); +/** + * Callback function type for editing bluetooth advertisement data before starting bluetooth advertisement. + * param[in] max_data_size Maximal size of advertisement data array + * param[out] data Advertisement data array + * param[out] data_size Actual Data size of advertisement data array + */ +typedef void (*CAAdvertisementDataGetterCB)(int max_data_size, char *data, int *data_size); + #ifdef __cplusplus } /* extern "C" */ #endif