First commit for ICMP capabilities, added CPU::GetCacheLineSize(), and removed BaseObj from containers.
This commit is contained in:
53
include/ehs/io/socket/BaseICMP.h
Normal file
53
include/ehs/io/socket/BaseICMP.h
Normal file
@@ -0,0 +1,53 @@
|
||||
#pragma once
|
||||
|
||||
#include "ehs/Serializer.h"
|
||||
#include "ehs/Types.h"
|
||||
#include "ehs/io/socket/Socket.h"
|
||||
|
||||
namespace ehs
|
||||
{
|
||||
struct ICMP_Header
|
||||
{
|
||||
UInt_8 type;
|
||||
UInt_8 code;
|
||||
UInt_16 checksum;
|
||||
};
|
||||
|
||||
struct ICMP_EchoRequest
|
||||
{
|
||||
UInt_16 id;
|
||||
UInt_16 sequence;
|
||||
};
|
||||
|
||||
class BaseICMP
|
||||
{
|
||||
private:
|
||||
IP version;
|
||||
|
||||
public:
|
||||
BaseICMP();
|
||||
|
||||
BaseICMP(IP version);
|
||||
|
||||
BaseICMP(BaseICMP &&icmp) noexcept;
|
||||
|
||||
BaseICMP(const BaseICMP &icmp);
|
||||
|
||||
BaseICMP &operator=(BaseICMP &&icmp) noexcept;
|
||||
|
||||
BaseICMP &operator=(const BaseICMP &icmp);
|
||||
|
||||
virtual UInt_64 Send(const Str_8 &address, ICMP_Header header, const Byte *data, UInt_64 size);
|
||||
|
||||
virtual UInt_64 Receive(Str_8 &address, ICMP_Header header, Serializer<UInt_64> &data);
|
||||
|
||||
void SendEchoRequest(const Str_8 &address, ICMP_EchoRequest er, const Byte *data, UInt_64 size);
|
||||
|
||||
virtual void SetReceiveTimeout(UInt_64 timeout);
|
||||
|
||||
virtual bool IsValid() const;
|
||||
|
||||
protected:
|
||||
static UInt_16 ComputeChecksum(UInt_16 *buffer, Size length);
|
||||
};
|
||||
}
|
7
include/ehs/io/socket/ICMP.h
Normal file
7
include/ehs/io/socket/ICMP.h
Normal file
@@ -0,0 +1,7 @@
|
||||
#pragma once
|
||||
|
||||
#ifdef EHS_OS_WINDOWS
|
||||
#include "BaseICMP.h"
|
||||
#else
|
||||
#include "ICMP_LNX.h"
|
||||
#endif
|
33
include/ehs/io/socket/ICMP_LNX.h
Normal file
33
include/ehs/io/socket/ICMP_LNX.h
Normal file
@@ -0,0 +1,33 @@
|
||||
#pragma once
|
||||
|
||||
#include "BaseICMP.h"
|
||||
|
||||
namespace ehs
|
||||
{
|
||||
class ICMP : public BaseICMP
|
||||
{
|
||||
private:
|
||||
Int_32 hdl;
|
||||
|
||||
public:
|
||||
ICMP();
|
||||
|
||||
ICMP(IP version);
|
||||
|
||||
ICMP(ICMP &&icmp) noexcept;
|
||||
|
||||
ICMP(const ICMP &icmp);
|
||||
|
||||
ICMP &operator=(ICMP &&icmp) noexcept;
|
||||
|
||||
ICMP &operator=(const ICMP &icmp);
|
||||
|
||||
UInt_64 Send(const Str_8 &address, ICMP_Header header, const Byte *data, UInt_64 size) override;
|
||||
|
||||
UInt_64 Receive(Str_8 &address, ICMP_Header header, Serializer<UInt_64> &data) override;
|
||||
|
||||
void SetReceiveTimeout(UInt_64 timeout) override;
|
||||
|
||||
bool IsValid() const override;
|
||||
};
|
||||
}
|
Reference in New Issue
Block a user