osaf/libs/agents/saf/ntfa/ntfa.h      |    3 +
 osaf/libs/agents/saf/ntfa/ntfa_api.c  |  207 +++++++++++++++++++++++++++++++++-
 osaf/libs/agents/saf/ntfa/ntfa_mds.c  |   52 ++++++++
 osaf/libs/agents/saf/ntfa/ntfa_util.c |    3 +
 4 files changed, 260 insertions(+), 5 deletions(-)


Changes include:
-maintain SAF version.
-minor version is updated from 01 to 02.
-ntfa will get NTFSV_CLM_NODE_STATUS_CALLBACK from NTFS for membership status 
of node.
-check is included in all apis, excluding saNTfFinalize(), to return 
SA_AIS_ERR_UNAVAILABLE
 if node loses CLM membership.

diff --git a/osaf/libs/agents/saf/ntfa/ntfa.h b/osaf/libs/agents/saf/ntfa/ntfa.h
--- a/osaf/libs/agents/saf/ntfa/ntfa.h
+++ b/osaf/libs/agents/saf/ntfa/ntfa.h
@@ -113,7 +113,9 @@ typedef struct ntfa_client_hdl_rec {
        ntfa_filter_hdl_rec_t *filter_list;     /* List of allocated filters */
        ntfa_reader_hdl_rec_t *reader_list;
        SYSF_MBX mbx;           /* priority q mbx b/w MDS & Library */
+       bool is_stale_client;  /* Status of client based on the CLM status of 
node.*/
        struct ntfa_client_hdl_rec *next;       /* next pointer for the list in 
ntfa_cb_t */
+       SaVersionT version;   /*Remember version of client (for future use.)*/
 } ntfa_client_hdl_rec_t;
 
 /*
@@ -132,6 +134,7 @@ typedef struct {
        int ntfs_sync_awaited;
        NCS_SEL_OBJ ntfs_sync_sel;
        SaUint32T ntf_var_data_limit;   /* max allowed variableDataSize */
+       SaClmClusterChangesT clm_node_state /*Reflects of the CLM status of 
this node(for future use).*/;
 } ntfa_cb_t;
 
 /* ntfa_saf_api.c */
diff --git a/osaf/libs/agents/saf/ntfa/ntfa_api.c 
b/osaf/libs/agents/saf/ntfa/ntfa_api.c
--- a/osaf/libs/agents/saf/ntfa/ntfa_api.c
+++ b/osaf/libs/agents/saf/ntfa/ntfa_api.c
@@ -915,7 +915,8 @@ SaAisErrorT saNtfInitialize(SaNtfHandleT
        if ((version->releaseCode == NTF_RELEASE_CODE) && 
(version->majorVersion <= NTF_MAJOR_VERSION) &&
            (0 < version->majorVersion)) {
                version->majorVersion = NTF_MAJOR_VERSION;
-               version->minorVersion = NTF_MINOR_VERSION;
+               if (version->minorVersion != NTF_MINOR_VERSION_0)
+                       version->minorVersion = NTF_MINOR_VERSION;
        } else {
                TRACE("version FAILED, required: %c.%u.%u, supported: 
%c.%u.%u\n",
                      version->releaseCode, version->majorVersion, 
version->minorVersion,
@@ -963,6 +964,10 @@ SaAisErrorT saNtfInitialize(SaNtfHandleT
        if (SA_AIS_OK != o_msg->info.api_resp_info.rc) {
                rc = o_msg->info.api_resp_info.rc;
                TRACE("NTFS return FAILED");
+               /*Check CLM membership of node.*/
+               if (rc == SA_AIS_ERR_UNAVAILABLE) {
+                       TRACE("Node not CLM member or stale client");
+               }
                goto err;
        }
 
@@ -977,7 +982,7 @@ SaAisErrorT saNtfInitialize(SaNtfHandleT
                rc = SA_AIS_ERR_NO_MEMORY;
                goto err;
        }
-
+       ntfa_hdl_rec->version = *version;
        /* pass the handle value to the appl */
        if (SA_AIS_OK == rc)
                *ntfHandle = ntfa_hdl_rec->local_hdl;
@@ -1044,7 +1049,13 @@ SaAisErrorT saNtfSelectionObjectGet(SaNt
                rc = SA_AIS_ERR_BAD_HANDLE;
                goto done;
        }
-
+       /*Check CLM membership of node.*/
+       if (hdl_rec->is_stale_client == true) {
+               TRACE("Node not CLM member or stale client");
+               ncshm_give_hdl(ntfHandle);
+               rc = SA_AIS_ERR_UNAVAILABLE;
+               goto done;
+       }
        /* Obtain the selection object from the IPC queue */
        sel_obj = m_NCS_IPC_GET_SEL_OBJ(&hdl_rec->mbx);
 
@@ -1101,6 +1112,14 @@ SaAisErrorT saNtfDispatch(SaNtfHandleT n
                goto done;
        }
 
+       /*Check CLM membership of node.*/
+       if (hdl_rec->is_stale_client == true) {
+               TRACE("Node not CLM member or stale client");
+               ncshm_give_hdl(ntfHandle);
+               rc = SA_AIS_ERR_UNAVAILABLE;
+               goto done;
+       }
+
        if ((rc = ntfa_hdl_cbk_dispatch(&ntfa_cb, hdl_rec, dispatchFlags)) != 
SA_AIS_OK)
                TRACE("NTFA_DISPATCH_FAILURE");
 
@@ -1265,6 +1284,14 @@ SaAisErrorT saNtfAlarmNotificationAlloca
     /**                 Lock ntfa_CB                 **/
        osafassert(pthread_mutex_lock(&ntfa_cb.cb_lock) == 0);
 
+       /*Check CLM membership of node.*/
+       if (hdl_rec->is_stale_client == true) {
+               TRACE("Node not CLM member or stale client");
+               osafassert(pthread_mutex_unlock(&ntfa_cb.cb_lock) == 0);
+               rc = SA_AIS_ERR_UNAVAILABLE;
+               goto done_give_hdl;
+       }
+
     /** Allocate an ntfa_LOG_STREAM_HDL_REC structure and insert this
      *  into the list of channel hdl record.
      **/
@@ -1347,6 +1374,13 @@ SaAisErrorT saNtfNotificationFree(SaNtfN
                rc = SA_AIS_ERR_BAD_HANDLE;
                goto done_give_hdl;
        }
+       /*Check CLM membership of node.*/
+       if (client_rec->is_stale_client == true) {
+               TRACE("Node not CLM member or stale client");
+               ncshm_give_hdl(client_handle);
+               rc = SA_AIS_ERR_UNAVAILABLE;
+               goto done_give_hdl;
+       }
 
        /* free the resources allocated by saNtf<ntfType>NotificationAllocate */
        ntfa_hdl_rec_destructor(notification_hdl_rec);
@@ -1417,6 +1451,14 @@ SaAisErrorT saNtfNotificationSend(SaNtfN
                rc = SA_AIS_ERR_BAD_HANDLE;
                goto done_give_hdl;
        }
+       /*Check CLM membership of node.*/
+       if (client_rec->is_stale_client == true) {
+               TRACE("Node not CLM member or stale client");
+               rc = SA_AIS_ERR_UNAVAILABLE;
+               osafassert(pthread_mutex_unlock(&ntfa_cb.cb_lock) == 0);
+               ncshm_give_hdl(client_handle);
+               goto done_give_hdl;
+       }
        osafassert(pthread_mutex_unlock(&ntfa_cb.cb_lock) == 0);
 
     /**
@@ -1515,6 +1557,10 @@ SaAisErrorT saNtfNotificationSend(SaNtfN
        if (SA_AIS_OK != o_msg->info.api_resp_info.rc) {
                rc = o_msg->info.api_resp_info.rc;
                TRACE("Bad return status!!! rc = %d", rc);
+               /*Check CLM membership of node.*/
+               if (rc == SA_AIS_ERR_UNAVAILABLE) {
+                       TRACE("Node not CLM member or stale client");
+               }
                goto done_give_hdls;
        }
        /* Return the notificationId to client from right notification */
@@ -1674,6 +1720,12 @@ SaAisErrorT saNtfNotificationSubscribe(c
                goto done;
        }
        
+       /*Check CLM membership of node.*/
+       if (client_hdl_rec->is_stale_client == true) {
+               TRACE("Node not CLM member or stale client");
+               rc = SA_AIS_ERR_UNAVAILABLE;
+               goto done;
+       }
        tmpHandle = ntfHandleGet(subscriptionId);
        if (tmpHandle != 0) {
                rc = SA_AIS_ERR_EXIST;
@@ -1720,6 +1772,10 @@ SaAisErrorT saNtfNotificationSubscribe(c
 
        if (rc != SA_AIS_OK) {
                subscriberListItemRemove(subscriptionId);
+               /*Check CLM membership of node.*/
+               if (rc == SA_AIS_ERR_UNAVAILABLE) {
+                       TRACE("Node not CLM member or stale client");
+               }
        }
        if (o_msg)
                ntfa_msg_destroy(o_msg);
@@ -1788,7 +1844,13 @@ saNtfObjectCreateDeleteNotificationAlloc
 
     /**                 Lock ntfa_CB                 **/
        osafassert(pthread_mutex_lock(&ntfa_cb.cb_lock) == 0);
-
+       /*Check CLM membership of node.*/
+       if (hdl_rec->is_stale_client == true) {
+               TRACE("Node not CLM member or stale client");
+               osafassert(pthread_mutex_unlock(&ntfa_cb.cb_lock) == 0);
+               rc = SA_AIS_ERR_UNAVAILABLE;
+               goto done_give_hdl;
+       }
        notification_hdl_rec = ntfa_notification_hdl_rec_add(&hdl_rec, 
variableDataSize, &rc);
        if (notification_hdl_rec == NULL) {
                osafassert(pthread_mutex_unlock(&ntfa_cb.cb_lock) == 0);
@@ -1862,7 +1924,13 @@ saNtfAttributeChangeNotificationAllocate
        }
     /**                 Lock ntfa_CB                 **/
        osafassert(pthread_mutex_lock(&ntfa_cb.cb_lock) == 0);
-
+       /*Check CLM membership of node.*/
+       if (hdl_rec->is_stale_client == true) {
+               TRACE("Node not CLM member or stale client");
+               osafassert(pthread_mutex_unlock(&ntfa_cb.cb_lock) == 0);
+               rc = SA_AIS_ERR_UNAVAILABLE;
+               goto done_give_hdl;
+       }
        notification_hdl_rec = ntfa_notification_hdl_rec_add(&hdl_rec, 
variableDataSize, &rc);
        if (notification_hdl_rec == NULL) {
                osafassert(pthread_mutex_unlock(&ntfa_cb.cb_lock) == 0);
@@ -1935,6 +2003,13 @@ saNtfStateChangeNotificationAllocate(SaN
 
     /**                 Lock ntfa_CB                 **/
        osafassert(pthread_mutex_lock(&ntfa_cb.cb_lock) == 0);
+       /*Check CLM membership of node.*/
+       if (hdl_rec->is_stale_client == true) {
+               TRACE("Node not CLM member or stale client");
+               osafassert(pthread_mutex_unlock(&ntfa_cb.cb_lock) == 0);
+               rc = SA_AIS_ERR_UNAVAILABLE;
+               goto done_give_hdl;
+       }
        notification_hdl_rec = ntfa_notification_hdl_rec_add(&hdl_rec, 
variableDataSize, &rc);
        if (notification_hdl_rec == NULL) {
                osafassert(pthread_mutex_unlock(&ntfa_cb.cb_lock) == 0);
@@ -2004,6 +2079,13 @@ SaAisErrorT saNtfSecurityAlarmNotificati
        }
     /**                 Lock ntfa_CB                 **/
        osafassert(pthread_mutex_lock(&ntfa_cb.cb_lock) == 0);
+       /*Check CLM membership of node.*/
+       if (hdl_rec->is_stale_client == true) {
+               TRACE("Node not CLM member or stale client");
+               osafassert(pthread_mutex_unlock(&ntfa_cb.cb_lock) == 0);
+               rc = SA_AIS_ERR_UNAVAILABLE;
+               goto done_give_hdl;
+       }
        notification_hdl_rec = ntfa_notification_hdl_rec_add(&hdl_rec, 
variableDataSize, &rc);
        if (notification_hdl_rec == NULL) {
                osafassert(pthread_mutex_unlock(&ntfa_cb.cb_lock) == 0);
@@ -2075,6 +2157,14 @@ SaAisErrorT saNtfPtrValAllocate(SaNtfNot
        }
 
        osafassert(pthread_mutex_lock(&ntfa_cb.cb_lock) == 0);
+       /*Check CLM membership of node.*/
+       if (client_rec->is_stale_client == true) {
+               TRACE("Node not CLM member or stale client");
+               osafassert(pthread_mutex_unlock(&ntfa_cb.cb_lock) == 0);
+               ncshm_give_hdl(client_handle);
+               rc = SA_AIS_ERR_UNAVAILABLE;
+               goto done_give_hdl;
+       }
        rc = ntfsv_ptr_val_alloc(&notification_hdl_rec->variable_data, value, 
dataSize, dataPtr);
        osafassert(pthread_mutex_unlock(&ntfa_cb.cb_lock) == 0);
        ncshm_give_hdl(client_handle);
@@ -2114,6 +2204,14 @@ SaAisErrorT saNtfArrayValAllocate(SaNtfN
                goto done_give_hdl;
        }
        osafassert(pthread_mutex_lock(&ntfa_cb.cb_lock) == 0);
+       /*Check CLM membership of node.*/
+       if (client_rec->is_stale_client == true) {
+               TRACE("Node not CLM member or stale client");
+               osafassert(pthread_mutex_unlock(&ntfa_cb.cb_lock) == 0);
+               ncshm_give_hdl(client_handle);
+               rc = SA_AIS_ERR_UNAVAILABLE;
+               goto done_give_hdl;
+       }
        rc = ntfsv_array_val_alloc(&notification_hdl_rec->variable_data, value, 
numElements, elementSize, arrayPtr);
        osafassert(pthread_mutex_unlock(&ntfa_cb.cb_lock) == 0);
        ncshm_give_hdl(client_handle);
@@ -2199,6 +2297,14 @@ SaAisErrorT saNtfPtrValGet(SaNtfNotifica
        }
 
        osafassert(pthread_mutex_lock(&ntfa_cb.cb_lock) == 0);
+       /*Check CLM membership of node.*/
+       if (client_rec->is_stale_client == true) {
+               TRACE("Node not CLM member or stale client");
+               osafassert(pthread_mutex_unlock(&ntfa_cb.cb_lock) == 0);
+               ncshm_give_hdl(client_handle);
+               rc = SA_AIS_ERR_UNAVAILABLE;
+               goto done_give_hdl;
+       }
        rc = ntfsv_ptr_val_get(&notification_hdl_rec->variable_data, value, 
dataPtr, dataSize);
        osafassert(pthread_mutex_unlock(&ntfa_cb.cb_lock) == 0);
        ncshm_give_hdl(client_handle);
@@ -2245,6 +2351,14 @@ SaAisErrorT saNtfArrayValGet(SaNtfNotifi
        }
 
        osafassert(pthread_mutex_lock(&ntfa_cb.cb_lock) == 0);
+       /*Check CLM membership of node.*/
+       if (client_rec->is_stale_client == true) {
+               TRACE("Node not CLM member or stale client");
+               osafassert(pthread_mutex_unlock(&ntfa_cb.cb_lock) == 0);
+               ncshm_give_hdl(client_handle);
+               rc = SA_AIS_ERR_UNAVAILABLE;
+               goto done_give_hdl;
+       }
        rc = ntfsv_array_val_get(&notification_hdl_rec->variable_data, value, 
arrayPtr, numElements, elementSize);
        ncshm_give_hdl(client_handle);
        osafassert(pthread_mutex_unlock(&ntfa_cb.cb_lock) == 0);
@@ -2285,6 +2399,13 @@ SaAisErrorT saNtfObjectCreateDeleteNotif
 
         /**                 Lock ntfa_CB                 **/
        osafassert(pthread_mutex_lock(&ntfa_cb.cb_lock) == 0);
+       /*Check CLM membership of node.*/
+       if (client_rec->is_stale_client == true) {
+               TRACE("Node not CLM member or stale client");
+               osafassert(pthread_mutex_unlock(&ntfa_cb.cb_lock) == 0);
+               rc = SA_AIS_ERR_UNAVAILABLE;
+               goto done_give_hdl;
+       }
 
        filter_hdl_rec = ntfa_filter_hdl_rec_add(&client_rec);
        if (filter_hdl_rec == NULL) {
@@ -2365,6 +2486,13 @@ SaAisErrorT saNtfAttributeChangeNotifica
 
         /**                 Lock ntfa_CB                 **/
        osafassert(pthread_mutex_lock(&ntfa_cb.cb_lock) == 0);
+       /*Check CLM membership of node.*/
+       if (client_rec->is_stale_client == true) {
+               TRACE("Node not CLM member or stale client");
+               osafassert(pthread_mutex_unlock(&ntfa_cb.cb_lock) == 0);
+               rc = SA_AIS_ERR_UNAVAILABLE;
+               goto done_give_hdl;
+       }
 
        filter_hdl_rec = ntfa_filter_hdl_rec_add(&client_rec);
        if (filter_hdl_rec == NULL) {
@@ -2447,6 +2575,13 @@ SaAisErrorT saNtfStateChangeNotification
 
         /**                 Lock ntfa_CB                 **/
        osafassert(pthread_mutex_lock(&ntfa_cb.cb_lock) == 0);
+       /*Check CLM membership of node.*/
+       if (client_rec->is_stale_client == true) {
+               TRACE("Node not CLM member or stale client");
+               osafassert(pthread_mutex_unlock(&ntfa_cb.cb_lock) == 0);
+               rc = SA_AIS_ERR_UNAVAILABLE;
+               goto done_give_hdl;
+       }
 
        filter_hdl_rec = ntfa_filter_hdl_rec_add(&client_rec);
        if (filter_hdl_rec == NULL) {
@@ -2528,6 +2663,13 @@ SaAisErrorT saNtfAlarmNotificationFilter
 
     /**                 Lock ntfa_CB                 **/
        osafassert(pthread_mutex_lock(&ntfa_cb.cb_lock) == 0);
+       /*Check CLM membership of node.*/
+       if (client_rec->is_stale_client == true) {
+               TRACE("Node not CLM member or stale client");
+               osafassert(pthread_mutex_unlock(&ntfa_cb.cb_lock) == 0);
+               rc = SA_AIS_ERR_UNAVAILABLE;
+               goto done_give_hdl;
+       }
 
        filter_hdl_rec = ntfa_filter_hdl_rec_add(&client_rec);
        if (filter_hdl_rec == NULL) {
@@ -2612,6 +2754,13 @@ SaAisErrorT saNtfSecurityAlarmNotificati
 
         /**                 Lock ntfa_CB                 **/
        osafassert(pthread_mutex_lock(&ntfa_cb.cb_lock) == 0);
+       /*Check CLM membership of node.*/
+       if (client_rec->is_stale_client == true) {
+               TRACE("Node not CLM member or stale client");
+               osafassert(pthread_mutex_unlock(&ntfa_cb.cb_lock) == 0);
+               rc = SA_AIS_ERR_UNAVAILABLE;
+               goto done_give_hdl;
+       }
 
        filter_hdl_rec = ntfa_filter_hdl_rec_add(&client_rec);
        if (filter_hdl_rec == NULL) {
@@ -2694,6 +2843,14 @@ SaAisErrorT saNtfNotificationFilterFree(
                goto done_give_hdl;
        }
 
+       /*Check CLM membership of node.*/
+       if (client_rec->is_stale_client == true) {
+               TRACE("Node not CLM member or stale client");
+               osafassert(pthread_mutex_unlock(&ntfa_cb.cb_lock) == 0);
+               rc = SA_AIS_ERR_UNAVAILABLE;
+               ncshm_give_hdl(client_handle);
+               goto done_give_hdl;
+       }
        /* free the resources allocated by saNtf<ntfType>FilterAllocate */
        ntfa_filter_hdl_rec_destructor(filter_hdl_rec);
 
@@ -2753,6 +2910,12 @@ SaAisErrorT saNtfNotificationUnsubscribe
                goto done;
        }
 
+       /*Check CLM membership of node.*/
+       if (client_hdl_rec->is_stale_client == true) {
+               TRACE("Node not CLM member or stale client");
+               rc = SA_AIS_ERR_UNAVAILABLE;
+               goto done_give_hdl;
+       }
        /**
          ** Populate a sync MDS message
          **/
@@ -2783,6 +2946,10 @@ SaAisErrorT saNtfNotificationUnsubscribe
                if (SA_AIS_OK != o_msg->info.api_resp_info.rc) {
                        rc = o_msg->info.api_resp_info.rc;
                        TRACE_1("Bad return status! rc = %d", rc);
+                       /*Check CLM membership of node.*/
+                       if (rc == SA_AIS_ERR_UNAVAILABLE) {
+                               TRACE("Node not CLM member or stale client");
+                       }
                        goto done_give_hdl;
                }
                subscriberListItemRemove(subscriptionId);
@@ -2871,6 +3038,12 @@ SaAisErrorT saNtfNotificationReadInitial
                TRACE("getFilters failed");
                goto done_give_client_hdl;
        } 
+       /*Check CLM membership of node.*/
+       if (client_hdl_rec->is_stale_client == true) {
+               TRACE("Node not CLM member or stale client");
+               rc = SA_AIS_ERR_UNAVAILABLE;
+               goto done_give_client_hdl;
+       }
        
     /**
      ** Populate a sync MDS message
@@ -2902,6 +3075,10 @@ SaAisErrorT saNtfNotificationReadInitial
        if (SA_AIS_OK != o_msg->info.api_resp_info.rc) {
                rc = o_msg->info.api_resp_info.rc;
                TRACE("Bad return status!!! rc = %d", rc);
+               /*Check CLM membership of node.*/
+               if (rc == SA_AIS_ERR_UNAVAILABLE) {
+                       TRACE("Node not CLM member or stale client");
+               }
                goto done_give_client_hdl;
        }
 
@@ -2981,6 +3158,12 @@ SaAisErrorT saNtfNotificationReadFinaliz
                rc = SA_AIS_ERR_BAD_HANDLE;
                goto done_give_read_hdl;
        }
+       /*Check CLM membership of node.*/
+       if (client_hdl_rec->is_stale_client == true) {
+               TRACE("Node not CLM member or stale client");
+               rc = SA_AIS_ERR_UNAVAILABLE;
+               goto done_give_hdls;
+       }
        TRACE_1("reader_hdl_rec = %u", reader_hdl_rec->reader_hdl);
 
     /**
@@ -3011,6 +3194,10 @@ SaAisErrorT saNtfNotificationReadFinaliz
        if (SA_AIS_OK != o_msg->info.api_resp_info.rc) {
                rc = o_msg->info.api_resp_info.rc;
                TRACE("Bad return status!!! rc = %d", rc);
+               /*Check CLM membership of node.*/
+               if (rc == SA_AIS_ERR_UNAVAILABLE) {
+                       TRACE("Node not CLM member or stale client");
+               }
                goto done_give_hdls;
        }
 
@@ -3080,6 +3267,12 @@ SaAisErrorT saNtfNotificationReadNext(Sa
                rc = SA_AIS_ERR_BAD_HANDLE;
                goto done_give_read_hdl;
        }
+       /*Check CLM membership of node.*/
+       if (client_hdl_rec->is_stale_client == true) {
+               TRACE("Node not CLM member or stale client");
+               rc = SA_AIS_ERR_UNAVAILABLE;
+               goto done_give_hdls;
+       }
        TRACE_1("reader_hdl_rec = %u", reader_hdl_rec->reader_hdl);
 
     /**
@@ -3111,6 +3304,10 @@ SaAisErrorT saNtfNotificationReadNext(Sa
                if (SA_AIS_OK != o_msg->info.api_resp_info.rc) {
                        rc = o_msg->info.api_resp_info.rc;
                        TRACE("error: response msg rc = %d", rc);
+                       /*Check CLM membership of node.*/
+                       if (rc == SA_AIS_ERR_UNAVAILABLE) {
+                               TRACE("Node not CLM member or stale client");
+                       }
                        goto done_give_hdls;
                }
                if (o_msg->info.api_resp_info.type != NTFSV_READ_NEXT_RSP) {
diff --git a/osaf/libs/agents/saf/ntfa/ntfa_mds.c 
b/osaf/libs/agents/saf/ntfa/ntfa_mds.c
--- a/osaf/libs/agents/saf/ntfa/ntfa_mds.c
+++ b/osaf/libs/agents/saf/ntfa/ntfa_mds.c
@@ -270,6 +270,33 @@ uint32_t ntfa_ntfs_msg_proc(ntfa_cb_t *c
        switch (ntfsv_msg->type) {
        case NTFSV_NTFS_CBK_MSG:
                switch (ntfsv_msg->info.cbk_info.type) {
+               case NTFSV_CLM_NODE_STATUS_CALLBACK:
+                       {
+                               ntfa_client_hdl_rec_t *ntfa_hdl_rec;
+                               ntfsv_ntfa_clm_status_cbk_t *param = 
&ntfsv_msg->info.cbk_info.param.clm_node_status_cbk;
+                               TRACE_2("NTFSV_CLM_NODE_STATUS_CALLBACK: "
+                                               "subscriptionId = %d,"
+                                               " client_id = %d",
+                                               
(int)ntfsv_msg->info.cbk_info.subscriptionId,
+                                               
(int)ntfsv_msg->info.cbk_info.ntfs_client_id);
+                               cb->clm_node_state = (SaClmClusterChangesT) 
param->clm_node_status;
+                               TRACE_2("CLM Membership of local node changed 
to : %u",
+                                               cb->clm_node_state);
+                               //Search client.
+                               if (NULL == (ntfa_hdl_rec =
+                                                       
ntfa_find_hdl_rec_by_client_id(cb,
+                                                               
ntfsv_msg->info.cbk_info.ntfs_client_id))) {
+                                       TRACE("client_id not found");
+                                       ntfa_msg_destroy(ntfsv_msg);
+                                        TRACE_LEAVE();
+                                        return NCSCC_RC_FAILURE;
+                                }
+                               //A client becomes stale if Node loses CLM 
Membership.
+                               if (cb->clm_node_state != SA_CLM_NODE_JOINED)
+                                       ntfa_hdl_rec->is_stale_client = true;
+                               ntfa_msg_destroy(ntfsv_msg);
+                       }
+                       break;
                case NTFSV_NOTIFICATION_CALLBACK:
                        {
                                ntfa_client_hdl_rec_t *ntfa_hdl_rec;
@@ -610,6 +637,27 @@ static uint32_t ntfa_dec_not_discard_cbk
        return ntfsv_dec_discard_msg(uba, param);
 }
 
+/**
+ * @brief  Decodes CLM node status callback msg.
+ *
+ * @param  ptr to NCS_UBAID.
+ * @param  ptr to ntfsv_msg_t.
+ *
+ * @return NCSCC_RC_SUCCESS/NCSCC_RC_FAILURE.
+ */
+static uint32_t ntfa_dec_clm_node_status_cbk_msg(NCS_UBAID *uba, ntfsv_msg_t 
*msg)
+{
+       uint8_t *p8;
+       ntfsv_ntfa_clm_status_cbk_t *param = 
&msg->info.cbk_info.param.clm_node_status_cbk;
+       uint8_t local_data[2];
+
+       osafassert(uba != NULL);
+
+       p8 = ncs_dec_flatten_space(uba, local_data, 2);
+       param->clm_node_status = ncs_decode_16bit(&p8);
+       ncs_dec_skip_space(uba, 2);
+       return NCSCC_RC_SUCCESS;
+}
 /****************************************************************************
   Name          : ntfa_dec_subscribe_rsp_msg
  
@@ -852,6 +900,10 @@ static uint32_t ntfa_mds_dec(struct ncsm
                                TRACE_2("decode discarded cbk message");
                                rc = ntfa_dec_not_discard_cbk_msg(uba, msg);
                                break;
+                       case NTFSV_CLM_NODE_STATUS_CALLBACK:
+                               TRACE_2("decode clm node status cbk message");
+                               rc = ntfa_dec_clm_node_status_cbk_msg(uba, msg);
+                               break;
                        default:
                                TRACE_2("Unknown callback type = %d!", 
msg->info.cbk_info.type);
                                rc = NCSCC_RC_FAILURE;
diff --git a/osaf/libs/agents/saf/ntfa/ntfa_util.c 
b/osaf/libs/agents/saf/ntfa/ntfa_util.c
--- a/osaf/libs/agents/saf/ntfa/ntfa_util.c
+++ b/osaf/libs/agents/saf/ntfa/ntfa_util.c
@@ -53,6 +53,8 @@ static unsigned int ntfa_create(void)
 
        pthread_mutex_lock(&ntfa_cb.cb_lock);
        ntfa_cb.ntfs_sync_awaited = 0;
+       ntfa_cb.clm_node_state = SA_CLM_NODE_JOINED;
+
        pthread_mutex_unlock(&ntfa_cb.cb_lock);
 
        /* No longer needed */
@@ -962,6 +964,7 @@ ntfa_client_hdl_rec_t *ntfa_hdl_rec_add(
     /** Associate with the client_id obtained from NTFS
      **/
        rec->ntfs_client_id = client_id;
+       rec->is_stale_client = false;
 
     /** Initialize and attach the IPC/Priority queue
      **/

------------------------------------------------------------------------------
Transform Data into Opportunity.
Accelerate data analysis in your applications with
Intel Data Analytics Acceleration Library.
Click to learn more.
http://pubads.g.doubleclick.net/gampad/clk?id=278785231&iu=/4140
_______________________________________________
Opensaf-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/opensaf-devel

Reply via email to