Fixed a bug in the build file, fixed functions signature for aes and ed25519, made visibility changes in packet and made the enums needed for destination

This commit is contained in:
Gu://em_ 2026-06-26 16:22:01 +02:00
parent 693d7cfe51
commit b67ae9ec59
5 changed files with 67 additions and 17 deletions

View file

@ -7,39 +7,39 @@ const ADDRESS_SIZE = 16;
///////////////// Enums
//
const IfacFlag = enum(u1) {
pub const IfacFlag = enum(u1) {
open = 0, // Packet for publically accessible interface
authenticated = 1, // Interface authentication is included in packet
};
const HeaderType = enum(u1) {
pub const HeaderType = enum(u1) {
type1 = 0, // One address field
type2 = 1, // Two address fields
};
const ContextFlag = enum(u1) {
pub const ContextFlag = enum(u1) {
// Meaning depends on packet context
unset = 0,
set = 1,
};
const PropagationType = enum(u1) {
pub const PropagationType = enum(u1) {
broadcast = 0,
transport = 1
};
const DestinationType = enum(u2) {
pub const DestinationType = enum(u2) {
single = 0b0,
group = 0b01,
plain = 0b10,
link = 0b11,
};
const PacketType = enum(u2) {
pub const PacketType = enum(u2) {
data = 0b0,
announce = 0b01,
link_request = 0b10,
proof = 0b11,
};
const PacketContext = enum(u8) {
pub const PacketContext = enum(u8) {
none = 0x00, // Generic data packet
resource = 0x01, // Packet is part of a resource
resource_adv = 0x02, // Packet is a resource advertisement
@ -66,7 +66,7 @@ const PacketContext = enum(u8) {
///////////////// Structs
//
const PacketHeader = packed struct {
pub const PacketHeader = packed struct {
ifac: IfacFlag,
header: HeaderType,
context: ContextFlag,
@ -76,7 +76,7 @@ const PacketHeader = packed struct {
hops: u8,
};
const Packet = struct {
pub const Packet = struct {
header: PacketHeader,
address1: [ADDRESS_SIZE]u8,
address2: [ADDRESS_SIZE]u8,