EHS
Loading...
Searching...
No Matches
ICMP_W32.h
Go to the documentation of this file.
1#pragma once
2
3#include "BaseICMP.h"
4#include "ehs/System/OS.h"
5
6#include <winsock2.h>
7#include <WS2tcpip.h>
8#include <iphlpapi.h>
9
10namespace ehs
11{
13 {
14 sockaddr_in6 src;
15 sockaddr_in6 dst;
17 };
18
19 class ICMP : public BaseICMP
20 {
21 private:
22 Socket hdl;
23 sockaddr_in6 src;
24
25 public:
26 ~ICMP() override;
27
29
30 ICMP(IP version);
31
32 ICMP(ICMP &&icmp) noexcept;
33
34 ICMP(const ICMP &icmp);
35
36 ICMP &operator=(ICMP &&icmp) noexcept;
37
38 ICMP &operator=(const ICMP &icmp);
39
40 void Release() override;
41
42 void SetReceiveTimeout(UInt_64 timeout) override;
43
44 bool IsValid() const override;
45
46 private:
47 static bool IsLinkLocal(const in6_addr &addr);
48
49 static sockaddr_in6 RetrieveSrcAddress();
50
51 static UInt_32 CalculatePseudoHeaderChecksum(const PseudoICMPv6_Header &header);
52
53 UInt_16 ComputeChecksumV6(UInt_16* buffer, Size length, const sockaddr_in6& dst);
54
55 UInt_64 SendV6(const Str_8 &address, ICMP_Header header, const Byte *data, UInt_64 size) override;
56
57 UInt_64 SendV4(const Str_8 &address, ICMP_Header header, const Byte *data, UInt_64 size) override;
58
59 UInt_64 ReceiveV6(Str_8 &address, ICMP_Header &header, Serializer<UInt_64> &data) const override;
60
61 UInt_64 ReceiveV4(Str_8 &address, ICMP_Header &header, Serializer<UInt_64> &data) const override;
62 };
63}
Definition BaseICMP.h:23
Definition ICMP_LNX.h:17
ICMP & operator=(ICMP &&icmp) noexcept
void Release() override
ICMP & operator=(const ICMP &icmp)
ICMP(const ICMP &icmp)
ICMP(IP version)
void SetReceiveTimeout(UInt_64 timeout) override
ICMP(ICMP &&icmp) noexcept
~ICMP() override
bool IsValid() const override
Definition Serializer.h:25
Definition Anchor.h:6
unsigned int UInt_32
Definition Types.h:49
IP
Definition Socket.h:29
Str< Char_8, UInt_64 > Str_8
Definition Str.h:1902
unsigned char Byte
Definition Types.h:39
unsigned short UInt_16
Definition Types.h:46
Definition BaseICMP.h:10
Definition ICMP_LNX.h:10
sockaddr_in6 src
Definition ICMP_LNX.h:11
UInt_32 length
Definition ICMP_LNX.h:13
sockaddr_in6 dst
Definition ICMP_LNX.h:12