summaryrefslogtreecommitdiff
path: root/src/lbtest_icmp.hh
blob: e081f49ce4026214f78837a7f30fc09b22842da1 (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
/*
 * Module: lbtest_icmp.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_ICMP_HH__
#define __LBTEST_ICMP_HH__

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

using namespace std;

/**
 *
 *
 **/
class LBTestICMP : public LBTest 
{
public:
  LBTestICMP(bool debug) : LBTest(debug) {}
  ~LBTestICMP() {}

  void
  init() {_status_line=name();}

  void
  send(LBHealth &health);

  string
  dump();

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

private:
  void
  send(int sock, const string &iface, const string &target_addr, int packet_id);

  unsigned short
  in_checksum(const unsigned short *buf, int length) const;
};

#endif //__LBTEST_ICMP_HH__