Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037 #ifndef _P_NET_VC_TEST_H_
00038 #define _P_NET_VC_TEST_H_
00039
00040 #include "libts.h"
00041
00042 class VIO;
00043 class MIOBuffer;
00044 class IOBufferReader;
00045
00046
00047
00048 enum NetVcTestType_t
00049 {
00050 NET_VC_TEST_ACTIVE,
00051 NET_VC_TEST_PASSIVE
00052 };
00053
00054 struct NVC_test_def
00055 {
00056 const char *test_name;
00057
00058 int bytes_to_send;
00059 int nbytes_write;
00060
00061 int bytes_to_read;
00062 int nbytes_read;
00063
00064 int write_bytes_per;
00065 int timeout;
00066
00067 int expected_read_term;
00068 int expected_write_term;
00069 };
00070
00071 extern NVC_test_def netvc_tests_def[];
00072 extern const unsigned num_netvc_tests;
00073
00074 class NetTestDriver:public Continuation
00075 {
00076 public:
00077 NetTestDriver();
00078 ~NetTestDriver();
00079
00080 int errors;
00081 protected:
00082
00083 RegressionTest * r;
00084 int *pstatus;
00085 };
00086
00087
00088 class NetVCTest:public Continuation
00089 {
00090 public:
00091 NetVCTest();
00092 ~NetVCTest();
00093 NetVcTestType_t test_cont_type;
00094
00095 int main_handler(int event, void *data);
00096 void read_handler(int event);
00097 void write_handler(int event);
00098 void cleanup();
00099
00100 void init_test(NetVcTestType_t n_type, NetTestDriver * driver,
00101 NetVConnection * nvc, RegressionTest * robj,
00102 NVC_test_def * my_def, const char *module_name_arg, const char *debug_tag_arg);
00103 void start_test();
00104 int fill_buffer(MIOBuffer * buf, uint8_t * seed, int bytes);
00105 int consume_and_check_bytes(IOBufferReader * r, uint8_t * seed);
00106
00107 void write_finished();
00108 void read_finished();
00109 void finished();
00110 void record_error(const char *msg);
00111
00112 NetVConnection *test_vc;
00113 RegressionTest *regress;
00114 NetTestDriver *driver;
00115
00116 VIO *read_vio;
00117 VIO *write_vio;
00118
00119 MIOBuffer *read_buffer;
00120 MIOBuffer *write_buffer;
00121
00122 IOBufferReader *reader_for_rbuf;
00123 IOBufferReader *reader_for_wbuf;
00124
00125 int write_bytes_to_add_per;
00126 int timeout;
00127
00128 int actual_bytes_read;
00129 int actual_bytes_sent;
00130
00131 bool write_done;
00132 bool read_done;
00133
00134 uint8_t read_seed;
00135 uint8_t write_seed;
00136
00137 int bytes_to_send;
00138 int bytes_to_read;
00139
00140 int nbytes_read;
00141 int nbytes_write;
00142
00143 int expected_read_term;
00144 int expected_write_term;
00145
00146 const char *test_name;
00147 const char *module_name;
00148 const char *debug_tag;
00149 };
00150
00151
00152 #endif