2
0
mirror of https://github.com/esiur/esiur-dotnet.git synced 2026-03-31 18:38:22 +00:00

renaming 2

This commit is contained in:
2026-03-17 22:15:43 +03:00
parent 9d936c0812
commit e22e0d952d
88 changed files with 1685 additions and 1866 deletions

View File

@@ -4,19 +4,19 @@ using System.Text;
namespace Esiur.Net.Packets
{
public static class IIPAuthExtensions
public static class EpAuthExtensions
{
public static IIPAuthPacketIAuthFormat GetIAuthFormat(this object value)
public static EpAuthPacketIAuthFormat GetIAuthFormat(this object value)
{
if (value is string)
return IIPAuthPacketIAuthFormat.Text;
return EpAuthPacketIAuthFormat.Text;
else if (value is int || value is uint
|| value is byte || value is sbyte
|| value is short || value is ushort
|| value is long || value is ulong)
return IIPAuthPacketIAuthFormat.Number;
return EpAuthPacketIAuthFormat.Number;
else if (value.GetType().IsArray)
return IIPAuthPacketIAuthFormat.Choice;
return EpAuthPacketIAuthFormat.Choice;
throw new Exception("Unknown IAuth format");
}

View File

@@ -35,33 +35,33 @@ using System.Timers;
namespace Esiur.Net.Packets;
public class IIPAuthPacket : Packet
public class EpAuthPacket : Packet
{
public IIPAuthPacketCommand Command
public EpAuthPacketCommand Command
{
get;
set;
}
public IIPAuthPacketInitialize Initialization
public EpAuthPacketInitialize Initialization
{
get;
set;
}
public IIPAuthPacketAcknowledge Acknowledgement
public EpAuthPacketAcknowledge Acknowledgement
{
get;
set;
}
public IIPAuthPacketAction Action
public EpAuthPacketAction Action
{
get;
set;
}
public IIPAuthPacketEvent Event
public EpAuthPacketEvent Event
{
get;
set;
@@ -92,13 +92,13 @@ public class IIPAuthPacket : Packet
}
public IIPAuthPacketPublicKeyAlgorithm PublicKeyAlgorithm
public EpAuthPacketPublicKeyAlgorithm PublicKeyAlgorithm
{
get;
set;
}
public IIPAuthPacketHashAlgorithm HashAlgorithm
public EpAuthPacketHashAlgorithm HashAlgorithm
{
get;
set;
@@ -176,14 +176,14 @@ public class IIPAuthPacket : Packet
if (NotEnough(offset, ends, 1))
return -dataLengthNeeded;
Command = (IIPAuthPacketCommand)(data[offset] >> 6);
Command = (EpAuthPacketCommand)(data[offset] >> 6);
if (Command == IIPAuthPacketCommand.Initialize)
if (Command == EpAuthPacketCommand.Initialize)
{
LocalMethod = (AuthenticationMethod)(data[offset] >> 4 & 0x3);
RemoteMethod = (AuthenticationMethod)(data[offset] >> 2 & 0x3);
Initialization = (IIPAuthPacketInitialize)(data[offset++] & 0xFC); // remove last two reserved LSBs
Initialization = (EpAuthPacketInitialize)(data[offset++] & 0xFC); // remove last two reserved LSBs
if (NotEnough(offset, ends, 1))
return -dataLengthNeeded;
@@ -197,13 +197,13 @@ public class IIPAuthPacket : Packet
offset += (uint)DataType.Value.TotalLength;
}
else if (Command == IIPAuthPacketCommand.Acknowledge)
else if (Command == EpAuthPacketCommand.Acknowledge)
{
LocalMethod = (AuthenticationMethod)(data[offset] >> 4 & 0x3);
RemoteMethod = (AuthenticationMethod)(data[offset] >> 2 & 0x3);
Acknowledgement = (IIPAuthPacketAcknowledge)(data[offset++] & 0xFC); // remove last two reserved LSBs
Acknowledgement = (EpAuthPacketAcknowledge)(data[offset++] & 0xFC); // remove last two reserved LSBs
if (NotEnough(offset, ends, 1))
return -dataLengthNeeded;
@@ -216,19 +216,19 @@ public class IIPAuthPacket : Packet
offset += (uint)DataType.Value.TotalLength;
}
else if (Command == IIPAuthPacketCommand.Action)
else if (Command == EpAuthPacketCommand.Action)
{
Action = (IIPAuthPacketAction)data[offset++]; // (IIPAuthPacketAction)(data[offset++] & 0x3f);
Action = (EpAuthPacketAction)data[offset++]; // (EPAuthPacketAction)(data[offset++] & 0x3f);
if (Action == IIPAuthPacketAction.AuthenticateHash
|| Action == IIPAuthPacketAction.AuthenticatePublicHash
|| Action == IIPAuthPacketAction.AuthenticatePrivateHash
|| Action == IIPAuthPacketAction.AuthenticatePublicPrivateHash)
if (Action == EpAuthPacketAction.AuthenticateHash
|| Action == EpAuthPacketAction.AuthenticatePublicHash
|| Action == EpAuthPacketAction.AuthenticatePrivateHash
|| Action == EpAuthPacketAction.AuthenticatePublicPrivateHash)
{
if (NotEnough(offset, ends, 3))
return -dataLengthNeeded;
HashAlgorithm = (IIPAuthPacketHashAlgorithm)data[offset++];
HashAlgorithm = (EpAuthPacketHashAlgorithm)data[offset++];
var hashLength = data.GetUInt16(offset, Endian.Little);
offset += 2;
@@ -241,13 +241,13 @@ public class IIPAuthPacket : Packet
offset += hashLength;
}
else if (Action == IIPAuthPacketAction.AuthenticatePrivateHashCert
|| Action == IIPAuthPacketAction.AuthenticatePublicPrivateHashCert)
else if (Action == EpAuthPacketAction.AuthenticatePrivateHashCert
|| Action == EpAuthPacketAction.AuthenticatePublicPrivateHashCert)
{
if (NotEnough(offset, ends, 3))
return -dataLengthNeeded;
HashAlgorithm = (IIPAuthPacketHashAlgorithm)data[offset++];
HashAlgorithm = (EpAuthPacketHashAlgorithm)data[offset++];
var hashLength = data.GetUInt16(offset, Endian.Little);
offset += 2;
@@ -272,7 +272,7 @@ public class IIPAuthPacket : Packet
offset += certLength;
}
else if (Action == IIPAuthPacketAction.IAuthPlain)
else if (Action == EpAuthPacketAction.IAuthPlain)
{
if (NotEnough(offset, ends, 5))
return -dataLengthNeeded;
@@ -288,7 +288,7 @@ public class IIPAuthPacket : Packet
offset += (uint)DataType.Value.TotalLength;
}
else if (Action == IIPAuthPacketAction.IAuthHashed)
else if (Action == EpAuthPacketAction.IAuthHashed)
{
if (NotEnough(offset, ends, 7))
return -dataLengthNeeded;
@@ -296,7 +296,7 @@ public class IIPAuthPacket : Packet
Reference = data.GetUInt32(offset, Endian.Little);
offset += 4;
HashAlgorithm = (IIPAuthPacketHashAlgorithm)data[offset++];
HashAlgorithm = (EpAuthPacketHashAlgorithm)data[offset++];
var cl = data.GetUInt16(offset, Endian.Little);
offset += 2;
@@ -309,7 +309,7 @@ public class IIPAuthPacket : Packet
offset += cl;
}
else if (Action == IIPAuthPacketAction.IAuthEncrypted)
else if (Action == EpAuthPacketAction.IAuthEncrypted)
{
if (NotEnough(offset, ends, 7))
return -dataLengthNeeded;
@@ -317,7 +317,7 @@ public class IIPAuthPacket : Packet
Reference = data.GetUInt32(offset, Endian.Little);
offset += 4;
PublicKeyAlgorithm = (IIPAuthPacketPublicKeyAlgorithm)data[offset++];
PublicKeyAlgorithm = (EpAuthPacketPublicKeyAlgorithm)data[offset++];
var cl = data.GetUInt16(offset, Endian.Little);
offset += 2;
@@ -330,11 +330,11 @@ public class IIPAuthPacket : Packet
offset += cl;
}
else if (Action == IIPAuthPacketAction.EstablishNewSession)
else if (Action == EpAuthPacketAction.EstablishNewSession)
{
// Nothing here
}
else if (Action == IIPAuthPacketAction.EstablishResumeSession)
else if (Action == EpAuthPacketAction.EstablishResumeSession)
{
if (NotEnough(offset, ends, 1))
return -dataLengthNeeded;
@@ -349,7 +349,7 @@ public class IIPAuthPacket : Packet
offset += sessionLength;
}
else if (Action == IIPAuthPacketAction.EncryptKeyExchange)
else if (Action == EpAuthPacketAction.EncryptKeyExchange)
{
if (NotEnough(offset, ends, 2))
return -dataLengthNeeded;
@@ -366,13 +366,13 @@ public class IIPAuthPacket : Packet
offset += keyLength;
}
else if (Action == IIPAuthPacketAction.RegisterEndToEndKey
|| Action == IIPAuthPacketAction.RegisterHomomorphic)
else if (Action == EpAuthPacketAction.RegisterEndToEndKey
|| Action == EpAuthPacketAction.RegisterHomomorphic)
{
if (NotEnough(offset, ends, 3))
return -dataLengthNeeded;
PublicKeyAlgorithm = (IIPAuthPacketPublicKeyAlgorithm)data[offset++];
PublicKeyAlgorithm = (EpAuthPacketPublicKeyAlgorithm)data[offset++];
var keyLength = data.GetUInt16(offset, Endian.Little);
@@ -387,14 +387,14 @@ public class IIPAuthPacket : Packet
}
}
else if (Command == IIPAuthPacketCommand.Event)
else if (Command == EpAuthPacketCommand.Event)
{
Event = (IIPAuthPacketEvent)data[offset++];
Event = (EpAuthPacketEvent)data[offset++];
if (Event == IIPAuthPacketEvent.ErrorTerminate
|| Event == IIPAuthPacketEvent.ErrorMustEncrypt
|| Event == IIPAuthPacketEvent.ErrorRetry)
if (Event == EpAuthPacketEvent.ErrorTerminate
|| Event == EpAuthPacketEvent.ErrorMustEncrypt
|| Event == EpAuthPacketEvent.ErrorRetry)
{
if (NotEnough(offset, ends, 3))
return -dataLengthNeeded;
@@ -411,7 +411,7 @@ public class IIPAuthPacket : Packet
offset += msgLength;
}
else if (Event == IIPAuthPacketEvent.IndicationEstablished)
else if (Event == EpAuthPacketEvent.IndicationEstablished)
{
if (NotEnough(offset, ends, 2))
return -dataLengthNeeded;
@@ -438,9 +438,9 @@ public class IIPAuthPacket : Packet
offset += accountLength;
}
else if (Event == IIPAuthPacketEvent.IAuthPlain
|| Event == IIPAuthPacketEvent.IAuthHashed
|| Event == IIPAuthPacketEvent.IAuthEncrypted)
else if (Event == EpAuthPacketEvent.IAuthPlain
|| Event == EpAuthPacketEvent.IAuthHashed
|| Event == EpAuthPacketEvent.IAuthEncrypted)
{
if (NotEnough(offset, ends, 1))
return -dataLengthNeeded;

View File

@@ -4,7 +4,7 @@ using System.Text;
namespace Esiur.Net.Packets
{
public enum IIPAuthPacketAcknowledge : byte
public enum EpAuthPacketAcknowledge : byte
{
NoAuthNoAuth = 0x40, // 0b01000000,
NoAuthCredentials = 0x44, // 0b01000100,

View File

@@ -4,7 +4,7 @@ using System.Text;
namespace Esiur.Net.Packets
{
public enum IIPAuthPacketAction : byte
public enum EpAuthPacketAction : byte
{
AuthenticateHash = 0x80,
AuthenticatePublicHash = 0x81,

View File

@@ -4,7 +4,7 @@ using System.Text;
namespace Esiur.Net.Packets
{
public enum IIPAuthPacketCommand : byte
public enum EpAuthPacketCommand : byte
{
Initialize = 0x0,
Acknowledge = 0x1,

View File

@@ -4,7 +4,7 @@ using System.Text;
namespace Esiur.Net.Packets
{
public enum IIPAuthPacketEvent : byte
public enum EpAuthPacketEvent : byte
{
ErrorTerminate = 0xC0,
ErrorMustEncrypt = 0xC1,

View File

@@ -4,7 +4,7 @@ using System.Text;
namespace Esiur.Net.Packets
{
public enum IIPAuthPacketHashAlgorithm
public enum EpAuthPacketHashAlgorithm
{
SHA256,
SHA3,

View File

@@ -4,7 +4,7 @@ using System.Text;
namespace Esiur.Net.Packets
{
public enum IIPAuthPacketHeader
public enum EpAuthPacketHeader
{
Version = 0,
Domain = 1,

View File

@@ -4,7 +4,7 @@ using System.Text;
namespace Esiur.Net.Packets
{
public enum IIPAuthPacketIAuthDestination
public enum EpAuthPacketIAuthDestination
{
Self = 0,
Device = 1, // logged in device

View File

@@ -4,7 +4,7 @@ using System.Text;
namespace Esiur.Net.Packets
{
public enum IIPAuthPacketIAuthFormat
public enum EpAuthPacketIAuthFormat
{
None = 0,
Number = 1,

View File

@@ -4,7 +4,7 @@ using System.Text;
namespace Esiur.Net.Packets
{
public enum IIPAuthPacketIAuthHeader : byte
public enum EpAuthPacketIAuthHeader : byte
{
Reference = 0,
Destination = 1,

View File

@@ -4,7 +4,7 @@ using System.Text;
namespace Esiur.Net.Packets
{
public enum IIPAuthPacketInitialize
public enum EpAuthPacketInitialize
{
NoAuthNoAuth = 0x0, //0b00000000,
NoAuthCredentials = 0x4, //0b00000100,

View File

@@ -4,7 +4,7 @@ using System.Text;
namespace Esiur.Net.Packets
{
public enum IIPAuthPacketPublicKeyAlgorithm
public enum EpAuthPacketPublicKeyAlgorithm
{
RSA = 0,
CKKS = 1,

View File

@@ -32,15 +32,15 @@ using System.Text;
using System.Threading.Tasks;
namespace Esiur.Net.Packets;
class IIPPacket : Packet
class EpPacket : Packet
{
public uint CallbackId { get; set; }
public IIPPacketMethod Method { get; set; }
public IIPPacketRequest Request { get; set; }
public IIPPacketReply Reply { get; set; }
public EpPacketMethod Method { get; set; }
public EpPacketRequest Request { get; set; }
public EpPacketReply Reply { get; set; }
public IIPPacketNotification Notification { get; set; }
public EpPacketNotification Notification { get; set; }
public byte Extension { get; set; }
@@ -59,10 +59,10 @@ class IIPPacket : Packet
{
return Method switch
{
IIPPacketMethod.Notification => $"{Method} {Notification}",
IIPPacketMethod.Request => $"{Method} {Request}",
IIPPacketMethod.Reply => $"{Method} {Reply}",
IIPPacketMethod.Extension => $"{Method} {Extension}",
EpPacketMethod.Notification => $"{Method} {Notification}",
EpPacketMethod.Request => $"{Method} {Request}",
EpPacketMethod.Reply => $"{Method} {Reply}",
EpPacketMethod.Extension => $"{Method} {Extension}",
_ => $"{Method}"
};
}
@@ -88,15 +88,15 @@ class IIPPacket : Packet
var hasDTU = (data[offset] & 0x20) == 0x20;
Method = (IIPPacketMethod)(data[offset] >> 6);
Method = (EpPacketMethod)(data[offset] >> 6);
if (Method == IIPPacketMethod.Notification)
if (Method == EpPacketMethod.Notification)
{
Notification = (IIPPacketNotification)(data[offset++] & 0x1f);
Notification = (EpPacketNotification)(data[offset++] & 0x1f);
}
else if (Method == IIPPacketMethod.Request)
else if (Method == EpPacketMethod.Request)
{
Request = (IIPPacketRequest)(data[offset++] & 0x1f);
Request = (EpPacketRequest)(data[offset++] & 0x1f);
if (NotEnough(offset, ends, 4))
return -dataLengthNeeded;
@@ -104,9 +104,9 @@ class IIPPacket : Packet
CallbackId = data.GetUInt32(offset, Endian.Little);
offset += 4;
}
else if (Method == IIPPacketMethod.Reply)
else if (Method == EpPacketMethod.Reply)
{
Reply = (IIPPacketReply)(data[offset++] & 0x1f);
Reply = (EpPacketReply)(data[offset++] & 0x1f);
if (NotEnough(offset, ends, 4))
return -dataLengthNeeded;
@@ -114,7 +114,7 @@ class IIPPacket : Packet
CallbackId = data.GetUInt32(offset, Endian.Little);
offset += 4;
}
else if (Method == IIPPacketMethod.Extension)
else if (Method == EpPacketMethod.Extension)
{
Extension = (byte)(data[offset++] & 0x1f);
}

View File

@@ -5,14 +5,14 @@ using System.Text;
namespace Esiur.Net.Packets;
struct IIPPacketAttachInfo
struct EpPacketAttachInfo
{
public string Link;
public ulong Age;
public byte[] Content;
public UUID TypeId;
public IIPPacketAttachInfo(UUID typeId, ulong age, string link, byte[] content)
public EpPacketAttachInfo(UUID typeId, ulong age, string link, byte[] content)
{
TypeId = typeId;
Age = age;

View File

@@ -4,7 +4,7 @@ using System.Text;
namespace Esiur.Net.Packets
{
public enum IIPPacketMethod : byte
public enum EpPacketMethod : byte
{
Notification = 0,
Request,

View File

@@ -4,7 +4,7 @@ using System.Text;
namespace Esiur.Net.Packets
{
public enum IIPPacketNotification : byte
public enum EpPacketNotification : byte
{
// Notification Invoke
PropertyModified = 0x0,

View File

@@ -4,7 +4,7 @@ using System.Text;
namespace Esiur.Net.Packets
{
public enum IIPPacketReply : byte
public enum EpPacketReply : byte
{
// Success
Completed = 0x0,

View File

@@ -4,7 +4,7 @@ using System.Text;
namespace Esiur.Net.Packets
{
public enum IIPPacketReport : byte
public enum EpPacketReport : byte
{
ManagementError,
ExecutionError,

View File

@@ -4,7 +4,7 @@ using System.Text;
namespace Esiur.Net.Packets
{
public enum IIPPacketRequest : byte
public enum EpPacketRequest : byte
{
// Request Invoke
InvokeFunction = 0x0,
@@ -13,11 +13,11 @@ namespace Esiur.Net.Packets
Unsubscribe = 0x3,
// Request Inquire
SchemaFromClassName = 0x8,
SchemaFromClassId = 0x9,
SchemaFromResourceId = 0xA,
TypeDefByName = 0x8,
TypeDefById = 0x9,
TypeDefByResourceId = 0xA,
Query = 0xB,
LinkSchemas = 0xC,
LinkTypeDefs = 0xC,
Token = 0xD,
GetResourceIdByLink = 0xE,