Main Page   Class Hierarchy   Compound List   File List   Compound Members  

C_CallContext.hpp

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 #ifndef _C_CALL_CONTEXT
00021 #define _C_CALL_CONTEXT
00022 
00023 #include "map_t.hpp"
00024 
00025 #include "ProtocolData.hpp"
00026 #include "C_MessageFrame.hpp"
00027 #include "ReceiveMsgContext.h"
00028 #include "C_ContextFrame.hpp"
00029 
00030 class C_Scenario ; // prevent from circular include 
00031                    // => C_Scenario.hpp only in .cpp
00032 
00033 class C_CallControl ; 
00034 
00035 typedef long T_CallContextState, *T_pCallContextState ;
00036 #define E_CTXT_AVAILABLE    0L
00037 #define E_CTXT_SUSPEND      1L
00038 #define E_CTXT_RECEIVE      2L
00039 #define E_CTXT_SEND         3L
00040 #define E_CTXT_WAIT         4L
00041 #define E_CTXT_NBSTATE      5L
00042 #define E_CTXT_ERROR       -1L
00043 
00044 class C_CallContext : public C_ContextFrame {
00045 public:
00046 
00047   typedef struct _retrans_context {
00048     C_CallContext * m_context             ;
00049     int             m_retrans_index       ; // id table internal 
00050     int             m_retrans_delay_index ; // delay value index
00051   } T_retransContext, *T_pRetransContext ;
00052 
00053   typedef list_t<T_retransContext> 
00054   T_retransContextList, *T_pRetransContextList;
00055 
00056   typedef struct _retrans_data {
00057     T_retransContextList::iterator m_iterator ;
00058     int                            m_index    ;
00059   } T_retransData, *T_pRetransData ;
00060 
00061   typedef list_t <T_retransData> T_retransDataList, *T_pRetransDataList ;
00062 
00063 
00064   // TEMPORARY
00065   bool                      m_created_call  ;
00066   // TEMPORARY
00067   struct timeval            m_current_time  ;
00068   struct timeval            m_start_time    ;
00069 
00070   int                       m_suspend_id    ;
00071   C_MessageFrame           *m_suspend_msg   ;
00072   int                       m_channel_id    ;
00073   
00074   C_MessageFrame           **m_retrans_msg     ;
00075   struct timeval            *m_retrans_time    ;
00076   int                       *m_nb_retrans_done ;
00077   int                       *m_retrans_cmd_idx ;
00078   int                        m_nb_retrans      ;
00079 
00080   T_retransContextList::iterator *m_retrans_it;
00081   bool                           *m_retrans_it_available ;
00082 
00083   T_retransContext          m_retrans_context ;
00084   bool                      m_retrans_to_do ;
00085 
00086   T_pValueData              m_id_table ;
00087 
00088   int                      *m_channel_table ; // response channel table
00089   int                       m_selected_line;
00090 
00091   int                       m_channel_received ;
00092   
00093   C_CallControl*            m_call_control ;
00094 
00095 
00096   C_CallContext(C_CallControl *P_call_control, 
00097                 int P_id, int P_nbChannel, int P_mem=0, int P_nbRetrans=0);
00098   ~C_CallContext() ;
00099 
00100   T_pValueData 
00101   set_id(int P_channel_id, T_pValueData P_val) ;
00102 
00103   static int m_nb_channel ;
00104 
00105   void init()  ;
00106   void reset() ;
00107   void reset_id(int P_channel_id) ;
00108 
00109 
00110   T_CallContextState init_state (C_Scenario *P_scen);
00111   T_CallContextState init_state (C_Scenario *P_scen, struct timeval *P_time);
00112   void               init_state (C_Scenario *P_scen, T_pReceiveMsgContext P_rcvCtxt);
00113   bool               msg_received (T_pReceiveMsgContext P_rcvCtxt);
00114 
00115   bool state_receive() ;
00116   void next_cmd () ;
00117   void switch_to_scenario (C_Scenario *P_scen);
00118 
00119 
00120   T_pValueData get_memory(int P_id) ;
00121   void                     reset_memory(int P_id);
00122 
00123   T_CallContextState get_state() ;
00124   void               set_state(T_CallContextState P_state);
00125 
00126   C_Scenario*        get_scenario();
00127   void               set_scenario(C_Scenario *P_scen);
00128 
00129   C_MessageFrame*    get_msg_received();
00130   void               set_msg_received(C_MessageFrame *P_msg);
00131 
00132   int                get_current_cmd_idx();
00133 
00134   int                get_internal_id ();
00135 
00136   void               clean_suspended () ;
00137   void               clean_retrans () ;
00138 
00139 private:
00140 
00141   int                       m_internal_call_id ;
00142   T_CallContextState        m_state ;
00143   C_Scenario               *m_scenario ;
00144   C_MessageFrame           *m_msg_received ;
00145   int                       m_current_cmd_idx ;
00146   T_pValueData              m_memory_table ;
00147   int                       m_nb_mem ;
00148 
00149   void reset_id() ;
00150 
00151 } ;
00152 
00153 typedef C_CallContext* T_pCallContext ;
00154 
00155 typedef map_t<T_ValueData,
00156               T_pCallContext> T_CallMap, *T_pCallMap ;
00157 
00158 #endif // _C_CALL_CONTEXT

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