X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;f=resource%2Fcsdk%2Fstack%2Finclude%2Foctypes.h;h=f1ed8b1a884b17125ed8eb94ac5f3205ba60a53e;hb=3c093548382bb2542c87a67e6e5fa32552c29cb3;hp=2117fc3cf37c509a8cfa0c0da784744559f78a72;hpb=edcfc3d2329da7b914771c0dcff5f42c9b74fd93;p=platform%2Fupstream%2Fiotivity.git diff --git a/resource/csdk/stack/include/octypes.h b/resource/csdk/stack/include/octypes.h old mode 100755 new mode 100644 index 2117fc3..f1ed8b1 --- a/resource/csdk/stack/include/octypes.h +++ b/resource/csdk/stack/include/octypes.h @@ -43,10 +43,18 @@ extern "C" { #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,7 +82,7 @@ extern "C" { /** KeepAlive URI.*/ #define OC_RSRVD_KEEPALIVE_URI "/oic/ping" - +#ifdef WITH_PRESENCE /** Presence */ /** Presence URI through which the OIC devices advertise their presence.*/ @@ -83,8 +91,7 @@ extern "C" { /** 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) +#endif // WITH_PRESENCE /** For multicast Discovery mechanism.*/ #define OC_MULTICAST_DISCOVERY_URI "/oic/res" @@ -92,6 +99,7 @@ extern "C" { /** Separator for multiple query string.*/ #define OC_QUERY_SEPARATOR "&;" +#ifdef WITH_PRESENCE /** * OC_DEFAULT_PRESENCE_TTL_SECONDS sets the default time to live (TTL) for presence. */ @@ -119,6 +127,8 @@ extern "C" { /** To delete.*/ #define OC_RSRVD_TRIGGER_DELETE "delete" +#endif // WITH_PRESENCE + /** * Attributes used to form a proper OIC conforming JSON message. */ @@ -145,8 +155,10 @@ extern "C" { /** To represent resource type.*/ #define OC_RSRVD_RESOURCE_TYPE "rt" +#ifdef WITH_PRESENCE /** To represent resource type with presence.*/ #define OC_RSRVD_RESOURCE_TYPE_PRESENCE "oic.wk.ad" +#endif /** To represent resource type with device.*/ #define OC_RSRVD_RESOURCE_TYPE_DEVICE "oic.wk.d" @@ -222,10 +234,10 @@ extern "C" { #define OC_RSRVD_HOSTING_PORT "port" /** TCP Port. */ -#define OC_RSRVD_TCP_PORT "tcp" +#define OC_RSRVD_TCP_PORT "x.org.iotivity.tcp" /** TLS Port. */ -#define OC_RSRVD_TLS_PORT "tls" +#define OC_RSRVD_TLS_PORT "x.org.iotivity.tls" /** For Server instance ID.*/ #define OC_RSRVD_SERVER_INSTANCE_ID "sid" @@ -599,6 +611,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). */ @@ -701,9 +736,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; /** @@ -985,6 +1023,7 @@ 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 @@ -1000,9 +1039,19 @@ typedef enum 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_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 @@ -1077,6 +1126,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; /** @@ -1114,9 +1171,11 @@ typedef enum OC_EH_TOO_LARGE = 413, OC_EH_UNSUPPORTED_MEDIA_TYPE = 415, 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; /** @@ -1256,8 +1315,10 @@ typedef enum PAYLOAD_TYPE_REPRESENTATION, /** The payload is an OCSecurityPayload */ PAYLOAD_TYPE_SECURITY, +#ifdef WITH_PRESENCE /** The payload is an OCPresencePayload */ PAYLOAD_TYPE_PRESENCE +#endif } OCPayloadType; /** @@ -1374,9 +1435,6 @@ typedef struct OCDiscoveryPayload /** Name */ char *name; - /** HREF */ - char *uri; - /** Resource Type */ OCStringLL *type; @@ -1686,7 +1744,6 @@ 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 @@ -1709,6 +1766,29 @@ typedef struct trustCertChainContext } 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 } #endif // __cplusplus