00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020 #ifndef _C_MESSAGEBINARY_
00021 #define _C_MESSAGEBINARY_
00022
00023 #include "C_GeneratorConfig.hpp"
00024 #include "C_MessageFrame.hpp"
00025 #include "C_ProtocolBinary.hpp"
00026 #include "C_ContextFrame.hpp"
00027 #include "iostream_t.hpp"
00028
00029 #include "C_RegExp.hpp"
00030
00031
00032 #define MAX_BODY_VALUES 65
00033
00034 class C_MessageBinary : public C_MessageFrame {
00035
00036 public:
00037
00038 C_MessageBinary(C_ProtocolBinary *P_protocol);
00039 ~C_MessageBinary();
00040
00041
00042 T_TypeType get_field_type (int P_id,
00043 int P_sub_id);
00044
00045 bool get_field_value(int P_id,
00046 C_RegExp *P_reg,
00047 T_pValueData P_value) ;
00048
00049 bool get_field_value (int P_id,
00050 int P_instance,
00051 int P_sub_id,
00052 T_pValueData P_value);
00053
00054 int get_buffer (T_pValueData P_dest,
00055 T_MessagePartType P_header_body_type);
00056
00057
00058
00059 bool set_field_value (T_pValueData P_value,
00060 int P_id,
00061 int P_instance,
00062 int P_sub_id);
00063
00064
00065 unsigned long get_call_id () ;
00066 void set_call_id (unsigned long P_id);
00067
00068
00069
00070 virtual T_pValueData get_session_id (C_ContextFrame *P_ctxt) ;
00071
00072
00073
00074 unsigned long get_type () ;
00075
00076 void set_type (unsigned long P_type) ;
00077
00078 unsigned long decode (unsigned char *P_buffer,
00079 size_t P_size,
00080 C_ProtocolFrame::T_pMsgError P_error) ;
00081
00082
00083 void encode (unsigned char *P_buffer,
00084 size_t *P_size,
00085 C_ProtocolFrame::T_pMsgError P_error) ;
00086
00087
00088
00089 virtual bool compare_types (C_MessageFrame *P_ref) ;
00090
00091 virtual bool update_fields (C_MessageFrame *P_ref) ;
00092 virtual void update_message_stats () ;
00093
00094 void set_header_value (int P_id, unsigned long P_val);
00095 void set_header_value (char* P_name, unsigned long P_val);
00096 void set_header_value (char* P_name, char *P_val);
00097 void set_header_value (int P_id, T_pValueData P_val);
00098
00099 void set_header_id_value (int P_id) ;
00100 void set_body_value (C_ProtocolBinary::T_pBodyValue P_val);
00101
00102 void get_header_value (T_pValueData P_res, int P_id);
00103 virtual void get_body_value (T_pValueData P_res, int P_id);
00104 virtual bool set_body_value (int P_id, T_pValueData P_val);
00105
00106 C_MessageBinary& operator= (C_MessageBinary & P_val);
00107 friend iostream_output& operator<< (iostream_output&, C_MessageBinary &);
00108
00109 C_ProtocolBinary *get_protocol();
00110
00111 bool check (C_MessageFrame *P_ref,
00112 unsigned int P_levelMask,
00113 T_CheckBehaviour P_behave) ;
00114
00115
00116 bool check_field_presence (int P_id,
00117 T_CheckBehaviour P_behave,
00118 int P_instance,
00119 int P_sub_id) ;
00120
00121 bool check_field_value (C_MessageFrame *P_ref,
00122 int P_id,
00123 T_CheckBehaviour P_behave,
00124 int P_instance,
00125 int P_sub_id) ;
00126
00127 bool check_field_order (int P_id,
00128 T_CheckBehaviour P_behave,
00129 int P_position);
00130
00131 void dump(iostream_output& P_stream) ;
00132
00133
00134 char* name();
00135
00136
00137 int get_id_message() ;
00138
00139
00140
00141 protected:
00142
00143 C_ProtocolBinary *m_protocol ;
00144 unsigned long m_call_id ;
00145
00146 T_ValueData m_id ;
00147 T_pValueData m_header_values ;
00148
00149 char *m_header_body_field_separator ;
00150
00151
00152
00153 int m_header_id ;
00154 int m_nb_body_values ;
00155 C_ProtocolBinary::T_pBodyValue m_body_val ;
00156 virtual T_pValueData get_out_of_session_id () ;
00157
00158
00159 } ;
00160
00161
00162
00163 typedef C_MessageBinary *T_pC_MessageBinary ;
00164
00165 #endif // _C_MESSAGEBINARY_
00166