]> git.ipfire.org Git - thirdparty/squid.git/blame - src/tests/testIcmp.h
SourceFormat Enforcement
[thirdparty/squid.git] / src / tests / testIcmp.h
CommitLineData
bbc27441 1/*
4ac4a490 2 * Copyright (C) 1996-2017 The Squid Software Foundation and contributors
bbc27441
AJ
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
37122e21
AJ
9#ifndef SQUID_SRC_TESTS_TESTICMP_H
10#define SQUID_SRC_TESTS_TESTICMP_H
cc192b50 11
4064ce8f 12#include <cppunit/extensions/HelperMacros.h>
cc192b50 13
14#if USE_ICMP
15
37122e21
AJ
16#include "icmp/Icmp.h"
17
b826ffb5 18class stubIcmp : public Icmp
cc192b50 19{
20public:
b826ffb5
AJ
21 stubIcmp() {};
22 virtual ~stubIcmp() {};
cc192b50 23 virtual int Open() { return 0; };
24 virtual void Close() {};
25
26 /// Construct ECHO request
b7ac5457 27 virtual void SendEcho(Ip::Address &to, int opcode, const char *payload, int len) {};
cc192b50 28
29 /// Handle ICMP responses.
30 virtual void Recv(void) {};
31
26ac0430 32 /* methods to relay test data from tester to private methods being tested */
cc192b50 33 int testChecksum(unsigned short *ptr, int size) { return CheckSum(ptr,size); };
34 int testHops(int ttl) { return ipHops(ttl); };
35};
37122e21 36#endif
cc192b50 37
38/**
39 * test the ICMP base class.
40 */
b826ffb5 41class testIcmp : public CPPUNIT_NS::TestFixture
cc192b50 42{
b826ffb5 43 CPPUNIT_TEST_SUITE( testIcmp );
cc192b50 44 CPPUNIT_TEST( testChecksum );
45 CPPUNIT_TEST( testHops );
cc192b50 46 CPPUNIT_TEST_SUITE_END();
47
48protected:
cc192b50 49 void testChecksum();
50 void testHops();
cc192b50 51};
52
37122e21 53#endif /* SQUID_SRC_TESTS_TESTICMP_H */
f53969cc 54