diff options
| author | slioch <slioch@eng-140.vyatta.com> | 2009-07-28 14:35:37 -0700 |
|---|---|---|
| committer | slioch <slioch@eng-140.vyatta.com> | 2009-07-28 14:35:37 -0700 |
| commit | dfbf4cac22b97eab470ecd251384bf471bfed3e6 (patch) | |
| tree | 5453baa75826ec854b8bc712852fced80106d93a /src/lbtest.hh | |
| parent | fe6f0901ab0970bcc937328e6093f5b0f118230d (diff) | |
| download | vyatta-wanloadbalance-dfbf4cac22b97eab470ecd251384bf471bfed3e6.tar.gz vyatta-wanloadbalance-dfbf4cac22b97eab470ecd251384bf471bfed3e6.zip | |
reworked tests to fix bug in handling of received packets. modified show cmd output.
Diffstat (limited to 'src/lbtest.hh')
| -rw-r--r-- | src/lbtest.hh | 87 |
1 files changed, 87 insertions, 0 deletions
diff --git a/src/lbtest.hh b/src/lbtest.hh new file mode 100644 index 0000000..2719cf5 --- /dev/null +++ b/src/lbtest.hh @@ -0,0 +1,87 @@ +/* + * Module: lbtest.hh + * + * This program is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 as published + * by the Free Software Foundation. + */ +#ifndef __LBTEST_HH__ +#define __LBTEST_HH__ + +#include <assert.h> +#include <map> +#include <set> +#include <vector> +#include <string> + +using namespace std; + +class LBHealth; + +/** + * + * + **/ +class PktData +{ +public: + PktData(string iface, int rtt) : _iface(iface),_rtt(rtt) {} + string _iface; + int _rtt; +}; + + +/** + * + * + **/ +class LBTest { +public: + typedef enum {K_NONE,K_SUCCESS,K_FAILURE} TestState; +public: + LBTest(bool debug) : + _debug(debug), + _state(K_NONE) + {init();} + + virtual ~LBTest(); + + virtual void + init(); + + virtual void + start(); + + virtual void + send(LBHealth &health) = 0; + + virtual string + dump() = 0; + + int + recv(LBHealth &health); + + virtual string + name() = 0; + +private: + int + receive(int recv_sock); + + +public: + bool _debug; + string _target; + int _resp_time; + int _state; + + static int _recv_icmp_sock; + static int _send_raw_sock; + static int _send_icmp_sock; + static bool _initialized; + static bool _received; + static int _packet_id; + static map<int,PktData> _results; +}; + +#endif //__LBTEST_HH__ |
