00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020 #ifndef _C_GENERATOR_CMDLINE_H
00021 #define _C_GENERATOR_CMDLINE_H
00022
00023 #include "Utils.hpp"
00024 #include "C_CommandLine.hpp"
00025 #include "C_XmlData.hpp"
00026
00027 #include "T_ConfigValue.h"
00028
00029 #include "iostream_t.hpp"
00030 #include "string_t.hpp"
00031
00032 #include "message_check_t.h"
00033
00034 #include "list_t.hpp"
00035 #include <regex.h>
00036
00037 typedef list_t<char*> T_charPlist, *T_pcharPlist ;
00038
00039
00040 typedef enum {
00041 E_CHECK_LEVEL_FIELD_PRESENCE,
00042 E_CHECK_LEVEL_FIELD_ADDED,
00043 E_NB_CHECK_LEVEL
00044 } T_CheckLevel ;
00045
00046 typedef enum {
00047 E_CHECK_DATA_SEQUENTIAL = 0 ,
00048 E_CHECK_DATA_RANDOM,
00049 E_NB_CHECK_DATA_SELECT
00050 } T_CheckDataSelect ;
00051
00052 typedef enum {
00053 E_MODEL_TRAFFIC_UNIFORM = 0 ,
00054 E_MODEL_TRAFFIC_BESTEFFORT,
00055 E_MODEL_TRAFFIC_POISSON,
00056 E_NB_MODEL_TRAFFIC_SELECT
00057 } T_ModelTrafficSelect ;
00058
00059 extern const unsigned int _check_level_mask [] ;
00060 extern const unsigned int _check_behaviour_mask [] ;
00061 extern const char* _check_external_select [] ;
00062 extern const char* _model_traffic_select [] ;
00063
00064
00065
00066 typedef enum {
00067 E_CMDLINE_conf_file = 0,
00068 E_CMDLINE_scen_file,
00069 E_CMDLINE_dico_file,
00070 E_CMDLINE_log_file,
00071 E_CMDLINE_log_level,
00072 E_CMDLINE_help,
00073 E_CMDLINE_bg_mode,
00074 E_CMDLINE_timestamp_log,
00075 E_CMDLINE_check_msg,
00076 E_CMDLINE_remote_cmd,
00077 E_CMDLINE_remote_dico_path,
00078
00079 E_CMDLINE_nbOptions
00080 } T_GeneratorCmdLineOption ;
00081
00082 typedef enum {
00083 E_CFG_OPT_CALL_RATE = 0 ,
00084 E_CFG_OPT_BURST_LIMIT,
00085 E_CFG_OPT_MAX_SEND,
00086 E_CFG_OPT_MAX_RECEIVE,
00087 E_CFG_OPT_SELECT_TIMEOUT_MS,
00088 E_CFG_OPT_MAX_SIMULTANEOUS_CALLS,
00089 E_CFG_OPT_CALL_TIMEOUT,
00090 E_CFG_OPT_MSG_BUFFER_SIZE,
00091 E_CFG_OPT_DISPLAY_PERIOD,
00092 E_CFG_OPT_LOG_STAT_PERIOD,
00093 E_CFG_OPT_LOG_FILE,
00094 E_CFG_OPT_LOG_STAT_FILE,
00095 E_CFG_OPT_RESP_TIME_REPART,
00096 E_CFG_OPT_NUMBER_CALLS,
00097 E_CFG_OPT_CHECK_LEVEL,
00098 E_CFG_OPT_CHECK_BEHAVIOUR,
00099 E_CFG_OPT_DATA_LOG_FILE,
00100 E_CFG_OPT_DATA_LOG_PERIOD,
00101 E_CFG_OPT_DATA_LOG_NUMBER,
00102 E_CFG_OPT_CALL_RATE_SCALE,
00103 E_CFG_OPT_EXTERNAL_DATA_FILE,
00104 E_CFG_OPT_EXTERNAL_DATA_SELECT,
00105 E_CFG_OPT_DATA_LOG_RTDISTRIB,
00106 E_CFG_OPT_LOG_PROTOCOL_STAT_PERIOD,
00107 E_CFG_OPT_LOG_PROTOCOL_STAT_NAME,
00108 E_CFG_OPT_LOG_PROTOCOL_STAT_FILE,
00109 E_CFG_OPT_DISPLAY_PROTOCOL_STAT,
00110 E_CFG_OPT_DISPLAY_SCENARIO_STAT,
00111 E_CFG_OPT_FILES_NO_TIMESTAMP,
00112 E_CFG_OPT_CALL_TIMEOUT_BEH_ABR,
00113 E_CFG_OPT_OPEN_TIMEOUT,
00114 E_CFG_OPT_EXECUTE_CHECK_ACTION,
00115 E_CFG_OPT_MAX_RETRANS,
00116 E_CFG_OPT_RETRANS_ENABLED,
00117 E_CFG_OPT_MODEL_TRAFFIC_SELECT,
00118
00119 E_CFG_OPT_Number
00120 } T_GeneratorConfigOption ;
00121
00122 class C_GeneratorConfig:public C_CommandLine<T_GeneratorCmdLineOption> {
00123
00124 public:
00125
00126 C_GeneratorConfig(int P_argc, char** P_argv);
00127 virtual ~C_GeneratorConfig();
00128
00129 bool set_data (T_GeneratorCmdLineOption P_opt, char **P_argtab) ;
00130
00131 bool set_value (T_GeneratorConfigOption P_opt, char *P_value);
00132
00133 bool get_value (T_GeneratorConfigOption P_opt, unsigned long *P_val);
00134 bool get_value (T_GeneratorConfigOption P_opt, unsigned int *P_val);
00135 bool get_value (T_GeneratorConfigOption P_opt, char **P_val);
00136 bool get_value (T_GeneratorConfigOption P_opt, string_t &P_val);
00137 bool is_value_set (T_GeneratorConfigOption P_opt) ;
00138
00139 T_GeneratorConfigOption get_code (char* P_name) ;
00140
00141 friend iostream_output& operator<< (iostream_output&, C_GeneratorConfig&);
00142
00143 bool checkConfig();
00144
00145 bool fromXml (C_XmlData *P_data);
00146
00147
00148
00149 char* get_conf_file();
00150 char* get_log_file();
00151 char* get_scen_file();
00152
00153
00154 T_pcharPlist get_dico_file_list() ;
00155
00156 unsigned int get_log_level();
00157 bool get_bg_mode ();
00158 bool get_timestamp_log ();
00159 bool get_check_msg () ;
00160
00161 char* get_remote_cmd() ;
00162
00163 char* get_remote_dico_path() ;
00164
00165
00166 bool get_display_protocol_stat () ;
00167 bool get_display_scenario_stat () ;
00168
00169
00170 bool get_files_no_timestamp () ;
00171 bool get_call_timeout_beh_abr () ;
00172
00173 bool get_execute_check_action () ;
00174
00175 bool get_retrans_enabled () ;
00176
00177
00178 T_pConfigValueList get_config_param_list() ;
00179 int analyze_protocol_stat(char *P_logProtocolStat,
00180 T_charPlist *P_protocol_list,
00181 bool *P_all_found);
00182
00183 private:
00184
00185
00186 char *m_option_log_file ;
00187 char *m_option_conf_file ;
00188
00189 T_pcharPlist m_option_dico_file_list ;
00190
00191 char *m_option_scen_file ;
00192 unsigned int m_option_log_level ;
00193 bool m_option_bg_mode ;
00194 bool m_option_timestamp_log ;
00195 bool m_option_check_msg ;
00196
00197 char *m_option_remote_cmd ;
00198 char *m_option_remote_dico_path ;
00199
00200
00201 bool *m_conf_opt_set ;
00202
00203 unsigned long m_call_rate ;
00204 unsigned long m_burst_limit ;
00205 unsigned long m_max_send ;
00206 unsigned long m_max_receive ;
00207 unsigned long m_select_timeout ;
00208 unsigned long m_max_simultaneous_calls ;
00209 unsigned long m_call_timeout ;
00210 unsigned long m_msg_buffer_size ;
00211 unsigned long m_display_period ;
00212 unsigned long m_log_stat_period ;
00213 char *m_log_stat_file ;
00214 char *m_resp_time_repart ;
00215 unsigned long m_number_calls ;
00216
00217
00218 char *m_external_data_file ;
00219 unsigned int m_external_data_select ;
00220
00221 unsigned int m_model_traffic_select ;
00222
00223
00224 unsigned int m_check_level_mask ;
00225 unsigned int m_check_behaviour ;
00226
00227 char *m_data_log_file ;
00228 unsigned long m_data_log_number ;
00229 unsigned long m_data_log_period ;
00230
00231
00232 unsigned long m_data_log_rtdistrib ;
00233 unsigned long m_log_protocol_stat_period ;
00234 char *m_log_protocol_stat_name ;
00235 char *m_log_protocol_stat_file ;
00236 bool m_display_protocol_stat ;
00237 bool m_display_scenario_stat ;
00238
00239 bool m_files_no_timestamp ;
00240 bool m_call_timeout_beh_abr ;
00241
00242 bool m_execute_check_action ;
00243
00244 unsigned long m_open_timeout ;
00245
00246 unsigned long m_max_retrans ;
00247 bool m_retrans_enabled ;
00248
00249 unsigned long m_call_rate_scale ;
00250
00251 T_pConfigValueList m_configValueList ;
00252
00253 };
00254
00255 #endif // _C_GENERATOR_CMDLINE_H
00256
00257
00258
00259
00260
00261
00262