summaryrefslogtreecommitdiff
path: root/src/lbtest_user.hh
blob: 534d4d0ef76d25f56af6dbe85b56bd5ed7d8925f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
/*
 * Module: lbtest_user.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_USER_HH__
#define __LBTEST_USER_HH__

#include <sys/types.h>
#include <sys/socket.h>
#include <netdb.h>
#include <iostream>
#include "lbtest.hh"

using namespace std;

/**
 *
 *
 **/
class LBTestUser : public LBTest 
{
public:
  LBTestUser(bool debug) : 
    LBTest(debug)
  {}
  LBTestUser(bool debug, string &script) :
    LBTest(debug),
    _script(script)
  {}
  ~LBTestUser() {}

  void
  send(LBHealth &health);

  std::string
  get_script() const {return _script;}

  void
  set_script(std::string &script) {_script = script;}

  string
  dump();

  string
  name() {return string("user");}

  //override, don't need base support for these.
  void
  init() {_status_line=name();}
  void
  start() {}
  int
  recv(LBHealth &health) {return (_state != LBTest::K_SUCCESS) ? -1 : 1;}


private: //methods
  int
  system_out(const string &cmd, string &out);

private: //variables
  string _script;
};

#endif //__LBTEST_USER_HH__