osaf/libs/agents/saf/amfa/Makefile.am       |    1 +
 osaf/libs/agents/saf/amfa/amf_agent.cc      |  638 ++++++++++++++-------------
 osaf/libs/agents/saf/amfa/ava_hdl.cc        |  246 +++++----
 osaf/libs/agents/saf/amfa/ava_init.cc       |   21 +-
 osaf/libs/agents/saf/amfa/ava_mds.cc        |  448 +++++++++++++++++++-
 osaf/libs/agents/saf/amfa/ava_op.cc         |   23 +-
 osaf/libs/agents/saf/amfa/include/ava.h     |    1 +
 osaf/libs/agents/saf/amfa/include/ava_cb.h  |    1 +
 osaf/libs/agents/saf/amfa/include/ava_mds.h |  267 +---------
 9 files changed, 979 insertions(+), 667 deletions(-)


diff --git a/osaf/libs/agents/saf/amfa/Makefile.am 
b/osaf/libs/agents/saf/amfa/Makefile.am
--- a/osaf/libs/agents/saf/amfa/Makefile.am
+++ b/osaf/libs/agents/saf/amfa/Makefile.am
@@ -25,6 +25,7 @@ noinst_LTLIBRARIES = libava.la
 libava_la_CXXFLAGS = $(AM_CXXFLAGS)
 
 libava_la_CPPFLAGS = \
+       -DSA_EXTENDED_NAME_SOURCE \
        $(AM_CPPFLAGS) \
        -I$(top_srcdir)/osaf/libs/common/amf/include \
        -I$(top_srcdir)/osaf/libs/agents/saf/amfa/include
diff --git a/osaf/libs/agents/saf/amfa/amf_agent.cc 
b/osaf/libs/agents/saf/amfa/amf_agent.cc
--- a/osaf/libs/agents/saf/amfa/amf_agent.cc
+++ b/osaf/libs/agents/saf/amfa/amf_agent.cc
@@ -366,7 +366,7 @@ SaAisErrorT AmfAgent::Finalize(SaAmfHand
   }
 
   /* populate & send the finalize message */
-  m_AVA_AMF_FINALIZE_MSG_FILL(msg, cb->ava_dest, hdl, cb->comp_name);
+  ava_fill_finalize_msg(&msg, cb->ava_dest, hdl, cb->comp_name);
   rc = static_cast<SaAisErrorT>(ava_mds_send(cb, &msg, 0));
   if (NCSCC_RC_SUCCESS == rc) {
     ncshm_give_hdl(hdl);
@@ -429,13 +429,12 @@ SaAisErrorT AmfAgent::ComponentRegister(
   AVA_HDL_REC *hdl_rec = 0;
   AVSV_NDA_AVA_MSG msg = {};
   AVSV_NDA_AVA_MSG *msg_rsp = 0;
-  SaNameT pcomp_name = {0};
+  SaNameT pcomp_name;
   SaAisErrorT rc = SA_AIS_OK;
   TRACE_ENTER2("SaAmfHandleT passed is %llx", hdl);
 
-  if (!comp_name || !(comp_name->length) ||
-      (comp_name->length > SA_MAX_NAME_LENGTH) ||
-      (proxy_comp_name && (!proxy_comp_name->length || proxy_comp_name->length 
> SA_MAX_NAME_LENGTH))) {
+  if (!comp_name || !ava_sanamet_is_valid(comp_name) ||
+    (proxy_comp_name && !ava_sanamet_is_valid(proxy_comp_name))) {
     TRACE_LEAVE2("Incorrect arguments");
     return SA_AIS_ERR_INVALID_PARAM;
   }
@@ -461,15 +460,17 @@ SaAisErrorT AmfAgent::ComponentRegister(
   }
 
   if (!m_AVA_FLAG_IS_COMP_NAME(cb)) {
-    if (getenv("SA_AMF_COMPONENT_NAME")) {
-      if (strlen(getenv("SA_AMF_COMPONENT_NAME")) < SA_MAX_NAME_LENGTH) {
-        strcpy((char *)cb->comp_name.value, getenv("SA_AMF_COMPONENT_NAME"));
-        cb->comp_name.length = (uint16_t)strlen((char *)cb->comp_name.value);
-        m_AVA_FLAG_SET(cb, AVA_FLAG_COMP_NAME);
-      } else {
-        TRACE_2("Length of SA_AMF_COMPONENT_NAME exceeds SA_MAX_NAME_LENGTH 
bytes");
+    SaConstStringT env_comp_name = getenv("SA_AMF_COMPONENT_NAME");
+    if (env_comp_name) {
+      if (strlen(env_comp_name) > kOsafMaxDnLength) {
+        TRACE_2("Length of SA_AMF_COMPONENT_NAME exceeds "
+            "kOsafMaxDnLength(%d) bytes", kOsafMaxDnLength);
         rc = SA_AIS_ERR_INVALID_PARAM;
         goto done;
+      } else {
+        // @cb->comp_name could be longDN, need to be freed later
+        osaf_extended_name_alloc(env_comp_name, &cb->comp_name);
+        m_AVA_FLAG_SET(cb, AVA_FLAG_COMP_NAME);
       }
     } else {
       TRACE_2("The SA_AMF_COMPONENT_NAME environment variable is NULL");
@@ -481,26 +482,31 @@ SaAisErrorT AmfAgent::ComponentRegister(
     ncshm_give_hdl(gl_ava_hdl);
 
   /* non-proxied, component Length part of component name should be OK */
-  if (!proxy_comp_name && (comp_name->length != cb->comp_name.length)) {
+  if (!proxy_comp_name && (osaf_extended_name_length(comp_name) !=
+            osaf_extended_name_length(&cb->comp_name))) {
     rc = SA_AIS_ERR_INVALID_PARAM;
     goto done;
   }
 
   /* proxy component, Length part of proxy component name should be Ok */
-  if (proxy_comp_name && (proxy_comp_name->length != cb->comp_name.length)) {
+  if (proxy_comp_name && (osaf_extended_name_length(proxy_comp_name) !=
+            osaf_extended_name_length(&cb->comp_name))) {
     rc = SA_AIS_ERR_INVALID_PARAM;
     goto done;
   }
 
   /* non-proxied component should not forge its name while registering */
-  if (!proxy_comp_name && strncmp((char *)comp_name->value, (char 
*)cb->comp_name.value, comp_name->length)) {
+  if (!proxy_comp_name && strncmp(osaf_extended_name_borrow(comp_name),
+                  osaf_extended_name_borrow(&cb->comp_name),
+                  osaf_extended_name_length(comp_name))) {
     rc = SA_AIS_ERR_BAD_OPERATION;
     goto done;
   }
 
   /* proxy component should not forge its name while registering its proxied */
-  if (proxy_comp_name &&
-      strncmp((char *)proxy_comp_name->value, (char *)cb->comp_name.value, 
proxy_comp_name->length)) {
+  if (proxy_comp_name && strncmp(osaf_extended_name_borrow(proxy_comp_name),
+                    osaf_extended_name_borrow(&cb->comp_name),
+                    osaf_extended_name_length(proxy_comp_name))) {
     TRACE("proxy component should not forge its name while registering its 
proxied");
     rc = SA_AIS_ERR_BAD_OPERATION;
     goto done;
@@ -515,8 +521,10 @@ SaAisErrorT AmfAgent::ComponentRegister(
 
   /* populate & send the register message */
   if (proxy_comp_name)
-    pcomp_name = *proxy_comp_name;
-  m_AVA_COMP_REG_MSG_FILL(msg, cb->ava_dest, hdl, *comp_name, pcomp_name);
+    osaf_extended_name_lend(osaf_extended_name_borrow(proxy_comp_name),  
&pcomp_name);
+  else
+    memset(&pcomp_name, 0, sizeof(SaNameT));
+  ava_fill_comp_reg_msg(&msg, cb->ava_dest, hdl, *comp_name, pcomp_name);
   rc = static_cast<SaAisErrorT>(ava_mds_send(cb, &msg, &msg_rsp));
   if (NCSCC_RC_SUCCESS == rc) {
     osafassert(AVSV_AVND_AMF_API_RESP_MSG == msg_rsp->type);
@@ -573,13 +581,12 @@ SaAisErrorT AmfAgent::ComponentUnregiste
   AVSV_NDA_AVA_MSG *msg_rsp = 0;
   AVA_CB *cb = 0;
   AVA_HDL_REC *hdl_rec = 0;
-  SaNameT pcomp_name = {0};
+  SaNameT pcomp_name;
   SaAisErrorT rc = SA_AIS_OK;
   TRACE_ENTER2("SaAmfHandleT passed is %llx", hdl);
 
-  if (!comp_name || !(comp_name->length) ||
-      (comp_name->length > SA_MAX_NAME_LENGTH) ||
-      (proxy_comp_name && (!proxy_comp_name->length || proxy_comp_name->length 
> SA_MAX_NAME_LENGTH))) {
+  if (!comp_name || !ava_sanamet_is_valid(comp_name) ||
+    (proxy_comp_name && !ava_sanamet_is_valid(proxy_comp_name))) {
     TRACE_LEAVE2("Incorrect arguments");
     return SA_AIS_ERR_INVALID_PARAM;
   }
@@ -605,27 +612,31 @@ SaAisErrorT AmfAgent::ComponentUnregiste
   }
 
   /* non-proxied, component Length part of component name should be OK */
-  if (!proxy_comp_name && (comp_name->length != cb->comp_name.length)) {
+  if (!proxy_comp_name && (osaf_extended_name_length(comp_name) !=
+            osaf_extended_name_length(&cb->comp_name))) {
     rc = SA_AIS_ERR_INVALID_PARAM;
     goto done;
   }
 
   /* proxy component, Length part of proxy component name should be Ok */
-  if (proxy_comp_name && (proxy_comp_name->length != cb->comp_name.length)) {
+  if (proxy_comp_name && (osaf_extended_name_length(proxy_comp_name) !=
+            osaf_extended_name_length(&cb->comp_name))) {
     rc = SA_AIS_ERR_INVALID_PARAM;
     goto done;
   }
-
-  /* non-proxied component should not forge its name while unregistering */
-  if (!proxy_comp_name && strncmp((char *)comp_name->value, (char 
*)cb->comp_name.value, comp_name->length)) {
+  /* non-proxied component should not forge its name while registering */
+  if (!proxy_comp_name && strncmp(osaf_extended_name_borrow(comp_name),
+                  osaf_extended_name_borrow(&cb->comp_name),
+                  osaf_extended_name_length(comp_name))) {
     TRACE("non-proxied component should not forge its name while 
unregistering");
     rc = SA_AIS_ERR_BAD_OPERATION;
     goto done;
   }
 
   /* proxy component should not forge its name while unregistering proxied */
-  if (proxy_comp_name &&
-      strncmp((char *)proxy_comp_name->value, (char *)cb->comp_name.value, 
proxy_comp_name->length)) {
+  if (proxy_comp_name && strncmp(osaf_extended_name_borrow(proxy_comp_name),
+                    osaf_extended_name_borrow(&cb->comp_name),
+                    osaf_extended_name_length(proxy_comp_name))) {
     TRACE("proxy component should not forge its name while unregistering 
proxied");
     rc = SA_AIS_ERR_BAD_OPERATION;
     goto done;
@@ -633,8 +644,10 @@ SaAisErrorT AmfAgent::ComponentUnregiste
 
   /* populate & send the unregister message */
   if (proxy_comp_name)
-    pcomp_name = *proxy_comp_name;
-  m_AVA_COMP_UNREG_MSG_FILL(msg, cb->ava_dest, hdl, *comp_name, pcomp_name);
+    osaf_extended_name_lend(osaf_extended_name_borrow(proxy_comp_name),  
&pcomp_name);
+  else
+    memset(&pcomp_name, 0, sizeof(SaNameT));
+  ava_fill_comp_unreg_msg(&msg, cb->ava_dest, hdl, *comp_name, pcomp_name);
   rc = static_cast<SaAisErrorT>(ava_mds_send(cb, &msg, &msg_rsp));
   if (NCSCC_RC_SUCCESS == rc) {
     osafassert(AVSV_AVND_AMF_API_RESP_MSG == msg_rsp->type);
@@ -707,7 +720,7 @@ SaAisErrorT AmfAgent::HealthcheckStart(S
     return SA_AIS_ERR_INVALID_PARAM;
   }
 
-  if (!comp_name || !(comp_name->length) || (comp_name->length > 
SA_MAX_NAME_LENGTH) ||
+  if (!comp_name || !ava_sanamet_is_valid(comp_name) ||
       !hc_key || !(hc_key->keyLen) || (hc_key->keyLen > 
SA_AMF_HEALTHCHECK_KEY_MAX)) {
     TRACE_LEAVE2("Incorrect arguments");
     return SA_AIS_ERR_INVALID_PARAM;
@@ -757,7 +770,7 @@ SaAisErrorT AmfAgent::HealthcheckStart(S
   }
 
   /* populate & send the healthcheck start message */
-  m_AVA_HC_START_MSG_FILL(msg, cb->ava_dest, hdl, *comp_name, cb->comp_name, 
*hc_key, inv, rec_rcvr);
+  ava_fill_hc_start_msg(&msg, cb->ava_dest, hdl, *comp_name, cb->comp_name, 
*hc_key, inv, rec_rcvr);
   rc = static_cast<SaAisErrorT>(ava_mds_send(cb, &msg, &msg_rsp));
   if (NCSCC_RC_SUCCESS == rc) {
     osafassert(AVSV_AVND_AMF_API_RESP_MSG == msg_rsp->type);
@@ -813,7 +826,7 @@ SaAisErrorT AmfAgent::HealthcheckStop(Sa
   SaAisErrorT rc = SA_AIS_OK;
   TRACE_ENTER2("SaAmfHandleT passed is %llx", hdl);
 
-  if (!comp_name || !(comp_name->length) || (comp_name->length > 
SA_MAX_NAME_LENGTH) ||
+  if (!comp_name || !ava_sanamet_is_valid(comp_name) ||
       !hc_key || !(hc_key->keyLen) || (hc_key->keyLen > 
SA_AMF_HEALTHCHECK_KEY_MAX)) {
     TRACE_LEAVE2("Incorrect arguments");
     return SA_AIS_ERR_INVALID_PARAM;
@@ -833,18 +846,107 @@ SaAisErrorT AmfAgent::HealthcheckStop(Sa
   }
   /* acquire cb read lock */
   m_NCS_LOCK(&cb->lock, NCS_LOCK_READ);
+    /* retrieve hdl rec */
+  if ( !(hdl_rec = (AVA_HDL_REC *)ncshm_take_hdl(NCS_SERVICE_ID_AVA, hdl)) ) {
+    rc = SA_AIS_ERR_BAD_HANDLE;
+    goto done;
+  }
+
+  /* populate & send the healthcheck stop message */
+  ava_fill_hc_stop_msg(&msg, cb->ava_dest, hdl, *comp_name, cb->comp_name, 
*hc_key);
+  rc = static_cast<SaAisErrorT>(ava_mds_send(cb, &msg, &msg_rsp));
+  if (NCSCC_RC_SUCCESS == rc) {
+    osafassert(AVSV_AVND_AMF_API_RESP_MSG == msg_rsp->type);
+    osafassert(AVSV_AMF_HC_STOP == msg_rsp->info.api_resp_info.type);
+    rc = msg_rsp->info.api_resp_info.rc;
+  } else if (NCSCC_RC_FAILURE == rc)
+    rc = SA_AIS_ERR_TRY_AGAIN;
+  else if (NCSCC_RC_REQ_TIMOUT == rc)
+    rc = SA_AIS_ERR_TIMEOUT;
+
+done:
+  /* release cb read lock and return handles */
+  if (cb) {
+    m_NCS_UNLOCK(&cb->lock, NCS_LOCK_READ);
+    ncshm_give_hdl(gl_ava_hdl);
+  }
+  if (hdl_rec)
+    ncshm_give_hdl(hdl);
+
+  /* free the contents of the request/response message */
+  if (msg_rsp)
+    avsv_nda_ava_msg_free(msg_rsp);
+  avsv_nda_ava_msg_content_free(&msg);
+
+  TRACE_LEAVE2("rc:%u", rc);
+  return rc;
+}
+
+/****************************************************************************
+  Name   : saAmfHealthcheckConfirm
+ 
+  Description   : This function allows a process (as part of a component) to 
+                 inform the AMF that it has performed the healthcheck.
+ 
+  Arguments     : hdl       - AMF handle
+                 comp_name - ptr to the comp name
+                 hc_key    - ptr to the healthcheck type
+                 hc_result - healthcheck result
+ 
+  Return Values : Refer to SAI-AIS specification for various return values.
+ 
+  Notes         : None.
+******************************************************************************/
+SaAisErrorT saAmfHealthcheckConfirm(SaAmfHandleT hdl,
+                                   const SaNameT *comp_name, const 
SaAmfHealthcheckKeyT *hc_key, SaAisErrorT hc_result)
+{
+       return AmfAgent::HealthcheckConfirm(hdl, comp_name, hc_key, hc_result);
+
+}
+
+SaAisErrorT AmfAgent::HealthcheckConfirm(SaAmfHandleT hdl,
+                                         const SaNameT *comp_name, const 
SaAmfHealthcheckKeyT *hc_key, SaAisErrorT hc_result) {
+
+  AVA_CB *cb = 0;
+  AVA_HDL_REC *hdl_rec = 0;
+  AVSV_NDA_AVA_MSG msg = {};
+  AVSV_NDA_AVA_MSG *msg_rsp = 0;
+  SaAisErrorT rc = SA_AIS_OK;
+  TRACE_ENTER2("SaAmfHandleT passed is %llx", hdl);
+
+  if (!comp_name || !ava_sanamet_is_valid(comp_name) ||
+      !hc_key || !(hc_key->keyLen) || (hc_key->keyLen > 
SA_AMF_HEALTHCHECK_KEY_MAX) ||
+      !m_AVA_AMF_RESP_ERR_CODE_IS_VALID(hc_result)) {
+    TRACE_LEAVE2("Incorrect arguments");
+    return SA_AIS_ERR_INVALID_PARAM;
+  }
+
+  /* Verifying the input Handle & global handle */
+  if(!gl_ava_hdl || hdl > AVSV_UNS32_HDL_MAX) {
+    TRACE_2("Invalid SaAmfHandle passed by component: %llx",hdl);
+    rc = SA_AIS_ERR_BAD_HANDLE;
+    goto done;
+  }
+  /* retrieve AvA CB */
+  if (!(cb = (AVA_CB *)ncshm_take_hdl(NCS_SERVICE_ID_AVA, gl_ava_hdl))) {
+    TRACE_4("SA_AIS_ERR_LIBRARY: Unable to retrieve cb handle");
+    rc = SA_AIS_ERR_LIBRARY;
+    goto done;
+  }
+  /* acquire cb read lock */
+  m_NCS_LOCK(&cb->lock, NCS_LOCK_READ);
   /* retrieve hdl rec */
   if ( !(hdl_rec = (AVA_HDL_REC *)ncshm_take_hdl(NCS_SERVICE_ID_AVA, hdl)) ) {
     rc = SA_AIS_ERR_BAD_HANDLE;
     goto done;
   }
 
-  /* populate & send the healthcheck stop message */
-  m_AVA_HC_STOP_MSG_FILL(msg, cb->ava_dest, hdl, *comp_name, cb->comp_name, 
*hc_key);
+  /* populate & send the healthcheck confirm message */
+  ava_fill_hc_confirm_msg(&msg, cb->ava_dest, hdl, *comp_name, cb->comp_name, 
*hc_key, hc_result);
   rc = static_cast<SaAisErrorT>(ava_mds_send(cb, &msg, &msg_rsp));
   if (NCSCC_RC_SUCCESS == rc) {
     osafassert(AVSV_AVND_AMF_API_RESP_MSG == msg_rsp->type);
-    osafassert(AVSV_AMF_HC_STOP == msg_rsp->info.api_resp_info.type);
+    osafassert(AVSV_AMF_HC_CONFIRM == msg_rsp->info.api_resp_info.type);
     rc = msg_rsp->info.api_resp_info.rc;
   } else if (NCSCC_RC_FAILURE == rc)
     rc = SA_AIS_ERR_TRY_AGAIN;
@@ -870,29 +972,35 @@ done:
 }
 
 /****************************************************************************
-  Name   : saAmfHealthcheckConfirm
+  Name   : saAmfPmStart
  
-  Description   : This function allows a process (as part of a component) to 
-                 inform the AMF that it has performed the healthcheck.
+  Description   : This function allows a process (as part of a comp) to start
+                 Passive Monitoring.
  
-  Arguments     : hdl       - AMF handle
-                 comp_name - ptr to the comp name
-                 hc_key    - ptr to the healthcheck type
-                 hc_result - healthcheck result
+  Arguments     : hdl      - AMF handle
+                 comp_name      - ptr to the comp name
+                 processId      - Identifier of a process to be monitored 
+                 desc_TreeDepth - Depth of the tree of descendents of the 
process
+                 pmErr   - Specifies the type of process errors to monitor
+                 rec_Recovery   - recommended recovery
+
  
   Return Values : Refer to SAI-AIS specification for various return values.
  
   Notes         : None.
 ******************************************************************************/
-SaAisErrorT saAmfHealthcheckConfirm(SaAmfHandleT hdl,
-                                   const SaNameT *comp_name, const 
SaAmfHealthcheckKeyT *hc_key, SaAisErrorT hc_result)
+SaAisErrorT saAmfPmStart(SaAmfHandleT hdl,
+                        const SaNameT *comp_name,
+                        SaUint64T processId,
+                        SaInt32T desc_TreeDepth, SaAmfPmErrorsT pmErr, 
SaAmfRecommendedRecoveryT rec_Recovery)
 {
-       return AmfAgent::HealthcheckConfirm(hdl, comp_name, hc_key, hc_result);
-
+       return AmfAgent::PmStart(hdl, comp_name, processId, desc_TreeDepth, 
pmErr, rec_Recovery);
 }
 
-SaAisErrorT AmfAgent::HealthcheckConfirm(SaAmfHandleT hdl,
-                                         const SaNameT *comp_name, const 
SaAmfHealthcheckKeyT *hc_key, SaAisErrorT hc_result) {
+SaAisErrorT AmfAgent::PmStart(SaAmfHandleT hdl,
+                              const SaNameT *comp_name,
+                              SaUint64T processId,
+                              SaInt32T desc_TreeDepth, SaAmfPmErrorsT pmErr, 
SaAmfRecommendedRecoveryT rec_Recovery) {
 
   AVA_CB *cb = 0;
   AVA_HDL_REC *hdl_rec = 0;
@@ -901,13 +1009,45 @@ SaAisErrorT AmfAgent::HealthcheckConfirm
   SaAisErrorT rc = SA_AIS_OK;
   TRACE_ENTER2("SaAmfHandleT passed is %llx", hdl);
 
-  if (!comp_name || !(comp_name->length) || (comp_name->length > 
SA_MAX_NAME_LENGTH) ||
-      !hc_key || !(hc_key->keyLen) || (hc_key->keyLen > 
SA_AMF_HEALTHCHECK_KEY_MAX) ||
-      !m_AVA_AMF_RESP_ERR_CODE_IS_VALID(hc_result)) {
+  /* input validation of component name */
+  if (!comp_name || !ava_sanamet_is_valid(comp_name)) {
     TRACE_LEAVE2("Incorrect arguments");
     return SA_AIS_ERR_INVALID_PARAM;
   }
 
+  /* input validation of descendant tree depth */
+  if (desc_TreeDepth < AVA_PM_START_ALL_DESCENDENTS) {
+    TRACE_LEAVE2("Incorrect Descendants tree depth");
+    return SA_AIS_ERR_INVALID_PARAM;
+  }
+
+  /* input validation of pmError */
+  if (pmErr != SA_AMF_PM_NON_ZERO_EXIT && pmErr != SA_AMF_PM_ZERO_EXIT &&
+      pmErr != (SA_AMF_PM_NON_ZERO_EXIT | SA_AMF_PM_ZERO_EXIT)) {
+    if ((pmErr == SA_AMF_PM_ABNORMAL_END) ||
+        (pmErr == (SA_AMF_PM_NON_ZERO_EXIT | SA_AMF_PM_ABNORMAL_END)) ||
+        (pmErr == (SA_AMF_PM_ZERO_EXIT | SA_AMF_PM_ABNORMAL_END)) ||
+        (pmErr == (SA_AMF_PM_ZERO_EXIT | SA_AMF_PM_NON_ZERO_EXIT | 
SA_AMF_PM_ABNORMAL_END))) {
+      TRACE_LEAVE2("Unsupported argument specified for SaAmfPmErrorsT ");
+      return SA_AIS_ERR_NOT_SUPPORTED;
+    } else {
+      TRACE_LEAVE2("Incorrect argument specified for SaAmfPmErrorsT ");
+      return SA_AIS_ERR_INVALID_PARAM;
+    }
+  }
+
+  /* input validation of Recomended recovery */
+  if (rec_Recovery < SA_AMF_NO_RECOMMENDATION || rec_Recovery > 
SA_AMF_CONTAINER_RESTART) {
+    TRACE_LEAVE2("Incorrect argument specified for SaAmfRecommendedRecoveryT");
+    return SA_AIS_ERR_INVALID_PARAM;
+  }
+
+  /* input validation of Process ID */
+  if (processId == 0) {
+    TRACE_LEAVE2("Incorrect argument specified for PID");
+    return SA_AIS_ERR_INVALID_PARAM;
+  }
+
   /* Verifying the input Handle & global handle */
   if(!gl_ava_hdl || hdl > AVSV_UNS32_HDL_MAX) {
     TRACE_2("Invalid SaAmfHandle passed by component: %llx",hdl);
@@ -928,12 +1068,13 @@ SaAisErrorT AmfAgent::HealthcheckConfirm
     goto done;
   }
 
-  /* populate & send the healthcheck confirm message */
-  m_AVA_HC_CONFIRM_MSG_FILL(msg, cb->ava_dest, hdl, *comp_name, cb->comp_name, 
*hc_key, hc_result);
+  /* populate & send the passive monitor start message */
+  ava_fill_pm_start_msg(&msg, cb->ava_dest, hdl, *comp_name, processId, 
desc_TreeDepth, pmErr, rec_Recovery);
+
   rc = static_cast<SaAisErrorT>(ava_mds_send(cb, &msg, &msg_rsp));
   if (NCSCC_RC_SUCCESS == rc) {
     osafassert(AVSV_AVND_AMF_API_RESP_MSG == msg_rsp->type);
-    osafassert(AVSV_AMF_HC_CONFIRM == msg_rsp->info.api_resp_info.type);
+    osafassert(AVSV_AMF_PM_START == msg_rsp->info.api_resp_info.type);
     rc = msg_rsp->info.api_resp_info.rc;
   } else if (NCSCC_RC_FAILURE == rc)
     rc = SA_AIS_ERR_TRY_AGAIN;
@@ -959,35 +1100,32 @@ done:
 }
 
 /****************************************************************************
-  Name   : saAmfPmStart
+  Name   : saAmfPmStop
  
-  Description   : This function allows a process (as part of a comp) to start
-                 Passive Monitoring.
+  Description   : This function allows a process to stop an already started
+                 passive monitor.
  
-  Arguments     : hdl      - AMF handle
-                 comp_name      - ptr to the comp name
-                 processId      - Identifier of a process to be monitored 
-                 desc_TreeDepth - Depth of the tree of descendents of the 
process
-                 pmErr   - Specifies the type of process errors to monitor
-                 rec_Recovery   - recommended recovery
-
- 
+  Arguments     : hdl  - AMF handle
+                 comp_name  - ptr to the comp name
+                 stopQual   - Qualifies which processes should stop being 
monitored 
+                 processId  - Identifier of a process to be monitored
+                 pmErr      - type of process errors that the Availability 
+                                 Management Framework should stop monitoring
+
   Return Values : Refer to SAI-AIS specification for various return values.
  
   Notes         : None.
 ******************************************************************************/
-SaAisErrorT saAmfPmStart(SaAmfHandleT hdl,
-                        const SaNameT *comp_name,
-                        SaUint64T processId,
-                        SaInt32T desc_TreeDepth, SaAmfPmErrorsT pmErr, 
SaAmfRecommendedRecoveryT rec_Recovery)
+SaAisErrorT saAmfPmStop(SaAmfHandleT hdl,
+                       const SaNameT *comp_name,
+                       SaAmfPmStopQualifierT stopQual, SaInt64T processId, 
SaAmfPmErrorsT pmErr)
 {
-       return AmfAgent::PmStart(hdl, comp_name, processId, desc_TreeDepth, 
pmErr, rec_Recovery);
+       return AmfAgent::PmStop(hdl, comp_name, stopQual, processId, pmErr);
 }
 
-SaAisErrorT AmfAgent::PmStart(SaAmfHandleT hdl,
-                              const SaNameT *comp_name,
-                              SaUint64T processId,
-                              SaInt32T desc_TreeDepth, SaAmfPmErrorsT pmErr, 
SaAmfRecommendedRecoveryT rec_Recovery) {
+SaAisErrorT AmfAgent::PmStop(SaAmfHandleT hdl,
+                             const SaNameT *comp_name,
+                             SaAmfPmStopQualifierT stopQual, SaInt64T 
processId, SaAmfPmErrorsT pmErr) {
 
   AVA_CB *cb = 0;
   AVA_HDL_REC *hdl_rec = 0;
@@ -997,14 +1135,15 @@ SaAisErrorT AmfAgent::PmStart(SaAmfHandl
   TRACE_ENTER2("SaAmfHandleT passed is %llx", hdl);
 
   /* input validation of component name */
-  if (!comp_name || !(comp_name->length) || (comp_name->length > 
SA_MAX_NAME_LENGTH)) {
-    TRACE_LEAVE2("Incorrect arguments");
+  if (!comp_name || !ava_sanamet_is_valid(comp_name)) {
+    TRACE_LEAVE2("Incorrect Arguments");
     return SA_AIS_ERR_INVALID_PARAM;
   }
 
-  /* input validation of descendant tree depth */
-  if (desc_TreeDepth < AVA_PM_START_ALL_DESCENDENTS) {
-    TRACE_LEAVE2("Incorrect Descendants tree depth");
+  /* input validation of StopQualifier */
+  if (stopQual != SA_AMF_PM_PROC && stopQual != SA_AMF_PM_PROC_AND_DESCENDENTS
+      && stopQual != SA_AMF_PM_ALL_PROCESSES) {
+    TRACE_LEAVE2("Incorrect argument specified for SaAmfPmStopQualifierT");
     return SA_AIS_ERR_INVALID_PARAM;
   }
 
@@ -1018,20 +1157,93 @@ SaAisErrorT AmfAgent::PmStart(SaAmfHandl
       TRACE_LEAVE2("Unsupported argument specified for SaAmfPmErrorsT ");
       return SA_AIS_ERR_NOT_SUPPORTED;
     } else {
-      TRACE_LEAVE2("Incorrect argument specified for SaAmfPmErrorsT ");
+      TRACE_LEAVE2("Incorrect argument specified for SaAmfPmErrorsT");
       return SA_AIS_ERR_INVALID_PARAM;
     }
   }
 
-  /* input validation of Recomended recovery */
-  if (rec_Recovery < SA_AMF_NO_RECOMMENDATION || rec_Recovery > 
SA_AMF_CONTAINER_RESTART) {
-    TRACE_LEAVE2("Incorrect argument specified for SaAmfRecommendedRecoveryT");
+  /* input validation of Process ID */
+  if (processId == 0) {
+    TRACE_LEAVE2("Incorrect argument specified for processId");
     return SA_AIS_ERR_INVALID_PARAM;
   }
 
-  /* input validation of Process ID */
-  if (processId == 0) {
-    TRACE_LEAVE2("Incorrect argument specified for PID");
+  /* Verifying the input Handle & global handle */
+  if(!gl_ava_hdl || hdl > AVSV_UNS32_HDL_MAX) {
+    TRACE_2("Invalid SaAmfHandle passed by component: %llx",hdl);
+    rc = SA_AIS_ERR_BAD_HANDLE;
+    goto done;
+  }
+  /* retrieve AvA CB */
+  if (!(cb = (AVA_CB *)ncshm_take_hdl(NCS_SERVICE_ID_AVA, gl_ava_hdl))) {
+    TRACE_4("SA_AIS_ERR_LIBRARY: Unable to retrieve cb handle");
+    rc = SA_AIS_ERR_LIBRARY;
+    goto done;
+  }
+  /* acquire cb read lock */
+  m_NCS_LOCK(&cb->lock, NCS_LOCK_READ);
+    /* retrieve hdl rec */
+  if ( !(hdl_rec = (AVA_HDL_REC *)ncshm_take_hdl(NCS_SERVICE_ID_AVA, hdl)) ) {
+    rc = SA_AIS_ERR_BAD_HANDLE;
+    goto done;
+  }
+
+  /* populate & send the Passive Monitoring stop message */
+  ava_fill_pm_stop_msg(&msg, cb->ava_dest, hdl, *comp_name, stopQual, 
processId, pmErr);
+  rc = static_cast<SaAisErrorT>(ava_mds_send(cb, &msg, &msg_rsp));
+  if (NCSCC_RC_SUCCESS == rc) {
+    osafassert(AVSV_AVND_AMF_API_RESP_MSG == msg_rsp->type);
+    osafassert(AVSV_AMF_PM_STOP == msg_rsp->info.api_resp_info.type);
+    rc = msg_rsp->info.api_resp_info.rc;
+  } else if (NCSCC_RC_FAILURE == rc)
+    rc = SA_AIS_ERR_TRY_AGAIN;
+  else if (NCSCC_RC_REQ_TIMOUT == rc)
+    rc = SA_AIS_ERR_TIMEOUT;
+
+done:
+  /* release cb read lock and return handles */
+  if (cb) {
+    m_NCS_UNLOCK(&cb->lock, NCS_LOCK_READ);
+    ncshm_give_hdl(gl_ava_hdl);
+  }
+  if (hdl_rec)
+    ncshm_give_hdl(hdl);
+
+  /* free the contents of the request/response message */
+  if (msg_rsp)
+    avsv_nda_ava_msg_free(msg_rsp);
+  avsv_nda_ava_msg_content_free(&msg);
+
+  TRACE_LEAVE2("rc:%u", rc);
+  return rc;
+}
+
+/****************************************************************************
+  Name   : saAmfComponentNameGet
+ 
+  Description   : This function returns the name of the component to which the
+                 process belongs.
+ 
+  Arguments     : hdl   - AMF handle
+                 o_comp_name - ptr to the comp name
+ 
+  Return Values : Refer to SAI-AIS specification for various return values.
+ 
+  Notes         : None.
+******************************************************************************/
+SaAisErrorT saAmfComponentNameGet(SaAmfHandleT hdl, SaNameT *o_comp_name)
+{
+       return AmfAgent::ComponentNameGet(hdl, o_comp_name);
+}
+
+SaAisErrorT AmfAgent::ComponentNameGet(SaAmfHandleT hdl, SaNameT *o_comp_name) 
{
+  AVA_CB *cb = 0;
+  AVA_HDL_REC *hdl_rec = 0;
+  SaAisErrorT rc = SA_AIS_OK;
+  TRACE_ENTER2("SaAmfHandleT passed is %llx", hdl);
+
+  if (!o_comp_name) {
+    TRACE_LEAVE2("Out param component name is NULL");
     return SA_AIS_ERR_INVALID_PARAM;
   }
 
@@ -1055,211 +1267,11 @@ SaAisErrorT AmfAgent::PmStart(SaAmfHandl
     goto done;
   }
 
-  /* populate & send the passive monitor start message */
-  m_AVA_PM_START_MSG_FILL(msg, cb->ava_dest, hdl, *comp_name, processId, 
desc_TreeDepth, pmErr, rec_Recovery);
-
-  rc = static_cast<SaAisErrorT>(ava_mds_send(cb, &msg, &msg_rsp));
-  if (NCSCC_RC_SUCCESS == rc) {
-    osafassert(AVSV_AVND_AMF_API_RESP_MSG == msg_rsp->type);
-    osafassert(AVSV_AMF_PM_START == msg_rsp->info.api_resp_info.type);
-    rc = msg_rsp->info.api_resp_info.rc;
-  } else if (NCSCC_RC_FAILURE == rc)
-    rc = SA_AIS_ERR_TRY_AGAIN;
-  else if (NCSCC_RC_REQ_TIMOUT == rc)
-    rc = SA_AIS_ERR_TIMEOUT;
-
-done:
-  /* release cb read lock and return handles */
-  if (cb) {
-    m_NCS_UNLOCK(&cb->lock, NCS_LOCK_READ);
-    ncshm_give_hdl(gl_ava_hdl);
-  }
-  if (hdl_rec)
-    ncshm_give_hdl(hdl);
-
-  /* free the contents of the request/response message */
-  if (msg_rsp)
-    avsv_nda_ava_msg_free(msg_rsp);
-  avsv_nda_ava_msg_content_free(&msg);
-
-  TRACE_LEAVE2("rc:%u", rc);
-  return rc;
-}
-
-/****************************************************************************
-  Name   : saAmfPmStop
- 
-  Description   : This function allows a process to stop an already started
-                 passive monitor.
- 
-  Arguments     : hdl  - AMF handle
-                 comp_name  - ptr to the comp name
-                 stopQual   - Qualifies which processes should stop being 
monitored 
-                 processId  - Identifier of a process to be monitored
-                 pmErr      - type of process errors that the Availability 
-                                 Management Framework should stop monitoring
-
-  Return Values : Refer to SAI-AIS specification for various return values.
- 
-  Notes         : None.
-******************************************************************************/
-SaAisErrorT saAmfPmStop(SaAmfHandleT hdl,
-                       const SaNameT *comp_name,
-                       SaAmfPmStopQualifierT stopQual, SaInt64T processId, 
SaAmfPmErrorsT pmErr)
-{
-       return AmfAgent::PmStop(hdl, comp_name, stopQual, processId, pmErr);
-}
-
-SaAisErrorT AmfAgent::PmStop(SaAmfHandleT hdl,
-                             const SaNameT *comp_name,
-                             SaAmfPmStopQualifierT stopQual, SaInt64T 
processId, SaAmfPmErrorsT pmErr) {
-
-  AVA_CB *cb = 0;
-  AVA_HDL_REC *hdl_rec = 0;
-  AVSV_NDA_AVA_MSG msg = {};
-  AVSV_NDA_AVA_MSG *msg_rsp = 0;
-  SaAisErrorT rc = SA_AIS_OK;
-  TRACE_ENTER2("SaAmfHandleT passed is %llx", hdl);
-
-  /* input validation of component name */
-  if (!comp_name || !(comp_name->length) || (comp_name->length > 
SA_MAX_NAME_LENGTH)) {
-    TRACE_LEAVE2("Incorrect Arguments");
-    return SA_AIS_ERR_INVALID_PARAM;
-  }
-
-  /* input validation of StopQualifier */
-  if (stopQual != SA_AMF_PM_PROC && stopQual != SA_AMF_PM_PROC_AND_DESCENDENTS
-      && stopQual != SA_AMF_PM_ALL_PROCESSES) {
-    TRACE_LEAVE2("Incorrect argument specified for SaAmfPmStopQualifierT");
-    return SA_AIS_ERR_INVALID_PARAM;
-  }
-
-  /* input validation of pmError */
-  if (pmErr != SA_AMF_PM_NON_ZERO_EXIT && pmErr != SA_AMF_PM_ZERO_EXIT &&
-      pmErr != (SA_AMF_PM_NON_ZERO_EXIT | SA_AMF_PM_ZERO_EXIT)) {
-    if ((pmErr == SA_AMF_PM_ABNORMAL_END) ||
-        (pmErr == (SA_AMF_PM_NON_ZERO_EXIT | SA_AMF_PM_ABNORMAL_END)) ||
-        (pmErr == (SA_AMF_PM_ZERO_EXIT | SA_AMF_PM_ABNORMAL_END)) ||
-        (pmErr == (SA_AMF_PM_ZERO_EXIT | SA_AMF_PM_NON_ZERO_EXIT | 
SA_AMF_PM_ABNORMAL_END))) {
-      TRACE_LEAVE2("Unsupported argument specified for SaAmfPmErrorsT ");
-      return SA_AIS_ERR_NOT_SUPPORTED;
-    } else {
-      TRACE_LEAVE2("Incorrect argument specified for SaAmfPmErrorsT");
-      return SA_AIS_ERR_INVALID_PARAM;
-    }
-  }
-
-  /* input validation of Process ID */
-  if (processId == 0) {
-    TRACE_LEAVE2("Incorrect argument specified for processId");
-    return SA_AIS_ERR_INVALID_PARAM;
-  }
-
-  /* Verifying the input Handle & global handle */
-  if(!gl_ava_hdl || hdl > AVSV_UNS32_HDL_MAX) {
-    TRACE_2("Invalid SaAmfHandle passed by component: %llx",hdl);
-    rc = SA_AIS_ERR_BAD_HANDLE;
-    goto done;
-  }
-  /* retrieve AvA CB */
-  if (!(cb = (AVA_CB *)ncshm_take_hdl(NCS_SERVICE_ID_AVA, gl_ava_hdl))) {
-    TRACE_4("SA_AIS_ERR_LIBRARY: Unable to retrieve cb handle");
-    rc = SA_AIS_ERR_LIBRARY;
-    goto done;
-  }
-  /* acquire cb read lock */
-  m_NCS_LOCK(&cb->lock, NCS_LOCK_READ);
-  /* retrieve hdl rec */
-  if ( !(hdl_rec = (AVA_HDL_REC *)ncshm_take_hdl(NCS_SERVICE_ID_AVA, hdl)) ) {
-    rc = SA_AIS_ERR_BAD_HANDLE;
-    goto done;
-  }
-
-  /* populate & send the Passive Monitoring stop message */
-  m_AVA_PM_STOP_MSG_FILL(msg, cb->ava_dest, hdl, *comp_name, stopQual, 
processId, pmErr);
-  rc = static_cast<SaAisErrorT>(ava_mds_send(cb, &msg, &msg_rsp));
-  if (NCSCC_RC_SUCCESS == rc) {
-    osafassert(AVSV_AVND_AMF_API_RESP_MSG == msg_rsp->type);
-    osafassert(AVSV_AMF_PM_STOP == msg_rsp->info.api_resp_info.type);
-    rc = msg_rsp->info.api_resp_info.rc;
-  } else if (NCSCC_RC_FAILURE == rc)
-    rc = SA_AIS_ERR_TRY_AGAIN;
-  else if (NCSCC_RC_REQ_TIMOUT == rc)
-    rc = SA_AIS_ERR_TIMEOUT;
-
-done:
-  /* release cb read lock and return handles */
-  if (cb) {
-    m_NCS_UNLOCK(&cb->lock, NCS_LOCK_READ);
-    ncshm_give_hdl(gl_ava_hdl);
-  }
-  if (hdl_rec)
-    ncshm_give_hdl(hdl);
-
-  /* free the contents of the request/response message */
-  if (msg_rsp)
-    avsv_nda_ava_msg_free(msg_rsp);
-  avsv_nda_ava_msg_content_free(&msg);
-
-  TRACE_LEAVE2("rc:%u", rc);
-  return rc;
-}
-
-/****************************************************************************
-  Name   : saAmfComponentNameGet
- 
-  Description   : This function returns the name of the component to which the
-                 process belongs.
- 
-  Arguments     : hdl   - AMF handle
-                 o_comp_name - ptr to the comp name
- 
-  Return Values : Refer to SAI-AIS specification for various return values.
- 
-  Notes         : None.
-******************************************************************************/
-SaAisErrorT saAmfComponentNameGet(SaAmfHandleT hdl, SaNameT *o_comp_name)
-{
-       return AmfAgent::ComponentNameGet(hdl, o_comp_name);
-}
-
-SaAisErrorT AmfAgent::ComponentNameGet(SaAmfHandleT hdl, SaNameT *o_comp_name) 
{
-  AVA_CB *cb = 0;
-  AVA_HDL_REC *hdl_rec = 0;
-  SaAisErrorT rc = SA_AIS_OK;
-  TRACE_ENTER2("SaAmfHandleT passed is %llx", hdl);
-
-  if (!o_comp_name) {
-    TRACE_LEAVE2("Out param component name is NULL");
-    return SA_AIS_ERR_INVALID_PARAM;
-  }
-
-  memset(o_comp_name, '\0', sizeof(SaNameT));
-
-  /* Verifying the input Handle & global handle */
-  if(!gl_ava_hdl || hdl > AVSV_UNS32_HDL_MAX) {
-    TRACE_2("Invalid SaAmfHandle passed by component: %llx",hdl);
-    rc = SA_AIS_ERR_BAD_HANDLE;
-    goto done;
-  }
-  /* retrieve AvA CB */
-  if (!(cb = (AVA_CB *)ncshm_take_hdl(NCS_SERVICE_ID_AVA, gl_ava_hdl))) {
-    TRACE_4("SA_AIS_ERR_LIBRARY: Unable to retrieve cb handle");
-    rc = SA_AIS_ERR_LIBRARY;
-    goto done;
-  }
-  /* acquire cb read lock */
-  m_NCS_LOCK(&cb->lock, NCS_LOCK_READ);
-  /* retrieve hdl rec */
-  if ( !(hdl_rec = (AVA_HDL_REC *)ncshm_take_hdl(NCS_SERVICE_ID_AVA, hdl)) ) {
-    rc = SA_AIS_ERR_BAD_HANDLE;
-    goto done;
-  }
-
   /* fetch the comp name */
   if (m_AVA_FLAG_IS_COMP_NAME(cb)) {
-    *o_comp_name = cb->comp_name;
-    o_comp_name->length = cb->comp_name.length;
+    /* reuse longDn in @cb->comp_name if any */
+    osaf_extended_name_lend(osaf_extended_name_borrow(&cb->comp_name),
+              o_comp_name);
   } else {
     TRACE_2("component name does not exist");
     rc = SA_AIS_ERR_NOT_EXIST;
@@ -1335,7 +1347,7 @@ SaAisErrorT AmfAgent::CSIQuiescingComple
   /* get the list of pending responses for this handle */
   list_resp = &hdl_rec->pend_resp;
   if (!list_resp) {
-    TRACE_2("No pendingresponses for this handle");
+    TRACE_2("No pending responses for this handle");
     rc = SA_AIS_ERR_LIBRARY;
     goto done;
   }
@@ -1360,7 +1372,7 @@ SaAisErrorT AmfAgent::CSIQuiescingComple
   }
 
   /* populate & send the 'Quiescing Complete' message */
-  m_AVA_CSI_QUIESCING_COMPL_MSG_FILL(msg, cb->ava_dest, hdl, inv, error, 
cb->comp_name);
+  ava_fill_csi_quiescing_complete_msg(&msg, cb->ava_dest, hdl, inv, error, 
cb->comp_name);
   rc = static_cast<SaAisErrorT>(ava_mds_send(cb, &msg, 0));
   if (NCSCC_RC_SUCCESS != rc)
     rc = SA_AIS_ERR_TRY_AGAIN;
@@ -1417,8 +1429,8 @@ SaAisErrorT AmfAgent::HAStateGet(SaAmfHa
   SaAisErrorT rc = SA_AIS_OK;
   TRACE_ENTER2("SaAmfHandleT passed is %llx", hdl);
 
-  if (!comp_name || !(comp_name->length) || (comp_name->length > 
SA_MAX_NAME_LENGTH) ||
-      !csi_name || !(csi_name->length) || (csi_name->length > 
SA_MAX_NAME_LENGTH) || !o_ha) {
+  if (!comp_name || !ava_sanamet_is_valid(comp_name) ||
+      !csi_name || !ava_sanamet_is_valid(csi_name) || !o_ha) {
     TRACE_LEAVE2("Incorrect arguments");
     return SA_AIS_ERR_INVALID_PARAM;
   }
@@ -1437,14 +1449,14 @@ SaAisErrorT AmfAgent::HAStateGet(SaAmfHa
   }
   /* acquire cb read lock */
   m_NCS_LOCK(&cb->lock, NCS_LOCK_READ);
-  /* retrieve hdl rec */
+    /* retrieve hdl rec */
   if ( !(hdl_rec = (AVA_HDL_REC *)ncshm_take_hdl(NCS_SERVICE_ID_AVA, hdl)) ) {
     rc = SA_AIS_ERR_BAD_HANDLE;
     goto done;
   }
 
   /* populate & send the 'ha state get' message */
-  m_AVA_HA_STATE_GET_MSG_FILL(msg, cb->ava_dest, hdl, *comp_name, *csi_name);
+  ava_fill_ha_state_get_msg(&msg, cb->ava_dest, hdl, *comp_name, *csi_name);
   rc = static_cast<SaAisErrorT>(ava_mds_send(cb, &msg, &msg_rsp));
   if (NCSCC_RC_SUCCESS == rc) {
     osafassert(AVSV_AVND_AMF_API_RESP_MSG == msg_rsp->type);
@@ -1515,7 +1527,7 @@ SaAisErrorT AmfAgent::ProtectionGroupTra
   SaAisErrorT rc = SA_AIS_OK;
   TRACE_ENTER2("SaAmfHandleT passed is %llx", hdl);
 
-  if (!csi_name || !(csi_name->length) || (csi_name->length > 
SA_MAX_NAME_LENGTH)) {
+  if (!csi_name || !ava_sanamet_is_valid(csi_name)) {
     TRACE_LEAVE2("Incorrect arguments");
     return SA_AIS_ERR_INVALID_PARAM;
   }
@@ -1577,7 +1589,7 @@ SaAisErrorT AmfAgent::ProtectionGroupTra
   }
 
   /* populate & send the pg start message */
-  m_AVA_PG_START_MSG_FILL(msg, cb->ava_dest, hdl, *csi_name, flags, is_syn);
+  ava_fill_pg_start_msg(&msg, cb->ava_dest, hdl, *csi_name, flags, is_syn);
   rc = static_cast<SaAisErrorT>(ava_mds_send(cb, &msg, &msg_rsp));
   if (NCSCC_RC_SUCCESS == rc) {
     /* the resp may contain only the oper result or the curr pg members */
@@ -1685,7 +1697,7 @@ SaAisErrorT AmfAgent::ProtectionGroupTra
   SaAisErrorT rc = SA_AIS_OK;
   TRACE_ENTER2("SaAmfHandleT passed is %llx", hdl);
 
-  if (!csi_name || !(csi_name->length) || (csi_name->length > 
SA_MAX_NAME_LENGTH)) {
+  if (!csi_name || !ava_sanamet_is_valid(csi_name)) {
     TRACE_LEAVE2("Incorrect arguments");
     return SA_AIS_ERR_INVALID_PARAM;
   }
@@ -1711,7 +1723,7 @@ SaAisErrorT AmfAgent::ProtectionGroupTra
   }
 
   /* populate & send the pg stop message */
-  m_AVA_PG_STOP_MSG_FILL(msg, cb->ava_dest, hdl, *csi_name);
+  ava_fill_pg_stop_msg(&msg, cb->ava_dest, hdl, *csi_name);
   rc = static_cast<SaAisErrorT>(ava_mds_send(cb, &msg, &msg_rsp));
   if (NCSCC_RC_SUCCESS == rc) {
     osafassert(AVSV_AVND_AMF_API_RESP_MSG == msg_rsp->type);
@@ -1775,7 +1787,7 @@ SaAisErrorT AmfAgent::ComponentErrorRepo
   TRACE_ENTER2("SaAmfHandleT passed is %llx", hdl);
 
   /* validate the component */
-  if (!err_comp || !(err_comp->length) || (err_comp->length > 
SA_MAX_NAME_LENGTH)) {
+  if (!err_comp || !ava_sanamet_is_valid(err_comp)) {
     TRACE_LEAVE2("Incorrect arguments");
     return SA_AIS_ERR_INVALID_PARAM;
   }
@@ -1811,7 +1823,7 @@ SaAisErrorT AmfAgent::ComponentErrorRepo
   }
 
   /* populate & send the 'error report' message */
-  m_AVA_ERR_REP_MSG_FILL(msg, cb->ava_dest, hdl, *err_comp, err_time, 
rec_rcvr);
+  ava_fill_error_report_msg(&msg, cb->ava_dest, hdl, *err_comp, err_time, 
rec_rcvr);
   rc = static_cast<SaAisErrorT>(ava_mds_send(cb, &msg, &msg_rsp));
   if (NCSCC_RC_SUCCESS == rc) {
     osafassert(AVSV_AVND_AMF_API_RESP_MSG == msg_rsp->type);
@@ -1867,7 +1879,7 @@ SaAisErrorT AmfAgent::ComponentErrorClea
   SaAisErrorT rc = SA_AIS_OK;
   TRACE_ENTER2("SaAmfHandleT passed is %llx", hdl);
 
-  if (!comp_name || !(comp_name->length) || (comp_name->length > 
SA_MAX_NAME_LENGTH)) {
+  if (!comp_name || !ava_sanamet_is_valid(comp_name)) {
     TRACE_LEAVE2("Incorrect arguments");
     return SA_AIS_ERR_INVALID_PARAM;
   }
@@ -1886,14 +1898,14 @@ SaAisErrorT AmfAgent::ComponentErrorClea
   }
   /* acquire cb read lock */
   m_NCS_LOCK(&cb->lock, NCS_LOCK_READ);
-  /* retrieve hdl rec */
+    /* retrieve hdl rec */
   if ( !(hdl_rec = (AVA_HDL_REC *)ncshm_take_hdl(NCS_SERVICE_ID_AVA, hdl)) ) {
     rc = SA_AIS_ERR_BAD_HANDLE;
     goto done;
   }
 
   /* populate & send the 'error clear' message */
-  m_AVA_ERR_CLEAR_MSG_FILL(msg, cb->ava_dest, hdl, *comp_name);
+  ava_fill_err_clear_msg(&msg, cb->ava_dest, hdl, *comp_name);
   rc = static_cast<SaAisErrorT>(ava_mds_send(cb, &msg, &msg_rsp));
   if (NCSCC_RC_SUCCESS == rc) {
     osafassert(AVSV_AVND_AMF_API_RESP_MSG == msg_rsp->type);
@@ -1994,7 +2006,7 @@ SaAisErrorT AmfAgent::Response(SaAmfHand
   }
 
   /* populate & send the 'AMF response' message */
-  m_AVA_AMF_RESP_MSG_FILL(msg, cb->ava_dest, hdl, inv, error, cb->comp_name);
+  ava_fill_response_msg(&msg, cb->ava_dest, hdl, inv, error, cb->comp_name);
 
   if (rec->cbk_info->type == AVSV_AMF_COMP_TERM)
     rc = static_cast<SaAisErrorT>(ava_mds_send(cb, &msg, &msg_rsp));
@@ -2366,7 +2378,7 @@ SaAisErrorT AmfAgent::ProtectionGroupTra
   /* TODO: check cluster membership, if node is not a member answer back with 
SA_AIS_ERR_UNAVAILABLE */
   /* TODO: check if handle is "old", due to node rejoin as member in cluster. 
If not: SA_AIS_ERR_UNAVAILABLE */
 
-  if (!csi_name || !(csi_name->length) || (csi_name->length > 
SA_MAX_NAME_LENGTH)) {
+  if (!csi_name || !ava_sanamet_is_valid(csi_name)) {
     TRACE_LEAVE2("Incorrect arguments");
     rc = SA_AIS_ERR_INVALID_PARAM;
     goto done;
@@ -2410,7 +2422,7 @@ SaAisErrorT AmfAgent::ProtectionGroupTra
   }
 
   /* populate & send the pg start message */
-  m_AVA_PG_START_MSG_FILL(msg, cb->ava_dest, hdl, *csi_name, flags, is_syn);
+  ava_fill_pg_start_msg(&msg, cb->ava_dest, hdl, *csi_name, flags, is_syn);
   rc = static_cast<SaAisErrorT>(ava_mds_send(cb, &msg, &msg_rsp));
   if (NCSCC_RC_SUCCESS == rc) {
     /* the resp may contain only the oper result or the curr pg members */
@@ -2438,7 +2450,6 @@ SaAisErrorT AmfAgent::ProtectionGroupTra
           ava_cpy_protection_group_ntf(buf->notification, 
rsp_buf->notification,
                                        buf->numberOfItems, 
SA_AMF_HARS_READY_FOR_ASSIGNMENT);
           rc = SA_AIS_ERR_NO_SPACE;
-          buf->numberOfItems = rsp_buf->numberOfItems;
         }
       } else { /* if(create_memory == false) */
 
@@ -2542,8 +2553,11 @@ SaAisErrorT AmfAgent::ProtectionGroupNot
   /* TODO: check if handle is "old", due to node rejoin as member in cluster. 
If not: SA_AIS_ERR_UNAVAILABLE */
 
   /* free memory */
-  if(notification)
+  if(notification) {
+    // TODO (minhchau): memleak if notification is an array
+    osaf_extended_name_free(&notification->member.compName);
     free(notification);
+  }
   else
     rc = SA_AIS_ERR_INVALID_PARAM;
 
diff --git a/osaf/libs/agents/saf/amfa/ava_hdl.cc 
b/osaf/libs/agents/saf/amfa/ava_hdl.cc
--- a/osaf/libs/agents/saf/amfa/ava_hdl.cc
+++ b/osaf/libs/agents/saf/amfa/ava_hdl.cc
@@ -37,7 +37,7 @@ static uint32_t ava_hdl_cbk_dispatch_one
 static uint32_t ava_hdl_cbk_dispatch_all(AVA_CB **, AVA_HDL_REC **);
 static uint32_t ava_hdl_cbk_dispatch_block(AVA_CB **, AVA_HDL_REC **);
 
-static void ava_hdl_cbk_rec_prc(AVSV_AMF_CBK_INFO *, SaAmfCallbacksT *);
+static uint32_t ava_hdl_cbk_rec_prc(AVSV_AMF_CBK_INFO *, SaAmfCallbacksT *);
 
 static void ava_hdl_pend_resp_list_del(AVA_CB *, AVA_PEND_RESP *);
 static bool ava_hdl_cbk_ipc_mbx_del(NCSCONTEXT arg, NCSCONTEXT msg);
@@ -373,7 +373,7 @@ uint32_t ava_hdl_cbk_dispatch_one(AVA_CB
                ncshm_give_hdl(hdl);
 
                /* process the callback list record */
-               ava_hdl_cbk_rec_prc(rec->cbk_info, &reg_cbk);
+               rc = ava_hdl_cbk_rec_prc(rec->cbk_info, &reg_cbk);
 
                m_NCS_LOCK(&(*cb)->lock, NCS_LOCK_WRITE);
 
@@ -444,7 +444,7 @@ uint32_t ava_hdl_cbk_dispatch_all(AVA_CB
                ncshm_give_hdl(hdl);
 
                /* process the callback list record */
-               ava_hdl_cbk_rec_prc(rec->cbk_info, &reg_cbk);
+               rc = ava_hdl_cbk_rec_prc(rec->cbk_info, &reg_cbk);
 
                m_NCS_LOCK(&(*cb)->lock, NCS_LOCK_WRITE);
 
@@ -527,7 +527,7 @@ uint32_t ava_hdl_cbk_dispatch_block(AVA_
                m_NCS_UNLOCK(&(*cb)->lock, NCS_LOCK_WRITE);
 
                /* process the callback list record */
-               ava_hdl_cbk_rec_prc(rec->cbk_info, &reg_cbk);
+               rc = ava_hdl_cbk_rec_prc(rec->cbk_info, &reg_cbk);
 
                /* take cb lock, so that any call to SaAmfResponce() will block 
*/
                m_NCS_LOCK(&(*cb)->lock, NCS_LOCK_WRITE);
@@ -577,121 +577,127 @@ uint32_t ava_hdl_cbk_dispatch_block(AVA_
  
   Return Values : None
  
-  Notes         : It may so happen that the callbacks that are dispatched may 
+  Notes         : - It may so happen that the callbacks that are dispatched may
                   finalize on the amf handle. Release AMF handle to the handle
                   manager before dispatching. Else Finalize blocks while 
                   destroying the association with handle manager.
+                  - Since AMF supports LongDn, though AMF client still has
+                  not supported LongDn, the callback comes may contain LongDn
+                  SaNameT. AMF Agent needs to drop this callback so that AMF
+                  client will not able to access LongDn SaNameT, otherwise
+                  client could be crashed.
 ******************************************************************************/
-void ava_hdl_cbk_rec_prc(AVSV_AMF_CBK_INFO *info, SaAmfCallbacksT *reg_cbk)
+uint32_t ava_hdl_cbk_rec_prc(AVSV_AMF_CBK_INFO *info, SaAmfCallbacksT *reg_cbk)
 {
+       uint32_t rc = SA_AIS_OK;
+       uint32_t i;
        TRACE_ENTER2("CallbackType = %d",info->type);
 
        /* invoke the corresponding callback */
        switch (info->type) {
-       case AVSV_AMF_HC:
-               {
+               case AVSV_AMF_HC: {
                        AVSV_AMF_HC_PARAM *hc = &info->param.hc;
-                       if (reg_cbk->saAmfHealthcheckCallback) {
-                               hc->comp_name.length = hc->comp_name.length;
-                               TRACE("Invoking Healthcheck Callback:\
-                                       InvocationId = %llx, Component Name =  
%s, Healthcheck Key = %s",
-                                       info->inv, hc->comp_name.value, 
hc->hc_key.key);
-                               reg_cbk->saAmfHealthcheckCallback(info->inv, 
&hc->comp_name, &hc->hc_key);
+                       if (!ava_sanamet_is_valid(&hc->comp_name)) {
+                               rc = SA_AIS_ERR_NAME_TOO_LONG;
                        }
+                       if (rc == SA_AIS_OK && 
reg_cbk->saAmfHealthcheckCallback) {
+                                       TRACE("Invoking Healthcheck Callback:"
+                                               "InvocationId = %llx, Component 
Name =  %s, Healthcheck Key = %s",
+                                               info->inv, 
osaf_extended_name_borrow(&hc->comp_name), hc->hc_key.key);
+                                       
reg_cbk->saAmfHealthcheckCallback(info->inv, &hc->comp_name, &hc->hc_key);
+                       }
+
+                       break;
                }
-               break;
-
-       case AVSV_AMF_COMP_TERM:
-               {
+               case AVSV_AMF_COMP_TERM: {
                        AVSV_AMF_COMP_TERM_PARAM *comp_term = 
&info->param.comp_term;
-
-                       if (reg_cbk->saAmfComponentTerminateCallback) {
-                               comp_term->comp_name.length = 
comp_term->comp_name.length;
-                               TRACE("Invoking component's 
saAmfComponentTerminateCallback: InvocationId = %llx,\
-                                        component name = %s",info->inv, 
comp_term->comp_name.value);
-                               
reg_cbk->saAmfComponentTerminateCallback(info->inv, &comp_term->comp_name);
+                       if (!ava_sanamet_is_valid(&comp_term->comp_name)) {
+                               rc = SA_AIS_ERR_NAME_TOO_LONG;
                        }
+                       if (rc == SA_AIS_OK && 
reg_cbk->saAmfComponentTerminateCallback) {
+                                       TRACE("Invoking component's 
saAmfComponentTerminateCallback: InvocationId = %llx,"
+                                                "component name = 
%s",info->inv, osaf_extended_name_borrow(&comp_term->comp_name));
+                                       
reg_cbk->saAmfComponentTerminateCallback(info->inv, &comp_term->comp_name);
+                       }
+                       break;
                }
-               break;
-
-       case AVSV_AMF_CSI_SET:
-               {
+               case AVSV_AMF_CSI_SET: {
                        AVSV_AMF_CSI_SET_PARAM *csi_set = &info->param.csi_set;
 
-                       if (reg_cbk->saAmfCSISetCallback) {
-                               csi_set->comp_name.length = 
csi_set->comp_name.length;
+                       if (!ava_sanamet_is_valid(&csi_set->csi_desc.csiName) ||
+                               !ava_sanamet_is_valid(&csi_set->comp_name) ||
+                               
!ava_sanamet_is_valid(&csi_set->csi_desc.csiStateDescriptor.activeDescriptor.activeCompName)
 ||
+                               
!ava_sanamet_is_valid(&csi_set->csi_desc.csiStateDescriptor.standbyDescriptor.activeCompName))
 {
+                               rc = SA_AIS_ERR_NAME_TOO_LONG;
+                       }
 
-                               if (SA_AMF_CSI_TARGET_ALL != 
csi_set->csi_desc.csiFlags) {
-                                       csi_set->csi_desc.csiName.length = 
csi_set->csi_desc.csiName.length;
-                               }
+                       if (rc == SA_AIS_OK && reg_cbk->saAmfCSISetCallback) {
+                               TRACE("CSISet: CSIName = %s, CSIFlags = %d, HA 
state = %d",
+                                       
osaf_extended_name_borrow(&csi_set->csi_desc.csiName),csi_set->csi_desc.csiFlags,csi_set->ha);
+                               TRACE("CSISet: Active Transition Descriptor = 
%u, Active Component Name = %s",
+                                       
csi_set->csi_desc.csiStateDescriptor.activeDescriptor.transitionDescriptor,
+                                       
osaf_extended_name_borrow(&csi_set->csi_desc.csiStateDescriptor.activeDescriptor.activeCompName));
+                               TRACE("CSISet: ActiveCompName = %s, StandbyRank 
= %u",
+                                       
osaf_extended_name_borrow(&csi_set->csi_desc.csiStateDescriptor.standbyDescriptor.activeCompName),
+                                       
csi_set->csi_desc.csiStateDescriptor.standbyDescriptor.standbyRank);
+                               TRACE("Invoking component's 
saAmfCSISetCallback: InvocationId = %llx, component name = %s",
+                                       
info->inv,osaf_extended_name_borrow(&csi_set->comp_name));
+                               reg_cbk->saAmfCSISetCallback(info->inv,
+                                       &csi_set->comp_name, csi_set->ha, 
csi_set->csi_desc);
+                       }
 
-                               TRACE("CSISet: CSIName = %s, CSIFlags = %d, HA 
state = %d",\
-                                       
csi_set->csi_desc.csiName.value,csi_set->csi_desc.csiFlags,csi_set->ha);
-
-                               if ((SA_AMF_HA_ACTIVE == csi_set->ha) &&
-                                   (SA_AMF_CSI_NEW_ASSIGN !=
-                                    
csi_set->csi_desc.csiStateDescriptor.activeDescriptor.transitionDescriptor)) {
-                                       
csi_set->csi_desc.csiStateDescriptor.activeDescriptor.activeCompName.length =
-                                           
csi_set->csi_desc.csiStateDescriptor.activeDescriptor.activeCompName.length;
-                               } else if (SA_AMF_HA_STANDBY == csi_set->ha) {
-                                       
csi_set->csi_desc.csiStateDescriptor.standbyDescriptor.activeCompName.length =
-                                           
csi_set->csi_desc.csiStateDescriptor.standbyDescriptor.activeCompName.
-                                           length;
-                               }
-
-                               TRACE("CSISet: Active Transition Descriptor = 
%u, Active Component Name = %s",\
-                                       
csi_set->csi_desc.csiStateDescriptor.activeDescriptor.transitionDescriptor,\
-                                       
csi_set->csi_desc.csiStateDescriptor.activeDescriptor.activeCompName.value);
-                               TRACE("CSISet: ActiveCompName = %s, StandbyRank 
= %u",\
-                                       
csi_set->csi_desc.csiStateDescriptor.standbyDescriptor.activeCompName.value,\
-                                       
csi_set->csi_desc.csiStateDescriptor.standbyDescriptor.standbyRank);
-                               TRACE("Invoking component's 
saAmfCSISetCallback: InvocationId = %llx, component name = %s",\
-                               info->inv,csi_set->comp_name.value);
-                               reg_cbk->saAmfCSISetCallback(info->inv,
-                                               &csi_set->comp_name, 
csi_set->ha, csi_set->csi_desc);
+                       break;
+               }
+               case AVSV_AMF_CSI_REM: {
+                       AVSV_AMF_CSI_REM_PARAM *csi_rem = &info->param.csi_rem;
+                       if (!ava_sanamet_is_valid(&csi_rem->comp_name) ||
+                               !ava_sanamet_is_valid(&csi_rem->csi_name)) {
+                               rc = SA_AIS_ERR_NAME_TOO_LONG;
                        }
+                       if (rc == SA_AIS_OK && reg_cbk->saAmfCSIRemoveCallback) 
{
+                               TRACE("Invoking component's 
saAmfCSIRemoveCallback: InvocationId = %llx, component name = %s,"
+                                       "CSIName = 
%s",info->inv,osaf_extended_name_borrow(&csi_rem->comp_name),
+                                       
osaf_extended_name_borrow(&csi_rem->csi_name));
+                               reg_cbk->saAmfCSIRemoveCallback(info->inv,
+                                                                       
&csi_rem->comp_name,
+                                                                       
&csi_rem->csi_name, csi_rem->csi_flags);
+                       }
+                       break;
                }
-               break;
-
-       case AVSV_AMF_CSI_REM:
-               {
-                       AVSV_AMF_CSI_REM_PARAM *csi_rem = &info->param.csi_rem;
-
-                       if (reg_cbk->saAmfCSIRemoveCallback) {
-                               csi_rem->comp_name.length = 
csi_rem->comp_name.length;
-                               csi_rem->csi_name.length = 
csi_rem->csi_name.length;
-                               TRACE("Invoking component's 
saAmfCSIRemoveCallback: InvocationId = %llx, component name = %s,\
-                               CSIName = 
%s",info->inv,csi_rem->comp_name.value,csi_rem->csi_name.value);
-                               reg_cbk->saAmfCSIRemoveCallback(info->inv,
-                                                               
&csi_rem->comp_name,
-                                                               
&csi_rem->csi_name, csi_rem->csi_flags);
-                       }
-               }
-               break;
-
-       case AVSV_AMF_PG_TRACK:
-               {
+               case AVSV_AMF_PG_TRACK: {
                        AVSV_AMF_PG_TRACK_PARAM *pg_track = 
&info->param.pg_track;
 
                        if(ava_B4_ver_used(0)) {
                                SaAmfProtectionGroupNotificationBufferT_4 buf 
={0};
-
-                               if (reg_cbk->saAmfProtectionGroupTrackCallback) 
{
-                                       pg_track->csi_name.length = 
pg_track->csi_name.length;
+                               for (i = 0 ; i < pg_track->buf.numberOfItems ; 
i++) {
+                                       if 
(!ava_sanamet_is_valid(&pg_track->buf.notification[i].member.compName)) {
+                                               rc = SA_AIS_ERR_NAME_TOO_LONG;
+                                               break;
+                                       }
+                               }
+                               if (rc == SA_AIS_OK && 
reg_cbk->saAmfProtectionGroupTrackCallback) {
                                        TRACE("PG track Information: Total 
number of items in buffer = %d",pg_track->buf.numberOfItems);
-
                                        /* copy the contents into a malloced 
buffer.. appl frees it */
                                        buf.numberOfItems = 
pg_track->buf.numberOfItems;
-
                                        buf.notification =
                                                
static_cast<SaAmfProtectionGroupNotificationT_4*>(malloc(buf.numberOfItems * 
sizeof(SaAmfProtectionGroupNotificationT_4)));
                                        if (buf.notification) {
                                                
ava_cpy_protection_group_ntf(buf.notification, pg_track->buf.notification,
                                                                
pg_track->buf.numberOfItems, SA_AMF_HARS_READY_FOR_ASSIGNMENT);
-                                               TRACE("Invoking PGTrack 
callback for CSIName = %s",pg_track->csi_name.value);
+
+                                               /* allocate LongDn strings for 
notification if any
+                                                * then client needs to free 
these LongDn string as well
+                                                */
+                                               for (i=0 ; i < 
buf.numberOfItems; i++) {
+                                                       
osaf_extended_name_alloc(
+                                                               
osaf_extended_name_borrow(&pg_track->buf.notification[i].member.compName),
+                                                               
&buf.notification[i].member.compName);
+                                               }
+                                               TRACE("Invoking PGTrack 
callback for CSIName = %s", osaf_extended_name_borrow(&pg_track->csi_name));
                                                
((SaAmfCallbacksT_4*)reg_cbk)->saAmfProtectionGroupTrackCallback(&pg_track->csi_name,
-                                                                               
           &buf,
-                                                                               
           pg_track->mem_num, pg_track->err);
+                                                                               
                        &buf,
+                                                                               
                          pg_track->mem_num, pg_track->err);
+                                               free(buf.notification);
                                        } else {
                                                pg_track->err = 
SA_AIS_ERR_NO_MEMORY;
                                                LOG_CR("Notification is NULL: 
Invoking PGTrack Callback with error SA_AIS_ERR_NO_MEMORY");
@@ -703,24 +709,38 @@ void ava_hdl_cbk_rec_prc(AVSV_AMF_CBK_IN
                        else /* B01 version is used */
                        {
                                SaAmfProtectionGroupNotificationBufferT buf;
-
-                               if (reg_cbk->saAmfProtectionGroupTrackCallback) 
{
-                                       pg_track->csi_name.length = 
pg_track->csi_name.length;
+                               for (i = 0 ; i < pg_track->buf.numberOfItems ; 
i++) {
+                                       if 
(!ava_sanamet_is_valid(&pg_track->buf.notification[i].member.compName)) {
+                                               rc = SA_AIS_ERR_NAME_TOO_LONG;
+                                               break;
+                                       }
+                               }
+                               if (rc == SA_AIS_OK && 
reg_cbk->saAmfProtectionGroupTrackCallback) {
                                        TRACE("PG track Information: Total 
number of items in buffer = %d",pg_track->buf.numberOfItems);
-
                                        /* copy the contents into a malloced 
buffer.. appl frees it */
                                        buf.numberOfItems = 
pg_track->buf.numberOfItems;
                                        buf.notification = 0;
-
                                        buf.notification =
                                                
static_cast<SaAmfProtectionGroupNotificationT*>(malloc(buf.numberOfItems * 
sizeof(SaAmfProtectionGroupNotificationT)));
                                        if (buf.notification) {
                                                memcpy(buf.notification, 
pg_track->buf.notification,
                                                           buf.numberOfItems * 
sizeof(SaAmfProtectionGroupNotificationT));
-                                               TRACE("Invoking PGTrack 
callback for CSIName = %s",pg_track->csi_name.value);
+                                               TRACE("Invoking PGTrack 
callback for CSIName = %s",
+                                                               
osaf_extended_name_borrow(&pg_track->csi_name));
+
+                                               /* allocate LongDn strings for 
notification if any
+                                                * then client needs to free 
these LongDn string as well
+                                                */
+                                               for (i=0 ; i < 
buf.numberOfItems; i++) {
+                                                       
osaf_extended_name_alloc(
+                                                               
osaf_extended_name_borrow(&pg_track->buf.notification[i].member.compName),
+                                                               
&buf.notification[i].member.compName);
+                                               }
+
                                                ((SaAmfCallbacksT 
*)reg_cbk)->saAmfProtectionGroupTrackCallback(&pg_track->csi_name,
                                                                                
           &buf,
                                                                                
           pg_track->mem_num, pg_track->err);
+                                               free(buf.notification);
                                        } else {
                                                pg_track->err = 
SA_AIS_ERR_NO_MEMORY;
                                                LOG_CR("Notification is NULL: 
Invoking PGTrack Callback with error SA_AIS_ERR_NO_MEMORY");
@@ -729,40 +749,40 @@ void ava_hdl_cbk_rec_prc(AVSV_AMF_CBK_IN
                                        }
                                }
                        }
+                       break;
                }
-               break;
-
-       case AVSV_AMF_PXIED_COMP_INST:
-               {
+               case AVSV_AMF_PXIED_COMP_INST: {
                        AVSV_AMF_PXIED_COMP_INST_PARAM *comp_inst = 
&info->param.pxied_comp_inst;
-
-                       if (reg_cbk->saAmfProxiedComponentInstantiateCallback) {
-                               comp_inst->comp_name.length = 
comp_inst->comp_name.length;
-                               TRACE("Invoking proxiedcomponentInstantiateCbk: 
proxied component name = %s",comp_inst->comp_name.value);
+                       if (!ava_sanamet_is_valid(&comp_inst->comp_name)) {
+                               rc = SA_AIS_ERR_NAME_TOO_LONG;
+                       }
+                       if (rc == SA_AIS_OK && 
reg_cbk->saAmfProxiedComponentInstantiateCallback) {
+                               TRACE("Invoking proxiedcomponentInstantiateCbk: 
proxied component name = %s",
+                                               
osaf_extended_name_borrow(&comp_inst->comp_name));
                                
reg_cbk->saAmfProxiedComponentInstantiateCallback(info->inv, 
&comp_inst->comp_name);
                        }
+                       break;
                }
-               break;
-
-       case AVSV_AMF_PXIED_COMP_CLEAN:
-               {
+               case AVSV_AMF_PXIED_COMP_CLEAN: {
                        AVSV_AMF_PXIED_COMP_CLEAN_PARAM *comp_clean = 
&info->param.pxied_comp_clean;
-
-                       if (reg_cbk->saAmfProxiedComponentCleanupCallback) {
-                               comp_clean->comp_name.length = 
comp_clean->comp_name.length;
-                               TRACE("Invoking proxiedcomponentcleanupCbk: 
proxied component name = %s",comp_clean->comp_name.value);
+                       if (!ava_sanamet_is_valid(&comp_clean->comp_name)) {
+                               rc = SA_AIS_ERR_NAME_TOO_LONG;
+                       }
+                       if (rc == SA_AIS_OK && 
reg_cbk->saAmfProxiedComponentCleanupCallback) {
+                               TRACE("Invoking proxiedcomponentcleanupCbk: 
proxied component name = %s",
+                                               
osaf_extended_name_borrow(&comp_clean->comp_name));
                                
reg_cbk->saAmfProxiedComponentCleanupCallback(info->inv, 
&comp_clean->comp_name);
                        }
+
+                       break;
                }
-               break;
-
-       default:
-               osafassert(0);
-               break;
+               default:
+                       osafassert(0);
+                       break;
        }                       /* switch */
 
        TRACE_LEAVE();
-       return;
+       return rc;
 }
 
 /****************************************************************************
diff --git a/osaf/libs/agents/saf/amfa/ava_init.cc 
b/osaf/libs/agents/saf/amfa/ava_init.cc
--- a/osaf/libs/agents/saf/amfa/ava_init.cc
+++ b/osaf/libs/agents/saf/amfa/ava_init.cc
@@ -120,6 +120,7 @@ uint32_t ava_create(NCS_LIB_CREATE *crea
        AVA_CB *cb = 0;
        uint32_t rc = NCSCC_RC_SUCCESS;
        EDU_ERR err;
+       SaConstStringT env_comp_name = getenv("SA_AMF_COMPONENT_NAME");
        TRACE_ENTER();
 
        /* allocate AvA cb */
@@ -129,17 +130,18 @@ uint32_t ava_create(NCS_LIB_CREATE *crea
                goto error;
        }
 
-       /* fetch the comp name from the env variable */
-       if (getenv("SA_AMF_COMPONENT_NAME")) {
-               if (strlen(getenv("SA_AMF_COMPONENT_NAME")) < 
SA_MAX_NAME_LENGTH) {
-                       strcpy((char *)cb->comp_name.value, 
getenv("SA_AMF_COMPONENT_NAME"));
-                       cb->comp_name.length = (uint16_t)strlen((char 
*)cb->comp_name.value);
-                       m_AVA_FLAG_SET(cb, AVA_FLAG_COMP_NAME);
-                       TRACE("Component name = %s",cb->comp_name.value);
-               } else {
-                       TRACE_2("Length of SA_AMF_COMPONENT_NAME exceeds 
SA_MAX_NAME_LENGTH bytes");
+       /* check the comp name from the env variable */
+       if (env_comp_name) {
+               if (strlen(env_comp_name) > kOsafMaxDnLength) {
+                       TRACE_2("Length of SA_AMF_COMPONENT_NAME exceeds "
+                                       "kOsafMaxDnLength(%d) bytes", 
kOsafMaxDnLength);
                        rc = NCSCC_RC_FAILURE;
                        goto error;
+               } else {
+                       // @cb->comp_name could be longDN, need to be freed 
later
+                       osaf_extended_name_alloc(env_comp_name, &cb->comp_name);
+                       m_AVA_FLAG_SET(cb, AVA_FLAG_COMP_NAME);
+                       TRACE("Component name = %s", 
osaf_extended_name_borrow(&cb->comp_name));
                }
        }
 
@@ -282,6 +284,7 @@ void ava_destroy(NCS_LIB_DESTROY *destro
        TRACE_1("Removing association with handle manager failed");
 
        /* free the control block */
+       osaf_extended_name_free(&cb->comp_name);
        free(cb);
 
        /* reset the global cb handle */
diff --git a/osaf/libs/agents/saf/amfa/ava_mds.cc 
b/osaf/libs/agents/saf/amfa/ava_mds.cc
--- a/osaf/libs/agents/saf/amfa/ava_mds.cc
+++ b/osaf/libs/agents/saf/amfa/ava_mds.cc
@@ -281,6 +281,7 @@ uint32_t ava_mds_cbk(NCSMDS_CALLBACK_INF
                                TRACE("MDS decode callback success");
                }
                break;
+
        case MDS_CALLBACK_ENC:
                {
                        info->info.enc.o_msg_fmt_ver = 
m_NCS_ENC_MSG_FMT_GET(info->info.enc.i_rem_svc_pvt_ver,
@@ -499,6 +500,137 @@ uint32_t ava_mds_flat_enc(AVA_CB *cb, MD
        case AVSV_AVA_API_MSG:
                /* encode into userbuf */
                rc = ncs_encode_n_octets_in_uba(enc_info->io_uba, (uint8_t 
*)msg, sizeof(AVSV_NDA_AVA_MSG));
+               if (NCSCC_RC_SUCCESS != rc)
+                       goto done;
+
+               switch (msg->info.api_info.type) {
+                               case AVSV_AMF_FINALIZE:
+                                       if 
(osaf_is_an_extended_name(&msg->info.api_info.param.finalize.comp_name)) {
+                                               
osaf_encode_sanamet(enc_info->io_uba, 
&msg->info.api_info.param.finalize.comp_name);
+                                       }
+                                       break;
+
+                               case AVSV_AMF_COMP_REG:
+                                       if 
(osaf_is_an_extended_name(&msg->info.api_info.param.reg.comp_name)) {
+                                               
osaf_encode_sanamet(enc_info->io_uba, &msg->info.api_info.param.reg.comp_name);
+                                       }
+
+                                       if 
(osaf_is_an_extended_name(&msg->info.api_info.param.reg.proxy_comp_name)) {
+                                               
osaf_encode_sanamet(enc_info->io_uba, 
&msg->info.api_info.param.reg.proxy_comp_name);
+                                       }
+                                       break;
+
+                               case AVSV_AMF_COMP_UNREG:
+                                       if 
(osaf_is_an_extended_name(&msg->info.api_info.param.unreg.comp_name)) {
+                                               
osaf_encode_sanamet(enc_info->io_uba, 
&msg->info.api_info.param.unreg.comp_name);
+                                       }
+
+                                       if 
(osaf_is_an_extended_name(&msg->info.api_info.param.unreg.proxy_comp_name)) {
+                                               
osaf_encode_sanamet(enc_info->io_uba, 
&msg->info.api_info.param.unreg.proxy_comp_name);
+                                       }
+
+                                       break;
+
+                               case AVSV_AMF_PM_START:
+                                       if 
(osaf_is_an_extended_name(&msg->info.api_info.param.pm_start.comp_name)) {
+                                               
osaf_encode_sanamet(enc_info->io_uba, 
&msg->info.api_info.param.pm_start.comp_name);
+                                       }
+                                       break;
+
+                               case AVSV_AMF_PM_STOP:
+                                       if 
(osaf_is_an_extended_name(&msg->info.api_info.param.pm_stop.comp_name)) {
+                                               
osaf_encode_sanamet(enc_info->io_uba, 
&msg->info.api_info.param.pm_stop.comp_name);
+                                       }
+                                       break;
+
+                               case AVSV_AMF_HC_START:
+                                       if 
(osaf_is_an_extended_name(&msg->info.api_info.param.hc_start.comp_name)) {
+                                               
osaf_encode_sanamet(enc_info->io_uba, 
&msg->info.api_info.param.hc_start.comp_name);
+                                       }
+
+                                       if 
(osaf_is_an_extended_name(&msg->info.api_info.param.hc_start.proxy_comp_name)) {
+                                               
osaf_encode_sanamet(enc_info->io_uba, 
&msg->info.api_info.param.hc_start.proxy_comp_name);
+                                       }
+
+                                       break;
+
+                               case AVSV_AMF_HC_STOP:
+                                       if 
(osaf_is_an_extended_name(&msg->info.api_info.param.hc_stop.comp_name)) {
+                                               
osaf_encode_sanamet(enc_info->io_uba, 
&msg->info.api_info.param.hc_stop.comp_name);
+                                       }
+
+                                       if 
(osaf_is_an_extended_name(&msg->info.api_info.param.hc_stop.proxy_comp_name)) {
+                                               
osaf_encode_sanamet(enc_info->io_uba, 
&msg->info.api_info.param.hc_stop.proxy_comp_name);
+                                       }
+
+                                       break;
+
+                               case AVSV_AMF_HC_CONFIRM:
+                                       if 
(osaf_is_an_extended_name(&msg->info.api_info.param.hc_confirm.comp_name)) {
+                                               
osaf_encode_sanamet(enc_info->io_uba, 
&msg->info.api_info.param.hc_confirm.comp_name);
+                                       }
+
+                                       if 
(osaf_is_an_extended_name(&msg->info.api_info.param.hc_confirm.proxy_comp_name))
 {
+                                               
osaf_encode_sanamet(enc_info->io_uba, 
&msg->info.api_info.param.hc_confirm.proxy_comp_name);
+                                       }
+
+                                       break;
+
+                               case AVSV_AMF_CSI_QUIESCING_COMPLETE:
+                                       if 
(osaf_is_an_extended_name(&msg->info.api_info.param.csiq_compl.comp_name)) {
+                                               
osaf_encode_sanamet(enc_info->io_uba, 
&msg->info.api_info.param.csiq_compl.comp_name);
+                                       }
+
+                                       break;
+
+                               case AVSV_AMF_HA_STATE_GET:
+                                       if 
(osaf_is_an_extended_name(&msg->info.api_info.param.ha_get.comp_name)) {
+                                               
osaf_encode_sanamet(enc_info->io_uba, 
&msg->info.api_info.param.ha_get.comp_name);
+                                       }
+
+                                       if 
(osaf_is_an_extended_name(&msg->info.api_info.param.ha_get.csi_name)) {
+                                               
osaf_encode_sanamet(enc_info->io_uba, 
&msg->info.api_info.param.ha_get.csi_name);
+                                       }
+
+                                       break;
+
+                               case AVSV_AMF_PG_START:
+                                       if 
(osaf_is_an_extended_name(&msg->info.api_info.param.pg_start.csi_name)) {
+                                               
osaf_encode_sanamet(enc_info->io_uba, 
&msg->info.api_info.param.pg_start.csi_name);
+                                       }
+
+                                       break;
+
+                               case AVSV_AMF_PG_STOP:
+                                       if 
(osaf_is_an_extended_name(&msg->info.api_info.param.pg_stop.csi_name)) {
+                                               
osaf_encode_sanamet(enc_info->io_uba, 
&msg->info.api_info.param.pg_stop.csi_name);
+                                       }
+                                       break;
+
+                               case AVSV_AMF_ERR_REP:
+                                       if 
(osaf_is_an_extended_name(&msg->info.api_info.param.err_rep.err_comp)) {
+                                               
osaf_encode_sanamet(enc_info->io_uba, 
&msg->info.api_info.param.err_rep.err_comp);
+                                       }
+
+                                       break;
+
+                               case AVSV_AMF_ERR_CLEAR:
+                                       if 
(osaf_is_an_extended_name(&msg->info.api_info.param.err_clear.comp_name)) {
+                                               
osaf_encode_sanamet(enc_info->io_uba, 
&msg->info.api_info.param.err_clear.comp_name);
+                                       }
+
+                                       break;
+
+                               case AVSV_AMF_RESP:
+                                       if 
(osaf_is_an_extended_name(&msg->info.api_info.param.resp.comp_name)) {
+                                               
osaf_encode_sanamet(enc_info->io_uba, &msg->info.api_info.param.resp.comp_name);
+                                       }
+
+                                       break;
+
+                               default:
+                                       break;
+               } /* switch */
                break;
 
        case AVSV_AVND_AMF_CBK_MSG:
@@ -507,6 +639,7 @@ uint32_t ava_mds_flat_enc(AVA_CB *cb, MD
                osafassert(0);
        }                       /* switch */
 
+done:
        TRACE_LEAVE2("retval = %u",rc);
        return rc;
 }
@@ -570,6 +703,15 @@ uint32_t ava_mds_flat_dec(AVA_CB *cb, MD
                                        AVSV_AMF_CSI_SET_PARAM *csi_set = 
&msg->info.cbk_info->param.csi_set;
                                        uint16_t len, i;
                                        uint8_t *p8;
+
+                                       if 
(osaf_is_an_extended_name(&csi_set->comp_name)) {
+                                               
osaf_decode_sanamet(dec_info->io_uba, &csi_set->comp_name);
+                                       }
+
+                                       if 
(osaf_is_an_extended_name(&csi_set->csi_desc.csiName)) {
+                                               
osaf_decode_sanamet(dec_info->io_uba, &csi_set->csi_desc.csiName);
+                                       }
+
                                        if (csi_set->attrs.number) {
                                                csi_set->attrs.list = 0;
                                                csi_set->attrs.list =
@@ -587,6 +729,12 @@ uint32_t ava_mds_flat_dec(AVA_CB *cb, MD
                                                                
LOG_CR("ncs_decode_n_octets_from_uba failed with rc= %d", rc);
                                                                goto err;
                                                        }
+
+                                                       // This is to keep the 
backward compatibility
+                                                       if 
(osaf_is_an_extended_name(&csi_set->attrs.list[i].name)) {
+                                                               
osaf_decode_sanamet(dec_info->io_uba, &csi_set->attrs.list[i].name);
+                                                       }
+                                                       //
                                                        p8 = 
ncs_dec_flatten_space(dec_info->io_uba, (uint8_t *)&len, 2);
                                                        len = 
ncs_decode_16bit(&p8);
                                                        
ncs_dec_skip_space(dec_info->io_uba, 2);
@@ -596,17 +744,36 @@ uint32_t ava_mds_flat_dec(AVA_CB *cb, MD
                                                                (uint8_t 
*)csi_set->attrs.list[i].string_ptr,
                                                                (len+1));
                                                        if (NCSCC_RC_SUCCESS != 
rc) {
-                                                               
LOG_CR("ncs_decode_n_octets_from_uba failed with rc = %d",                      
                                                       rc);
+                                                               
LOG_CR("ncs_decode_n_octets_from_uba failed with rc = %d", rc);
                                                                goto err;
                                                        }
                                                }
                                        }
+
+                                       if (csi_set->ha == SA_AMF_HA_ACTIVE) {
+                                               if 
(osaf_is_an_extended_name(&csi_set->csi_desc.csiStateDescriptor.activeDescriptor.activeCompName))
 {
+                                                       
osaf_decode_sanamet(dec_info->io_uba,
+                                                                               
                
&csi_set->csi_desc.csiStateDescriptor.activeDescriptor.activeCompName);
+                                               }
+                                       }
+
+                                       if (csi_set->ha == SA_AMF_HA_STANDBY) {
+                                               if 
(osaf_is_an_extended_name(&csi_set->csi_desc.csiStateDescriptor.standbyDescriptor.activeCompName))
 {
+                                                       
osaf_decode_sanamet(dec_info->io_uba,
+                                                                               
                
&csi_set->csi_desc.csiStateDescriptor.standbyDescriptor.activeCompName);
+                                               }
+                                       }
                                }
                                break;
 
                        case AVSV_AMF_PG_TRACK:
                                {
                                        AVSV_AMF_PG_TRACK_PARAM *pg_track = 
&msg->info.cbk_info->param.pg_track;
+                                       uint16_t i;
+
+                                       if 
(osaf_is_an_extended_name(&pg_track->csi_name)) {
+                                               
osaf_decode_sanamet(dec_info->io_uba, &pg_track->csi_name);
+                                       }
 
                                        if (pg_track->buf.numberOfItems) {
                                                pg_track->buf.notification = 0;
@@ -628,16 +795,68 @@ uint32_t ava_mds_flat_dec(AVA_CB *cb, MD
                                                        
TRACE_2("ncs_decode_n_octets_from_uba failed with rc = %d", rc);
                                                        goto err;
                                                }
+
+                                               for (i = 0; i < 
pg_track->buf.numberOfItems; i++) {
+                                                       if 
(osaf_is_an_extended_name(&pg_track->buf.notification[i].member.compName)) {
+                                                               
osaf_decode_sanamet(dec_info->io_uba, 
&pg_track->buf.notification[i].member.compName);
+                                                       }
+                                               }
                                        }
                                }
                                break;
 
                        case AVSV_AMF_HC:
+                               {
+                                       AVSV_AMF_HC_PARAM *hc = 
&msg->info.cbk_info->param.hc;
+
+                                       if 
(osaf_is_an_extended_name(&hc->comp_name)) {
+                                               
osaf_decode_sanamet(dec_info->io_uba, &hc->comp_name);
+                                       }
+                               }
+                               break;
+
                        case AVSV_AMF_COMP_TERM:
+                               {
+                                       AVSV_AMF_COMP_TERM_PARAM *comp_term = 
&msg->info.cbk_info->param.comp_term;
+
+                                       if 
(osaf_is_an_extended_name(&comp_term->comp_name)) {
+                                               
osaf_decode_sanamet(dec_info->io_uba, &comp_term->comp_name);
+                                       }
+                               }
+                               break;
+
                        case AVSV_AMF_CSI_REM:
+                               {
+                                       AVSV_AMF_CSI_REM_PARAM *csi_rem = 
&msg->info.cbk_info->param.csi_rem;
+
+                                       if 
(osaf_is_an_extended_name(&csi_rem->comp_name)) {
+                                               
osaf_decode_sanamet(dec_info->io_uba, &csi_rem->comp_name);
+                                       }
+
+                                       if 
(osaf_is_an_extended_name(&csi_rem->csi_name)) {
+                                               
osaf_decode_sanamet(dec_info->io_uba, &csi_rem->csi_name);
+                                       }
+                               }
+                               break;
+
                        case AVSV_AMF_PXIED_COMP_INST:
+                               {
+                                       AVSV_AMF_PXIED_COMP_INST_PARAM 
*pxied_comp_inst = &msg->info.cbk_info->param.pxied_comp_inst;
+
+                                       if 
(osaf_is_an_extended_name(&pxied_comp_inst->comp_name)) {
+                                               
osaf_decode_sanamet(dec_info->io_uba, &pxied_comp_inst->comp_name);
+                                       }
+                               }
+                               break;
+
                        case AVSV_AMF_PXIED_COMP_CLEAN:
-                               /* already decoded above */
+                               {
+                                       AVSV_AMF_PXIED_COMP_CLEAN_PARAM 
*pxied_comp_clean = &msg->info.cbk_info->param.pxied_comp_clean;
+
+                                       if 
(osaf_is_an_extended_name(&pxied_comp_clean->comp_name)) {
+                                               
osaf_decode_sanamet(dec_info->io_uba, &pxied_comp_clean->comp_name);
+                                       }
+                               }
                                break;
 
                        default:
@@ -647,7 +866,19 @@ uint32_t ava_mds_flat_dec(AVA_CB *cb, MD
                break;
 
        case AVSV_AVND_AMF_API_RESP_MSG:
-               /* already decoded above */
+               {
+                       AVSV_AMF_API_RESP_INFO *api_resp_info = 
&msg->info.api_resp_info;
+
+                       if (api_resp_info->type == AVSV_AMF_HA_STATE_GET) {
+                               if 
(osaf_is_an_extended_name(&api_resp_info->param.ha_get.comp_name)) {
+                                       osaf_decode_sanamet(dec_info->io_uba, 
&api_resp_info->param.ha_get.comp_name);
+                               }
+
+                               if 
(osaf_is_an_extended_name(&api_resp_info->param.ha_get.csi_name)) {
+                                       osaf_decode_sanamet(dec_info->io_uba, 
&api_resp_info->param.ha_get.csi_name);
+                               }
+                       }
+               }
                break;
 
        case AVSV_AVA_API_MSG:
@@ -900,3 +1131,214 @@ extern "C" void ava_install_amf_down_cb(
 
        TRACE_LEAVE();
 }
+
+void ava_fill_finalize_msg(AVSV_NDA_AVA_MSG* msg, MDS_DEST dst,
+               SaAmfHandleT hdl, SaNameT comp_name)
+{
+       msg->type = AVSV_AVA_API_MSG;
+       msg->info.api_info.type = AVSV_AMF_FINALIZE;
+       msg->info.api_info.dest = dst;
+       msg->info.api_info.param.finalize.hdl = hdl;
+       osaf_extended_name_alloc(osaf_extended_name_borrow(&comp_name),
+                       &msg->info.api_info.param.finalize.comp_name);
+}
+
+void ava_fill_comp_reg_msg(AVSV_NDA_AVA_MSG* msg, MDS_DEST dst,
+               SaAmfHandleT hdl, SaNameT comp_name, SaNameT proxy_comp_name)
+{
+       msg->type = AVSV_AVA_API_MSG;
+       msg->info.api_info.type = AVSV_AMF_COMP_REG;
+       msg->info.api_info.dest = dst;
+       msg->info.api_info.param.reg.hdl = hdl;
+       osaf_extended_name_alloc(osaf_extended_name_borrow(&comp_name),
+                       &msg->info.api_info.param.reg.comp_name);
+       osaf_extended_name_alloc(osaf_extended_name_borrow(&proxy_comp_name),
+                       &msg->info.api_info.param.reg.proxy_comp_name);
+}
+
+void ava_fill_comp_unreg_msg(AVSV_NDA_AVA_MSG* msg, MDS_DEST dst,
+               SaAmfHandleT hdl, SaNameT comp_name, SaNameT proxy_comp_name)
+{
+       msg->type = AVSV_AVA_API_MSG;
+       msg->info.api_info.type = AVSV_AMF_COMP_UNREG;
+       msg->info.api_info.dest = dst;
+       msg->info.api_info.param.unreg.hdl = hdl;
+       osaf_extended_name_alloc(osaf_extended_name_borrow(&comp_name),
+                       &msg->info.api_info.param.unreg.comp_name);
+       osaf_extended_name_alloc(osaf_extended_name_borrow(&proxy_comp_name),
+                       &msg->info.api_info.param.unreg.proxy_comp_name);
+}
+
+void ava_fill_hc_start_msg(AVSV_NDA_AVA_MSG* msg, MDS_DEST dst,
+               SaAmfHandleT hdl, SaNameT comp_name, SaNameT proxy_comp_name,
+               SaAmfHealthcheckKeyT hc_key, SaAmfHealthcheckInvocationT hc_inv,
+               SaAmfRecommendedRecoveryT rcv)
+{
+       msg->type = AVSV_AVA_API_MSG;
+       msg->info.api_info.type = AVSV_AMF_HC_START;
+       msg->info.api_info.dest = dst;
+       msg->info.api_info.param.hc_start.hdl = hdl;
+       osaf_extended_name_alloc(osaf_extended_name_borrow(&comp_name),
+                       &msg->info.api_info.param.hc_start.comp_name);
+       osaf_extended_name_alloc(osaf_extended_name_borrow(&proxy_comp_name),
+                       &msg->info.api_info.param.hc_start.proxy_comp_name);
+   memcpy(msg->info.api_info.param.hc_start.hc_key.key,
+                          hc_key.key, hc_key.keyLen);
+   msg->info.api_info.param.hc_start.hc_key.keyLen = hc_key.keyLen;
+   msg->info.api_info.param.hc_start.inv_type = hc_inv;
+   msg->info.api_info.param.hc_start.rec_rcvr.saf_amf = rcv;
+}
+
+void ava_fill_hc_stop_msg(AVSV_NDA_AVA_MSG* msg, MDS_DEST dst,
+               SaAmfHandleT hdl, SaNameT comp_name, SaNameT proxy_comp_name,
+               SaAmfHealthcheckKeyT hc_key)
+{
+       msg->type = AVSV_AVA_API_MSG;
+       msg->info.api_info.type = AVSV_AMF_HC_STOP;
+       msg->info.api_info.dest = dst;
+       msg->info.api_info.param.hc_stop.hdl = hdl;
+       osaf_extended_name_alloc(osaf_extended_name_borrow(&comp_name),
+                       &msg->info.api_info.param.hc_stop.comp_name);
+       osaf_extended_name_alloc(osaf_extended_name_borrow(&proxy_comp_name),
+                       &msg->info.api_info.param.hc_stop.proxy_comp_name);
+   memcpy(msg->info.api_info.param.hc_stop.hc_key.key,
+                          hc_key.key, hc_key.keyLen);
+   msg->info.api_info.param.hc_stop.hc_key.keyLen = hc_key.keyLen;
+}
+
+void ava_fill_hc_confirm_msg(AVSV_NDA_AVA_MSG* msg, MDS_DEST dst,
+               SaAmfHandleT hdl, SaNameT comp_name, SaNameT proxy_comp_name,
+               SaAmfHealthcheckKeyT hc_key, SaAisErrorT res)
+{
+       msg->type = AVSV_AVA_API_MSG;
+       msg->info.api_info.type = AVSV_AMF_HC_CONFIRM;
+       msg->info.api_info.dest = dst;
+       msg->info.api_info.param.hc_confirm.hdl = hdl;
+       osaf_extended_name_alloc(osaf_extended_name_borrow(&comp_name),
+                       &msg->info.api_info.param.hc_confirm.comp_name);
+       osaf_extended_name_alloc(osaf_extended_name_borrow(&proxy_comp_name),
+                       &msg->info.api_info.param.hc_confirm.proxy_comp_name);
+       memcpy(msg->info.api_info.param.hc_confirm.hc_key.key,
+                       hc_key.key, hc_key.keyLen);
+       msg->info.api_info.param.hc_confirm.hc_key.keyLen = hc_key.keyLen;
+       msg->info.api_info.param.hc_confirm.hc_res = res;
+}
+
+void ava_fill_pm_start_msg(AVSV_NDA_AVA_MSG* msg, MDS_DEST dst,
+               SaAmfHandleT hdl, SaNameT comp_name, SaUint64T processId,
+               SaInt32T depth, SaAmfPmErrorsT pmErr, SaAmfRecommendedRecoveryT 
rcv)
+{
+       msg->type = AVSV_AVA_API_MSG;
+       msg->info.api_info.type = AVSV_AMF_PM_START;
+       msg->info.api_info.dest = dst;
+       msg->info.api_info.param.pm_start.hdl = hdl;
+       osaf_extended_name_alloc(osaf_extended_name_borrow(&comp_name),
+                       &msg->info.api_info.param.pm_start.comp_name);
+       msg->info.api_info.param.pm_start.pid = processId;
+       msg->info.api_info.param.pm_start.desc_tree_depth = depth;
+       msg->info.api_info.param.pm_start.pm_err = pmErr;
+       msg->info.api_info.param.pm_start.rec_rcvr.saf_amf = rcv;
+
+}
+
+void ava_fill_pm_stop_msg(AVSV_NDA_AVA_MSG* msg, MDS_DEST dst,
+               SaAmfHandleT hdl, SaNameT comp_name, SaAmfPmStopQualifierT stop,
+               SaUint64T processId, SaAmfPmErrorsT pmErr)
+{
+       msg->type = AVSV_AVA_API_MSG;
+       msg->info.api_info.type = AVSV_AMF_PM_STOP;
+       msg->info.api_info.dest = dst;
+       msg->info.api_info.param.pm_stop.hdl = hdl;
+       osaf_extended_name_alloc(osaf_extended_name_borrow(&comp_name),
+                       &msg->info.api_info.param.pm_stop.comp_name);
+       msg->info.api_info.param.pm_stop.pid = processId;
+       msg->info.api_info.param.pm_stop.stop_qual = stop;
+       msg->info.api_info.param.pm_stop.pm_err = pmErr;
+}
+
+void ava_fill_ha_state_get_msg(AVSV_NDA_AVA_MSG* msg, MDS_DEST dst,
+               SaAmfHandleT hdl, SaNameT comp_name, SaNameT csi_name)
+{
+       msg->type = AVSV_AVA_API_MSG;
+       msg->info.api_info.type = AVSV_AMF_HA_STATE_GET;
+       msg->info.api_info.dest = dst;
+       msg->info.api_info.param.ha_get.hdl = hdl;
+       osaf_extended_name_alloc(osaf_extended_name_borrow(&comp_name),
+                       &msg->info.api_info.param.ha_get.comp_name);
+       osaf_extended_name_alloc(osaf_extended_name_borrow(&csi_name),
+                       &msg->info.api_info.param.ha_get.csi_name);
+}
+
+void ava_fill_pg_start_msg(AVSV_NDA_AVA_MSG* msg, MDS_DEST dst,
+               SaAmfHandleT hdl, SaNameT csi_name, SaUint8T flag, bool syn)
+{
+       msg->type = AVSV_AVA_API_MSG;
+       msg->info.api_info.type = AVSV_AMF_PG_START;
+       msg->info.api_info.dest = dst;
+       msg->info.api_info.param.pg_start.hdl = hdl;
+       osaf_extended_name_alloc(osaf_extended_name_borrow(&csi_name),
+                       &msg->info.api_info.param.pg_start.csi_name);
+       msg->info.api_info.param.pg_start.flags = flag;
+       msg->info.api_info.param.pg_start.is_syn = syn;
+}
+
+void ava_fill_pg_stop_msg(AVSV_NDA_AVA_MSG* msg, MDS_DEST dst,
+               SaAmfHandleT hdl, SaNameT csi_name)
+{
+       msg->type = AVSV_AVA_API_MSG;
+       msg->info.api_info.type = AVSV_AMF_PG_STOP;
+       msg->info.api_info.dest = dst;
+       msg->info.api_info.param.ha_get.hdl = hdl;
+       osaf_extended_name_alloc(osaf_extended_name_borrow(&csi_name),
+                       &msg->info.api_info.param.ha_get.csi_name);
+}
+void ava_fill_error_report_msg(AVSV_NDA_AVA_MSG* msg, MDS_DEST dst,
+               SaAmfHandleT hdl, SaNameT comp_name, SaTimeT time,
+               SaAmfRecommendedRecoveryT rcv)
+{
+       msg->type = AVSV_AVA_API_MSG;
+       msg->info.api_info.type = AVSV_AMF_ERR_REP;
+       msg->info.api_info.dest = dst;
+       msg->info.api_info.param.err_rep.hdl = hdl;
+       osaf_extended_name_alloc(osaf_extended_name_borrow(&comp_name),
+                       &msg->info.api_info.param.err_rep.err_comp);
+       msg->info.api_info.param.err_rep.detect_time = time;
+       msg->info.api_info.param.err_rep.rec_rcvr.saf_amf = rcv;
+}
+
+void ava_fill_err_clear_msg(AVSV_NDA_AVA_MSG* msg, MDS_DEST dst, SaAmfHandleT 
hdl, SaNameT comp_name)
+{
+       msg->type = AVSV_AVA_API_MSG;
+       msg->info.api_info.type = AVSV_AMF_ERR_CLEAR;
+       msg->info.api_info.dest = dst;
+       msg->info.api_info.param.err_clear.hdl = hdl;
+       // if hidden longDn in @comp_name, reuse it for @msg
+       osaf_extended_name_alloc(osaf_extended_name_borrow(&comp_name),
+                       &msg->info.api_info.param.err_clear.comp_name);
+}
+void ava_fill_response_msg(AVSV_NDA_AVA_MSG* msg, MDS_DEST dst,
+               SaAmfHandleT hdl, SaInvocationT inv, SaAisErrorT error,
+               SaNameT comp_name)
+{
+       msg->type = AVSV_AVA_API_MSG;
+       msg->info.api_info.type = AVSV_AMF_RESP;
+       msg->info.api_info.dest = dst;
+       msg->info.api_info.param.resp.hdl = hdl;
+       msg->info.api_info.param.resp.inv = inv;
+       msg->info.api_info.param.resp.err = error;
+       osaf_extended_name_alloc(osaf_extended_name_borrow(&comp_name),
+                       &msg->info.api_info.param.resp.comp_name);
+}
+void ava_fill_csi_quiescing_complete_msg(AVSV_NDA_AVA_MSG* msg, MDS_DEST dst,
+               SaAmfHandleT hdl, SaInvocationT inv, SaAisErrorT error,
+               SaNameT comp_name)
+{
+       msg->type = AVSV_AVA_API_MSG;
+       msg->info.api_info.type = AVSV_AMF_CSI_QUIESCING_COMPLETE;
+       msg->info.api_info.dest = dst;
+       msg->info.api_info.param.csiq_compl.hdl = hdl;
+       msg->info.api_info.param.csiq_compl.inv = inv;
+       msg->info.api_info.param.csiq_compl.err = error;
+       osaf_extended_name_alloc(osaf_extended_name_borrow(&comp_name),
+                       &msg->info.api_info.param.csiq_compl.comp_name);
+}
diff --git a/osaf/libs/agents/saf/amfa/ava_op.cc 
b/osaf/libs/agents/saf/amfa/ava_op.cc
--- a/osaf/libs/agents/saf/amfa/ava_op.cc
+++ b/osaf/libs/agents/saf/amfa/ava_op.cc
@@ -148,12 +148,29 @@ void ava_cpy_protection_group_ntf(SaAmfP
        memset(to_ntf, 0, items * sizeof(*to_ntf));
        for(i = 0; i < items; i++) {
                to_ntf[i].change = from_ntf[i].change;
-               memcpy(to_ntf[i].member.compName.value, 
from_ntf[i].member.compName.value,
-                               from_ntf[i].member.compName.length);
-               to_ntf[i].member.compName.length = 
from_ntf[i].member.compName.length;
+               
osaf_extended_name_alloc(osaf_extended_name_borrow(&from_ntf[i].member.compName),
+                                                                
&to_ntf[i].member.compName);
                to_ntf[i].member.haReadinessState = ha_read_state;
                to_ntf[i].member.haState = from_ntf[i].member.haState;
                to_ntf[i].member.rank = from_ntf[i].member.rank;
        }
 }
 
+/**
+ *  @Brief: Check SaNameT is a valid formation
+ *
+ */
+bool ava_sanamet_is_valid(const SaNameT* pName)
+{
+       if (!osaf_is_extended_name_valid(pName)) {
+               LOG_WA("Environment variable SA_ENABLE_EXTENDED_NAMES "
+                       "is not set, or not using extended name api");
+               return false;
+       }
+       if (osaf_extended_name_length(pName) > kOsafMaxDnLength) {
+               LOG_ER("Exceeding maximum of extended name length(%u)"
+                       ,kOsafMaxDnLength);
+               return false;
+       }
+       return true;
+}
diff --git a/osaf/libs/agents/saf/amfa/include/ava.h 
b/osaf/libs/agents/saf/amfa/include/ava.h
--- a/osaf/libs/agents/saf/amfa/include/ava.h
+++ b/osaf/libs/agents/saf/amfa/include/ava.h
@@ -43,6 +43,7 @@
 #include "ava_hdl.h"
 #include "ava_mds.h"
 #include "ava_cb.h"
+#include "osaf_extended_name.h"
 
 #include<logtrace.h>
 
diff --git a/osaf/libs/agents/saf/amfa/include/ava_cb.h 
b/osaf/libs/agents/saf/amfa/include/ava_cb.h
--- a/osaf/libs/agents/saf/amfa/include/ava_cb.h
+++ b/osaf/libs/agents/saf/amfa/include/ava_cb.h
@@ -113,6 +113,7 @@ void ava_cpy_protection_group_ntf(SaAmfP
                                const SaAmfProtectionGroupNotificationT 
*from_ntf,
                                SaUint32T items,
                                SaAmfHAReadinessStateT ha_read_state);
+bool ava_sanamet_is_valid(const SaNameT* pName);
 
 #ifdef  __cplusplus
 }
diff --git a/osaf/libs/agents/saf/amfa/include/ava_mds.h 
b/osaf/libs/agents/saf/amfa/include/ava_mds.h
--- a/osaf/libs/agents/saf/amfa/include/ava_mds.h
+++ b/osaf/libs/agents/saf/amfa/include/ava_mds.h
@@ -41,234 +41,47 @@ extern "C" {
 #define AVA_AVND_SUBPART_VER_MAX   1
 
 /*****************************************************************************
-                 Macros to fill the MDS message structure
+                 Function to fill the MDS message structure
 *****************************************************************************/
-/* Macro to populate the 'AMF Initialize' message */
-#define m_AVA_AMF_INIT_MSG_FILL(m, dst) \
-{ \
-   (m).type = AVSV_AVA_API_MSG; \
-   (m).info.api_info.type = AVSV_AMF_INITIALIZE; \
-   (m).info.api_info.dest = (dst); \
-}
-
-/* Macro to populate the 'AMF Finalize' message */
-#define m_AVA_AMF_FINALIZE_MSG_FILL(m, dst, hd, cn) \
-{ \
-   (m).type = AVSV_AVA_API_MSG; \
-   (m).info.api_info.type = AVSV_AMF_FINALIZE; \
-   (m).info.api_info.dest = (dst); \
-   (m).info.api_info.param.finalize.hdl = (hd); \
-   (m).info.api_info.param.finalize.comp_name = (cn); \
-}
-
-/* Macro to populate the 'component register' message */
-#define m_AVA_COMP_REG_MSG_FILL(m, dst, hd, cn, pcn) \
-{ \
-   (m).type = AVSV_AVA_API_MSG; \
-   (m).info.api_info.type = AVSV_AMF_COMP_REG; \
-   (m).info.api_info.dest = (dst); \
-   (m).info.api_info.param.reg.hdl = (hd); \
-   memcpy((m).info.api_info.param.reg.comp_name.value, \
-                   (cn).value, (cn).length); \
-   (m).info.api_info.param.reg.comp_name.length = (cn).length; \
-   memcpy((m).info.api_info.param.reg.proxy_comp_name.value, \
-                   (pcn).value, (pcn).length); \
-   (m).info.api_info.param.reg.proxy_comp_name.length = (pcn).length; \
-}
-
-/* Macro to populate the 'component unregister' message */
-#define m_AVA_COMP_UNREG_MSG_FILL(m, dst, hd, cn, pcn) \
-{ \
-   (m).type = AVSV_AVA_API_MSG; \
-   (m).info.api_info.type = AVSV_AMF_COMP_UNREG; \
-   (m).info.api_info.dest = (dst); \
-   (m).info.api_info.param.unreg.hdl = (hd); \
-   memcpy((m).info.api_info.param.unreg.comp_name.value, \
-                   (cn).value, (cn).length); \
-   (m).info.api_info.param.unreg.comp_name.length = (cn).length; \
-   memcpy((m).info.api_info.param.unreg.proxy_comp_name.value, \
-                   (pcn).value, (pcn).length); \
-   (m).info.api_info.param.unreg.proxy_comp_name.length = (pcn).length; \
-}
-
-/* Macro to populate the 'healthcheck start' message */
-#define m_AVA_HC_START_MSG_FILL(m, dst, hd, cn, pcn, hck, inv, rr) \
-{ \
-   (m).type = AVSV_AVA_API_MSG; \
-   (m).info.api_info.type = AVSV_AMF_HC_START; \
-   (m).info.api_info.dest = (dst); \
-   (m).info.api_info.param.hc_start.hdl = (hd); \
-   memcpy((m).info.api_info.param.hc_start.comp_name.value, \
-                   (cn).value, (cn).length); \
-   (m).info.api_info.param.hc_start.comp_name.length = (cn).length; \
-   memcpy((m).info.api_info.param.hc_start.proxy_comp_name.value, \
-                   (pcn).value, (pcn).length); \
-   (m).info.api_info.param.hc_start.proxy_comp_name.length = (pcn).length; \
-   memcpy((m).info.api_info.param.hc_start.hc_key.key, \
-                   (hck).key, (hck).keyLen); \
-   (m).info.api_info.param.hc_start.hc_key.keyLen = (hck).keyLen; \
-   (m).info.api_info.param.hc_start.inv_type = (inv); \
-   (m).info.api_info.param.hc_start.rec_rcvr.saf_amf = (rr); \
-}
-
-/* Macro to populate the 'healthcheck stop' message */
-#define m_AVA_HC_STOP_MSG_FILL(m, dst, hd, cn, pcn, hck) \
-{ \
-   (m).type = AVSV_AVA_API_MSG; \
-   (m).info.api_info.type = AVSV_AMF_HC_STOP; \
-   (m).info.api_info.dest = (dst); \
-   (m).info.api_info.param.hc_stop.hdl = (hd); \
-   memcpy((m).info.api_info.param.hc_stop.comp_name.value, \
-                   (cn).value, (cn).length); \
-   (m).info.api_info.param.hc_stop.comp_name.length = (cn).length; \
-   memcpy((m).info.api_info.param.hc_stop.proxy_comp_name.value, \
-                   (pcn).value,  (pcn).length); \
-   (m).info.api_info.param.hc_stop.proxy_comp_name.length = (pcn).length; \
-   memcpy((m).info.api_info.param.hc_stop.hc_key.key, \
-                   (hck).key, (hck).keyLen); \
-   (m).info.api_info.param.hc_stop.hc_key.keyLen = (hck).keyLen; \
-}
-
-/* Macro to populate the 'healthcheck confirm' message */
-#define m_AVA_HC_CONFIRM_MSG_FILL(m, dst, hd, cn, pcn, hck, res) \
-{ \
-   (m).type = AVSV_AVA_API_MSG; \
-   (m).info.api_info.type = AVSV_AMF_HC_CONFIRM; \
-   (m).info.api_info.dest = (dst); \
-   (m).info.api_info.param.hc_confirm.hdl = (hd); \
-   memcpy((m).info.api_info.param.hc_confirm.comp_name.value, \
-                   (cn).value, (cn).length); \
-   (m).info.api_info.param.hc_confirm.comp_name.length = (cn).length; \
-   memcpy((m).info.api_info.param.hc_confirm.proxy_comp_name.value, \
-                   (pcn).value,  (pcn).length); \
-   (m).info.api_info.param.hc_confirm.proxy_comp_name.length = (pcn).length; \
-   memcpy((m).info.api_info.param.hc_confirm.hc_key.key, \
-                   (hck).key, (hck).keyLen); \
-   (m).info.api_info.param.hc_confirm.hc_key.keyLen = (hck).keyLen; \
-   (m).info.api_info.param.hc_confirm.hc_res = (res); \
-}
-
-/* Macro to populate the 'Passive Monitoring start' message */
-#define m_AVA_PM_START_MSG_FILL(m, dst, hd, cn, processId, depth, pmErr, rec) \
-{ \
-   (m).type = AVSV_AVA_API_MSG; \
-   (m).info.api_info.type = AVSV_AMF_PM_START; \
-   (m).info.api_info.dest = (dst); \
-   (m).info.api_info.param.hc_start.hdl = (hd); \
-   memcpy((m).info.api_info.param.pm_start.comp_name.value, \
-                   (cn).value, (cn).length); \
-   (m).info.api_info.param.pm_start.comp_name.length = (cn).length; \
-   (m).info.api_info.param.pm_start.pid = (processId); \
-   (m).info.api_info.param.pm_start.desc_tree_depth = (depth); \
-   (m).info.api_info.param.pm_start.pm_err = (pmErr); \
-   (m).info.api_info.param.pm_start.rec_rcvr.saf_amf = (rec); \
-}
-
-/* Macro to populate the 'Passive Monitoring stop' message */
-#define m_AVA_PM_STOP_MSG_FILL(m, dst, hd, cn, stop, processId, pmErr) \
-{ \
-   (m).type = AVSV_AVA_API_MSG; \
-   (m).info.api_info.type = AVSV_AMF_PM_STOP; \
-   (m).info.api_info.dest = (dst); \
-   (m).info.api_info.param.pm_stop.hdl = (hd); \
-   memcpy((m).info.api_info.param.pm_stop.comp_name.value, \
-                   (cn).value, (cn).length); \
-   (m).info.api_info.param.pm_stop.comp_name.length = (cn).length; \
-   (m).info.api_info.param.pm_stop.stop_qual = (stop); \
-   (m).info.api_info.param.pm_stop.pid = (processId); \
-   (m).info.api_info.param.pm_stop.pm_err = (pmErr); \
-}
-
-/* Macro to populate the 'ha state get' message */
-#define m_AVA_HA_STATE_GET_MSG_FILL(m, dst, hd, cn, csi) \
-{ \
-   (m).type = AVSV_AVA_API_MSG; \
-   (m).info.api_info.type = AVSV_AMF_HA_STATE_GET; \
-   (m).info.api_info.dest = (dst); \
-   (m).info.api_info.param.ha_get.hdl = (hd); \
-   memcpy((m).info.api_info.param.ha_get.comp_name.value, \
-                   (cn).value, (cn).length); \
-   (m).info.api_info.param.ha_get.comp_name.length = (cn).length; \
-   memcpy((m).info.api_info.param.ha_get.csi_name.value, \
-                   (csi).value, (csi).length); \
-   (m).info.api_info.param.ha_get.csi_name.length = (csi).length; \
-}
-
-/* Macro to populate the 'pg track start' message */
-#define m_AVA_PG_START_MSG_FILL(m, dst, hd, csin, fl, syn) \
-{ \
-   (m).type = AVSV_AVA_API_MSG; \
-   (m).info.api_info.type = AVSV_AMF_PG_START; \
-   (m).info.api_info.dest = (dst); \
-   (m).info.api_info.param.pg_start.hdl = (hd); \
-   memcpy((m).info.api_info.param.pg_start.csi_name.value, \
-                   (csin).value, (csin).length); \
-   (m).info.api_info.param.pg_start.csi_name.length = (csin).length; \
-   (m).info.api_info.param.pg_start.flags = (fl); \
-   (m).info.api_info.param.pg_start.is_syn = (syn); \
-}
-
-/* Macro to populate the 'pg track stop' message */
-#define m_AVA_PG_STOP_MSG_FILL(m, dst, hd, csin) \
-{ \
-   (m).type = AVSV_AVA_API_MSG; \
-   (m).info.api_info.type = AVSV_AMF_PG_STOP; \
-   (m).info.api_info.dest = (dst); \
-   (m).info.api_info.param.pg_stop.hdl = (hd); \
-   memcpy((m).info.api_info.param.pg_stop.csi_name.value, \
-                   (csin).value, (csin).length); \
-   (m).info.api_info.param.pg_stop.csi_name.length = (csin).length; \
-}
-
-/* Macro to populate the 'error report' message */
-#define m_AVA_ERR_REP_MSG_FILL(m, dst, hd, ec, et, rr) \
-{ \
-   (m).type = AVSV_AVA_API_MSG; \
-   (m).info.api_info.type = AVSV_AMF_ERR_REP; \
-   (m).info.api_info.dest = (dst); \
-   (m).info.api_info.param.err_rep.hdl = (hd); \
-   memcpy((m).info.api_info.param.err_rep.err_comp.value, \
-                   (ec).value, (ec).length); \
-   (m).info.api_info.param.err_rep.err_comp.length = (ec).length; \
-   (m).info.api_info.param.err_rep.detect_time = (et); \
-   (m).info.api_info.param.err_rep.rec_rcvr.saf_amf = (rr); \
-}
-
-/* Macro to populate the 'error clear' message */
-#define m_AVA_ERR_CLEAR_MSG_FILL(m, dst, hd, cn) \
-{ \
-   (m).type = AVSV_AVA_API_MSG; \
-   (m).info.api_info.type = AVSV_AMF_ERR_CLEAR; \
-   (m).info.api_info.dest = (dst); \
-   (m).info.api_info.param.err_clear.hdl = (hd); \
-   memcpy((m).info.api_info.param.err_clear.comp_name.value, \
-                   (cn).value, (cn).length); \
-   (m).info.api_info.param.err_clear.comp_name.length = (cn).length; \
-}
-
-/* Macro to populate the 'AMF response' message */
-#define m_AVA_AMF_RESP_MSG_FILL(m, dst, hd, in, er, cn) \
-{ \
-   (m).type = AVSV_AVA_API_MSG; \
-   (m).info.api_info.type = AVSV_AMF_RESP; \
-   (m).info.api_info.dest = (dst); \
-   (m).info.api_info.param.resp.hdl = (hd); \
-   (m).info.api_info.param.resp.inv = (in); \
-   (m).info.api_info.param.resp.err = (er); \
-   (m).info.api_info.param.resp.comp_name = (cn); \
-}
-
-/* Macro to populate the 'AMF response' message */
-#define m_AVA_CSI_QUIESCING_COMPL_MSG_FILL(m, dst, hd, in, er, cn) \
-{ \
-   (m).type = AVSV_AVA_API_MSG; \
-   (m).info.api_info.type = AVSV_AMF_CSI_QUIESCING_COMPLETE; \
-   (m).info.api_info.dest = (dst); \
-   (m).info.api_info.param.csiq_compl.hdl = (hd); \
-   (m).info.api_info.param.csiq_compl.inv = (in); \
-   (m).info.api_info.param.csiq_compl.err = (er); \
-   (m).info.api_info.param.csiq_compl.comp_name = (cn); \
-}
+void ava_fill_finalize_msg(AVSV_NDA_AVA_MSG* msg, MDS_DEST dst,
+               SaAmfHandleT hdl, SaNameT comp_name);
+void ava_fill_comp_reg_msg(AVSV_NDA_AVA_MSG* msg, MDS_DEST dst,
+               SaAmfHandleT hdl, SaNameT comp_name, SaNameT proxy_comp_name);
+void ava_fill_comp_unreg_msg(AVSV_NDA_AVA_MSG* msg, MDS_DEST dst,
+               SaAmfHandleT hdl, SaNameT comp_name, SaNameT proxy_comp_name);
+void ava_fill_hc_start_msg(AVSV_NDA_AVA_MSG* msg, MDS_DEST dst,
+               SaAmfHandleT hdl, SaNameT comp_name, SaNameT proxy_comp_name,
+               SaAmfHealthcheckKeyT hc_key, SaAmfHealthcheckInvocationT hc_inv,
+               SaAmfRecommendedRecoveryT rcv);
+void ava_fill_hc_stop_msg(AVSV_NDA_AVA_MSG* msg, MDS_DEST dst,
+               SaAmfHandleT hdl, SaNameT comp_name, SaNameT proxy_comp_name,
+               SaAmfHealthcheckKeyT hc_key);
+void ava_fill_hc_confirm_msg(AVSV_NDA_AVA_MSG* msg, MDS_DEST dst,
+               SaAmfHandleT hdl, SaNameT comp_name, SaNameT proxy_comp_name,
+               SaAmfHealthcheckKeyT hc_key, SaAisErrorT res);
+void ava_fill_pm_start_msg(AVSV_NDA_AVA_MSG* msg, MDS_DEST dst,
+               SaAmfHandleT hdl, SaNameT comp_name, SaUint64T processId,
+               SaInt32T depth, SaAmfPmErrorsT pmErr, SaAmfRecommendedRecoveryT 
rcv);
+void ava_fill_pm_stop_msg(AVSV_NDA_AVA_MSG* msg, MDS_DEST dst,
+               SaAmfHandleT hdl, SaNameT comp_name, SaAmfPmStopQualifierT stop,
+               SaUint64T processId, SaAmfPmErrorsT pmErr);
+void ava_fill_ha_state_get_msg(AVSV_NDA_AVA_MSG* msg, MDS_DEST dst,
+               SaAmfHandleT hdl, SaNameT comp_name, SaNameT csi_name);
+void ava_fill_pg_start_msg(AVSV_NDA_AVA_MSG* msg, MDS_DEST dst,
+               SaAmfHandleT hdl, SaNameT csi_name, SaUint8T flag, bool syn);
+void ava_fill_pg_stop_msg(AVSV_NDA_AVA_MSG* msg, MDS_DEST dst,
+               SaAmfHandleT hdl, SaNameT csi_name);
+void ava_fill_error_report_msg(AVSV_NDA_AVA_MSG* msg, MDS_DEST dst,
+               SaAmfHandleT hdl, SaNameT comp_name, SaTimeT time,
+               SaAmfRecommendedRecoveryT rcv);
+void ava_fill_err_clear_msg(AVSV_NDA_AVA_MSG* msg, MDS_DEST dst,
+               SaAmfHandleT hdl, SaNameT comp_name);
+void ava_fill_response_msg(AVSV_NDA_AVA_MSG* msg, MDS_DEST dst,
+               SaAmfHandleT hdl, SaInvocationT inv, SaAisErrorT error,
+               SaNameT comp_name);
+void ava_fill_csi_quiescing_complete_msg(AVSV_NDA_AVA_MSG* msg, MDS_DEST dst,
+               SaAmfHandleT hdl, SaInvocationT inv, SaAisErrorT error,
+               SaNameT comp_name);
 
 /*** Extern function declarations ***/
 struct ava_cb_tag;


------------------------------------------------------------------------------
Attend Shape: An AT&T Tech Expo July 15-16. Meet us at AT&T Park in San
Francisco, CA to explore cutting-edge tech and listen to tech luminaries
present their vision of the future. This family event has something for
everyone, including kids. Get more information and register today.
http://sdm.link/attshape
_______________________________________________
Opensaf-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/opensaf-devel

Reply via email to