testIcmp.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 1996-2017 The Squid Software Foundation and contributors
3  *
4  * Squid software is distributed under GPLv2+ license and includes
5  * contributions from numerous individuals and organizations.
6  * Please see the COPYING and CONTRIBUTORS files for details.
7  */
8 
9 #ifndef SQUID_SRC_TESTS_TESTICMP_H
10 #define SQUID_SRC_TESTS_TESTICMP_H
11 
12 #include <cppunit/extensions/HelperMacros.h>
13 
14 #if USE_ICMP
15 
16 #include "icmp/Icmp.h"
17 
18 class stubIcmp : public Icmp
19 {
20 public:
21  stubIcmp() {};
22  virtual ~stubIcmp() {};
23  virtual int Open() { return 0; };
24  virtual void Close() {};
25 
27  virtual void SendEcho(Ip::Address &to, int opcode, const char *payload, int len) {};
28 
30  virtual void Recv(void) {};
31 
32  /* methods to relay test data from tester to private methods being tested */
33  int testChecksum(unsigned short *ptr, int size) { return CheckSum(ptr,size); };
34  int testHops(int ttl) { return ipHops(ttl); };
35 };
36 #endif
37 
41 class testIcmp : public CPPUNIT_NS::TestFixture
42 {
47 
48 protected:
49  void testChecksum();
50  void testHops();
51 };
52 
53 #endif /* SQUID_SRC_TESTS_TESTICMP_H */
54 
Definition: Icmp.h:64
int ipHops(int ttl)
Definition: Icmp.cc:67
int testChecksum(unsigned short *ptr, int size)
Definition: testIcmp.h:33
int testHops(int ttl)
Definition: testIcmp.h:34
void testHops()
Definition: testIcmp.cc:75
CPPUNIT_TEST_SUITE_END()
virtual void Close()
Shutdown pinger helper and control channel.
Definition: testIcmp.h:24
int CheckSum(unsigned short *ptr, int size)
Calculate a packet checksum.
Definition: Icmp.cc:38
int unsigned int const char *desc STUB void int len
Definition: stub_fd.cc:20
virtual int Open()
Start pinger helper and initiate control channel.
Definition: testIcmp.h:23
void testChecksum()
Definition: testIcmp.cc:20
virtual ~stubIcmp()
Definition: testIcmp.h:22
CPPUNIT_TEST(testChecksum)
virtual void Recv(void)
Handle ICMP responses.
Definition: testIcmp.h:30
stubIcmp()
Definition: testIcmp.h:21
virtual void SendEcho(Ip::Address &to, int opcode, const char *payload, int len)
Construct ECHO request.
Definition: testIcmp.h:27
CPPUNIT_TEST_SUITE(testIcmp)
int size
Definition: ModDevPoll.cc:77

 

Introduction

Documentation

Support

Miscellaneous

Web Site Translations

Mirrors