Parsing about a payload including resource information of multiple devices
[platform/upstream/iotivity.git] / resource / csdk / stack / include / octypes.h
index 6269687..7ea3819 100644 (file)
@@ -64,7 +64,7 @@ extern "C" {
 
 /** Resource Type.*/
 #define OC_RSRVD_RESOURCE_TYPES_URI           "/oic/res/types/d"
-#ifdef ROUTING_GATEWAY
+#if defined (ROUTING_GATEWAY) || defined (ROUTING_EP)
 /** Gateway URI.*/
 #define OC_RSRVD_GATEWAY_URI                  "/oic/gateway"
 #endif
@@ -137,6 +137,15 @@ extern "C" {
 /** To represent resource type with presence.*/
 #define OC_RSRVD_RESOURCE_TYPE_PRESENCE "oic.wk.ad"
 
+/** To represent resource type with device.*/
+#define OC_RSRVD_RESOURCE_TYPE_DEVICE   "oic.wk.d"
+
+/** To represent resource type with platform.*/
+#define OC_RSRVD_RESOURCE_TYPE_PLATFORM "oic.wk.p"
+
+/** To represent resource type with RES.*/
+#define OC_RSRVD_RESOURCE_TYPE_RES    "oic.wk.res"
+
 /** To represent interface.*/
 #define OC_RSRVD_INTERFACE              "if"
 
@@ -155,6 +164,9 @@ extern "C" {
 /** To represent default interface.*/
 #define OC_RSRVD_INTERFACE_DEFAULT      "oic.if.baseline"
 
+/** To represent read-only interface.*/
+#define OC_RSRVD_INTERFACE_READ         "oic.if.r"
+
 /** To represent ll interface.*/
 #define OC_RSRVD_INTERFACE_LL           "oic.if.ll"
 
@@ -173,9 +185,6 @@ extern "C" {
 /** To represent host name.*/
 #define OC_RSRVD_HOST_NAME              "hn"
 
-/** To represent version.*/
-#define OC_RSRVD_VERSION                "icv"
-
 /** To represent policy.*/
 #define OC_RSRVD_POLICY                 "p"
 
@@ -188,6 +197,9 @@ extern "C" {
 /** Port. */
 #define OC_RSRVD_HOSTING_PORT           "port"
 
+/** TCP Port. */
+#define OC_RSRVD_TCP_PORT               "tcp"
+
 /** For Server instance ID.*/
 #define OC_RSRVD_SERVER_INSTANCE_ID     "sid"
 
@@ -239,16 +251,16 @@ extern "C" {
 #define OC_RSRVD_DEVICE_NAME            "n"
 
 /** Device specification version.*/
-#define OC_RSRVD_SPEC_VERSION           "lcv"
+#define OC_RSRVD_SPEC_VERSION           "icv"
 
 /** Device data model.*/
 #define OC_RSRVD_DATA_MODEL_VERSION     "dmv"
 
 /** Device specification version.*/
-#define OC_SPEC_VERSION                "0.9.0"
+#define OC_SPEC_VERSION                "core.1.0.0"
 
 /** Device Data Model version.*/
-#define OC_DATA_MODEL_VERSION          "sec.0.95"
+#define OC_DATA_MODEL_VERSION          "res.1.0.0"
 
 /**
  *  These provide backward compatibility - their use is deprecated.
@@ -269,12 +281,75 @@ extern "C" {
 #ifdef RA_ADAPTER
 #define MAX_ADDR_STR_SIZE (256)
 #else
-#define MAX_ADDR_STR_SIZE (40)
+/** Max Address could be
+ * "coap+tcp://[xxxx:xxxx:xxxx:xxxx:xxxx:xxxx:yyy.yyy.yyy.yyy]:xxxxx"
+ * +1 for null terminator.
+ */
+#define MAX_ADDR_STR_SIZE (65)
 #endif
 
+/** Length of MAC address */
+#define MAC_ADDR_STR_SIZE (17)
+
+/** Blocks of MAC address */
+#define MAC_ADDR_BLOCKS (6)
+
 /** Max identity size. */
 #define MAX_IDENTITY_SIZE (32)
 
+/** Universal unique identity size. */
+#define UUID_IDENTITY_SIZE (128/8)
+
+/** Resource Directory */
+
+/** Resource Directory URI used to Discover RD and Publish resources.*/
+#define OC_RSRVD_RD_URI                  "/oic/rd"
+
+/** To represent resource type with rd.*/
+#define OC_RSRVD_RESOURCE_TYPE_RD        "oic.wk.rd"
+
+/** RD Discovery bias factor type. */
+#define OC_RSRVD_RD_DISCOVERY_SEL        "sel"
+
+/** Base URI. */
+#define OC_RSRVD_BASE_URI                "baseURI"
+
+/** Unique value per collection/link. */
+#define OC_RSRVD_INS                     "ins"
+
+/** Allowable resource types in the links. */
+#define OC_RSRVD_RTS                     "rts"
+
+/** Default relationship. */
+#define OC_RSRVD_DREL                    "drel"
+
+/** Defines relationship between links. */
+#define OC_RSRVD_REL                     "rel"
+
+/** Defines title. */
+#define OC_RSRVD_TITLE                   "title"
+
+/** Defines URI. */
+#define OC_RSRVD_URI                     "uri"
+
+/** Defines media type. */
+#define OC_RSRVD_MEDIA_TYPE              "mt"
+
+/** To represent resource type with Publish RD.*/
+#define OC_RSRVD_RESOURCE_TYPE_RDPUBLISH "oic.wk.rdpub"
+
+/**
+ * Mark a parameter as unused. Used to prevent unused variable compiler warnings.
+ * Used in three cases:
+ * 1. in callbacks when one of the parameters are unused
+ * 2. when due to code changes a functions parameter is no longer
+ *    used but must be left in place for backward compatibility
+ *    reasons.
+ * 3. a variable is only used in the debug build variant and would
+ *    give a build warning in release mode.
+ */
+#define OC_UNUSED(x) (void)(x)
+
 /**
  * These enums (OCTransportAdapter and OCTransportFlags) must
  * be kept synchronized with OCConnectivityType (below) as well as
@@ -293,17 +368,15 @@ typedef enum
 
     /** RFCOMM over Bluetooth EDR.*/
     OC_ADAPTER_RFCOMM_BTEDR = (1 << 2),
-
 #ifdef RA_ADAPTER
     /**Remote Access over XMPP.*/
     OC_ADAPTER_REMOTE_ACCESS = (1 << 3),
 #endif
-
-#ifdef TCP_ADAPTER
     /** CoAP over TCP.*/
-    OC_ADAPTER_TCP           = (1 << 4)
-#endif
+    OC_ADAPTER_TCP           = (1 << 4),
 
+    /** NFC Transport for Messaging.*/
+    OC_ADAPTER_NFC           = (1 << 5)
 } OCTransportAdapter;
 
 /**
@@ -319,14 +392,14 @@ typedef enum
     OC_FLAG_SECURE     = (1 << 4),
 
     /** IPv4 & IPv6 auto-selection is the default.*/
-    /** IP adapter only.*/
+    /** IP & TCP adapter only.*/
     OC_IP_USE_V6       = (1 << 5),
 
-    /** IP adapter only.*/
+    /** IP & TCP adapter only.*/
     OC_IP_USE_V4       = (1 << 6),
 
-    /** internal use only.*/
-    OC_RESERVED1       = (1 << 7),   // internal use only
+    /** Multicast only.*/
+    OC_MULTICAST       = (1 << 7),
 
     /** Link-Local multicast is the default multicast scope for IPv6.
      *  These are placed here to correspond to the IPv6 multicast address bits.*/
@@ -361,6 +434,12 @@ typedef enum
 #define OC_MASK_MODS     (0x0FF0)
 #define OC_MASK_FAMS     (OC_IP_USE_V6|OC_IP_USE_V4)
 
+typedef struct OCStringLL
+{
+    struct OCStringLL *next;
+    char* value;
+} OCStringLL;
+
 /**
  * End point identity.
  */
@@ -374,6 +453,15 @@ typedef struct
 } OCIdentity;
 
 /**
+ * Universally unique identifier.
+ */
+typedef struct
+{
+    /** identitifier string.*/
+    unsigned char id[UUID_IDENTITY_SIZE];
+} OCUUIdentity;
+
+/**
  * Data structure to encapsulate IPv4/IPv6/Contiki/lwIP device addresses.
  * OCDevAddr must be the same as CAEndpoint (in CACommon.h).
  */
@@ -392,7 +480,7 @@ typedef struct
     char                    addr[MAX_ADDR_STR_SIZE];
 
     /** usually zero for default interface.*/
-    uint32_t                interface;
+    uint32_t                ifindex;
 #if defined (ROUTING_GATEWAY) || defined (ROUTING_EP)
     char                    routeData[MAX_ADDR_STR_SIZE]; //destination GatewayID:ClientId
 #endif
@@ -424,11 +512,11 @@ typedef enum
     /** Remote Access over XMPP.*/
     CT_ADAPTER_REMOTE_ACCESS = (1 << 19),
 #endif
-
-#ifdef TCP_ADAPTER
     /** CoAP over TCP.*/
-    CT_ADAPTER_TCP          = (1 << 20),
-#endif
+    CT_ADAPTER_TCP     = (1 << 20),
+
+    /** NFC Transport.*/
+    CT_ADAPTER_NFC     = (1 << 21),
 
     /** Insecure transport is the default (subject to change).*/
 
@@ -505,11 +593,11 @@ typedef enum
     /** De-register observation, intended for internal use.*/
     OC_REST_CANCEL_OBSERVE = (1 << 6),
 
-    #ifdef WITH_PRESENCE
+#ifdef WITH_PRESENCE
     /** Subscribe for all presence notifications of a particular resource.*/
     OC_REST_PRESENCE       = (1 << 7),
 
-    #endif
+#endif
     /** Allows OCDoResource caller to do discovery.*/
     OC_REST_DISCOVER       = (1 << 8)
 } OCMethod;
@@ -585,8 +673,12 @@ typedef enum
      *  processing its requests from clients.*/
     OC_SLOW          = (1 << 3),
 
+#ifdef __WITH_DTLS__
     /** When this bit is set, the resource is a secure resource.*/
     OC_SECURE        = (1 << 4),
+#else
+    OC_SECURE        = (0),
+#endif
 
     /** When this bit is set, the resource is allowed to be discovered only
      *  if discovery request contains an explicit querystring.
@@ -616,6 +708,7 @@ typedef enum
     OC_STACK_RESOURCE_CREATED,
     OC_STACK_RESOURCE_DELETED,
     OC_STACK_CONTINUE,
+    OC_STACK_RESOURCE_CHANGED,
     /** Success status code - END HERE.*/
 
     /** Error status code - START HERE.*/
@@ -658,18 +751,25 @@ typedef enum
 
     /** Request is not authorized by Resource Server. */
     OC_STACK_UNAUTHORIZED_REQ,
+    OC_STACK_TOO_LARGE_REQ,
 
     /** Error code from PDM */
     OC_STACK_PDM_IS_NOT_INITIALIZED,
     OC_STACK_DUPLICATE_UUID,
     OC_STACK_INCONSISTENT_DB,
 
+    /**
+     * Error code from OTM
+     * This error is pushed from DTLS interface when handshake failure happens
+     */
+    OC_STACK_AUTHENTICATION_FAILURE,
+
     /** Insert all new error codes here!.*/
-    #ifdef WITH_PRESENCE
+#ifdef WITH_PRESENCE
     OC_STACK_PRESENCE_STOPPED = 128,
     OC_STACK_PRESENCE_TIMEOUT,
     OC_STACK_PRESENCE_DO_NOT_HANDLE,
-    #endif
+#endif
     /** ERROR in stack.*/
     OC_STACK_ERROR = 255
     /** Error status code - END HERE.*/
@@ -718,6 +818,7 @@ typedef enum
  * Persistent storage handlers. An APP must provide OCPersistentStorage handler pointers
  * when it calls OCRegisterPersistentStorageHandler.
  * Persistent storage open handler points to default file path.
+ * It should check file path and whether the file is symbolic link or no.
  * Application can point to appropriate SVR database path for it's IoTivity Server.
  */
 typedef struct {
@@ -756,11 +857,21 @@ typedef enum
 {
     OC_EH_OK = 0,
     OC_EH_ERROR,
-    OC_EH_RESOURCE_CREATED,
-    OC_EH_RESOURCE_DELETED,
-    OC_EH_SLOW,
-    OC_EH_FORBIDDEN,
-    OC_EH_RESOURCE_NOT_FOUND
+    OC_EH_RESOURCE_CREATED, // 2.01
+    OC_EH_RESOURCE_DELETED, // 2.02
+    OC_EH_SLOW, // 2.05
+    OC_EH_FORBIDDEN, // 4.03
+    OC_EH_RESOURCE_NOT_FOUND, // 4.04
+    OC_EH_VALID,   // 2.03
+    OC_EH_CHANGED, // 2.04
+    OC_EH_CONTENT, // 2.05
+    OC_EH_BAD_REQ, // 4.00
+    OC_EH_UNAUTHORIZED_REQ, // 4.01
+    OC_EH_BAD_OPT, // 4.02
+    OC_EH_METHOD_NOT_ALLOWED, // 4.05
+    OC_EH_NOT_ACCEPTABLE, // 4.06
+    OC_EH_INTERNAL_SERVER_ERROR, // 5.00
+    OC_EH_RETRANSMIT_TIMEOUT // 5.04
 } OCEntityHandlerResult;
 
 /**
@@ -852,11 +963,21 @@ typedef struct
 {
     /** Pointer to the device name.*/
     char *deviceName;
-
+    /** Pointer to the types.*/
+    OCStringLL *types;
+    /** Pointer to the device specification version.*/
+    char *specVersion;
+    /** Pointer to the device data model versions (in CSV format).*/
+    OCStringLL *dataModelVersions;
 } OCDeviceInfo;
 
 #ifdef RA_ADAPTER
 /**
+ * callback for bound JID
+ */
+typedef void (*jid_bound_cb)(char *jid);
+
+/**
  * CA Remote Access information for XMPP Client
  *
  */
@@ -869,6 +990,7 @@ typedef struct
     char *password;     /**< login password */
     char *resource;     /**< specific resource for login */
     char *user_jid;     /**< specific JID for login */
+    jid_bound_cb jidbound;  /**< callback when JID bound */
 } OCRAInfo_t;
 #endif  /* RA_ADAPTER */
 
@@ -876,19 +998,33 @@ typedef struct
 /** Enum to describe the type of object held by the OCPayload object.*/
 typedef enum
 {
+    /** Contents of the payload are invalid */
     PAYLOAD_TYPE_INVALID,
+    /** The payload is an OCDiscoveryPayload */
     PAYLOAD_TYPE_DISCOVERY,
+    /** The payload is an OCDevicePayload */
     PAYLOAD_TYPE_DEVICE,
+    /** The payload is an OCPlatformPayload */
     PAYLOAD_TYPE_PLATFORM,
+    /** The payload is an OCRepPayload */
     PAYLOAD_TYPE_REPRESENTATION,
+    /** The payload is an OCSecurityPayload */
     PAYLOAD_TYPE_SECURITY,
+    /** The payload is an OCPresencePayload */
     PAYLOAD_TYPE_PRESENCE,
+    /** The payload is an OCRDPayload */
     PAYLOAD_TYPE_RD
 } OCPayloadType;
 
+/**
+ * A generic struct representing a payload returned from a resource operation
+ *
+ * A pointer to OCPayLoad can be cast to a more specific struct to access members
+ * for the its type.
+ */
 typedef struct
 {
-    // The type of message that was received
+    /** The type of message that was received */
     OCPayloadType type;
 } OCPayload;
 
@@ -899,10 +1035,21 @@ typedef enum
     OCREP_PROP_DOUBLE,
     OCREP_PROP_BOOL,
     OCREP_PROP_STRING,
+    OCREP_PROP_BYTE_STRING,
     OCREP_PROP_OBJECT,
     OCREP_PROP_ARRAY
 }OCRepPayloadPropType;
 
+/** This structure will be used to represent a binary string for CBOR payloads.*/
+typedef struct
+{
+    /** pointer to data bytes.*/
+    uint8_t* bytes;
+
+    /** number of data bytes.*/
+    size_t   len;
+} OCByteString;
+
 #define MAX_REP_ARRAY_DEPTH 3
 typedef struct
 {
@@ -915,6 +1062,10 @@ typedef struct
         double* dArray;
         bool* bArray;
         char** strArray;
+
+        /** pointer to ByteString array.*/
+        OCByteString* ocByteStrArray;
+
         struct OCRepPayload** objArray;
     };
 } OCRepPayloadValueArray;
@@ -929,6 +1080,10 @@ typedef struct OCRepPayloadValue
         double d;
         bool b;
         char* str;
+
+        /** ByteString object.*/
+        OCByteString ocByteStr;
+
         struct OCRepPayload* obj;
         OCRepPayloadValueArray arr;
     };
@@ -936,12 +1091,6 @@ typedef struct OCRepPayloadValue
 
 } OCRepPayloadValue;
 
-typedef struct OCStringLL
-{
-    struct OCStringLL *next;
-    char* value;
-} OCStringLL;
-
 // used for get/set/put/observe/etc representations
 typedef struct OCRepPayload
 {
@@ -957,29 +1106,163 @@ typedef struct OCRepPayload
 typedef struct OCResourcePayload
 {
     char* uri;
-    uint8_t* sid;
     OCStringLL* types;
     OCStringLL* interfaces;
     uint8_t bitmap;
     bool secure;
     uint16_t port;
+#ifdef TCP_ADAPTER
+    uint16_t tcpPort;
+#endif
     struct OCResourcePayload* next;
 } OCResourcePayload;
 
+/**
+ * Structure holding Links Payload. It is a sub-structure used in
+ * OCResourceCollectionPayload.
+ */
+typedef struct OCLinksPayload
+{
+    /** This is the target relative URI. */
+    char *href;
+    /** Resource Type - A standard OIC specified or vendor defined resource
+     * type of the resource referenced by the target URI. */
+    OCStringLL *rt;
+    /** Interface - The interfaces supported by the resource referenced by the target URI. */
+    OCStringLL *itf;
+    /** The relation of the target URI referenced by the link to the context URI;
+     * The default value is null. */
+    char *rel;
+    /** Specifies if the resource referenced by the target URIis observable or not. */
+    bool obs;
+    /** A title for the link relation. Can be used by the UI to provide a context. */
+    char *title;
+    /** This is used to override the context URI e.g. override the URI of the containing collection. */
+    char *uri;
+    /** The instance identifier for this web link in an array of web links - used in links. */
+    union
+    {
+        /** An ordinal number that is not repeated - must be unique in the collection context. */
+        uint8_t ins;
+        /** Any unique string including a URI. */
+        char *uniqueStr;
+        /** Use UUID for universal uniqueness - used in /oic/res to identify the device. */
+        OCIdentity uniqueUUID;
+    };
+    /** A hint of the media type of the representation of the resource referenced by the target URI. */
+    OCStringLL *mt;
+    /** Holding address of the next resource. */
+    struct OCLinksPayload *next;
+} OCLinksPayload;
+
+/** Structure holding tags value of the links payload. */
 typedef struct
 {
+    /** Name of tags. */
+    OCDeviceInfo n;
+    /** Device identifier. */
+    OCIdentity di;
+    /** The base URI where the resources are hold. */
+    char *baseURI;
+    /** Bitmap holds observable, discoverable, secure option flag.*/
+    uint8_t bitmap;
+    /** Port set in case, the secure flag is set above. */
+    uint16_t port;
+    /** Id for each set of links i.e. tag. */
+    union
+    {
+        /** An ordinal number that is not repeated - must be unique in the collection context. */
+        uint8_t ins;
+        /** Any unique string including a URI. */
+        char *uniqueStr;
+        /** Use UUID for universal uniqueness - used in /oic/res to identify the device. */
+        OCIdentity uniqueUUID;
+    };
+    /** Defines the list of allowable resource types (for Target and anchors) in links included
+     * in the collection; new links being created can only be from this list. */
+    char *rts;
+    /** When specified this is the default relationship to use when an OIC Link does not specify
+     * an explicit relationship with *rel* parameter. */
+    char *drel;
+    /** Time to keep holding resource.*/
+    uint32_t ttl;
+} OCTagsPayload;
+
+/** Resource collection payload. */
+typedef struct OCResourceCollectionPayload
+{
+    /** Collection tags payload.*/
+    OCTagsPayload *tags;
+    /** Array of links payload. */
+    OCLinksPayload *setLinks;
+    /** Holding address of the next resource. */
+    struct OCResourceCollectionPayload *next;
+} OCResourceCollectionPayload;
+
+typedef struct OCDiscoveryPayload
+{
     OCPayload base;
-    OCResourcePayload* resources;
+
+    /** Device Id */
+    char *sid;
+
+    /** A special case for handling RD address. */
+    char* baseURI;
+
+    /** Name */
+    char *name;
+
+    /** HREF */
+    char *uri;
+
+    /** Resource Type */
+    OCStringLL *type;
+
+    /** Interface */
+    OCStringLL *iface;
+
+    /** This structure holds the old /oic/res response. */
+    OCResourcePayload *resources;
+
+    /** Holding address of the next DiscoveryPayload. */
+    struct OCDiscoveryPayload *next;
+
 } OCDiscoveryPayload;
 
+/**
+ * Structure holding discovery payload.
+ */
+typedef struct
+{
+    /** Device Name. */
+    OCDeviceInfo n;
+    /** Device Identity. */
+    OCIdentity di;
+    /** Value holding the bias factor of the RD. */
+    uint8_t sel;
+} OCRDDiscoveryPayload;
+
+/**
+ * RD Payload that will be transmitted over the wire.
+ */
 typedef struct
 {
     OCPayload base;
-    char* uri;
-    uint8_t* sid;
+    /** Pointer to the discovery response payload.*/
+    OCRDDiscoveryPayload *rdDiscovery;
+    /** Pointer to the publish payload.*/
+    OCResourceCollectionPayload *rdPublish;
+} OCRDPayload;
+
+typedef struct
+{
+    OCPayload base;
+    char *sid;
     char* deviceName;
     char* specVersion;
-    char* dataModelVersion;
+    OCStringLL *dataModelVersions;
+    OCStringLL *interfaces;
+    OCStringLL *types;
 } OCDevicePayload;
 
 typedef struct
@@ -987,13 +1270,17 @@ typedef struct
     OCPayload base;
     char* uri;
     OCPlatformInfo info;
+    OCStringLL* rt;
+    OCStringLL* interfaces;
 } OCPlatformPayload;
 
 typedef struct
 {
     OCPayload base;
-    char* securityData;
+    uint8_t* securityData;
+    size_t payloadSize;
 } OCSecurityPayload;
+
 #ifdef WITH_PRESENCE
 typedef struct
 {
@@ -1038,6 +1325,9 @@ typedef struct
     /** Pointer to the array of the received vendor specific header options.*/
     OCHeaderOption * rcvdVendorSpecificHeaderOptions;
 
+    /** Message id.*/
+    uint16_t messageID;
+
     /** the payload from the request PDU.*/
     OCPayload *payload;
 
@@ -1123,15 +1413,51 @@ typedef enum
 } OCEntityHandlerFlag;
 
 /**
- * Possible returned values from client application.
+ * Possible return values from client application callback
+ *
+ * A client application callback returns an OCStackApplicationResult to indicate whether
+ * the stack should continue to keep the callback registered.
  */
 typedef enum
 {
+    /** Make no more calls to the callback and call the OCClientContextDeleter for this callback */
     OC_STACK_DELETE_TRANSACTION = 0,
+    /** Keep this callback registered and call it if an apropriate event occurs */
     OC_STACK_KEEP_TRANSACTION
 } OCStackApplicationResult;
 
 
+//#ifdef DIRECT_PAIRING
+/**
+ * @brief   direct pairing Method Type.
+ *              0:  not allowed
+ *              1:  pre-configured pin
+ *              2:  random pin
+ */
+typedef enum OCPrm
+{
+    DP_NOT_ALLOWED             = 0x0,
+    DP_PRE_CONFIGURED        = (0x1 << 0),
+    DP_RANDOM_PIN               = (0x1 << 1),
+} OCPrm_t;
+
+/**
+ * Device Information of discoverd direct pairing device(s).
+ */
+typedef struct OCDPDev
+{
+    OCDevAddr               endpoint;
+    OCConnectivityType   connType;
+    uint16_t                     securePort;
+    bool                  edp;
+    OCPrm_t           *prm;
+    size_t                prmLen;
+    OCUUIdentity     deviceID;
+    OCUUIdentity     rowner;
+    struct OCDPDev *next;
+} OCDPDev_t;
+//#endif // DIRECT_PAIRING
+
 /*
  * -------------------------------------------------------------------------------------------
  * Callback function definitions
@@ -1184,6 +1510,18 @@ typedef OCEntityHandlerResult (*OCEntityHandler)
 typedef OCEntityHandlerResult (*OCDeviceEntityHandler)
 (OCEntityHandlerFlag flag, OCEntityHandlerRequest * entityHandlerRequest, char* uri, void* callbackParam);
 
+//#ifdef DIRECT_PAIRING
+/**
+ * Callback function definition of direct-pairing
+ *
+ * @param[OUT] ctx - user context returned in the callback.
+ * @param[OUT] peer - pairing device info.
+ * @param[OUT} result - It's returned with 'OC_STACK_XXX'. It will return 'OC_STACK_OK'
+ *                                   if D2D pairing is success without error
+ */
+typedef void (*OCDirectPairingCB)(void *ctx, OCDPDev_t *peer, OCStackResult result);
+//#endif // DIRECT_PAIRING
+
 #ifdef __cplusplus
 }
 #endif // __cplusplus