• Main Page
  • Related Pages
  • Namespaces
  • Data Structures
  • Files
  • File List
  • Globals

P_NetVCTest.h

Go to the documentation of this file.
00001 /** @file
00002 
00003   A brief file description
00004 
00005   @section license License
00006 
00007   Licensed to the Apache Software Foundation (ASF) under one
00008   or more contributor license agreements.  See the NOTICE file
00009   distributed with this work for additional information
00010   regarding copyright ownership.  The ASF licenses this file
00011   to you under the Apache License, Version 2.0 (the
00012   "License"); you may not use this file except in compliance
00013   with the License.  You may obtain a copy of the License at
00014 
00015       http://www.apache.org/licenses/LICENSE-2.0
00016 
00017   Unless required by applicable law or agreed to in writing, software
00018   distributed under the License is distributed on an "AS IS" BASIS,
00019   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
00020   See the License for the specific language governing permissions and
00021   limitations under the License.
00022  */
00023 
00024 /****************************************************************************
00025 
00026   P_NetVCTest.h
00027 
00028    Description:
00029        Unit test for infastructure for VConnections implementing the
00030          NetVConnection interface
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

Generated by  doxygen 1.7.1