static uns32 msg_encode(MDS_CALLBACK_ENC_INFO *enc_info) { struct rde_msg *msg; NCS_UBAID *uba; uns8 *data; enc_info->o_msg_fmt_ver = 1; uba = enc_info->io_uba; msg = (struct rde_msg *)enc_info->i_msg; data = ncs_enc_reserve_space(uba, sizeof(uns32)); assert(data); ncs_encode_32bit(&data, msg->type); ncs_enc_claim_space(uba, sizeof(uns32)); switch (msg->type) { case RDE_MSG_PEER_INFO_REQ: case RDE_MSG_PEER_INFO_RESP: data = ncs_enc_reserve_space(uba, sizeof(uns32)); assert(data); ncs_encode_32bit(&data, msg->info.peer_info.ha_role); ncs_enc_claim_space(uba, sizeof(uns32)); break; default: assert(0); break; } return NCSCC_RC_SUCCESS; }
/**************************************************************************** Name : eda_enc_subscribe_msg Description : This routine encodes a subscribe API msg Arguments : NCS_UBAID *msg, EDSV_MSG *msg Return Values : uint32_t Notes : None. ******************************************************************************/ static uint32_t eda_enc_subscribe_msg(NCS_UBAID *uba, EDSV_MSG *msg) { uint8_t *p8; uint32_t x; uint32_t total_bytes = 0; SaEvtEventFilterT *filter_ptr; EDSV_EDA_SUBSCRIBE_PARAM *param = &msg->info.api_info.param.subscribe; if (uba == NULL) { TRACE_4("uba is NULL"); return 0; } /** encode the contents **/ p8 = ncs_enc_reserve_space(uba, 24); if (!p8) { TRACE_4("reserve space failed"); } ncs_encode_32bit(&p8, param->reg_id); ncs_encode_32bit(&p8, param->chan_id); ncs_encode_32bit(&p8, param->chan_open_id); ncs_encode_32bit(&p8, param->sub_id); ncs_encode_64bit(&p8, param->filter_array->filtersNumber); ncs_enc_claim_space(uba, 24); total_bytes += 24; /* Encode the filters */ filter_ptr = param->filter_array->filters; for (x = 0; x < (uint32_t)param->filter_array->filtersNumber; x++) { /* Save room for the filterType(4 bytes), patternSize(8 bytes) */ p8 = ncs_enc_reserve_space(uba, 12); if (!p8) { TRACE_4("reserve space failed"); } ncs_encode_32bit(&p8, filter_ptr->filterType); ncs_encode_64bit(&p8, filter_ptr->filter.patternSize); ncs_enc_claim_space(uba, 12); total_bytes = 12; /* For zero length filters, fake encode zero */ if ((uint32_t)filter_ptr->filter.patternSize == 0) { p8 = ncs_enc_reserve_space(uba, 4); if (!p8) { TRACE_4("reserve space failed"); } ncs_encode_32bit(&p8, 0); ncs_enc_claim_space(uba, 4); total_bytes += 4; } else { ncs_encode_n_octets_in_uba(uba, filter_ptr->filter.pattern, (uint32_t)filter_ptr->filter.patternSize); total_bytes += (uint32_t)filter_ptr->filter.patternSize; } filter_ptr++; } return total_bytes; }
/**************************************************************************** Name : eda_enc_chan_unlink_msg Description : This routine encodes a chan unlink API msg Arguments : NCS_UBAID *msg, EDSV_MSG *msg Return Values : uint32_t Notes : None. ******************************************************************************/ static uint32_t eda_enc_chan_unlink_msg(NCS_UBAID *uba, EDSV_MSG *msg) { uint8_t *p8; uint32_t total_bytes = 0; EDSV_EDA_CHAN_UNLINK_PARAM *param = &msg->info.api_info.param.chan_unlink; if (uba == NULL) { TRACE_4("uba is NULL"); return 0; } /** encode the contents **/ p8 = ncs_enc_reserve_space(uba, 6); if (!p8) { TRACE_4("reserve space failed"); } ncs_encode_32bit(&p8, param->reg_id); ncs_encode_16bit(&p8, param->chan_name.length); ncs_enc_claim_space(uba, 6); total_bytes += 6; ncs_encode_n_octets_in_uba(uba, param->chan_name.value, (uint32_t)param->chan_name.length); total_bytes += (uint32_t)param->chan_name.length; return total_bytes; }
/**************************************************************************** Name : eda_enc_unsubscribe_msg Description : This routine encodes a unsubscribe API msg Arguments : NCS_UBAID *msg, EDSV_MSG *msg Return Values : uint32_t Notes : None. ******************************************************************************/ static uint32_t eda_enc_unsubscribe_msg(NCS_UBAID *uba, EDSV_MSG *msg) { uint8_t *p8; uint32_t total_bytes = 0; EDSV_EDA_UNSUBSCRIBE_PARAM *param = &msg->info.api_info.param.unsubscribe; if (uba == NULL) { TRACE_4("uba is NULL"); return 0; } /** encode the contents **/ p8 = ncs_enc_reserve_space(uba, 16); if (!p8) { TRACE_4("reserve space failed"); } ncs_encode_32bit(&p8, param->reg_id); ncs_encode_32bit(&p8, param->chan_id); ncs_encode_32bit(&p8, param->chan_open_id); ncs_encode_32bit(&p8, param->sub_id); ncs_enc_claim_space(uba, 16); total_bytes += 16; return total_bytes; }
/**************************************************************************** Name : eda_enc_retention_time_clr_msg Description : This routine encodes a retention time clear API msg Arguments : NCS_UBAID *msg, EDSV_MSG *msg Return Values : uint32_t Notes : None. ******************************************************************************/ static uint32_t eda_enc_retention_time_clr_msg(NCS_UBAID *uba, EDSV_MSG *msg) { uint8_t *p8; uint32_t total_bytes = 0; EDSV_EDA_RETENTION_TIME_CLR_PARAM *param = &msg->info.api_info.param.rettimeclr; if (uba == NULL) { TRACE_4("uba is NULL"); return 0; } /** encode the contents **/ p8 = ncs_enc_reserve_space(uba, 16); if (!p8) { TRACE_4("reserve space failed"); } ncs_encode_32bit(&p8, param->reg_id); ncs_encode_32bit(&p8, param->chan_id); ncs_encode_32bit(&p8, param->chan_open_id); ncs_encode_32bit(&p8, param->event_id); ncs_enc_claim_space(uba, 16); total_bytes += 16; return total_bytes; }
/**************************************************************************** Name : ntfa_enc_reader_initialize_msg Description : This routine encodes an reader_initialize API msg Arguments : NCS_UBAID *msg, NTFSV_MSG *msg Return Values : uns32 Notes : None. ******************************************************************************/ static uns32 ntfa_enc_reader_initialize_msg(NCS_UBAID *uba, ntfsv_msg_t *msg) { uns8 *p8; uns32 total_bytes = 0; ntfsv_reader_init_req_t *param = &msg->info.api_info.param.reader_init; TRACE_ENTER(); assert(uba != NULL); /** encode the contents **/ p8 = ncs_enc_reserve_space(uba, 22); if (!p8) { TRACE("NULL pointer"); return 0; } ncs_encode_32bit(&p8, param->client_id); ncs_encode_16bit(&p8, param->searchCriteria.searchMode); ncs_encode_64bit(&p8, param->searchCriteria.eventTime); ncs_encode_64bit(&p8, param->searchCriteria.notificationId); ncs_enc_claim_space(uba, 22); total_bytes += 22; TRACE_LEAVE(); return total_bytes; }
/*************************************************************************** * Name : fm_fm_mds_enc * * Description : To encode GFM related messages * * Arguments :Pointer to the MDS callback info struct MDS_CALLBACK_DEC_INFO * * Return Values : NCSCC_RC_FAILURE/NCSCC_RC_SUCCESS * * Notes : None. ***************************************************************************/ static uint32_t fm_fm_mds_enc(MDS_CALLBACK_ENC_INFO *enc_info) { GFM_GFM_MSG *msg; NCS_UBAID *uba; uint8_t *data; if (NULL == enc_info) return m_LEAP_DBG_SINK(NCSCC_RC_FAILURE); if ((NULL == enc_info->i_msg) || (NULL == enc_info->io_uba)) return m_LEAP_DBG_SINK(NCSCC_RC_FAILURE); uba = enc_info->io_uba; msg = (GFM_GFM_MSG *)enc_info->i_msg; data = ncs_enc_reserve_space(uba, sizeof(uint8_t)); if (NULL == data) return m_LEAP_DBG_SINK(NCSCC_RC_FAILURE); ncs_encode_8bit(&data, msg->msg_type); ncs_enc_claim_space(uba, sizeof(uint8_t)); switch (msg->msg_type) { case GFM_GFM_EVT_NODE_INFO_EXCHANGE: data = ncs_enc_reserve_space(uba, (2 * sizeof(uint32_t))); if (data == NULL) { m_LEAP_DBG_SINK(NCSCC_RC_FAILURE); } ncs_encode_32bit(&data, msg->info.node_info.node_id); ncs_encode_32bit(&data, msg->info.node_info.node_name.length); ncs_enc_claim_space(uba, 2 * sizeof(uint32_t)); ncs_encode_n_octets_in_uba(uba, msg->info.node_info.node_name.value, (uint32_t)msg->info.node_info.node_name.length); break; default: syslog(LOG_INFO, "fm_fm_mds_enc: Invalid msg type for encode."); return m_LEAP_DBG_SINK(NCSCC_RC_FAILURE); break; } return NCSCC_RC_SUCCESS; }
/**************************************************************************** Name : lga_enc_lstr_close_msg Description : This routine encodes a log stream close API msg Arguments : NCS_UBAID *msg, LGSV_MSG *msg Return Values : uint32_t Notes : None. ******************************************************************************/ static uint32_t lga_enc_lstr_close_msg(NCS_UBAID *uba, lgsv_msg_t *msg) { uint8_t *p8; uint32_t total_bytes = 0; lgsv_stream_close_req_t *param = &msg->info.api_info.param.lstr_close; osafassert(uba != NULL); /** encode the contents **/ p8 = ncs_enc_reserve_space(uba, 8); if (!p8) { TRACE("p8 NULL!!!"); return 0; } ncs_encode_32bit(&p8, param->client_id); ncs_encode_32bit(&p8, param->lstr_id); ncs_enc_claim_space(uba, 8); total_bytes += 8; return total_bytes; }
/**************************************************************************** Name : eda_enc_finalize_msg Description : This routine encodes a finalize API msg Arguments : NCS_UBAID *msg, EDSV_MSG *msg Return Values : uint32_t Notes : None. ******************************************************************************/ static uint32_t eda_enc_finalize_msg(NCS_UBAID *uba, EDSV_MSG *msg) { uint8_t *p8; uint32_t total_bytes = 0; EDSV_EDA_FINALIZE_PARAM *param = &msg->info.api_info.param.finalize; if (uba == NULL) { TRACE_4("uba is NULL"); return 0; } /** encode the contents **/ p8 = ncs_enc_reserve_space(uba, 4); if (!p8) { TRACE_4("reserve space failed"); } ncs_encode_32bit(&p8, param->reg_id); ncs_enc_claim_space(uba, 4); total_bytes += 4; return total_bytes; }
/************************************************************************************************ * Name : glsv_gld_mbcsv_enc_warm_sync_rsp * Description : To encode the message that is to be sent to Standby at the time of warm sync * Arguments : GLSV_GLD_CB, NCS_MBCSV_CB_ARG - Mbcsv callback argument * * Return Values : Success / Error * * Notes : This is called at the active side ************************************************************************************************/ static uint32_t glsv_gld_mbcsv_enc_warm_sync_rsp(GLSV_GLD_CB *gld_cb, NCS_MBCSV_CB_ARG *arg) { uint32_t rc = NCSCC_RC_SUCCESS; uint8_t *wsync_ptr; TRACE_ENTER(); /* Reserve space to send the async update counter */ wsync_ptr = ncs_enc_reserve_space(&arg->info.encode.io_uba, sizeof(uint32_t)); if (wsync_ptr == NULL) { LOG_CR("GLD enc reserve space failed: Error %s", strerror(errno)); assert(0); } /* SEND THE ASYNC UPDATE COUNTER */ ncs_enc_claim_space(&arg->info.encode.io_uba, sizeof(uint32_t)); ncs_encode_32bit(&wsync_ptr, gld_cb->gld_async_cnt); arg->info.encode.io_msg_type = NCS_MBCSV_MSG_WARM_SYNC_RESP_COMPLETE; TRACE_LEAVE(); return rc; }
/**************************************************************************** Name : ntfa_enc_reader_finalize_msg Description : This routine encodes an reader_finalize API msg Arguments : NCS_UBAID *msg, NTFSV_MSG *msg Return Values : uns32 Notes : None. ******************************************************************************/ static uns32 ntfa_enc_reader_finalize_msg(NCS_UBAID *uba, ntfsv_msg_t *msg) { uns8 *p8; uns32 total_bytes = 0; ntfsv_reader_finalize_req_t *param = &msg->info.api_info.param.reader_finalize; TRACE_ENTER(); assert(uba != NULL); /** encode the contents **/ p8 = ncs_enc_reserve_space(uba, 8); if (!p8) { TRACE("NULL pointer"); return 0; } ncs_encode_32bit(&p8, param->client_id); ncs_encode_32bit(&p8, param->readerId); ncs_enc_claim_space(uba, 8); total_bytes += 8; TRACE_LEAVE(); return total_bytes; }
/**************************************************************************** Name : lga_enc_finalize_msg Description : This routine encodes a finalize API msg Arguments : NCS_UBAID *msg, LGSV_MSG *msg Return Values : uint32_t Notes : None. ******************************************************************************/ static uint32_t lga_enc_finalize_msg(NCS_UBAID *uba, lgsv_msg_t *msg) { uint8_t *p8; uint32_t total_bytes = 0; lgsv_finalize_req_t *param = &msg->info.api_info.param.finalize; TRACE_ENTER(); osafassert(uba != NULL); /** encode the contents **/ p8 = ncs_enc_reserve_space(uba, 4); if (!p8) { TRACE("NULL pointer"); return 0; } ncs_encode_32bit(&p8, param->client_id); ncs_enc_claim_space(uba, 4); total_bytes += 4; TRACE_LEAVE(); return total_bytes; }
/**************************************************************************** Name : eda_enc_initialize_msg Description : This routine encodes an initialize API msg Arguments : NCS_UBAID *msg, EDSV_MSG *msg Return Values : uint32_t Notes : None. ******************************************************************************/ static uint32_t eda_enc_initialize_msg(NCS_UBAID *uba, EDSV_MSG *msg) { uint8_t *p8; uint32_t total_bytes = 0; EDSV_EDA_INIT_PARAM *param = &msg->info.api_info.param.init; if (uba == NULL) { TRACE_4("uba is NULL"); return 0; } /** encode the contents **/ p8 = ncs_enc_reserve_space(uba, 3); if (!p8) { TRACE_4("reserve space failed"); } ncs_encode_8bit(&p8, param->version.releaseCode); ncs_encode_8bit(&p8, param->version.majorVersion); ncs_encode_8bit(&p8, param->version.minorVersion); ncs_enc_claim_space(uba, 3); total_bytes += 3; return total_bytes; }
/**************************************************************************** Name : lga_enc_initialize_msg Description : This routine encodes an initialize API msg Arguments : NCS_UBAID *msg, LGSV_MSG *msg Return Values : uint32_t Notes : None. ******************************************************************************/ static uint32_t lga_enc_initialize_msg(NCS_UBAID *uba, lgsv_msg_t *msg) { uint8_t *p8; uint32_t total_bytes = 0; lgsv_initialize_req_t *param = &msg->info.api_info.param.init; TRACE_ENTER(); osafassert(uba != NULL); /** encode the contents **/ p8 = ncs_enc_reserve_space(uba, 3); if (!p8) { TRACE("NULL pointer"); return 0; } ncs_encode_8bit(&p8, param->version.releaseCode); ncs_encode_8bit(&p8, param->version.majorVersion); ncs_encode_8bit(&p8, param->version.minorVersion); ncs_enc_claim_space(uba, 3); total_bytes += 3; TRACE_LEAVE(); return total_bytes; }
uns32 dts_mds_enc(MDS_CLIENT_HDL yr_svc_hdl, NCSCONTEXT msg, SS_SVC_ID to_svc, NCS_UBAID *uba, MDS_SVC_PVT_SUB_PART_VER remote_ver, MDS_CLIENT_MSG_FORMAT_VER *msg_fmat_ver) { uns8 *data; DTSV_MSG *mm; NCS_UBAID *payload_uba; if (uba == NULL) return m_DTS_DBG_SINK(NCSCC_RC_FAILURE, "dts_mds_enc: User buff is NULL"); /*Versioning changes - Set message format version same as remote version */ *msg_fmat_ver = 1; mm = (DTSV_MSG *)msg; if (mm == NULL) return m_DTS_DBG_SINK(NCSCC_RC_FAILURE, "dts_mds_enc: Message to be encoded is NULL"); data = ncs_enc_reserve_space(uba, DTSV_DTS_DTA_MSG_HDR_SIZE); if (data == NULL) return m_DTS_DBG_SINK(NCSCC_RC_FAILURE, "dts_mds_enc: ncs_enc_reserve_space returns NULL"); ncs_encode_16bit(&data, mm->vrid); ncs_encode_8bit(&data, mm->msg_type); ncs_enc_claim_space(uba, DTSV_DTS_DTA_MSG_HDR_SIZE); switch (mm->msg_type) { case DTS_SVC_REG_CONF: { data = ncs_enc_reserve_space(uba, DTSV_REG_CONF_MSG_SIZE); if (data == NULL) return m_DTS_DBG_SINK(NCSCC_RC_FAILURE, "dts_mds_enc: ncs_enc_reserve_space returns NULL"); ncs_encode_32bit(&data, mm->data.data.reg_conf.msg_fltr.svc_id); ncs_encode_32bit(&data, mm->data.data.reg_conf.msg_fltr.enable_log); ncs_encode_32bit(&data, mm->data.data.reg_conf.msg_fltr.category_bit_map); ncs_encode_8bit(&data, mm->data.data.reg_conf.msg_fltr.severity_bit_map); /* No need of policy handles */ /*ncs_encode_32bit(&data, mm->data.data.reg_conf.msg_fltr.policy_hdl); */ ncs_enc_claim_space(uba, DTSV_REG_CONF_MSG_SIZE); break; } case DTS_SVC_MSG_FLTR: { data = ncs_enc_reserve_space(uba, DTSV_FLTR_MSG_SIZE); if (data == NULL) return m_DTS_DBG_SINK(NCSCC_RC_FAILURE, "dts_mds_enc: ncs_enc_reserve_space returns NULL"); ncs_encode_32bit(&data, mm->data.data.msg_fltr.svc_id); ncs_encode_32bit(&data, mm->data.data.msg_fltr.enable_log); ncs_encode_32bit(&data, mm->data.data.msg_fltr.category_bit_map); ncs_encode_8bit(&data, mm->data.data.msg_fltr.severity_bit_map); ncs_enc_claim_space(uba, DTSV_FLTR_MSG_SIZE); break; } case DTS_FAIL_OVER: { payload_uba = &mm->data.data.msg.log_msg.uba; ncs_enc_append_usrbuf(uba, payload_uba->start); break; } #if (DTA_FLOW == 1) case DTA_FLOW_CONTROL: case DTS_CONGESTION_HIT: case DTS_CONGESTION_CLEAR: /* Do nothing */ break; #endif default: return NCSCC_RC_FAILURE; } return NCSCC_RC_SUCCESS; }
/****************************************************************************\ * Name : ncs_logmsg_int * * Description : This function is use for Message Logging. * * Arguments : svc_id : Service ID. * fmat_id : Format ID. * str_table_id : String tabel ID. * category : Message category. * severity : Message Severity. * fmat_type : Format type to be used for logging. * * Return Values : NCSCC_RC_SUCCESS/NCSCC_RC_FAILURE. * * Notes : None. \*****************************************************************************/ uns32 ncs_logmsg_int(SS_SVC_ID svc_id, uns32 inst_id, uns8 fmat_id, uns8 str_table_id, uns32 category, uns8 severity, char *fmat_type, va_list argp) { uns32 i = 0, length = 0; DTA_CB *inst = &dta_cb; DTSV_MSG *msg; NCSFL_HDR *hdr; REG_TBL_ENTRY *svc; NCS_UBAID *uba = NULL; uns8 *data; uns32 send_pri; int warning_rmval = 0; /*************************************************************************\ * As different fields of the log-message are encoded, the minimum DTS * required to understand the message may change. \*************************************************************************/ uns32 act_dts_ver; /* Active dts's version. */ uns32 min_dts_ver; /* Minimum DTS version that understands message */ DTA_LOG_BUFFER *list = &inst->log_buffer; DTA_BUFFERED_LOG *buf = NULL; /* Check if DTA is created. Continue logging if DTA is created */ if (inst->created == FALSE) { return m_DTA_DBG_SINK_SVC(NCSCC_RC_FAILURE, "ncs_logmsg: DTA does not exist. First create DTA before logging.", svc_id); } m_DTA_LK(&inst->lock); /* * Check whether DTS exist. If DTS does not exist then there is no * point in logging message. Return failure. * Changed as of 15th June 2006. * If FLS doesn't exist & number of buffer msgs is more than DTA_BUF_LIMIT * then drop the message and return failure. */ if ((inst->dts_exist == FALSE) && (list->num_of_logs >= DTA_BUF_LIMIT)) { m_DTA_UNLK(&inst->lock); return m_DTA_DBG_SINK_SVC(NCSCC_RC_FAILURE, "ncs_logmsg: DTS does not exist & DTA log buffer is full. Log message is dropped.", svc_id); } /* * Check whether the Sevice is registered with the DTSv. If not already * bound return failure. */ if (((svc = (REG_TBL_ENTRY *)ncs_patricia_tree_get(&inst->reg_tbl, (const uns8 *)&svc_id)) == NULL)) { m_DTA_UNLK(&inst->lock); return NCSCC_RC_FAILURE; } #if (DTA_FLOW == 1) /* Check whether logging is enabled beyond default level for this service * i.e. INFO or DEBUG levels are enabled or not. * If logging levels are increased to INFO/DEBUG, don't apply DTA message * thresholding. Otherwise DTA defines MAX threshold of 2000 messages after * which all messages will be dropped. In such cases, check the rate of * logging for such processes. */ if (svc->severity_bit_map > 0xFC) { /* Don't apply thresholding of messages here */ } else { /* Else apply thresholding */ if (inst->msg_count > DTA_MAX_THRESHOLD) { m_DTA_UNLK(&inst->lock); warning_rmval = m_DTA_DBG_SINK(NCSCC_RC_FAILURE, "ncs_logmsg: DTA queued msgs exceeds 2000. Message will be dropped."); return NCSCC_RC_FAILURE; } } /* Drop INFO/DEBUG messages at source during congestion */ if ((inst->dts_congested == TRUE) && (severity < NCSFL_SEV_NOTICE)) { m_DTA_UNLK(&inst->lock); return NCSCC_RC_FAILURE; } #endif msg = m_MMGR_ALLOC_DTSV_MSG; if (msg == NULL) { m_DTA_UNLK(&inst->lock); return m_DTA_DBG_SINK(NCSCC_RC_FAILURE, "ncs_logmsg: Memory allocation failer for DTSV_MSG"); } memset(msg, '\0', sizeof(DTSV_MSG)); hdr = &msg->data.data.msg.log_msg.hdr; hdr->category = category; hdr->severity = severity; hdr->fmat_id = fmat_id; hdr->ss_id = svc_id; hdr->inst_id = inst_id; hdr->str_table_id = str_table_id; /* Apply the filter Policies. If the logging is disabled * then return success. We are returning success here since it may * possible that logging is disabled by user. */ if (dta_svc_reg_log_en(svc, &msg->data.data.msg.log_msg) == NCSCC_RC_FAILURE) { m_DTA_UNLK(&inst->lock); m_MMGR_FREE_DTSV_MSG(msg); return NCSCC_RC_SUCCESS; } if (NCSCC_RC_SUCCESS != dta_copy_octets(&hdr->fmat_type, fmat_type, (uns16)(1 + strlen(fmat_type)))) { m_DTA_UNLK(&inst->lock); m_MMGR_FREE_DTSV_MSG(msg); return m_DTA_DBG_SINK(NCSCC_RC_FAILURE, "ncs_logmsg_int: Copy octet failed."); } /* Flexlog Agent fills in the TIME STAMP value */ m_GET_MSEC_TIME_STAMP(&hdr->time.seconds, &hdr->time.millisecs); msg->vrid = inst->vrid; msg->msg_type = DTA_LOG_DATA; uba = &msg->data.data.msg.log_msg.uba; /* act_dts_ver needs to be recorded before inst->lock is unlocked */ act_dts_ver = inst->act_dts_ver; min_dts_ver = 1; /* DTS should be at least this version to interpret the encoded message. This directly determines the message format vesion */ m_DTA_UNLK(&inst->lock); memset(uba, '\0', sizeof(NCS_UBAID)); if (ncs_enc_init_space(uba) != NCSCC_RC_SUCCESS) { m_MMGR_FREE_OCT(hdr->fmat_type); m_MMGR_FREE_DTSV_MSG(msg); return m_DTA_DBG_SINK_SVC(NCSCC_RC_FAILURE, "ncs_logmsg: Unable to init user buff", svc_id); } while (fmat_type[i] != '\0') { switch (fmat_type[i]) { case 'T': { break; } case 'I': { uns32 idx; idx = m_NCSFL_MAKE_IDX((uns32)str_table_id, (uns32)va_arg(argp, uns32)); data = ncs_enc_reserve_space(uba, sizeof(uns32)); if (data == NULL) goto reserve_error; ncs_encode_32bit(&data, idx); ncs_enc_claim_space(uba, sizeof(uns32)); break; } case 'L': { data = ncs_enc_reserve_space(uba, sizeof(uns32)); if (data == NULL) goto reserve_error; ncs_encode_32bit(&data, va_arg(argp, uns32)); ncs_enc_claim_space(uba, sizeof(uns32)); break; } case 'C': { char *str = va_arg(argp, char *); if (NULL == str) { if (uba->start != NULL) m_MMGR_FREE_BUFR_LIST(uba->start); m_MMGR_FREE_OCT(hdr->fmat_type); m_MMGR_FREE_DTSV_MSG(msg); return m_DTA_DBG_SINK_SVC(NCSCC_RC_FAILURE, "ncs_logmsg: NULL string passed for format type 'C'", svc_id); } length = strlen(str) + 1; if (length > (DTS_MAX_SIZE_DATA * 3)) { if (uba->start != NULL) m_MMGR_FREE_BUFR_LIST(uba->start); m_MMGR_FREE_OCT(hdr->fmat_type); m_MMGR_FREE_DTSV_MSG(msg); return m_DTA_DBG_SINK_SVC(NCSCC_RC_FAILURE, "ncs_logmsg: Can not log string with more than 1536 characters", svc_id); } data = ncs_enc_reserve_space(uba, sizeof(uns32)); if (data == NULL) goto reserve_error; ncs_encode_32bit(&data, length); ncs_enc_claim_space(uba, sizeof(uns32)); ncs_encode_n_octets_in_uba(uba, (uns8 *)str, length); break; } case 'M': { data = ncs_enc_reserve_space(uba, sizeof(uns16)); if (data == NULL) goto reserve_error; ncs_encode_16bit(&data, (uns16)va_arg(argp, uns32)); ncs_enc_claim_space(uba, sizeof(uns16)); break; } case 'D': { NCSFL_MEM mem_d = va_arg(argp, NCSFL_MEM); if (mem_d.len > DTS_MAX_SIZE_DATA) mem_d.len = DTS_MAX_SIZE_DATA; /* Versioning & 64-bit compatibility changes - Encode the msg * for format 'D' after checking the version of the current * Active DTS. * If Active DTS has MDS version 1 and DTA arch 64-bit then, * encode 32 bits with reserved bit-pattern 0x6464. * Else, if DTS has MDS version 2, then encode 64-bits of the * address. * Also fill DTA_LOG_MSG structure with the DTS version as seen * while encoding. */ /* The 'D' message is encoded at version 1 or 2 based on whether DTS is at version 1 or higher respectively. */ /* Check for compatibility with receiving DTS version and set the minimum DTS version required */ if (act_dts_ver == 1) { /* Compatible DTS. Update minimum DTS version required */ if (min_dts_ver < 1) min_dts_ver = 1; data = ncs_enc_reserve_space(uba, (sizeof(uns16) + sizeof(uns32))); if (data == NULL) goto reserve_error; ncs_encode_16bit(&data, mem_d.len); if (sizeof(inst) == 8) { /* Attempt to print 64-bit address on 32-bit DTS. * Print pre-defined bit pattern to indicate error. */ ncs_encode_32bit(&data, (uns32)0x6464); } else if (sizeof(inst) == 4) { /* Do it the old way */ ncs_encode_32bit(&data, NCS_PTR_TO_UNS32_CAST(mem_d.addr)); } ncs_enc_claim_space(uba, (sizeof(uns16) + sizeof(uns32))); } /* Act DTS on version 2 or higher , then encode all 64-bits */ else { /* Compatible DTS. Update minimum DTS version required */ if (min_dts_ver < 2) min_dts_ver = 2; data = ncs_enc_reserve_space(uba, (sizeof(uns16) + sizeof(uns64))); if (data == NULL) goto reserve_error; ncs_encode_16bit(&data, mem_d.len); ncs_encode_64bit(&data, (uns64)(long)mem_d.addr); ncs_enc_claim_space(uba, (sizeof(uns16) + sizeof(uns64))); } ncs_encode_n_octets_in_uba(uba, (uns8 *)mem_d.dump, (uns32)mem_d.len); break; } case 'P': { NCSFL_PDU pdu = va_arg(argp, NCSFL_PDU); if (pdu.len > DTS_MAX_SIZE_DATA) pdu.len = DTS_MAX_SIZE_DATA; data = ncs_enc_reserve_space(uba, sizeof(uns16)); if (data == NULL) goto reserve_error; ncs_encode_16bit(&data, pdu.len); ncs_enc_claim_space(uba, sizeof(uns16)); ncs_encode_n_octets_in_uba(uba, (uns8 *)pdu.dump, (uns32)pdu.len); break; } case 'A': { encode_ip_address(uba, va_arg(argp, NCS_IP_ADDR)); break; } case 'S': { data = ncs_enc_reserve_space(uba, sizeof(uns8)); if (data == NULL) goto reserve_error; ncs_encode_8bit(&data, (uns8)va_arg(argp, uns32)); ncs_enc_claim_space(uba, sizeof(uns8)); break; } /* Added code for handling float values */ case 'F': { char str[DTS_MAX_DBL_DIGITS] = ""; int num_chars = sprintf(str, "%f", va_arg(argp, double)); if (num_chars == 0) { warning_rmval = m_DTA_DBG_SINK(NCSCC_RC_FAILURE, "ncs_logmsg: Float to string conversion gives NULL"); goto reserve_error; } length = strlen(str) + 1; data = ncs_enc_reserve_space(uba, sizeof(uns32)); if (data == NULL) goto reserve_error; ncs_encode_32bit(&data, length); ncs_enc_claim_space(uba, sizeof(uns32)); ncs_encode_n_octets_in_uba(uba, (uns8 *)str, length); break; } case 'N': { char str[DTS_MAX_DBL_DIGITS] = ""; int num_chars = 0; /* Check for compatibility with receiving DTS version and set the minimum DTS version required */ if (act_dts_ver == 1) { /* Incompatible DTS */ goto reserve_error; } else { /* Compatible DTS. Update minimum DTS version required */ if (min_dts_ver < 2) min_dts_ver = 2; } num_chars = sprintf(str, "%lld", va_arg(argp, long long)); if (num_chars == 0) { warning_rmval = m_DTA_DBG_SINK(NCSCC_RC_FAILURE, "ncs_logmsg: long long to string conversion gives NULL"); goto reserve_error; } length = strlen(str) + 1; data = ncs_enc_reserve_space(uba, sizeof(uns32)); if (data == NULL) goto reserve_error; ncs_encode_32bit(&data, length); ncs_enc_claim_space(uba, sizeof(uns32)); ncs_encode_n_octets_in_uba(uba, (uns8 *)str, length); break; } case 'U': { char str[DTS_MAX_DBL_DIGITS] = ""; int num_chars = 0; /* Check for compatibility with receiving DTS version and set the minimum DTS version required */ if (act_dts_ver == 1) { /* Incompatible DTS */ goto reserve_error; } else { /* Compatible DTS. Update minimum DTS version required */ if (min_dts_ver < 2) min_dts_ver = 2; } num_chars = sprintf(str, "%llu", va_arg(argp, unsigned long long)); if (num_chars == 0) { warning_rmval = m_DTA_DBG_SINK(NCSCC_RC_FAILURE, "ncs_logmsg: unsigned long long to string conversion gives NULL"); goto reserve_error; } length = strlen(str) + 1; data = ncs_enc_reserve_space(uba, sizeof(uns32)); if (data == NULL) goto reserve_error; ncs_encode_32bit(&data, length); ncs_enc_claim_space(uba, sizeof(uns32)); ncs_encode_n_octets_in_uba(uba, (uns8 *)str, length); break; } case 'X': { char str[DTS_MAX_DBL_DIGITS] = ""; int num_chars = 0; /* Check for compatibility with receiving DTS version and set the minimum DTS version required */ if (act_dts_ver == 1) { /* Incompatible DTS */ goto reserve_error; } else { /* Compatible DTS. Update minimum DTS version required */ if (min_dts_ver < 2) min_dts_ver = 2; } num_chars = sprintf(str, "Ox%016llx", va_arg(argp, long long)); if (num_chars == 0) { warning_rmval = m_DTA_DBG_SINK(NCSCC_RC_FAILURE, "ncs_logmsg: 64bit hex to string conversion gives NULL"); goto reserve_error; } length = strlen(str) + 1; data = ncs_enc_reserve_space(uba, sizeof(uns32)); if (data == NULL) goto reserve_error; ncs_encode_32bit(&data, length); ncs_enc_claim_space(uba, sizeof(uns32)); ncs_encode_n_octets_in_uba(uba, (uns8 *)str, length); break; } default: { if (uba->start != NULL) m_MMGR_FREE_BUFR_LIST(uba->start); m_MMGR_FREE_OCT(hdr->fmat_type); m_MMGR_FREE_DTSV_MSG(msg); return m_DTA_DBG_SINK_SVC(NCSCC_RC_FAILURE, "ncs_logmsg: Format Type Not accounted for", svc_id); } } i++; } /* Buffer log messgages if DTS is not up _or_ registration is not confirmed */ if ((inst->dts_exist == FALSE) || (svc->log_msg == FALSE)) { m_DTA_LK(&inst->lock); buf = m_MMGR_ALLOC_DTA_BUFFERED_LOG; if (!buf) { if (msg->data.data.msg.log_msg.uba.start != NULL) m_MMGR_FREE_BUFR_LIST(msg->data.data.msg.log_msg.uba.start); m_MMGR_FREE_OCT(msg->data.data.msg.log_msg.hdr.fmat_type); if (0 != msg) m_MMGR_FREE_DTSV_MSG(msg); m_DTA_UNLK(&inst->lock); return m_DTA_DBG_SINK(NCSCC_RC_FAILURE, "Failed to allocate memory for log buffering"); } /* Set the msg format version based on how it is encoded above. Usually it will be 1, because during DTS initialization, until active DTS shows up (i.e until inst->dts_exist becomes TRUE) active DTS version is assumed to be 1. */ msg->data.data.msg.msg_fmat_ver = min_dts_ver; memset(buf, '\0', sizeof(DTA_BUFFERED_LOG)); buf->buf_msg = msg; buf->next = NULL; if (!list->head) list->head = buf; else list->tail->next = buf; list->tail = buf; list->num_of_logs++; m_DTA_UNLK(&inst->lock); } else { send_pri = NCS_IPC_PRIORITY_LOW; /* Set the msg format version to final value of min_dts_ver */ msg->data.data.msg.msg_fmat_ver = min_dts_ver; /* Smik - We don't send the msg to MDS but to DTA's msgbox */ if (m_DTA_SND_MSG(&gl_dta_mbx, msg, send_pri) != NCSCC_RC_SUCCESS) { if (uba->start != NULL) m_MMGR_FREE_BUFR_LIST(uba->start); m_MMGR_FREE_OCT(hdr->fmat_type); m_MMGR_FREE_DTSV_MSG(msg); /*if (dta_mds_async_send(&msg, inst) != NCSCC_RC_SUCCESS) */ return m_DTA_DBG_SINK(NCSCC_RC_FAILURE, "ncs_logmsg: send to DTA msgbox failed"); } } return NCSCC_RC_SUCCESS; reserve_error: if (uba->start != NULL) m_MMGR_FREE_BUFR_LIST(uba->start); m_MMGR_FREE_OCT(hdr->fmat_type); m_MMGR_FREE_DTSV_MSG(msg); return m_DTA_DBG_SINK(NCSCC_RC_FAILURE, "ncs_logmsg: Unable to reserve space in encode"); }
/******************************************************************************************* * Name : glsv_gld_mbcsv_enc_msg_rsp * * Description : To encode the message that is to be sent to Standby for Cold Sync * Arguments : * * Return Values : |------------------|---------------|-----------|------|-----------|-----------| |No. of Ckpts | ckpt record 1 |ckpt rec 2 |..... |ckpt rec n | async upd | |that will be sent | | | | | cnt ( 0 ) | |------------------|---------------------------|------|-----------|-----------| *******************************************************************************************/ static uint32_t glsv_gld_mbcsv_enc_msg_rsp(GLSV_GLD_CB *gld_cb, NCS_MBCSV_CB_ARG *arg) { GLSV_GLD_RSC_INFO *rsc_info = NULL; GLSV_GLD_A2S_RSC_DETAILS rsc_details; GLSV_NODE_LIST *node_list = NULL; GLSV_A2S_NODE_LIST *a2s_node_list = NULL; GLSV_A2S_NODE_LIST *tmp_a2s_node_list = NULL; GLSV_GLD_GLND_DETAILS *node_details = NULL; uint32_t rc = NCSCC_RC_SUCCESS, no_of_ckpts = 0; EDU_ERR ederror = 0; uint8_t *header; uint8_t *async_cnt; TRACE_ENTER(); /* COLD_SYNC_RESP IS DONE BY THE ACTIVE */ if (gld_cb->ha_state == SA_AMF_HA_STANDBY) { rc = NCSCC_RC_FAILURE; goto end; } memset(&rsc_details, '\0', sizeof(GLSV_GLD_A2S_RSC_DETAILS)); /* First reserve space to store the number of checkpoints that will be sent */ header = ncs_enc_reserve_space(&arg->info.encode.io_uba, sizeof(uint8_t)); if (header == NULL) { LOG_CR("GLD enc reserve space failed: Error %s", strerror(errno)); assert(0); } ncs_enc_claim_space(&arg->info.encode.io_uba, sizeof(uint8_t)); /* Get the first node */ if (!gld_cb->prev_rsc_id) rsc_info = gld_cb->rsc_info; else { rsc_info = gld_cb->rsc_info; while (rsc_info != NULL) { if (rsc_info->rsc_id == gld_cb->prev_rsc_id) break; rsc_info = rsc_info->next; } if (rsc_info) rsc_info = rsc_info->next; } if (rsc_info == NULL) { /* LOG TBD */ rc = NCSCC_RC_FAILURE; goto end; } else { while (rsc_info != NULL) { node_list = rsc_info->node_list; no_of_ckpts++; memcpy(&rsc_details.resource_name, &rsc_info->lck_name, sizeof(SaNameT)); rsc_details.rsc_id = rsc_info->rsc_id; rsc_details.can_orphan = rsc_info->can_orphan; rsc_details.orphan_lck_mode = rsc_info->orphan_lck_mode; rsc_details.node_list = a2s_node_list = m_MMGR_ALLOC_A2S_GLSV_NODE_LIST; if (rsc_details.node_list == NULL) { LOG_CR("Rsc info alloc failed: Error %s", strerror(errno)); assert(0); } memset(rsc_details.node_list, '\0', sizeof(GLSV_A2S_NODE_LIST)); if (node_list != NULL) { memcpy(&rsc_details.node_list->dest_id, &rsc_info->node_list->dest_id, sizeof(MDS_DEST)); /* Get the master node for this resource */ node_details = (GLSV_GLD_GLND_DETAILS *)ncs_patricia_tree_get(&gld_cb->glnd_details, (uint8_t *)&node_list->node_id); if (node_details == NULL) { LOG_ER("Patricia tree get failed: node_id %u", node_list->node_id); } else rsc_details.node_list->status = node_details->status; node_list = node_list->next; while (node_list != NULL) { a2s_node_list->next = m_MMGR_ALLOC_A2S_GLSV_NODE_LIST; a2s_node_list = a2s_node_list->next; if (a2s_node_list == NULL) { LOG_CR("Rsc info alloc failed: Error %s", strerror(errno)); assert(0); if (rsc_details.node_list) { a2s_node_list = rsc_details.node_list; while (a2s_node_list != NULL) { tmp_a2s_node_list = a2s_node_list; a2s_node_list = a2s_node_list->next; m_MMGR_FREE_A2S_GLSV_NODE_LIST(tmp_a2s_node_list); } } rc = NCSCC_RC_FAILURE; goto end; } memset(a2s_node_list, '\0', sizeof(GLSV_A2S_NODE_LIST)); memcpy(&a2s_node_list->dest_id, &node_list->dest_id, sizeof(MDS_DEST)); node_details = (GLSV_GLD_GLND_DETAILS *)ncs_patricia_tree_get(&gld_cb->glnd_details, (uint8_t *)&node_list->node_id); if (node_details == NULL) { LOG_ER("Patricia tree get failed: node_id %u", node_list->node_id); rc = NCSCC_RC_FAILURE; goto end; } else a2s_node_list->status = node_details->status; node_list = node_list->next; } } /* DO THE EDU EXEC */ rc = m_NCS_EDU_EXEC(&gld_cb->edu_hdl, glsv_edp_gld_evt_a2s_rsc_details, &arg->info.encode.io_uba, EDP_OP_TYPE_ENC, &rsc_details, &ederror); if (rc != NCSCC_RC_SUCCESS) { LOG_ER("EDU exec coldsync evt failed"); rc = NCSCC_RC_FAILURE; goto end; } if (rsc_details.node_list) { a2s_node_list = rsc_details.node_list; while (a2s_node_list != NULL) { tmp_a2s_node_list = a2s_node_list; a2s_node_list = a2s_node_list->next; m_MMGR_FREE_A2S_GLSV_NODE_LIST(tmp_a2s_node_list); } } if (no_of_ckpts == MAX_NO_OF_RSC_INFO_RECORDS) break; rsc_info = rsc_info->next; } /* while */ } if (rsc_info != NULL) gld_cb->prev_rsc_id = rsc_info->rsc_id; ncs_encode_8bit(&header, no_of_ckpts); /* This will have the count of async updates that have been sent, this will be 0 initially */ async_cnt = ncs_enc_reserve_space(&arg->info.encode.io_uba, sizeof(uint32_t)); if (async_cnt == NULL) { LOG_CR("GLD enc reserve space failed: Error %s", strerror(errno)); assert(0); } ncs_enc_claim_space(&arg->info.encode.io_uba, sizeof(uint32_t)); ncs_encode_32bit(&async_cnt, gld_cb->gld_async_cnt); if (no_of_ckpts < MAX_NO_OF_RSC_INFO_RECORDS) { if (arg->info.encode.io_msg_type == NCS_MBCSV_MSG_COLD_SYNC_RESP) arg->info.encode.io_msg_type = NCS_MBCSV_MSG_COLD_SYNC_RESP_COMPLETE; else { if (arg->info.encode.io_msg_type == NCS_MBCSV_MSG_DATA_RESP) arg->info.encode.io_msg_type = NCS_MBCSV_MSG_DATA_RESP_COMPLETE; } gld_cb->prev_rsc_id = 0; } end: TRACE_LEAVE(); return rc; }
/**************************************************************************** Name : ntfa_mds_enc Description : This is a callback routine that is invoked to encode NTFS messages. Arguments : pointer to struct ncsmds_callback_info Return Values : NCSCC_RC_SUCCESS/NCSCC_RC_FAILURE Notes : None. ******************************************************************************/ static uns32 ntfa_mds_enc(struct ncsmds_callback_info *info) { ntfsv_msg_t *msg; NCS_UBAID *uba; uns8 *p8; uns32 total_bytes = 0; MDS_CLIENT_MSG_FORMAT_VER msg_fmt_version; TRACE_ENTER(); msg_fmt_version = m_NCS_ENC_MSG_FMT_GET(info->info.enc.i_rem_svc_pvt_ver, NTFA_WRT_NTFS_SUBPART_VER_AT_MIN_MSG_FMT, NTFA_WRT_NTFS_SUBPART_VER_AT_MAX_MSG_FMT, NTFA_WRT_NTFS_MSG_FMT_ARRAY); if (0 == msg_fmt_version) { TRACE("Wrong msg_fmt_version!!\n"); TRACE_LEAVE(); return NCSCC_RC_FAILURE; } info->info.enc.o_msg_fmt_ver = msg_fmt_version; msg = (ntfsv_msg_t *)info->info.enc.i_msg; uba = info->info.enc.io_uba; if (uba == NULL) { TRACE("uba=NULL"); TRACE_LEAVE(); return NCSCC_RC_FAILURE; } /** encode the type of message **/ p8 = ncs_enc_reserve_space(uba, 4); if (!p8) { TRACE("NULL pointer"); TRACE_LEAVE(); return NCSCC_RC_FAILURE; } ncs_encode_32bit(&p8, msg->type); ncs_enc_claim_space(uba, 4); total_bytes += 4; TRACE_2("msgtype: %d", msg->type); if (NTFSV_NTFA_API_MSG == msg->type) { /** encode the API msg subtype **/ p8 = ncs_enc_reserve_space(uba, 4); if (!p8) { TRACE("encode API msg subtype FAILED"); TRACE_LEAVE(); /* fixme: ok to do return fail?? */ return NCSCC_RC_FAILURE; } ncs_encode_32bit(&p8, msg->info.api_info.type); ncs_enc_claim_space(uba, 4); total_bytes += 4; TRACE_2("api_info.type: %d\n", msg->info.api_info.type); switch (msg->info.api_info.type) { case NTFSV_INITIALIZE_REQ: total_bytes += ntfa_enc_initialize_msg(uba, msg); break; case NTFSV_FINALIZE_REQ: total_bytes += ntfa_enc_finalize_msg(uba, msg); break; case NTFSV_SUBSCRIBE_REQ: total_bytes += ntfa_enc_subscribe_msg(uba, msg); break; case NTFSV_UNSUBSCRIBE_REQ: total_bytes += ntfa_enc_unsubscribe_msg(uba, msg); break; case NTFSV_SEND_NOT_REQ: total_bytes += ntfa_enc_send_not_msg(uba, msg); break; case NTFSV_READER_INITIALIZE_REQ: total_bytes += ntfa_enc_reader_initialize_msg(uba, msg); break; case NTFSV_READER_FINALIZE_REQ: total_bytes += ntfa_enc_reader_finalize_msg(uba, msg); break; case NTFSV_READ_NEXT_REQ: total_bytes += ntfa_enc_read_next_msg(uba, msg); break; default: TRACE("Unknown API type = %d", msg->info.api_info.type); break; } } TRACE_LEAVE(); return NCSCC_RC_SUCCESS; }
/**************************************************************************** Name : lga_enc_lstr_open_sync_msg Description : This routine encodes a log stream open sync API msg Arguments : NCS_UBAID *msg, LGSV_MSG *msg Return Values : uint32_t Notes : None. ******************************************************************************/ static uint32_t lga_enc_lstr_open_sync_msg(NCS_UBAID *uba, lgsv_msg_t *msg) { int len; uint8_t *p8; uint32_t total_bytes = 0; lgsv_stream_open_req_t *param = &msg->info.api_info.param.lstr_open_sync; TRACE_ENTER(); osafassert(uba != NULL); /** encode the contents **/ p8 = ncs_enc_reserve_space(uba, 6); if (!p8) { TRACE("p8 NULL!!!"); return 0; } ncs_encode_32bit(&p8, param->client_id); ncs_encode_16bit(&p8, param->lstr_name.length); ncs_enc_claim_space(uba, 6); total_bytes += 6; /* Encode log stream name */ ncs_encode_n_octets_in_uba(uba, param->lstr_name.value, (uint32_t)param->lstr_name.length); total_bytes += (uint32_t)param->lstr_name.length; /* Encode logFileName if initiated */ p8 = ncs_enc_reserve_space(uba, 2); if (!p8) { TRACE("p8 NULL!!!"); goto done; } if (param->logFileName != NULL) len = strlen(param->logFileName) + 1; else len = 0; ncs_encode_16bit(&p8, len); ncs_enc_claim_space(uba, 2); total_bytes += 2; if (param->logFileName != NULL) { ncs_encode_n_octets_in_uba(uba, (uint8_t *)param->logFileName, len); total_bytes += len; } /* Encode logFilePathName if initiated */ p8 = ncs_enc_reserve_space(uba, 2); if (!p8) { TRACE("p8 NULL!!!"); goto done; } if (param->logFilePathName) len = strlen(param->logFilePathName) + 1; else len = 0; ncs_encode_16bit(&p8, len); ncs_enc_claim_space(uba, 2); total_bytes += 2; if (param->logFilePathName != NULL) { ncs_encode_n_octets_in_uba(uba, (uint8_t *)param->logFilePathName, len); total_bytes += len; } /* Encode format string if initiated */ p8 = ncs_enc_reserve_space(uba, 24); if (!p8) { TRACE("p8 NULL!!!"); goto done; } if (param->logFileFmt != NULL) len = strlen(param->logFileFmt) + 1; else len = 0; ncs_encode_64bit(&p8, param->maxLogFileSize); ncs_encode_32bit(&p8, param->maxLogRecordSize); ncs_encode_32bit(&p8, (uint32_t)param->haProperty); ncs_encode_32bit(&p8, (uint32_t)param->logFileFullAction); ncs_encode_16bit(&p8, param->maxFilesRotated); ncs_encode_16bit(&p8, len); ncs_enc_claim_space(uba, 24); total_bytes += 24; if (len > 0) { ncs_encode_n_octets_in_uba(uba, (uint8_t *)param->logFileFmt, len); total_bytes += len; } /* Encode last item in struct => open flags!!!! */ p8 = ncs_enc_reserve_space(uba, 1); if (!p8) { TRACE("p8 NULL!!!"); goto done; } ncs_encode_8bit(&p8, param->lstr_open_flags); ncs_enc_claim_space(uba, 1); total_bytes += 1; done: TRACE_LEAVE(); return total_bytes; }
/**************************************************************************** Name : lga_enc_write_log_async_msg Description : This routine encodes a write log async API msg Arguments : NCS_UBAID *msg, LGSV_MSG *msg Return Values : uint32_t Notes : None. ******************************************************************************/ static uint32_t lga_enc_write_log_async_msg(NCS_UBAID *uba, lgsv_msg_t *msg) { uint8_t *p8; uint32_t total_bytes = 0; lgsv_write_log_async_req_t *param = &msg->info.api_info.param.write_log_async; const SaLogNtfLogHeaderT *ntfLogH; const SaLogGenericLogHeaderT *genLogH; osafassert(uba != NULL); /** encode the contents **/ p8 = ncs_enc_reserve_space(uba, 20); if (!p8) { TRACE("Could not reserve space"); return 0; } ncs_encode_64bit(&p8, param->invocation); ncs_encode_32bit(&p8, param->ack_flags); ncs_encode_32bit(&p8, param->client_id); ncs_encode_32bit(&p8, param->lstr_id); ncs_enc_claim_space(uba, 20); total_bytes += 20; p8 = ncs_enc_reserve_space(uba, 12); if (!p8) { TRACE("Could not reserve space"); return 0; } ncs_encode_64bit(&p8, *param->logTimeStamp); ncs_encode_32bit(&p8, (uint32_t)param->logRecord->logHdrType); ncs_enc_claim_space(uba, 12); total_bytes += 12; /* Alarm and application streams so far. */ switch (param->logRecord->logHdrType) { case SA_LOG_NTF_HEADER: ntfLogH = ¶m->logRecord->logHeader.ntfHdr; p8 = ncs_enc_reserve_space(uba, 14); if (!p8) { TRACE("Could not reserve space"); return 0; } ncs_encode_64bit(&p8, ntfLogH->notificationId); ncs_encode_32bit(&p8, (uint32_t)ntfLogH->eventType); ncs_encode_16bit(&p8, ntfLogH->notificationObject->length); ncs_enc_claim_space(uba, 14); total_bytes += 14; ncs_encode_n_octets_in_uba(uba, ntfLogH->notificationObject->value, (uint32_t)ntfLogH->notificationObject->length); total_bytes += ntfLogH->notificationObject->length; p8 = ncs_enc_reserve_space(uba, 2); if (!p8) { TRACE("Could not reserve space"); return 0; } ncs_encode_16bit(&p8, ntfLogH->notifyingObject->length); ncs_enc_claim_space(uba, 2); total_bytes += 2; ncs_encode_n_octets_in_uba(uba, ntfLogH->notifyingObject->value, ntfLogH->notifyingObject->length); total_bytes += ntfLogH->notifyingObject->length; p8 = ncs_enc_reserve_space(uba, 16); if (!p8) { TRACE("Could not reserve space"); return 0; } ncs_encode_32bit(&p8, ntfLogH->notificationClassId->vendorId); ncs_encode_16bit(&p8, ntfLogH->notificationClassId->majorId); ncs_encode_16bit(&p8, ntfLogH->notificationClassId->minorId); ncs_encode_64bit(&p8, ntfLogH->eventTime); ncs_enc_claim_space(uba, 16); total_bytes += 16; break; case SA_LOG_GENERIC_HEADER: genLogH = ¶m->logRecord->logHeader.genericHdr; p8 = ncs_enc_reserve_space(uba, 10); if (!p8) { TRACE("Could not reserve space"); return 0; } ncs_encode_32bit(&p8, 0); ncs_encode_16bit(&p8, 0); ncs_encode_16bit(&p8, 0); ncs_encode_16bit(&p8, param->logSvcUsrName->length); ncs_enc_claim_space(uba, 10); total_bytes += 10; ncs_encode_n_octets_in_uba(uba, (uint8_t *)param->logSvcUsrName->value, (uint32_t)param->logSvcUsrName->length); total_bytes += param->logSvcUsrName->length; p8 = ncs_enc_reserve_space(uba, 2); if (!p8) { TRACE("Could not reserve space"); return 0; } ncs_encode_16bit(&p8, genLogH->logSeverity); total_bytes += 2; break; default: TRACE("ERROR IN logHdrType in logRecord!!!"); break; } p8 = ncs_enc_reserve_space(uba, 4); if (!p8) { TRACE("Could not reserve space"); return 0; } if (param->logRecord->logBuffer == NULL) { ncs_encode_32bit(&p8, (uint32_t)0); } else { ncs_encode_32bit(&p8, (uint32_t)param->logRecord->logBuffer->logBufSize); } ncs_enc_claim_space(uba, 4); total_bytes += 4; if ((param->logRecord->logBuffer != NULL) && (param->logRecord->logBuffer->logBuf != NULL)) { ncs_encode_n_octets_in_uba(uba, param->logRecord->logBuffer->logBuf, (uint32_t)param->logRecord->logBuffer->logBufSize); total_bytes += (uint32_t)param->logRecord->logBuffer->logBufSize; } return total_bytes; }
/**************************************************************************** Name : eda_enc_publish_msg Description : This routine encodes a publish API msg Arguments : NCS_UBAID *msg, EDSV_MSG *msg Return Values : uint32_t Notes : None. ******************************************************************************/ static uint32_t eda_enc_publish_msg(NCS_UBAID *uba, EDSV_MSG *msg) { uint8_t *p8; uint32_t total_bytes = 0; uint32_t x; SaEvtEventPatternT *pattern_ptr; EDSV_EDA_PUBLISH_PARAM *param = &msg->info.api_info.param.publish; if (uba == NULL) { TRACE_4("uba is NULL"); return 0; } /** encode the contents **/ p8 = ncs_enc_reserve_space(uba, 20); if (!p8) { TRACE_4("reserve space failed"); } ncs_encode_32bit(&p8, param->reg_id); ncs_encode_32bit(&p8, param->chan_id); ncs_encode_32bit(&p8, param->chan_open_id); ncs_encode_64bit(&p8, param->pattern_array->patternsNumber); ncs_enc_claim_space(uba, 20); total_bytes += 20; /* Encode the patterns */ pattern_ptr = param->pattern_array->patterns; for (x = 0; x < (uint32_t)param->pattern_array->patternsNumber; x++) { /* Save room for the patternSize field (8 bytes) */ p8 = ncs_enc_reserve_space(uba, 8); if (!p8) { TRACE_4("reserve space failed"); } ncs_encode_64bit(&p8, pattern_ptr->patternSize); ncs_enc_claim_space(uba, 8); total_bytes += 8; /* For zero length patterns, fake encode zero */ if (pattern_ptr->patternSize == 0) { p8 = ncs_enc_reserve_space(uba, 4); if (!p8) { TRACE_4("reserve space failed"); } ncs_encode_32bit(&p8, 0); ncs_enc_claim_space(uba, 4); total_bytes += 4; } else { ncs_encode_n_octets_in_uba(uba, pattern_ptr->pattern, (uint32_t)pattern_ptr->patternSize); total_bytes += (uint32_t)pattern_ptr->patternSize; } pattern_ptr++; } p8 = ncs_enc_reserve_space(uba, 11); if (!p8) { TRACE_4("reserve space failed"); } ncs_encode_8bit(&p8, param->priority); ncs_encode_64bit(&p8, param->retention_time); ncs_encode_16bit(&p8, param->publisher_name.length); ncs_enc_claim_space(uba, 11); total_bytes += 11; ncs_encode_n_octets_in_uba(uba, param->publisher_name.value, (uint32_t)param->publisher_name.length); total_bytes += (uint32_t)param->publisher_name.length; p8 = ncs_enc_reserve_space(uba, 12); if (!p8) { TRACE_4("reserve space failed"); } ncs_encode_32bit(&p8, param->event_id); ncs_encode_64bit(&p8, param->data_len); ncs_enc_claim_space(uba, 12); total_bytes += 12; ncs_encode_n_octets_in_uba(uba, param->data, (uint32_t)param->data_len); total_bytes += (uint32_t)param->data_len; return total_bytes; }
/**************************************************************************** Name : cpa_mds_enc Description : This function encodes an events sent from CPA to remote CPND. Arguments : cb : CPA control Block. info : Info for encoding Return Values : NCSCC_RC_SUCCESS/NCSCC_RC_FAILURE Notes : None. ******************************************************************************/ static uint32_t cpa_mds_enc(CPA_CB *cb, MDS_CALLBACK_ENC_INFO *enc_info) { CPSV_EVT *pevt = NULL; EDU_ERR ederror = 0; NCS_UBAID *io_uba = enc_info->io_uba; uint32_t rc = NCSCC_RC_SUCCESS; uint8_t *pstream = NULL; TRACE_ENTER(); /* Get the Msg Format version from the SERVICE_ID & RMT_SVC_PVT_SUBPART_VERSION */ if (enc_info->i_to_svc_id == NCSMDS_SVC_ID_CPND) { /* This is special case to handle the 4.2 deployed node upgrade , the 4.2 has inconsistency between `enc_info->i_rem_svc_pvt_ver` ( CPND_MDS_PVT_SUBPART_VERSION /CPA_MDS_PVT_SUBPART_VERSION ) and `cpa_cpnd_msg_fmt_table` ( CPND_WRT_CPND_SUBPART_VER_RANGE / CPND_WRT_CPA_SUBPART_VER_RANGE) For all other up coming version `m_NCS_ENC_MSG_FMT_GET` logic works fine */ if (enc_info->i_rem_svc_pvt_ver <= 3) /* opensaf 4.2 CPND_MDS_PVT_SUBPART_VERSION was 3 but CPND_WRT_CPND_SUBPART_VER_RANGE was 2 */ enc_info->o_msg_fmt_ver = cpa_cpnd_msg_fmt_table[enc_info->i_rem_svc_pvt_ver - 2]; else /* m_NCS_ENC_MSG_FMT_GET call is equal to cpa_cpnd_msg_fmt_table[enc_info->i_rem_svc_pvt_ver - 1] */ enc_info->o_msg_fmt_ver = m_NCS_ENC_MSG_FMT_GET(enc_info->i_rem_svc_pvt_ver, CPA_WRT_CPND_SUBPART_VER_MIN, CPA_WRT_CPND_SUBPART_VER_MAX, cpa_cpnd_msg_fmt_table); } if (enc_info->o_msg_fmt_ver) { pevt = (CPSV_EVT *)enc_info->i_msg; if (pevt->type == CPSV_EVT_TYPE_CPND) { if (pevt->info.cpnd.type == CPND_EVT_A2ND_CKPT_WRITE) { pstream = ncs_enc_reserve_space(io_uba, 12); if (!pstream) return m_CPSV_DBG_SINK(NCSCC_RC_FAILURE, "Memory alloc failed in cpa_mds_enc \n"); ncs_encode_32bit(&pstream, pevt->type); /* CPSV_EVT Type */ ncs_encode_32bit(&pstream, pevt->info.cpnd.error); /* cpnd_evt error This is for backword compatible purpose with EDU enc/dec with 3.0.2 */ ncs_encode_32bit(&pstream, pevt->info.cpnd.type); /* cpnd_evt SubType */ ncs_enc_claim_space(io_uba, 12); rc = cpsv_ckpt_access_encode(&pevt->info.cpnd.info.ckpt_write, io_uba); TRACE_LEAVE(); return rc; } else if (pevt->info.cpnd.type == CPND_EVT_A2ND_CKPT_READ) { pstream = ncs_enc_reserve_space(io_uba, 12); if (!pstream) return m_CPSV_DBG_SINK(NCSCC_RC_FAILURE, "Memory alloc failed in cpa_mds_enc \n"); ncs_encode_32bit(&pstream, pevt->type); /* CPSV_EVT Type */ ncs_encode_32bit(&pstream, pevt->info.cpnd.error); /* cpnd_evt error This is for backword compatible purpose with EDU enc/dec with 3.0.2 */ ncs_encode_32bit(&pstream, pevt->info.cpnd.type); /* cpnd_evt SubType */ ncs_enc_claim_space(io_uba, 12); rc = cpsv_ckpt_access_encode(&pevt->info.cpnd.info.ckpt_read, io_uba); TRACE_LEAVE(); return rc; } else if(pevt->info.cpnd.type == CPND_EVT_A2ND_CKPT_REFCNTSET) { if(enc_info->o_msg_fmt_ver < 2) { TRACE_LEAVE(); return NCSCC_RC_FAILURE; } else { pstream = ncs_enc_reserve_space(io_uba, 12); if(!pstream) return m_CPSV_DBG_SINK(NCSCC_RC_FAILURE,"Memory alloc failed in cpa_mds_enc \n"); ncs_encode_32bit(&pstream , pevt->type); ncs_encode_32bit(&pstream , pevt->info.cpnd.error); ncs_encode_32bit(&pstream , pevt->info.cpnd.type); ncs_enc_claim_space(io_uba, 12); rc = cpsv_ref_cnt_encode(io_uba,&pevt->info.cpnd.info.refCntsetReq); TRACE_LEAVE(); return rc; } } } /* For all other cases call EDU othen than Write/Read API's */ rc = m_NCS_EDU_EXEC(&cb->edu_hdl, FUNC_NAME(CPSV_EVT), enc_info->io_uba, EDP_OP_TYPE_ENC, pevt, &ederror); TRACE_LEAVE(); return rc; } else { /* Drop The Message As Msg Fmt Version Not understandable */ TRACE_4("cpa api processing failed in mds_enc "); return NCSCC_RC_FAILURE; } }
/**************************************************************************** Name : cpa_mds_enc Description : This function encodes an events sent from CPA to remote CPND. Arguments : cb : CPA control Block. info : Info for encoding Return Values : NCSCC_RC_SUCCESS/NCSCC_RC_FAILURE Notes : None. ******************************************************************************/ static uns32 cpa_mds_enc(CPA_CB *cb, MDS_CALLBACK_ENC_INFO *enc_info) { CPSV_EVT *pevt = NULL; EDU_ERR ederror = 0; NCS_UBAID *io_uba = enc_info->io_uba; uns32 rc = NCSCC_RC_SUCCESS; uns8 *pstream = NULL; /* Get the Msg Format version from the SERVICE_ID & RMT_SVC_PVT_SUBPART_VERSION */ if (enc_info->i_to_svc_id == NCSMDS_SVC_ID_CPND) { enc_info->o_msg_fmt_ver = m_NCS_ENC_MSG_FMT_GET(enc_info->i_rem_svc_pvt_ver, CPA_WRT_CPND_SUBPART_VER_MIN, CPA_WRT_CPND_SUBPART_VER_MAX, cpa_cpnd_msg_fmt_table); } if (enc_info->o_msg_fmt_ver) { pevt = (CPSV_EVT *)enc_info->i_msg; if (pevt->type == CPSV_EVT_TYPE_CPND) { if (pevt->info.cpnd.type == CPND_EVT_A2ND_CKPT_WRITE) { pstream = ncs_enc_reserve_space(io_uba, 12); if (!pstream) return m_CPSV_DBG_SINK(NCSCC_RC_FAILURE, "Memory alloc failed in cpa_mds_enc \n"); ncs_encode_32bit(&pstream, pevt->type); /* CPSV_EVT Type */ ncs_encode_32bit(&pstream, pevt->info.cpnd.error); /* cpnd_evt error This is for backword compatible purpose with EDU enc/dec with 3.0.2 */ ncs_encode_32bit(&pstream, pevt->info.cpnd.type); /* cpnd_evt SubType */ ncs_enc_claim_space(io_uba, 12); rc = cpsv_ckpt_access_encode(&pevt->info.cpnd.info.ckpt_write, io_uba); return rc; } else if (pevt->info.cpnd.type == CPND_EVT_A2ND_CKPT_READ) { pstream = ncs_enc_reserve_space(io_uba, 12); if (!pstream) return m_CPSV_DBG_SINK(NCSCC_RC_FAILURE, "Memory alloc failed in cpa_mds_enc \n"); ncs_encode_32bit(&pstream, pevt->type); /* CPSV_EVT Type */ ncs_encode_32bit(&pstream, pevt->info.cpnd.error); /* cpnd_evt error This is for backword compatible purpose with EDU enc/dec with 3.0.2 */ ncs_encode_32bit(&pstream, pevt->info.cpnd.type); /* cpnd_evt SubType */ ncs_enc_claim_space(io_uba, 12); rc = cpsv_ckpt_access_encode(&pevt->info.cpnd.info.ckpt_read, io_uba); return rc; } else if(pevt->info.cpnd.type == CPND_EVT_A2ND_CKPT_REFCNTSET) { if(enc_info->o_msg_fmt_ver < 2) return NCSCC_RC_FAILURE; else { pstream = ncs_enc_reserve_space(io_uba, 12); if(!pstream) return m_CPSV_DBG_SINK(NCSCC_RC_FAILURE,"Memory alloc failed in cpa_mds_enc \n"); ncs_encode_32bit(&pstream , pevt->type); ncs_encode_32bit(&pstream , pevt->info.cpnd.error); ncs_encode_32bit(&pstream , pevt->info.cpnd.type); ncs_enc_claim_space(io_uba, 12); rc = cpsv_ref_cnt_encode(io_uba,&pevt->info.cpnd.info.refCntsetReq); return rc; } } } /* For all other cases call EDU othen than Write/Read API's */ rc = m_NCS_EDU_EXEC(&cb->edu_hdl, FUNC_NAME(CPSV_EVT), enc_info->io_uba, EDP_OP_TYPE_ENC, pevt, &ederror); return rc; } else { /* Drop The Message As Msg Fmt Version Not understandable */ m_LOG_CPA_CCL(CPA_PROC_FAILED, NCSFL_LC_CKPT_MGMT, NCSFL_SEV_ERROR, "mds_enc", __FILE__, __LINE__); return NCSCC_RC_FAILURE; } }
/**************************************************************************** Name : lga_mds_enc Description : This is a callback routine that is invoked to encode LGS messages. Arguments : pointer to struct ncsmds_callback_info Return Values : NCSCC_RC_SUCCESS/NCSCC_RC_FAILURE Notes : None. ******************************************************************************/ static uint32_t lga_mds_enc(struct ncsmds_callback_info *info) { lgsv_msg_t *msg; NCS_UBAID *uba; uint8_t *p8; uint32_t total_bytes = 0; MDS_CLIENT_MSG_FORMAT_VER msg_fmt_version; TRACE_ENTER(); msg_fmt_version = m_NCS_ENC_MSG_FMT_GET(info->info.enc.i_rem_svc_pvt_ver, LGA_WRT_LGS_SUBPART_VER_AT_MIN_MSG_FMT, LGA_WRT_LGS_SUBPART_VER_AT_MAX_MSG_FMT, LGA_WRT_LGS_MSG_FMT_ARRAY); if (0 == msg_fmt_version) { TRACE("Wrong msg_fmt_version!!\n"); TRACE_LEAVE(); return NCSCC_RC_FAILURE; } info->info.enc.o_msg_fmt_ver = msg_fmt_version; msg = (lgsv_msg_t *)info->info.enc.i_msg; uba = info->info.enc.io_uba; if (uba == NULL) { TRACE("uba=NULL"); TRACE_LEAVE(); return NCSCC_RC_FAILURE; } /** encode the type of message **/ p8 = ncs_enc_reserve_space(uba, 4); if (!p8) { TRACE("NULL pointer"); TRACE_LEAVE(); return NCSCC_RC_FAILURE; } ncs_encode_32bit(&p8, msg->type); ncs_enc_claim_space(uba, 4); total_bytes += 4; TRACE_2("msgtype: %d", msg->type); if (LGSV_LGA_API_MSG == msg->type) { /** encode the API msg subtype **/ p8 = ncs_enc_reserve_space(uba, 4); if (!p8) { TRACE("encode API msg subtype FAILED"); TRACE_LEAVE(); /* fixme: ok to do return fail?? */ return NCSCC_RC_FAILURE; } ncs_encode_32bit(&p8, msg->info.api_info.type); ncs_enc_claim_space(uba, 4); total_bytes += 4; TRACE_2("api_info.type: %d\n", msg->info.api_info.type); switch (msg->info.api_info.type) { case LGSV_INITIALIZE_REQ: total_bytes += lga_enc_initialize_msg(uba, msg); break; case LGSV_FINALIZE_REQ: total_bytes += lga_enc_finalize_msg(uba, msg); break; case LGSV_STREAM_OPEN_REQ: total_bytes += lga_enc_lstr_open_sync_msg(uba, msg); break; case LGSV_STREAM_CLOSE_REQ: total_bytes += lga_enc_lstr_close_msg(uba, msg); break; case LGSV_WRITE_LOG_ASYNC_REQ: total_bytes += lga_enc_write_log_async_msg(uba, msg); break; default: TRACE("Unknown API type = %d", msg->info.api_info.type); break; } } TRACE_LEAVE(); return NCSCC_RC_SUCCESS; }
/******************************************************************************************* * Name : glsv_gld_mbcsv_enc_async_update * * Description : To encode the data and to send it to Standby at the time of Async Update * Arguments : NCS_MBCSV_CB_ARG - MBCSv callback Argument * * Return Values : Success / Error * Notes : from io_reo_type - the event is determined and based on the event we encode the MBCSv_MSG This is called at the active side *******************************************************************************************/ static uint32_t glsv_gld_mbcsv_enc_async_update(GLSV_GLD_CB *gld_cb, NCS_MBCSV_CB_ARG *arg) { GLSV_GLD_A2S_CKPT_EVT *a2s_msg; uint32_t rc = NCSCC_RC_SUCCESS; EDU_ERR ederror = 0; uint8_t *gld_type_ptr = NULL; TRACE_ENTER(); /* Increment the async update count gld_cb->gld_async_cnt */ gld_cb->gld_async_cnt++; gld_type_ptr = ncs_enc_reserve_space(&arg->info.encode.io_uba, sizeof(uint8_t)); if (gld_type_ptr == NULL) { LOG_CR("GLD enc reserve space failed:Error %s", strerror(errno)); assert(0); } ncs_enc_claim_space(&arg->info.encode.io_uba, sizeof(uint8_t)); ncs_encode_8bit(&gld_type_ptr, arg->info.encode.io_reo_type); switch (arg->info.encode.io_reo_type) { case GLSV_GLD_EVT_RSC_OPEN: a2s_msg = (GLSV_GLD_A2S_CKPT_EVT *)NCS_INT64_TO_PTR_CAST(arg->info.encode.io_reo_hdl); rc = m_NCS_EDU_EXEC(&gld_cb->edu_hdl, glsv_edp_gld_a2s_evt_rsc_open_info, &arg->info.encode.io_uba, EDP_OP_TYPE_ENC, &a2s_msg->info.rsc_open_info, &ederror); if (rc != NCSCC_RC_SUCCESS) { LOG_ER("EDU exec async rsc open evt failed"); rc = NCSCC_RC_FAILURE; } break; case GLSV_GLD_EVT_RSC_CLOSE: a2s_msg = (GLSV_GLD_A2S_CKPT_EVT *)NCS_INT64_TO_PTR_CAST(arg->info.encode.io_reo_hdl); rc = m_NCS_EDU_EXEC(&gld_cb->edu_hdl, glsv_edp_gld_a2s_evt_rsc_details, &arg->info.encode.io_uba, EDP_OP_TYPE_ENC, &a2s_msg->info.rsc_details, &ederror); if (rc != NCSCC_RC_SUCCESS) { LOG_ER("EDU exec async rsc close evt failed"); rc = NCSCC_RC_FAILURE; } break; case GLSV_GLD_EVT_SET_ORPHAN: a2s_msg = (GLSV_GLD_A2S_CKPT_EVT *)NCS_INT64_TO_PTR_CAST(arg->info.encode.io_reo_hdl); rc = m_NCS_EDU_EXEC(&gld_cb->edu_hdl, glsv_edp_gld_a2s_evt_rsc_details, &arg->info.encode.io_uba, EDP_OP_TYPE_ENC, &a2s_msg->info.rsc_details, &ederror); if (rc != NCSCC_RC_SUCCESS) { LOG_ER("EDU exec async set orphan evt failed"); rc = NCSCC_RC_FAILURE; } break; case GLSV_GLD_EVT_GLND_DOWN: case GLSV_GLD_EVT_GLND_OPERATIONAL: a2s_msg = (GLSV_GLD_A2S_CKPT_EVT *)NCS_INT64_TO_PTR_CAST(arg->info.encode.io_reo_hdl); rc = m_NCS_EDU_EXEC(&gld_cb->edu_hdl, glsv_edp_gld_a2s_evt_glnd_mds_info, &arg->info.encode.io_uba, EDP_OP_TYPE_ENC, &a2s_msg->info.glnd_mds_info, &ederror); if (rc != NCSCC_RC_SUCCESS) { LOG_ER("EDU exec async glnd down evt failed"); rc = NCSCC_RC_FAILURE; } break; default: rc = NCSCC_RC_FAILURE; goto end; } end: TRACE_LEAVE(); return rc; }