Update snapshot(2017-10-11)
[platform/upstream/iotivity.git] / resource / csdk / stack / include / internal / ocobserve.h
index 284cfba..b057497 100644 (file)
@@ -96,6 +96,18 @@ typedef struct ResourceObserver
 
 } ResourceObserver;
 
+/**
+ *  Initialize observer list.
+ *
+ * @return ::OC_STACK_OK on success, some other value upon failure.
+ */
+OCStackResult InitializeObseverList();
+
+/**
+ *  Terminate observer list.
+ */
+void TerminateObserverList();
+
 #ifdef WITH_PRESENCE
 /**
  * Create an observe response and send to all observers in the observe list.
@@ -208,6 +220,7 @@ OCStackResult DeleteObserverUsingDevAddr(const OCDevAddr *devAddr);
  * @param tokenLength      Length of token.
  *
  * @return Pointer to found observer.
+ * This is copy of observer, caller must release its memory using FreeObserver().
  */
 ResourceObserver* GetObserverUsingToken (const CAToken_t token, uint8_t tokenLength);
 
@@ -217,10 +230,20 @@ ResourceObserver* GetObserverUsingToken (const CAToken_t token, uint8_t tokenLen
  * @param observeId        Observer ID to search for.
  *
  * @return Pointer to found observer.
+ * This is copy of observer, caller must release its memory using FreeObserver().
  */
 ResourceObserver* GetObserverUsingId (const OCObservationId observeId);
 
 /**
+ * Search the list of observers for the specified observe ID.
+ *
+ * @param observeId        Observer ID to search for.
+ *
+ * @return true if observer found matched with observer ID, otherwise false.
+ */
+bool IsObserverAvailable (const OCObservationId observeId);
+
+/**
  *  Add observe header option to a request.
  *
  * @param caHdrOpt        Target request CA header option.
@@ -255,5 +278,12 @@ GetObserveHeaderOption (uint32_t * observationOption,
                         CAHeaderOption_t *options,
                         uint8_t * numOptions);
 
+/**
+ *  Free memory associated with observer.
+ *
+ * @param obsNode        Observer to be freed.
+ */
+void FreeObserver (ResourceObserver* obsNode);
+
 #endif //OC_OBSERVE_H