Main Page   Class Hierarchy   Compound List   File List   Compound Members  

C_StoreAction.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_StoreAction.hpp"
00021 #include "GeneratorTrace.hpp"
00022 #include "GeneratorError.h"
00023 
00024 C_StoreAction::C_StoreAction(T_CmdAction        P_cmdAction,
00025                              T_pControllers P_controllers)
00026   : C_CommandAction (P_cmdAction, P_controllers) {
00027 }
00028 
00029 C_StoreAction::~C_StoreAction() {
00030 }
00031 
00032 
00033 T_exeCode    C_StoreAction::execute(T_pCmd_scenario P_pCmd,
00034                                     T_pCallContext  P_callCtxt,
00035                                     C_MessageFrame *P_msg,
00036                                     C_MessageFrame *P_ref) {
00037 
00038   T_exeCode           L_exeCode    = E_EXE_NOERROR ;
00039   
00040   T_pValueData L_mem = NULL ;
00041   int            L_size ;
00042   
00043   P_callCtxt->reset_memory(m_mem_id) ;
00044   
00045   GEN_DEBUG(2, "store memory id = " << m_mem_id);
00046   GEN_DEBUG(2, "store field id = " << m_id);
00047   
00048   L_mem = P_callCtxt->get_memory(m_mem_id);
00049   
00050   L_size = m_size ;
00051   
00052   if (L_size != -1) {
00053     // string or binary type
00054     T_ValueData L_val ;
00055     L_val.m_type = E_TYPE_NUMBER ;
00056     
00057     
00058     if (P_msg -> get_field_value(m_id, 
00059                                  m_instance_id,
00060                                  m_sub_id,
00061                                  &L_val) == true) {
00062       
00063       if (L_size > ((int)L_val.m_value.m_val_binary.m_size-m_begin)) {
00064         
00065         GEN_LOG_EVENT(LOG_LEVEL_TRAFFIC_ERR, 
00066                       action_name_table[m_type] 
00067                       << ": the size desired  ["
00068                       << L_size << "] exceed the length of buffer ["
00069                       << (L_val.m_value.m_val_binary.m_size - m_begin) << "]");
00070         
00071         GEN_LOG_EVENT(LOG_LEVEL_TRAFFIC_ERR, 
00072                       "error on call with session-id ["
00073                       << P_callCtxt->m_id_table[P_pCmd->m_channel_id] << "]");
00074         
00075         resetMemory(L_val);
00076         L_exeCode = E_EXE_ERROR;
00077       } else {
00078         L_mem->m_value.m_val_binary.m_size = L_size ;
00079         L_mem->m_type = L_val.m_type ;
00080         
00081         ALLOC_TABLE(L_mem->m_value.m_val_binary.m_value,
00082                     unsigned char*,
00083                     sizeof(unsigned char),
00084                     L_size);
00085         
00086         extractBinaryVal(*L_mem, m_begin, L_size,
00087                          L_val);
00088         
00089         resetMemory(L_val);
00090       }
00091     } else {
00092       GEN_LOG_EVENT(LOG_LEVEL_TRAFFIC_ERR, 
00093                     action_name_table[m_type] 
00094                     << ": the value of the field asked is incorrect or not found");
00095       
00096       GEN_LOG_EVENT(LOG_LEVEL_TRAFFIC_ERR, 
00097                     "error on call with session-id ["
00098                     << P_callCtxt->m_id_table[P_pCmd->m_channel_id] << "]");
00099       
00100       L_exeCode = E_EXE_ERROR;
00101     }
00102   } else {
00103     
00104     if (m_regexp_data != NULL) {
00105       if (P_msg -> get_field_value(m_id, 
00106                                    m_regexp_data,
00107                                    L_mem) == false) {
00108         
00109         GEN_LOG_EVENT(LOG_LEVEL_TRAFFIC_ERR, 
00110                       action_name_table[m_type] 
00111                       << ": the value of the field asked is incorrect or not found");
00112         
00113         GEN_LOG_EVENT(LOG_LEVEL_TRAFFIC_ERR, 
00114                       "error on call with session-id ["
00115                       << P_callCtxt->m_id_table[P_pCmd->m_channel_id] << "]");
00116         
00117         L_exeCode = E_EXE_ERROR;
00118       }
00119     } else {
00120       if (P_msg -> get_field_value(m_id, 
00121                                    m_instance_id,
00122                                    m_sub_id,
00123                                    L_mem) == false) {
00124         
00125         GEN_LOG_EVENT(LOG_LEVEL_TRAFFIC_ERR, 
00126                       action_name_table[m_type] 
00127                       << ": the value of the field asked is incorrect or not found");
00128         
00129         GEN_LOG_EVENT(LOG_LEVEL_TRAFFIC_ERR, 
00130                       "error on call with session-id ["
00131                       << P_callCtxt->m_id_table[P_pCmd->m_channel_id] << "]");
00132         
00133         L_exeCode = E_EXE_ERROR;
00134       }
00135     }
00136     
00137   }
00138   return (L_exeCode);
00139 }
00140 
00141 
00142 
00143 
00144 

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