adding subtract rsp code (got deleted by mistake)

This commit is contained in:
David Yat Sin 2012-07-02 04:43:21 -04:00
parent e2e3a5c34e
commit 5ec258b388
3 changed files with 66 additions and 5 deletions

View File

@ -647,3 +647,62 @@ switch_status_t mg_send_modify_rsp(SuId suId, MgMgcoCommand *req)
} }
/*****************************************************************************************************************************/ /*****************************************************************************************************************************/
/*****************************************************************************************************************************/
switch_status_t mg_send_subtract_rsp(SuId suId, MgMgcoCommand *req)
{
MgMgcoCommand cmd;
int ret = 0x00;
MgMgcoTermId *termId;
MgMgcoCtxt ctxt;
memset(&cmd,0, sizeof(cmd));
/*copy transaction-id*/
memcpy(&cmd.transId, &req->transId,sizeof(MgMgcoTransId));
/*copy context-id*/ /*TODO - in case of $ context should be generated by app, we should not simply copy incoming structure */
memcpy(&cmd.contextId, &req->contextId,sizeof(MgMgcoContextId));
/*copy peer identifier */
memcpy(&cmd.peerId, &req->peerId,sizeof(TknU32));
/*fill response structue */
if(SWITCH_STATUS_FALSE == (ret = mg_stack_alloc_mem((Ptr*)&cmd.u.mgCmdRsp[0],sizeof(MgMgcoCmdReply)))){
return ret;
}
cmd.u.mgCmdRsp[0]->pres.pres = PRSNT_NODEF;
cmd.u.mgCmdRsp[0]->type.pres = PRSNT_NODEF;
cmd.u.mgCmdRsp[0]->type.val = MGT_SUB;
cmd.u.mgCmdRsp[0]->u.sub.pres.pres = PRSNT_NODEF;
cmd.u.mgCmdRsp[0]->u.sub.termIdLst.num.pres = PRSNT_NODEF;
cmd.u.mgCmdRsp[0]->u.sub.termIdLst.num.val = 1;
mgUtlAllocMgMgcoTermIdLst(&cmd.u.mgCmdRsp[0]->u.sub.termIdLst, &req->u.mgCmdReq[0]->cmd.u.sub.termIdLst);
#ifdef GCP_VER_2_1
termId = cmd.u.mgCmdRsp[0]->u.sub.termIdLst.terms[0];
#else
termId = &(cmd.u.mgCmdRsp[0]->u.sub.termId);
#endif
mg_fill_mgco_termid(termId, (CONSTANT U8*)"term1",&req->u.mgCmdRsp[0]->memCp);
/* We will always send one command at a time..*/
cmd.cmdStatus.pres = PRSNT_NODEF;
cmd.cmdStatus.val = CH_CMD_STATUS_END_OF_CMD;
cmd.cmdType.pres = PRSNT_NODEF;
cmd.cmdType.val = CH_CMD_TYPE_RSP;
ret = sng_mgco_send_cmd(suId, &cmd);
memcpy(&ctxt.transId,&req->transId,sizeof(MgMgcoTransId));
memcpy(&ctxt.cntxtId, &req->contextId,sizeof(MgMgcoContextId));
memcpy(&ctxt.peerId, &req->peerId,sizeof(TknU32));
ctxt.cmdStatus.pres = PRSNT_NODEF;
ctxt.cmdStatus.val = CH_CMD_STATUS_END_OF_AXN;
ret = sng_mgco_send_axn_req(suId, &ctxt);
return ret;
}

View File

@ -132,6 +132,7 @@ switch_status_t mg_send_audit_rsp(SuId suId, MgMgcoCommand *req);
switch_status_t handle_mg_audit_cmd(SuId suId, MgMgcoCommand *auditReq); switch_status_t handle_mg_audit_cmd(SuId suId, MgMgcoCommand *auditReq);
switch_status_t mg_send_modify_rsp(SuId suId, MgMgcoCommand *req); switch_status_t mg_send_modify_rsp(SuId suId, MgMgcoCommand *req);
switch_status_t mg_send_subtract_rsp(SuId suId, MgMgcoCommand *req);
void mg_util_set_term_string ( MgStr *errTxt, MgMgcoTermId *termId); void mg_util_set_term_string ( MgStr *errTxt, MgMgcoTermId *termId);
MgMgcoTermIdLst *mg_get_term_id_list(MgMgcoCommand *cmd); MgMgcoTermIdLst *mg_get_term_id_list(MgMgcoCommand *cmd);
switch_status_t handle_pkg_audit( SuId suId, MgMgcoCommand *auditReq); switch_status_t handle_pkg_audit( SuId suId, MgMgcoCommand *auditReq);

View File

@ -182,7 +182,7 @@ void handle_mgco_txn_ind(Pst *pst, SuId suId, MgMgcoMsg* msg)
case MGT_TXNREQ: case MGT_TXNREQ:
{ {
MgMgcoTxnReq* txnReq; MgMgcoTxnReq* txnReq;
MgMgcoTransId transId; /* XXX */ /*MgMgcoTransId transId; *//* XXX */
int axnIter; int axnIter;
txnReq = &(msg->body.u.tl.txns[txnIter]->u.req); txnReq = &(msg->body.u.tl.txns[txnIter]->u.req);
@ -207,14 +207,13 @@ void handle_mgco_txn_ind(Pst *pst, SuId suId, MgMgcoMsg* msg)
MgMgcoCommand mgCmd; MgMgcoCommand mgCmd;
memset(&mgCmd, 0, sizeof(mgCmd)); memset(&mgCmd, 0, sizeof(mgCmd));
mgCmd.peerId = msg->lcl.id; mgCmd.peerId = msg->lcl.id;
mgCmd.transId = transId;
mgCmd.u.mgCmdInd[0] = cmdReq; mgCmd.u.mgCmdInd[0] = cmdReq;
/* XXX Handle choose context before this */ /* XXX Handle choose context before this */
mgCmd.contextId = ctxId; mgCmd.contextId = ctxId;
mgCmd.transId = transId; /*mgCmd.transId = transId;*/
mgCmd.cmdStatus.pres = PRSNT_NODEF; mgCmd.cmdStatus.pres = PRSNT_NODEF;
@ -353,7 +352,7 @@ void handle_mgco_txn_ind(Pst *pst, SuId suId, MgMgcoMsg* msg)
/*****************************************************************************************************************************/ /*****************************************************************************************************************************/
void handle_mgco_cmd_ind(Pst *pst, SuId suId, MgMgcoCommand* cmd) void handle_mgco_cmd_ind(Pst *pst, SuId suId, MgMgcoCommand* cmd)
{ {
uint32_t txn_id = 0x00; U32 txn_id = 0x00;
MgMgcoInd *mgErr; MgMgcoInd *mgErr;
MgStr errTxt; MgStr errTxt;
MgMgcoContextId ctxtId; MgMgcoContextId ctxtId;
@ -373,7 +372,7 @@ void handle_mgco_cmd_ind(Pst *pst, SuId suId, MgMgcoCommand* cmd)
ctxtId.type.pres = NOTPRSNT; ctxtId.type.pres = NOTPRSNT;
ctxtId.val.pres = NOTPRSNT; ctxtId.val.pres = NOTPRSNT;
mg_util_set_txn_string(&errTxt, (U32*)&txn_id); mg_util_set_txn_string(&errTxt, &txn_id);
if (SWITCH_STATUS_SUCCESS == mg_build_mgco_err_request(&mgErr, txn_id, &ctxtId, if (SWITCH_STATUS_SUCCESS == mg_build_mgco_err_request(&mgErr, txn_id, &ctxtId,
MGT_MGCO_RSP_CODE_INVLD_IDENTIFIER, &errTxt)) { MGT_MGCO_RSP_CODE_INVLD_IDENTIFIER, &errTxt)) {
@ -427,6 +426,8 @@ void handle_mgco_cmd_ind(Pst *pst, SuId suId, MgMgcoCommand* cmd)
case MGT_SUB: case MGT_SUB:
{ {
/*MgMgcoSubAudReq *addReq = &cmdReq->cmd.u.sub;*/ /*MgMgcoSubAudReq *addReq = &cmdReq->cmd.u.sub;*/
mg_send_subtract_rsp(suId, cmd);
break;
} }
case MGT_SVCCHG: case MGT_SVCCHG:
{ {