/****************************************************************************
  Name          : cpa_mds_dec_flat
 
  Description   : This function decodes an events sent to CPA.
 
  Arguments     : cb    : CPA control Block.
                  dec_info  : Info for decoding
  
  Return Values : NCSCC_RC_SUCCESS/NCSCC_RC_FAILURE
 
  Notes         : None.
******************************************************************************/
static uns32 cpa_mds_dec_flat(CPA_CB *cb, MDS_CALLBACK_DEC_FLAT_INFO *info)
{
	CPSV_EVT *evt = NULL;
	NCS_UBAID *uba = info->io_uba;
	uns32 rc = NCSCC_RC_SUCCESS;
	NCS_BOOL is_valid_msg_fmt = FALSE;

	if (info->i_fr_svc_id == NCSMDS_SVC_ID_CPND) {
		is_valid_msg_fmt = m_NCS_MSG_FORMAT_IS_VALID(info->i_msg_fmt_ver,
							     CPA_WRT_CPND_SUBPART_VER_MIN,
							     CPA_WRT_CPND_SUBPART_VER_MAX, cpa_cpnd_msg_fmt_table);
	} else if (info->i_fr_svc_id == NCSMDS_SVC_ID_CPD) {
		is_valid_msg_fmt = m_NCS_MSG_FORMAT_IS_VALID(info->i_msg_fmt_ver,
							     CPA_WRT_CPD_SUBPART_VER_MIN,
							     CPA_WRT_CPD_SUBPART_VER_MAX, cpa_cpd_msg_fmt_table);
	}

	if (is_valid_msg_fmt) {

		if (info->i_fr_svc_id == NCSMDS_SVC_ID_CPND || info->i_fr_svc_id == NCSMDS_SVC_ID_CPD) {
			evt = (CPSV_EVT *)m_MMGR_ALLOC_CPSV_EVT(NCS_SERVICE_ID_CPA);
			if (evt == NULL) {
				m_LOG_CPA_CCLL(CPA_MEM_ALLOC_FAILED, NCSFL_LC_CKPT_MGMT,
					       NCSFL_SEV_ERROR, "mds_dec_flat", __FILE__, __LINE__,
					       NCSCC_RC_OUT_OF_MEM);
				return NCSCC_RC_OUT_OF_MEM;
			}
			info->o_msg = evt;
			rc = cpsv_evt_dec_flat(&cb->edu_hdl, uba, evt);
			return rc;
		} else {
			m_LOG_CPA_CCLL(CPA_PROC_FAILED, NCSFL_LC_CKPT_MGMT, NCSFL_SEV_INFO, "mds_dec_flat", __FILE__,
				       __LINE__, rc);
			return NCSCC_RC_FAILURE;
		}
	} else {
		m_LOG_CPA_CCLL(CPA_PROC_FAILED, NCSFL_LC_CKPT_MGMT, NCSFL_SEV_INFO, "mds_dec_flat", __FILE__, __LINE__,
			       rc);
		return NCSCC_RC_FAILURE;
	}
}
Exemple #2
0
/****************************************************************************
  Name          : cpa_mds_dec_flat
 
  Description   : This function decodes an events sent to CPA.
 
  Arguments     : cb    : CPA control Block.
                  dec_info  : Info for decoding
  
  Return Values : NCSCC_RC_SUCCESS/NCSCC_RC_FAILURE
 
  Notes         : None.
******************************************************************************/
static uint32_t cpa_mds_dec_flat(CPA_CB *cb, MDS_CALLBACK_DEC_FLAT_INFO *info)
{
	CPSV_EVT *evt = NULL;
	NCS_UBAID *uba = info->io_uba;
	uint32_t rc = NCSCC_RC_SUCCESS;
	bool is_valid_msg_fmt = false;

	TRACE_ENTER();

	if (info->i_fr_svc_id == NCSMDS_SVC_ID_CPND) {
		is_valid_msg_fmt = m_NCS_MSG_FORMAT_IS_VALID(info->i_msg_fmt_ver,
							     CPA_WRT_CPND_SUBPART_VER_MIN,
							     CPA_WRT_CPND_SUBPART_VER_MAX, cpa_cpnd_msg_fmt_table);
	} else if (info->i_fr_svc_id == NCSMDS_SVC_ID_CPD) {
		is_valid_msg_fmt = m_NCS_MSG_FORMAT_IS_VALID(info->i_msg_fmt_ver,
							     CPA_WRT_CPD_SUBPART_VER_MIN,
							     CPA_WRT_CPD_SUBPART_VER_MAX, cpa_cpd_msg_fmt_table);
	}

	if (is_valid_msg_fmt) {

		if (info->i_fr_svc_id == NCSMDS_SVC_ID_CPND || info->i_fr_svc_id == NCSMDS_SVC_ID_CPD) {
			evt = (CPSV_EVT *)m_MMGR_ALLOC_CPSV_EVT(NCS_SERVICE_ID_CPA);
			if (evt == NULL) {
				TRACE_4("cpa mem allocation failed in mds_dec_flat");
				return NCSCC_RC_OUT_OF_MEM;
			}
			info->o_msg = evt;
			rc = cpsv_evt_dec_flat(&cb->edu_hdl, uba, evt);
			TRACE_LEAVE();
			return rc;
		} else {
			TRACE_4("cpa api processing failed in mds_dec_flat with return value:%d",rc);
			return NCSCC_RC_FAILURE;
		}
	} else {
		TRACE_4("cpa api processing failed in mds_dec_flat with return value:%d",rc);
		return NCSCC_RC_FAILURE;
	}
}