X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;f=resource%2Fcsdk%2Fstack%2Finclude%2Foctypes.h;h=8187b884f7afb7525ae44554f96692648535102a;hb=03ae7cd73e2e10a8de75da40a0e476cc955b46b2;hp=073902ceebfada09b2c32ed1607e8cbdea45dac2;hpb=f0d8169c70ca507043ced46a95a4d1e8bc2c4804;p=platform%2Fupstream%2Fiotivity.git diff --git a/resource/csdk/stack/include/octypes.h b/resource/csdk/stack/include/octypes.h index 073902c..8187b88 100644 --- a/resource/csdk/stack/include/octypes.h +++ b/resource/csdk/stack/include/octypes.h @@ -39,14 +39,19 @@ extern "C" { #endif // __cplusplus -/** For the feature presence.*/ -#define WITH_PRESENCE - #include "ocpresence.h" + +// TODO : need for secure psi +#if defined(__WITH_DTLS__) || defined(__WITH_TLS__) +#define __SECURE_PSI__ +#endif + //----------------------------------------------------------------------------- // Defines //----------------------------------------------------------------------------- +#define IOTIVITY_VERSION "1.2.1" + /** * OIC Virtual resources supported by every OIC device. */ @@ -74,18 +79,12 @@ extern "C" { /** KeepAlive URI.*/ #define OC_RSRVD_KEEPALIVE_URI "/oic/ping" - -/** Presence */ - /** Presence URI through which the OIC devices advertise their presence.*/ #define OC_RSRVD_PRESENCE_URI "/oic/ad" /** Presence URI through which the OIC devices advertise their device presence.*/ #define OC_RSRVD_DEVICE_PRESENCE_URI "/oic/prs" -/** Sets the default time to live (TTL) for presence.*/ -#define OC_DEFAULT_PRESENCE_TTL_SECONDS (60) - /** For multicast Discovery mechanism.*/ #define OC_MULTICAST_DISCOVERY_URI "/oic/res" @@ -154,6 +153,9 @@ extern "C" { /** To represent resource type with platform.*/ #define OC_RSRVD_RESOURCE_TYPE_PLATFORM "oic.wk.p" +/** To represent resource type with collection.*/ +#define OC_RSRVD_RESOURCE_TYPE_COLLECTION "oic.wk.col" + /** To represent resource type with RES.*/ #define OC_RSRVD_RESOURCE_TYPE_RES "oic.wk.res" @@ -221,6 +223,9 @@ extern "C" { /** TCP Port. */ #define OC_RSRVD_TCP_PORT "x.org.iotivity.tcp" +/** TLS Port. */ +#define OC_RSRVD_TLS_PORT "x.org.iotivity.tls" + /** For Server instance ID.*/ #define OC_RSRVD_SERVER_INSTANCE_ID "sid" @@ -261,6 +266,8 @@ extern "C" { /** System time for the platform. */ #define OC_RSRVD_SYSTEM_TIME "st" +/** VID for the platform. */ +#define OC_RSRVD_VID "vid" /** * Device. */ @@ -281,8 +288,7 @@ extern "C" { #define OC_SPEC_VERSION "core.1.1.0" /** Device Data Model version.*/ -#define OC_DATA_MODEL_VERSION "res.1.1.0" - +#define OC_DATA_MODEL_VERSION "res.1.1.0,sh.1.1.0" /** * These provide backward compatibility - their use is deprecated. */ @@ -370,6 +376,9 @@ extern "C" { /** Account URI.*/ #define OC_RSRVD_ACCOUNT_URI "/oic/account" +/** Account user URI.*/ +#define OC_RSRVD_ACCOUNT_SEARCH_URI "/oic/account/search" + /** Account session URI.*/ #define OC_RSRVD_ACCOUNT_SESSION_URI "/oic/account/session" @@ -406,32 +415,32 @@ extern "C" { /** Defines user UUID. */ #define OC_RSRVD_USER_UUID "uid" -/** Defines user ID. */ -#define OC_RSRVD_USER_ID "userid" - /** Defines group ID. */ #define OC_RSRVD_GROUP_ID "gid" -/** Defines group Master ID. */ -#define OC_RSRVD_GROUP_MASTER_ID "gmid" - -/** Defines group type. */ -#define OC_RSRVD_GROUP_TYPE "gtype" - /** Defines member of group ID. */ #define OC_RSRVD_MEMBER_ID "mid" -/** Defines device ID list. */ -#define OC_RSRVD_DEVICE_ID_LIST "dilist" +/** Defines invite. */ +#define OC_RSRVD_INVITE "invite" -/** Defines public. */ -#define OC_RSRVD_PUBLIC "Public" +/** Defines accept. */ +#define OC_RSRVD_ACCEPT "accept" -/** Defines private. */ -#define OC_RSRVD_PRIVATE "Private" +/** Defines operation. */ +#define OC_RSRVD_OPERATION "op" -/** Defines invite. */ -#define OC_RSRVD_INVITE "invite" +/** Defines add. */ +#define OC_RSRVD_ADD "add" + +/** Defines delete. */ +#define OC_RSRVD_DELETE "delete" + +/** Defines owner. */ +#define OC_RSRVD_OWNER "owner" + +/** Defines members. */ +#define OC_RSRVD_MEMBERS "members" /** To represent grant type with refresh token. */ #define OC_RSRVD_GRANT_TYPE_REFRESH_TOKEN "refresh_token" @@ -589,6 +598,29 @@ typedef enum OC_ADAPTER_NFC = (1 << 5) } OCTransportAdapter; +typedef enum +{ + OC_DEFAULT_BT_FLAGS = 0, + // flags for BLE transport + OC_LE_ADV_DISABLE = 0x1, // disable BLE advertisement. + OC_LE_ADV_ENABLE = 0x2, // enable BLE advertisement. + OC_LE_SERVER_DISABLE = (1 << 4), // disable gatt server. + // flags for EDR transport + OC_EDR_SERVER_DISABLE = (1 << 7) // disable rfcomm server. +} OCTransportBTFlags_t; + +/** + * Log level to print can be controlled through this enum. + * And privacy logs contained uid, Token, Device id, etc can also disable. + * This enum (OCLogLevel) must be kept synchronized with + * CAUtilLogLevel_t (in CACommon.h). + */ +typedef enum +{ + OC_LOG_LEVEL_ALL = 1, // all logs. + OC_LOG_LEVEL_INFO, // debug level is disabled. +} OCLogLevel; + /** * Enum layout assumes some targets have 16-bit integer (e.g., Arduino). */ @@ -691,9 +723,12 @@ typedef struct /** usually zero for default interface.*/ uint32_t ifindex; -#if defined (ROUTING_GATEWAY) || defined (ROUTING_EP) - char routeData[MAX_ADDR_STR_SIZE]; //destination GatewayID:ClientId -#endif + + /** destination GatewayID:ClientId.*/ + char routeData[MAX_ADDR_STR_SIZE]; + + /** device ID of remote.*/ + char remoteId[MAX_IDENTITY_SIZE]; } OCDevAddr; /** @@ -800,11 +835,9 @@ typedef enum /** Register observe request for all notifications, including stale notifications.*/ OC_REST_OBSERVE_ALL = (1 << 5), -#ifdef WITH_PRESENCE /** Subscribe for all presence notifications of a particular resource.*/ OC_REST_PRESENCE = (1 << 7), -#endif /** Allows OCDoResource caller to do discovery.*/ OC_REST_DISCOVER = (1 << 8) } OCMethod; @@ -849,7 +882,9 @@ typedef enum OC_HIGH_QOS, /** No Quality is defined, let the stack decide.*/ - OC_NA_QOS + OC_NA_QOS, + + OC_LOW_QOS_WITH_TCP } OCQualityOfService; /** @@ -975,23 +1010,34 @@ typedef enum OC_STACK_PDM_IS_NOT_INITIALIZED, OC_STACK_DUPLICATE_UUID, OC_STACK_INCONSISTENT_DB, + OC_STACK_SVR_DB_NOT_EXIST, /** * Error code from OTM * This error is pushed from DTLS interface when handshake failure happens */ OC_STACK_AUTHENTICATION_FAILURE, + OC_STACK_NOT_ALLOWED_OXM, /** Insert all new error codes here!.*/ -#ifdef WITH_PRESENCE OC_STACK_PRESENCE_STOPPED = 128, OC_STACK_PRESENCE_TIMEOUT, OC_STACK_PRESENCE_DO_NOT_HANDLE, -#endif + + /** Request is denied by the user*/ + OC_STACK_USER_DENIED_REQ, + OC_STACK_NOT_ACCEPTABLE, + OC_STACK_METHOD_NOT_ALLOWED, /** ERROR code from server */ OC_STACK_FORBIDDEN_REQ, /** 403*/ + OC_STACK_TOO_MANY_REQUESTS, /** 429*/ OC_STACK_INTERNAL_SERVER_ERROR, /** 500*/ + OC_STACK_NOT_IMPLEMENTED, /** 501*/ + OC_STACK_BAD_GATEWAY, /** 502*/ + OC_STACK_SERVICE_UNAVAILABLE, /** 503*/ + OC_STACK_GATEWAY_TIMEOUT, /** 504*/ + OC_STACK_PROXY_NOT_SUPPORTED, /** 505*/ /** ERROR in stack.*/ OC_STACK_ERROR = 255 @@ -1011,15 +1057,15 @@ typedef void * OCResourceHandle; /** * Handle to an OCRequest object owned by the OCStack. */ -typedef void * OCRequestHandle; +typedef uint32_t OCRequestHandle; /** * Unique identifier for each observation request. Used when observations are * registered or de-registered. Used by entity handler to signal specific * observers to be notified of resource changes. - * There can be maximum of 256 observations per server. + * There can be maximum of 3840 observations per server. */ -typedef uint8_t OCObservationId; +typedef uint16_t OCObservationId; /** * Sequence number is a 24 bit field, @@ -1066,6 +1112,14 @@ typedef struct { /** Persistent storage unlink handler.*/ int (* unlink)(const char *path); + + /** Persistent Storage Handler for Encryption.*/ + int (* encrypt)(const unsigned char *pt, size_t size, + unsigned char**ct, size_t *ct_len); + + /**Persistent Storage Handler for Decryption.*/ + int (* decrypt)(const unsigned char *ct, size_t size, + unsigned char**pt, size_t *pt_len); } OCPersistentStorage; /** @@ -1102,10 +1156,13 @@ typedef enum OC_EH_NOT_ACCEPTABLE = 406, OC_EH_TOO_LARGE = 413, OC_EH_UNSUPPORTED_MEDIA_TYPE = 415, + OC_EH_TOO_MANY_REQUESTS = 429, OC_EH_INTERNAL_SERVER_ERROR = 500, + OC_EH_NOT_IMPLEMENTED = 501, OC_EH_BAD_GATEWAY = 502, OC_EH_SERVICE_UNAVAILABLE = 503, - OC_EH_RETRANSMIT_TIMEOUT = 504 + OC_EH_RETRANSMIT_TIMEOUT = 504, + OC_EH_PROXY_NOT_SUPPORTED = 505 } OCEntityHandlerResult; /** @@ -1149,6 +1206,7 @@ typedef struct OCHeaderOption /** * This structure describes the platform properties. All non-Null properties will be * included in a platform discovery request. + * @deprecated: Use OCSetPropertyValue to set platform value. */ typedef struct { @@ -1191,6 +1249,7 @@ typedef struct * This structure is expected as input for device properties. * device name is mandatory and expected from the application. * device id of type UUID will be generated by the stack. + * @deprecated: Use OCSetPropertyValue to set device value. */ typedef struct { @@ -1235,9 +1294,9 @@ typedef enum PAYLOAD_TYPE_INVALID, /** The payload is an OCDiscoveryPayload */ PAYLOAD_TYPE_DISCOVERY, - /** The payload is an OCDevicePayload */ + /** The payload of the device */ PAYLOAD_TYPE_DEVICE, - /** The payload is an OCPlatformPayload */ + /** The payload type of the platform */ PAYLOAD_TYPE_PLATFORM, /** The payload is an OCRepPayload */ PAYLOAD_TYPE_REPRESENTATION, @@ -1361,9 +1420,6 @@ typedef struct OCDiscoveryPayload /** Name */ char *name; - /** HREF */ - char *uri; - /** Resource Type */ OCStringLL *type; @@ -1381,31 +1437,10 @@ typedef struct OCDiscoveryPayload typedef struct { OCPayload base; - char *sid; - char* deviceName; - char* specVersion; - OCStringLL *dataModelVersions; - OCStringLL *interfaces; - OCStringLL *types; -} OCDevicePayload; - -typedef struct -{ - OCPayload base; - char* uri; - OCPlatformInfo info; - OCStringLL* rt; - OCStringLL* interfaces; -} OCPlatformPayload; - -typedef struct -{ - OCPayload base; uint8_t* securityData; size_t payloadSize; } OCSecurityPayload; -#ifdef WITH_PRESENCE typedef struct { OCPayload base; @@ -1414,7 +1449,6 @@ typedef struct OCPresenceTrigger trigger; char* resourceType; } OCPresencePayload; -#endif /** * Incoming requests handled by the server. Requests are passed in as a parameter to the @@ -1491,7 +1525,7 @@ typedef struct uint8_t numRcvdVendorSpecificHeaderOptions; /** An array of the received vendor specific header options.*/ - OCHeaderOption rcvdVendorSpecificHeaderOptions[MAX_HEADER_OPTIONS]; + OCHeaderOption *rcvdVendorSpecificHeaderOptions; } OCClientResponse; /** @@ -1693,6 +1727,50 @@ typedef OCEntityHandlerResult (*OCDeviceEntityHandler) */ typedef void (*OCDirectPairingCB)(void *ctx, OCDPDev_t *peer, OCStackResult result); //#endif // DIRECT_PAIRING +#if defined(__WITH_DTLS__) || defined(__WITH_TLS__) +/** + * Callback function definition for Change in TrustCertChain + * + * @param[IN] ctx - user context returned in the callback. + * @param[IN] credId - trustCertChain changed for this ID + * @param[IN] trustCertChain - trustcertchain binary blob. + * @param[IN] chainSize - size of trustchain + */ +typedef void (*TrustCertChainChangeCB)(void *ctx, uint16_t credId, uint8_t *trustCertChain, + size_t chainSize); + +/** + * certChain context structure. + */ +typedef struct trustCertChainContext +{ + TrustCertChainChangeCB callback; + void *context; +} trustCertChainContext_t; +#endif + +/** + * OTM State + */ +typedef enum +{ + OC_OTM_READY = 0, + OC_OTM_STARTED = 1, + OC_OTM_DONE = 2, + OC_OTM_ERROR = 3 +} OCOtmEvent_t; + +/** + * Callback function to receive the OTM event on server side. + * + * @param[in] ctx user context returned in the callback + * @param[in] addr PT's address (address can be NULL in case of init state) + * @param[in] port PT's port (It is meaningless in case of init state & BLE) + * @param[in] uuid PT's UUID (UUID can be NULL in case of init state & coap reqest) + * @param[in] event OTM state (@ref OCOtmEvent_t) + */ +typedef void (*OCOtmEventHandler)(void *ctx, const char *addr, uint16_t port, + const char *ownerId, OCOtmEvent_t event); #ifdef __cplusplus }