friendev EtherDune TCP/IP library
/home/jander/temp/etherdune/ICMP.h
Go to the documentation of this file.
1 // EtherDune ICMP Abstract base class
2 // Author: Javier Peletier <jm@friendev.com>
3 // Summary: Implements common ICMP packet building routines and ICMP checksum
4 // Summary: Used as base class for ICMP Echo (ping)
5 //
6 // Copyright (c) 2015 All Rights Reserved, http://friendev.com
7 //
8 // This source is subject to the GPLv2 license.
9 // Please see the License.txt file for more information.
10 // All other rights reserved.
11 //
12 // THIS CODE AND INFORMATION ARE PROVIDED "AS IS" WITHOUT WARRANTY OF ANY
13 // KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
14 // IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A
15 // PARTICULAR PURPOSE.
16 
24 
25 #ifndef _ICMP_H_
26 #define _ICMP_H_
27 
28 #include <ACross.h>
29 #include "NetworkService.h"
30 
31 class ICMP : protected NetworkService
32 {
33 
34 private:
35 
36  bool onPacketReceived();
37 
38 protected:
39 
40  bool loadAll();
41  void calcICMPChecksum();
42  void sendICMPPacket(const IPAddress& targetIP, uint16_t dataLength);
43 
44  virtual bool onICMPMessage() = 0;
45 
46 };
47 
48 #endif
bool loadAll()
Loads the entire ICMP packet into memory.
Definition: ICMP.cpp:40
virtual bool onICMPMessage()=0
Implements common ICMP packet building routines and ICMP checksum.
Definition: ICMP.h:31
represents an IP address in memory
Definition: inet.h:181
void sendICMPPacket(const IPAddress &targetIP, uint16_t dataLength)
Sends an ICMP packet
Definition: ICMP.cpp:69
void calcICMPChecksum()
Calculates the ICMP checksum and populates the checksum field in the ICMP header. ...
Definition: ICMP.cpp:59
Abstract base class for any network service running in EtherDune.