EHS
Loading...
Searching...
No Matches
BaseICMP.h
Go to the documentation of this file.
1#pragma once
2
3#include "ehs/Serializer.h"
4#include "ehs/Types.h"
6
7namespace ehs
8{
15
21
23 {
24 private:
25 IP version;
26
27 public:
28 virtual ~BaseICMP() = default;
29
30 BaseICMP();
31
32 BaseICMP(IP version);
33
34 BaseICMP(BaseICMP &&icmp) noexcept;
35
36 BaseICMP(const BaseICMP &icmp);
37
38 BaseICMP &operator=(BaseICMP &&icmp) noexcept;
39
40 BaseICMP &operator=(const BaseICMP &icmp);
41
42 virtual void Release();
43
44 UInt_64 Send(const Str_8 &address, ICMP_Header header, const Byte *data, UInt_64 size);
45
46 UInt_64 Receive(Str_8 &address, ICMP_Header &header, Serializer<UInt_64> &data);
47
48 void SendEchoRequest(const Str_8 &address, ICMP_EchoRequest er, const Byte *data, UInt_64 size);
49
50 virtual void SetReceiveTimeout(UInt_64 timeout);
51
52 IP GetVersion() const;
53
54 virtual bool IsValid() const;
55
56 protected:
57 static UInt_16 ComputeChecksumV4(UInt_16 *buffer, Size length);
58
59 private:
60 virtual UInt_64 SendV6(const Str_8 &address, ICMP_Header header, const Byte *data, UInt_64 size);
61
62 virtual UInt_64 SendV4(const Str_8 &address, ICMP_Header header, const Byte *data, UInt_64 size);
63
64 virtual UInt_64 ReceiveV6(Str_8 &address, ICMP_Header &header, Serializer<UInt_64> &data) const;
65
66 virtual UInt_64 ReceiveV4(Str_8 &address, ICMP_Header &header, Serializer<UInt_64> &data) const;
67 };
68}
virtual void SetReceiveTimeout(UInt_64 timeout)
Definition BaseICMP.cpp:94
BaseICMP()
Definition BaseICMP.cpp:8
virtual bool IsValid() const
Definition BaseICMP.cpp:103
BaseICMP & operator=(BaseICMP &&icmp) noexcept
Definition BaseICMP.cpp:28
UInt_64 Send(const Str_8 &address, ICMP_Header header, const Byte *data, UInt_64 size)
Definition BaseICMP.cpp:52
virtual ~BaseICMP()=default
virtual void Release()
Definition BaseICMP.cpp:48
IP GetVersion() const
Definition BaseICMP.cpp:98
UInt_64 Receive(Str_8 &address, ICMP_Header &header, Serializer< UInt_64 > &data)
Definition BaseICMP.cpp:60
static UInt_16 ComputeChecksumV4(UInt_16 *buffer, Size length)
Definition BaseICMP.cpp:108
void SendEchoRequest(const Str_8 &address, ICMP_EchoRequest er, const Byte *data, UInt_64 size)
Definition BaseICMP.cpp:68
Definition Serializer.h:25
Definition Anchor.h:6
IP
Definition Socket.h:29
unsigned char UInt_8
Definition Types.h:43
Str< Char_8, UInt_64 > Str_8
Definition Str.h:1953
unsigned char Byte
Definition Types.h:39
unsigned short UInt_16
Definition Types.h:46
Definition BaseICMP.h:17
UInt_16 id
Definition BaseICMP.h:18
UInt_16 sequence
Definition BaseICMP.h:19
Definition BaseICMP.h:10
UInt_16 checksum
Definition BaseICMP.h:13
UInt_8 code
Definition BaseICMP.h:12
UInt_8 type
Definition BaseICMP.h:11