Main Page   Class Hierarchy   Compound List   File List   Compound Members  

C_SetNewSessionIdAction.cpp

00001 /*
00002  *  This program is free software; you can redistribute it and/or modify
00003  *  it under the terms of the GNU General Public License as published by
00004  *  the Free Software Foundation; either version 2 of the License, or
00005  *  (at your option) any later version.
00006  *
00007  *  This program is distributed in the hope that it will be useful,
00008  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
00009  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00010  *  GNU General Public License for more details.
00011  *
00012  *  You should have received a copy of the GNU General Public License
00013  *  along with this program; if not, write to the Free Software
00014  *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
00015  *
00016  * (c)Copyright 2006 Hewlett-Packard Development Company, LP.
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       //break;
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         // resetMemory(L_val);
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 

Generated on Wed Mar 7 14:44:58 2007 for Seagull by doxygen1.2.14 written by Dimitri van Heesch, © 1997-2002