00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020 #include "C_SetNewSessionIdAction.hpp"
00021 #include "GeneratorTrace.hpp"
00022 #include "GeneratorError.h"
00023 #include "C_CallControl.hpp"
00024
00025 C_SetNewSessionIdAction::C_SetNewSessionIdAction(T_CmdAction P_cmdAction,
00026 T_pControllers P_controllers)
00027 : C_CommandAction (P_cmdAction, P_controllers) {
00028 }
00029
00030 C_SetNewSessionIdAction::~C_SetNewSessionIdAction() {
00031 }
00032
00033
00034 T_exeCode C_SetNewSessionIdAction::execute(T_pCmd_scenario P_pCmd,
00035 T_pCallContext P_callCtxt,
00036 C_MessageFrame *P_msg,
00037 C_MessageFrame *P_ref) {
00038
00039 T_exeCode L_exeCode = E_EXE_NOERROR ;
00040
00041 T_pValueData L_mem ;
00042 T_ValueData L_val ;
00043
00044 T_CallMap::iterator L_call_it ;
00045 T_pValueData L_value_id ;
00046
00047 T_pCallMap *L_map = P_callCtxt->m_call_control->get_call_map();
00048
00049 L_val.m_type = E_TYPE_NUMBER ;
00050
00051 L_mem = P_callCtxt->get_memory(m_mem_id);
00052
00053 if (P_msg -> get_field_value(m_id,
00054 m_instance_id,
00055 m_sub_id,
00056 &L_val) == true) {
00057 if (*L_mem == L_val ) {
00058
00059 } else {
00060 L_call_it = L_map[P_pCmd->m_channel_id]
00061 ->find (T_CallMap::key_type(P_callCtxt->m_id_table[P_pCmd->m_channel_id]));
00062 if (L_call_it != L_map[P_pCmd->m_channel_id]->end()) {
00063 L_map[P_pCmd->m_channel_id]->erase (L_call_it);
00064 P_callCtxt->reset_id (P_pCmd->m_channel_id);
00065 L_value_id = P_callCtxt->set_id (P_pCmd->m_channel_id,L_mem);
00066 L_map[P_pCmd->m_channel_id]
00067 ->insert(T_CallMap::value_type(*L_value_id, P_callCtxt));
00068
00069 }
00070 }
00071 resetMemory(L_val);
00072 } else {
00073 GEN_LOG_EVENT(LOG_LEVEL_TRAFFIC_ERR,
00074 action_name_table[m_type]
00075 << ": the value of the field asked is incorrect or not found");
00076
00077 GEN_LOG_EVENT(LOG_LEVEL_TRAFFIC_ERR,
00078 "error on call with session-id ["
00079 << P_callCtxt->m_id_table[P_pCmd->m_channel_id] << "]");
00080
00081 L_exeCode = E_EXE_ERROR;
00082 }
00083
00084
00085 return (L_exeCode);
00086 }
00087
00088
00089
00090
00091