00001 
00002 
00003 
00004 
00005 
00006 
00007 
00008 
00009 
00010 
00011 
00012 
00013 
00014 
00015 
00016 
00017 
00018 
00019 
00020 #ifndef _C_MESSAGE_TEXT_H
00021 #define _C_MESSAGE_TEXT_H
00022 
00023 
00024 #include "C_GeneratorConfig.hpp"
00025 #include "C_MessageFrame.hpp"
00026 #include "iostream_t.hpp"
00027 #include "C_ProtocolTextFrame.hpp"
00028 
00029 
00030 #include "TextDef.hpp"
00031 
00032 class C_ProtocolText ;
00033 
00034 class C_MessageText : public C_MessageFrame {
00035 public:
00036 
00037   C_MessageText (C_ProtocolText *P_protocol);
00038   C_MessageText(C_ProtocolText *P_protocol,
00039                 T_pValueData    P_header,
00040                 T_pValueData    P_body,
00041                 int            *P_id)  ;
00042   virtual ~C_MessageText ();
00043 
00044   C_MessageText(C_MessageText &P_val) ;
00045   
00046 
00047   T_pValueData get_session_id (C_ContextFrame *P_ctxt) ;
00048   T_pValueData get_out_of_session_id () ;
00049   bool         update_fields (C_MessageFrame *P_ref) ;
00050   bool         compare_types (C_MessageFrame *P_ref) ;
00051 
00052   void         update_message_stats () ;
00053   bool         check (C_MessageFrame    *P_ref,
00054                                 unsigned int       P_levelMask,
00055                                 T_CheckBehaviour   P_behave) ;
00056   
00057 
00058   bool         check_field_presence (int              P_id,
00059                                      T_CheckBehaviour P_behave,
00060                                      int P_instance,
00061                                      int P_sub_id) ;
00062   
00063   bool         check_field_value (C_MessageFrame  *P_ref,
00064                                   int              P_id,
00065                                   T_CheckBehaviour P_behave,
00066                                   int P_instance,
00067                                   int P_sub_id) ;
00068 
00069   bool         check_field_order (int              P_id,
00070                                   T_CheckBehaviour P_behave,
00071                                   int              P_position) ;
00072 
00073 
00074   T_TypeType   get_field_type  (int P_id,
00075                                 int P_sub_id) ;
00076 
00077 
00078 
00079   bool         get_field_value (int P_id, 
00080                                 C_RegExp *P_reg,
00081                                 T_pValueData P_value) ;
00082 
00083   bool         get_field_value (int P_id, 
00084                                 int P_instance,
00085                                 int P_sub_id,
00086                                 T_pValueData P_value) ;
00087 
00088   int          get_buffer (T_pValueData P_dest,
00089                            T_MessagePartType P_header_body_type) ;
00090 
00091 
00092   bool         set_field_value (T_pValueData P_value, 
00093                                 int P_id,
00094                                 int P_instance,
00095                                 int P_sub_id) ;
00096 
00097 
00098   char*        name() ;
00099 
00100   friend iostream_output& operator<< (iostream_output&, C_MessageText &);
00101   void         dump(iostream_output&) ;
00102 
00103   int          get_id_message() ;
00104   void         set_id_message(int P_id) ;
00105 
00106   char*        get_text_value(bool P_header_body);  
00107   int          set_text_value(bool P_header_body, T_pValueData P_value, 
00108                               int P_start, int P_end);  
00109 
00110   T_pValueData get_data_value(bool P_header_body);  
00111 
00112   C_ProtocolFrame::T_MsgError encode(unsigned char *P_buf,
00113                                      size_t        *P_siz);
00114   
00115   unsigned long decode(unsigned char *P_buf,
00116                        size_t         P_siz,
00117                        C_ProtocolFrame::T_pMsgError P_error) ;
00118   
00119 
00120   
00121   
00122 
00123 
00124 
00125 
00126 
00127 
00128   
00129 
00130   C_ProtocolFrame::T_MsgError DecodeBodyWithContentLength (int P_index, 
00131                                                            char *P_ptr, size_t *P_size);
00132 
00133   C_ProtocolFrame::T_MsgError DecodeBodyWithParser (int P_index,
00134                                                     char *P_ptr,
00135                                                     size_t *P_size) ;
00136 
00137 
00138 
00139 
00140   
00141 
00142 
00143 
00144   
00145 
00146   
00147 
00148   
00149 
00150 
00151 
00152 
00153 
00154 
00155 
00156 
00157 
00158 
00159 
00160   
00161 
00162   C_ProtocolFrame::T_MsgError EncodeWithContentLength (int P_index);
00163 
00164   C_ProtocolFrame::T_MsgError NoEncode (int P_index);
00165 
00166 
00167   T_pValueData getSessionFromField (C_ContextFrame *P_ctxt) ;
00168   T_pValueData getSessionFromOpenId (C_ContextFrame *P_ctxt) ;
00169 
00170 
00171 protected:
00172 private:
00173 
00174   C_ProtocolText            *m_protocol              ;
00175   T_pValueData               m_header, m_body        ;
00176   int                        m_id                    ;
00177   T_pValueData               m_session_id            ;
00178 
00179 
00180   
00181 
00182 
00183 
00184 
00185 
00186 
00187 
00188 
00189 
00190 
00191 
00192 
00193 
00194 
00195 
00196 
00197 
00198 
00199 
00200 
00201 
00202 
00203 } ;
00204 
00205 typedef C_MessageText *T_pC_MessageText ;
00206 
00207 
00208 #endif // _C_MESSAGE_TEXT_H
00209 
00210 
00211 
00212 
00213 
00214 
00215