replace : iotivity -> iotivity-sec
[platform/upstream/iotivity.git] / resource / include / OCResource.h
index cf9bded..e1f7bc6 100644 (file)
 //
 //-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
 
-/// @file OCResource.h
+/**
+ * @file
+ *
+ * This file contains the declaration of classes and its members related to
+ * Resource.
+ */
 
-/// @brief  This file contains the declaration of classes and its members related to
-///         Resource.
-
-#ifndef __OCRESOURCE_H
-#define __OCRESOURCE_H
+#ifndef OC_RESOURCE_H_
+#define OC_RESOURCE_H_
 
 #include <memory>
 #include <random>
 
 namespace OC
 {
+    class OCResource;
+    class OCResourceIdentifier;
+    std::ostream& operator <<(std::ostream& os, const OCResourceIdentifier& ri);
+    /**
+    *  @brief  OCResourceIdentifier represents the identity information for a server. This
+    *          object combined with the OCResource's URI property uniquely identify an
+    *          OCResource on or across networks.
+    *          Equality operators are implemented.  However, internal representation is subject
+    *          to change and thus should not be accessed or depended on.
+    */
+    class OCResourceIdentifier
+    {
+        friend class OCResource;
+        friend std::ostream& operator <<(std::ostream& os, const OCResourceIdentifier& ri);
+
+        public:
+            OCResourceIdentifier() = delete;
+
+            OCResourceIdentifier(const OCResourceIdentifier&) = default;
+
+#if defined(_MSC_VER) && (_MSC_VER < 1900)
+            OCResourceIdentifier(OCResourceIdentifier&& o):
+                m_resourceUri(std::move(o.m_resourceUri)),
+                m_representation(o.m_representation)
+            {
+            }
+#else
+            OCResourceIdentifier(OCResourceIdentifier&&) = default;
+#endif
+
+            OCResourceIdentifier& operator=(const OCResourceIdentifier&) = delete;
+
+            OCResourceIdentifier& operator=(OCResourceIdentifier&&) = delete;
+
+            bool operator==(const OCResourceIdentifier &other) const;
+
+            bool operator!=(const OCResourceIdentifier &other) const;
+
+            bool operator<(const OCResourceIdentifier &other) const;
+
+            bool operator>(const OCResourceIdentifier &other) const;
+
+            bool operator<=(const OCResourceIdentifier &other) const;
+
+            bool operator>=(const OCResourceIdentifier &other) const;
+
+        private:
+
+            OCResourceIdentifier(const std::string& wireServerIdentifier,
+                    const std::string& resourceUri );
+
+        private:
+            std::string m_representation;
+            const std::string& m_resourceUri;
+    };
+
     /**
     *   @brief  OCResource represents an OC resource. A resource could be a light controller,
     *           temperature sensor, smoke detector, etc. A resource comes with a well-defined
@@ -52,6 +110,35 @@ namespace OC
     friend class ListenOCContainer;
     public:
         typedef std::shared_ptr<OCResource> Ptr;
+
+#if defined(_MSC_VER) && (_MSC_VER < 1900)
+        OCResource(OCResource&& o):
+            m_clientWrapper(std::move(o.m_clientWrapper)),
+            m_uri(std::move(o.m_uri)),
+            m_resourceId(std::move(o.m_resourceId)),
+            m_devAddr(std::move(o.m_devAddr)),
+            m_deviceName(std::move(o.m_deviceName)),
+            m_useHostString(o.m_useHostString),
+            m_property(o.m_property),
+            m_isCollection(o.m_isCollection),
+            m_resourceTypes(std::move(o.m_resourceTypes)),
+            m_interfaces(std::move(o.m_interfaces)),
+            m_children(std::move(m_children)),
+            m_observeHandle(std::move(m_observeHandle)),
+            m_headerOptions(std::move(m_headerOptions))
+        {
+        }
+#else
+        OCResource(OCResource&&) = default;
+#endif
+        // Explicitly delete the copy ctor since VS2013 would try to generate one, and
+        // the standard says that defaulting the move ctor should delete the copy ctor.
+        OCResource(const OCResource&) = delete;
+
+        // We cannot support copy/move assigns since OCResourceIdentifier doesn't.
+        OCResource& operator=(OCResource&&) = delete;
+        OCResource& operator=(const OCResource&) = delete;
+
         /**
         * Virtual destructor
         */
@@ -64,11 +151,21 @@ namespace OC
         *        The callback function will be invoked with a map of attribute name and values.
         *        The callback function will also have the result from this Get operation
         *        This will have error codes
-        * @param QualityOfService the quality of communication
-        * @return OCStackResult return value of this API. Returns OC_STACK_OK if success.
-        * NOTE: OCStackResult is defined in ocstack.h.
+        * @return Returns  ::OC_STACK_OK on success, some other value upon failure.
+        * @note OCStackResult is defined in ocstack.h.
         */
         OCStackResult get(const QueryParamsMap& queryParametersMap, GetCallback attributeHandler);
+        /**
+        * Function to get the attributes of a resource.
+        * @param queryParametersMap map which can have the query parameter name and value
+        * @param attributeHandler handles callback
+        *        The callback function will be invoked with a map of attribute name and values.
+        *        The callback function will also have the result from this Get operation
+        *        This will have error codes
+        * @param QoS the quality of communication
+        * @return Returns  ::OC_STACK_OK on success, some other value upon failure.
+        * @note OCStackResult is defined in ocstack.h.
+        */
         OCStackResult get(const QueryParamsMap& queryParametersMap, GetCallback attributeHandler,
                           QualityOfService QoS);
 
@@ -84,33 +181,68 @@ namespace OC
         *        resource container (list will be empty if not a container)
         *        The callback function will also have the result from this Get operation. This will
         *        have error codes
-        * @param QualityOfService the quality of communication
-        * @return OCStackResult return value of this API. Returns OC_STACK_OK if success. <br>
-        * NOTE: OCStackResult is defined in ocstack.h.<br>
-        * <b>Example:</b><br>
+        * @return Returns  ::OC_STACK_OK on success, some other value upon failure.
+        * @note OCStackResult is defined in ocstack.h.
+        * @par Example:
         * Consider resource "a/home" (with link interface and resource type as home) contains links
         *  to "a/kitchen" and "a/room".
-        * Step 1: get("home", Link_Interface, &onGet)<br>
+        * -# get("home", Link_Interface, &onGet)
+        * @par
         * Callback onGet will receive a) Empty attribute map because there are no attributes for
         * a/home b) list with
         * full URI of "a/kitchen" and "a/room" resources and their properties c) error code for GET
-        * operation<br>
-        * NOTE: A resource may contain single or multiple resource types. Also, a resource may
-        * contain single or multiple interfaces.<br>
+        * operation
+        * @note A resource may contain single or multiple resource types. Also, a resource may
+        * contain single or multiple interfaces.
         * Currently, single GET request is allowed to do operate on single resource type or resource
-        * interface. In future, a single GET <br>
-        * can operate on multiple resource types and interfaces. <br>
-        * NOTE: A client can traverse a tree or graph by doing successive GETs on the returned
-        * resources at a node.<br>
+        * interface. In future, a single GET
+        * can operate on multiple resource types and interfaces.
+        * @note A client can traverse a tree or graph by doing successive GETs on the returned
+        * resources at a node.
+        *
         */
         OCStackResult get(const std::string& resourceType, const std::string& resourceInterface,
                         const QueryParamsMap& queryParametersMap, GetCallback attributeHandler);
+        /**
+        * Function to get the attributes of a resource.
+        *
+        * @param resourceType resourceType of the resource operate on
+        * @param resourceInterface interface type of the resource to operate on
+        * @param queryParametersMap map which can have the query parameter name and value
+        * @param attributeHandler handles callback
+        *        The callback function will be invoked with a map of attribute name and values.
+        *        The callback function will be invoked with a list of URIs if 'get' is invoked on a
+        *        resource container (list will be empty if not a container)
+        *        The callback function will also have the result from this Get operation. This will
+        *        have error codes
+        * @param QoS the quality of communication
+        * @return Returns  ::OC_STACK_OK on success, some other value upon failure.
+        * note OCStackResult is defined in ocstack.h.
+        * @par Example:
+        * Consider resource "a/home" (with link interface and resource type as home) contains links
+        *  to "a/kitchen" and "a/room".
+        * -# get("home", Link_Interface, &onGet)
+        * @par
+        * Callback onGet will receive a) Empty attribute map because there are no attributes for
+        * a/home b) list with
+        * full URI of "a/kitchen" and "a/room" resources and their properties c) error code for GET
+        * operation
+        * @note A resource may contain single or multiple resource types. Also, a resource may
+        * contain single or multiple interfaces.
+        * Currently, single GET request is allowed to do operate on single resource type or resource
+        * interface. In future, a single GET
+        * can operate on multiple resource types and interfaces.
+        * @note A client can traverse a tree or graph by doing successive GETs on the returned
+        * resources at a node.
+        *
+        */
         OCStackResult get(const std::string& resourceType, const std::string& resourceInterface,
                         const QueryParamsMap& queryParametersMap, GetCallback attributeHandler,
                         QualityOfService QoS);
 
         /**
         * Function to set the representation of a resource (via PUT)
+        *
         * @param representation which can either have all the attribute names and values
                  (which will represent entire state of the resource) or a
         *        set of attribute names and values which needs to be modified
@@ -119,18 +251,35 @@ namespace OC
         *        This will have error codes
         * @param queryParametersMap map which can have the query parameter name and value
         * @param attributeHandler attribute handler
-        * @param QualityOfService the quality of communication
-        * @return OCStackResult return value of this API. Returns OC_STACK_OK if success.
-        * NOTE: OCStackResult is defined in ocstack.h.
+        * @return Returns  ::OC_STACK_OK on success, some other value upon failure.
+        * @note OCStackResult is defined in ocstack.h.
+        *
         */
         OCStackResult put(const OCRepresentation& representation,
                         const QueryParamsMap& queryParametersMap, PutCallback attributeHandler);
+        /**
+        * Function to set the representation of a resource (via PUT)
+        *
+        * @param representation which can either have all the attribute names and values
+                 (which will represent entire state of the resource) or a
+        *        set of attribute names and values which needs to be modified
+        *        The callback function will be invoked with a map of attribute name and values.
+        *        The callback function will also have the result from this Put operation
+        *        This will have error codes
+        * @param queryParametersMap map which can have the query parameter name and value
+        * @param attributeHandler attribute handler
+        * @param QoS the quality of communication
+        * @return Returns  ::OC_STACK_OK on success, some other value upon failure.
+        * @note OCStackResult is defined in ocstack.h.
+        *
+        */
         OCStackResult put(const OCRepresentation& representation,
                         const QueryParamsMap& queryParametersMap, PutCallback attributeHandler,
                         QualityOfService QoS);
 
         /**
         * Function to set the attributes of a resource (via PUT)
+        *
         * @param resourceType resource type of the resource to operate on
         * @param resourceInterface interface type of the resource to operate on
         * @param representation representation of the resource
@@ -143,39 +292,74 @@ namespace OC
         *        and values
         *        (which will represent entire state of the resource) or a
         *        set of attribute names and values which needs to be modified
-        * @param QualityOfService the quality of communication
-        * @return OCStackResult return value of this API. Returns OC_STACK_OK if success. <br>
-        * NOTE: OCStackResult is defined in ocstack.h. <br>
+        * @return Returns  ::OC_STACK_OK on success, some other value upon failure.
+        * @note OCStackResult is defined in ocstack.h.
+        *
         */
         OCStackResult put(const std::string& resourceType, const std::string& resourceInterface,
                         const OCRepresentation& representation, const QueryParamsMap& queryParametersMap,
                         PutCallback attributeHandler);
+        /**
+        * Function to set the attributes of a resource (via PUT)
+        * @param resourceType resource type of the resource to operate on
+        * @param resourceInterface interface type of the resource to operate on
+        * @param representation representation of the resource
+        * @param queryParametersMap Map which can have the query parameter name and value
+        * @param attributeHandler attribute handler
+        *        The callback function will be invoked with a map of attribute name and values.
+        *        The callback function will also have the result from this Put operation
+        *        This will have error codes.
+        *        The Representation parameter maps which can either have all the attribute names
+        *        and values
+        *        (which will represent entire state of the resource) or a
+        *        set of attribute names and values which needs to be modified
+        * @param QoS the quality of communication
+        * @return Returns  ::OC_STACK_OK on success, some other value upon failure.
+        * @note OCStackResult is defined in ocstack.h.
+        *
+        */
         OCStackResult put(const std::string& resourceType, const std::string& resourceInterface,
                         const OCRepresentation& representation, const QueryParamsMap& queryParametersMap,
                         PutCallback attributeHandler, QualityOfService QoS);
 
         /**
         * Function to post on a resource
+        *
         * @param representation which can either have all the attribute names and values
-                 (which will represent entire state of the resource) or a
+        *        (which will represent entire state of the resource) or a
         *        set of attribute names and values which needs to be modified
         *        The callback function will be invoked with a map of attribute name and values.
         *        The callback function will also have the result from this Put operation
         *        This will have error codes
         * @param queryParametersMap map which can have the query parameter name and value
         * @param attributeHandler attribute handler
-        * @param QualityOfService the quality of communication
-        * @return OCStackResult return value of this API. Returns OC_STACK_OK if success.
-        * NOTE: OCStackResult is defined in ocstack.h.
+        * @return Returns  ::OC_STACK_OK on success, some other value upon failure.
+        * @note OCStackResult is defined in ocstack.h.
         */
         OCStackResult post(const OCRepresentation& representation,
                         const QueryParamsMap& queryParametersMap, PostCallback attributeHandler);
+        /**
+        * Function to post on a resource
+        *
+        * @param representation which can either have all the attribute names and values
+        *        (which will represent entire state of the resource) or a
+        *        set of attribute names and values which needs to be modified
+        *        The callback function will be invoked with a map of attribute name and values.
+        *        The callback function will also have the result from this Put operation
+        *        This will have error codes
+        * @param queryParametersMap map which can have the query parameter name and value
+        * @param attributeHandler attribute handler
+        * @param QoS the quality of communication
+        * @return Returns  ::OC_STACK_OK on success, some other value upon failure.
+        * @note OCStackResult is defined in ocstack.h.
+        */
         OCStackResult post(const OCRepresentation& representation,
                         const QueryParamsMap& queryParametersMap, PostCallback attributeHandler,
                         QualityOfService QoS);
 
         /**
         * Function to post on a resource
+        *
         * @param resourceType resource type of the resource to operate on
         * @param resourceInterface interface type of the resource to operate on
         * @param representation representation of the resource
@@ -188,49 +372,88 @@ namespace OC
         *        and values
         *        (which will represent entire state of the resource) or a
         *        set of attribute names and values which needs to be modified
-        * @param QualityOfService the quality of communication
-        * @return OCStackResult return value of this API. Returns OC_STACK_OK if success. <br>
-        * NOTE: OCStackResult is defined in ocstack.h. <br>
+        * @return Returns  ::OC_STACK_OK on success, some other value upon failure.
+        * @note OCStackResult is defined in ocstack.h.
+        *
         */
         OCStackResult post(const std::string& resourceType, const std::string& resourceInterface,
                         const OCRepresentation& representation, const QueryParamsMap& queryParametersMap,
                         PostCallback attributeHandler);
+        /**
+        * Function to post on a resource
+        *
+        * @param resourceType resource type of the resource to operate on
+        * @param resourceInterface interface type of the resource to operate on
+        * @param representation representation of the resource
+        * @param queryParametersMap Map which can have the query parameter name and value
+        * @param attributeHandler attribute handler
+        *        The callback function will be invoked with a map of attribute name and values.
+        *        The callback function will also have the result from this Put operation
+        *        This will have error codes.
+        *        The Representation parameter maps which can either have all the attribute names
+        *        and values
+        *        (which will represent entire state of the resource) or a
+        *        set of attribute names and values which needs to be modified
+        * @param QoS the quality of communication
+        * @return Returns  ::OC_STACK_OK on success, some other value upon failure.
+        * @note OCStackResult is defined in ocstack.h.
+        *
+        */
         OCStackResult post(const std::string& resourceType, const std::string& resourceInterface,
                         const OCRepresentation& representation, const QueryParamsMap& queryParametersMap,
                         PostCallback attributeHandler, QualityOfService QoS);
 
         /**
         * Function to perform DELETE operation
-        * @param observeHandler handles callback
+        *
+        * @param deleteHandler handles callback
         *        The callback function will have headerOptions and result from this Delete
         *        operation. This will have error codes
-        * @return OCStackResult return value of this API. Returns OC_STACK_OK if success.
-        * NOTE: OCStackResult is defined in ocstack.h.
+        * @return Returns  ::OC_STACK_OK on success, some other value upon failure.
+        * @note OCStackResult is defined in ocstack.h.
+        *
         */
         OCStackResult deleteResource(DeleteCallback deleteHandler);
         OCStackResult deleteResource(DeleteCallback deleteHandler, QualityOfService QoS);
 
         /**
         * Function to set observation on the resource
+        *
         * @param observeType allows the client to specify how it wants to observe.
         * @param queryParametersMap map which can have the query parameter name and value
         * @param observeHandler handles callback
         *        The callback function will be invoked with a map of attribute name and values.
         *        The callback function will also have the result from this observe operation
         *        This will have error codes
-        * @param QualityOfService the quality of communication
-        * @return OCStackResult return value of this API. Returns OC_STACK_OK if success.
-        * NOTE: OCStackResult is defined in ocstack.h.
+        * @return Returns  ::OC_STACK_OK on success, some other value upon failure.
+        * @note OCStackResult is defined in ocstack.h.
+        *
         */
         OCStackResult observe(ObserveType observeType, const QueryParamsMap& queryParametersMap,
                         ObserveCallback observeHandler);
+        /**
+        * Function to set observation on the resource
+        *
+        * @param observeType allows the client to specify how it wants to observe.
+        * @param queryParametersMap map which can have the query parameter name and value
+        * @param observeHandler handles callback
+        *        The callback function will be invoked with a map of attribute name and values.
+        *        The callback function will also have the result from this observe operation
+        *        This will have error codes
+        * @param qos the quality of communication
+        * @return Returns  ::OC_STACK_OK on success, some other value upon failure.
+        * @note OCStackResult is defined in ocstack.h.
+        *
+        */
         OCStackResult observe(ObserveType observeType, const QueryParamsMap& queryParametersMap,
                         ObserveCallback observeHandler, QualityOfService qos);
 
         /**
         * Function to cancel the observation on the resource
-        * @return OCStackResult return value of this API. Returns OC_STACK_OK if success.
-        * NOTE: OCStackResult is defined in ocstack.h.
+        *
+        * @return Returns  ::OC_STACK_OK on success, some other value upon failure.
+        * @note OCStackResult is defined in ocstack.h.
+        *
         */
         OCStackResult cancelObserve();
         OCStackResult cancelObserve(QualityOfService qos);
@@ -240,47 +463,62 @@ namespace OC
         * @param headerOptions std::vector where header information(header optionID and optionData
         * is passed
         *
-        * NOTE: Once the headers information is set, it will be applicable to GET, PUT and observe
-        * request. <br>
+        * @note Once the headers information is set, it will be applicable to GET, PUT and observe
+        * request.
         * setHeaderOptions can be used multiple times if headers need to be modifed by the client.
         * Latest headers will be used to send in the request. <br>
-        * NOTE: Initial support is only for two headers. If headerMap consists of more than two
+        * @note Initial support is only for two headers. If headerMap consists of more than two
         * header options, they will be ignored. <br>
         * Use unsetHeaderOptions API to clear the header information.
         */
-        void setHeaderOptions(const HeaderOptions& headerOptions)
-        {
-            m_headerOptions = headerOptions;
-        }
+        void setHeaderOptions(const HeaderOptions& headerOptions);
 
         /**
         * Function to unset header options.
         */
-        void unsetHeaderOptions()
-        {
-            m_headerOptions.clear();
-        }
+        void unsetHeaderOptions();
 
         /**
         * Function to get the host address of this resource
         * @return std::string host address
-        * NOTE: This might or might not be exposed in future due to security concerns
+        * @note This might or might not be exposed in future due to security concerns
         */
         std::string host() const;
 
         /**
+        * Function to set host address information.
+        *
+        * @param host std::string host address
+        *             optionally one of
+        *                   CoAP over UDP prefix    "coap://"
+        *                   CoAP over TCP prefix    "coap+tcp://"
+        *                   CoAP over DTLS prefix   "coaps://"
+        *                   CoAP over TLS prefix    "coaps+tcp://"
+        *                   CoAP over RFCOMM prefix "coap+rfcomm://"
+        *                   CoAP over GATT prefix   "coap+gatt://"
+        *             optionally one of
+        *                   IPv6 address            "[1234::5678]"
+        *                   IPv4 address            "192.168.1.1"
+        *             optional port               ":5683"
+        *
+        * @note This should be in the format coap://address:port.
+        *       If host has different connectivity type with a given OCResource object
+        *       which was discovered after calling findResource API, raise an exception on failure.
+        *
+        */
+        void setHost(const std::string& host);
+
+        /**
         * Function to get the URI for this resource
         * @return std::string resource URI
         */
         std::string uri() const;
 
-#ifdef CA_INT
         /**
         * Function to get the connectivity type of this resource
-        * @return uint8_t connectivity type
+        * @return enum connectivity type (flags and adapter)
         */
-        uint8_t connectivityType() const;
-#endif
+        OCConnectivityType connectivityType() const;
 
         /**
         * Function to provide ability to check if this resource is observable or not
@@ -288,54 +526,201 @@ namespace OC
         *         not observable.
         */
         bool isObservable() const;
+        
+        OCDevAddr getDevAddr() const;
+
+#ifdef WITH_MQ
+        /**
+        * Function to provide ability to check if this resource is publisher or not
+        * @return bool true indicates resource is publisher; false indicates resource is
+        *         not publisher.
+        */
+        bool isPublish() const;
+#endif
 
         /**
         * Function to get the list of resource types
         * @return vector of resource types
         */
-        std::vector<std::string> getResourceTypes() const
-        {
-            return m_resourceTypes;
-        }
+        std::vector<std::string> getResourceTypes() const;
 
         /**
         * Function to get the list of resource interfaces
         * @return vector of resource interface
         */
-        std::vector<std::string> getResourceInterfaces(void) const
-        {
-            return m_interfaces;
-        }
+        std::vector<std::string> getResourceInterfaces(void) const;
+
+        // TODO-CA Revisit this since we are exposing two identifiers
+        /**
+        * Function to get a unique identifier for this
+        * resource across network interfaces.  This will
+        * be guaranteed unique for every resource-per-server
+        * independent of how this was discovered.
+        * @return OCResourceIdentifier object, which can
+        * be used for all comparison and hashing.
+        */
+        OCResourceIdentifier uniqueIdentifier() const;
+
+        /**
+        * Function to get a string representation of the resource's server ID.
+        * This is unique per- server independent on how it was discovered.
+        * @note The format of the return value is subject to change and will
+        * likely change both in size and contents in the future.
+        */
+        std::string sid() const;
+
+        /**
+        * Function to get a string representation of the human friendly name defined by the vendor.
+        * @note The format of the return value is subject to change and will
+        * likely change both in size and contents in the future.
+        */
+        std::string deviceName() const;
+
+#ifdef WITH_MQ
+        /**
+        * Function to discovery Topics from MQ Broker.
+        *
+        * @param queryParametersMap map which can have the query parameter name and value
+        * @param attributeHandler handles callback
+        * @param qos the quality of communication
+        *
+        * @return Returns  ::OC_STACK_OK on success, some other value upon failure.
+        * @note OCStackResult is defined in ocstack.h.
+        *
+        */
+        OCStackResult discoveryMQTopics(const QueryParamsMap& queryParametersMap,
+                                        MQTopicCallback attributeHandler,
+                                        QualityOfService qos);
+        /**
+        * Function to create Topic into MQ Broker.
+        * SubTopic is also created through this method.
+        *
+        * @param rep representation of the topic
+        * @param topicUri new uri of the topic which want to create
+        * @param queryParametersMap map which can have the query parameter name and value
+        * @param attributeHandler handles callback
+        * @param qos the quality of communication
+        *
+        * @return Returns  ::OC_STACK_OK on success, some other value upon failure.
+        * @note OCStackResult is defined in ocstack.h.
+        *
+        */
+        OCStackResult createMQTopic(const OCRepresentation& rep,
+                                    const std::string& topicUri,
+                                    const QueryParamsMap& queryParametersMap,
+                                    MQTopicCallback attributeHandler,
+                                    QualityOfService qos);
+#endif
+#ifdef MQ_SUBSCRIBER
+        /**
+        * Function to subscribe Topic to MQ Broker.
+        *
+        * @param observeType allows the client to specify how it wants to observe.
+        * @param queryParametersMap map which can have the query parameter name and value
+        * @param observeHandler handles callback
+        * @param qos the quality of communication
+        *
+        * @return Returns  ::OC_STACK_OK on success, some other value upon failure.
+        * @note OCStackResult is defined in ocstack.h.
+        *
+        */
+        OCStackResult subscribeMQTopic(ObserveType observeType,
+                                       const QueryParamsMap& queryParametersMap,
+                                       ObserveCallback observeHandler,
+                                       QualityOfService qos);
+
+        /**
+        * Function to unsubscribe Topic to MQ Broker.
+        *
+        * @param qos the quality of communication
+        *
+        * @return Returns  ::OC_STACK_OK on success, some other value upon failure.
+        * @note OCStackResult is defined in ocstack.h.
+        *
+        */
+        OCStackResult unsubscribeMQTopic(QualityOfService qos);
+
+        /**
+        * Function to request publish to MQ publisher.
+        * Publisher can confirm the request message as key:"req_pub" and value:"true".
+        *
+        * @param queryParametersMap map which can have the query parameter name and value
+        * @param attributeHandler handles callback
+        * @param qos the quality of communication
+        *
+        * @return Returns  ::OC_STACK_OK on success, some other value upon failure.
+        * @note OCStackResult is defined in ocstack.h.
+        *
+        */
+        OCStackResult requestMQPublish(const QueryParamsMap& queryParametersMap,
+                                       PostCallback attributeHandler,
+                                       QualityOfService qos);
+#endif
+#ifdef MQ_PUBLISHER
+        /**
+        * Function to publish Topic information into MQ Broker.
+        *
+        * @param rep representation of the topic
+        * @param queryParametersMap map which can have the query parameter name and value
+        * @param attributeHandler handles callback
+        * @param qos the quality of communication
+        *
+        * @return Returns  ::OC_STACK_OK on success, some other value upon failure.
+        * @note OCStackResult is defined in ocstack.h.
+        *
+        */
+        OCStackResult publishMQTopic(const OCRepresentation& rep,
+                                     const QueryParamsMap& queryParametersMap,
+                                     PostCallback attributeHandler,
+                                     QualityOfService qos);
+#endif
+        // overloaded operators allow for putting into a 'set'
+        // the uniqueidentifier allows for putting into a hash
+        bool operator==(const OCResource &other) const;
+
+        bool operator!=(const OCResource &other) const;
+
+        bool operator<(const OCResource &other) const;
+
+        bool operator>(const OCResource &other) const;
+
+        bool operator<=(const OCResource &other) const;
+
+        bool operator>=(const OCResource &other) const;
 
     private:
         std::weak_ptr<IClientWrapper> m_clientWrapper;
         std::string m_uri;
-        std::string m_host;
-#ifdef CA_INT
-        uint8_t m_connectivityType;
-#endif
-        bool m_isObservable;
+        OCResourceIdentifier m_resourceId;
+        OCDevAddr m_devAddr;
+        bool m_useHostString;
         bool m_isCollection;
+        uint8_t m_property;
         std::vector<std::string> m_resourceTypes;
         std::vector<std::string> m_interfaces;
         std::vector<std::string> m_children;
         OCDoHandle m_observeHandle;
+        std::string m_deviceName;
         HeaderOptions m_headerOptions;
 
     private:
-#ifdef CA_INT
-        OCResource(std::weak_ptr<IClientWrapper> clientWrapper, const std::string& host,
-            const std::string& uri, uint8_t m_connectivityType, bool observable,
-            const std::vector<std::string>& resourceTypes,
-            const std::vector<std::string>& interfaces);
-#else
-        OCResource(std::weak_ptr<IClientWrapper> clientWrapper, const std::string& host,
-            const std::string& uri, bool observable,
-            const std::vector<std::string>& resourceTypes,
-            const std::vector<std::string>& interfaces);
-#endif
+        OCResource(std::weak_ptr<IClientWrapper> clientWrapper,
+                    const OCDevAddr& devAddr, const std::string& uri,
+                    const std::string& serverId, uint8_t property,
+                    const std::vector<std::string>& resourceTypes,
+                    const std::vector<std::string>& interfaces,
+                    const std::string& deviceName);
+
+        OCResource(std::weak_ptr<IClientWrapper> clientWrapper,
+                    const std::string& host, const std::string& uri,
+                    const std::string& serverId,
+                    OCConnectivityType connectivityType, uint8_t property,
+                    const std::vector<std::string>& resourceTypes,
+                    const std::vector<std::string>& interfaces,
+                    const std::string& deviceName);
     };
 
 } // namespace OC
 
-#endif //__OCRESOURCE_H
+#endif // OC_RESOURCE_H
+