EHS/include/io/socket/Utils.h

56 lines
884 B
C
Raw Normal View History

2023-12-17 03:29:08 -08:00
#pragma once
2023-12-17 15:00:08 -08:00
#include "EHS.h"
#include "Serializer.h"
2023-12-17 03:29:08 -08:00
2023-12-17 15:56:13 -08:00
namespace ehs
2023-12-17 03:29:08 -08:00
{
enum class EndDisp : UInt_8
{
UNKNOWN,
SERVICE,
ENDPOINT
};
enum class Status : UInt_8
{
ACTIVE,
PENDING,
IN_LOCAL_QUEUE,
IN_REMOTE_QUEUE,
};
struct Header
{
bool encrypted = true;
UInt_64 id = 0;
UInt_64 fragments = 0;
UInt_64 fragment = 0;
bool ensure = false;
EndDisp disposition = EndDisp::UNKNOWN;
UInt_64 endpointId = 0;
UInt_64 system = 0;
UInt_64 op = 0;
};
struct Packet
{
Header header;
Serializer<> payload;
};
struct Insurance
{
Header header;
Serializer<> payload;
float lastResend;
};
}
#ifndef COMMS_IPV4_PAYLOAD
2023-12-17 15:56:13 -08:00
#define COMMS_IPV4_PAYLOAD (EHS_IPV4_UDP_PAYLOAD - (UInt_16)sizeof(Header))
2023-12-17 03:29:08 -08:00
#endif
#ifndef COMMS_IPV6_PAYLOAD
2023-12-17 15:56:13 -08:00
#define COMMS_IPV6_PAYLOAD (EHS_IPV6_UDP_PAYLOAD - (UInt_16)sizeof(Header))
2023-12-17 03:29:08 -08:00
#endif