From c37e48007e377e3b94904d52645c30fe19ab198f Mon Sep 17 00:00:00 2001 From: night0721 Date: Fri, 27 Sep 2024 23:53:03 +0100 Subject: [PATCH] Make structs to be anonymous --- include/ht.h | 2 +- include/key.h | 4 ++-- include/packet.h | 4 ++-- include/zen/user.h | 4 ++-- include/zmr/zmr.h | 4 ++-- 5 files changed, 9 insertions(+), 9 deletions(-) diff --git a/include/ht.h b/include/ht.h index 5eaad5f..1da8ebb 100644 --- a/include/ht.h +++ b/include/ht.h @@ -3,7 +3,7 @@ #define TABLE_SIZE 100 -typedef struct client { +typedef struct { int id; char name[32]; //pthread_t thread; diff --git a/include/key.h b/include/key.h index 4167add..cee5259 100644 --- a/include/key.h +++ b/include/key.h @@ -16,7 +16,7 @@ #define SK_SIZE SK_ED25519_SIZE #define SHARED_KEY_SIZE crypto_kx_SESSIONKEYBYTES -typedef struct public_key { +typedef struct { uint8_t raw[PK_ED25519_SIZE]; uint8_t username[MAX_NAME]; time_t creation; @@ -24,7 +24,7 @@ typedef struct public_key { uint8_t full[PK_SIZE]; } public_key; -typedef struct keypair_t { +typedef struct { public_key pk; uint8_t sk[SK_SIZE]; } keypair_t; diff --git a/include/packet.h b/include/packet.h index 9b68f99..6475114 100644 --- a/include/packet.h +++ b/include/packet.h @@ -60,7 +60,7 @@ #define ADDITIONAL_SIZE crypto_box_MACBYTES /* 16 */ #define MAX_MESSAGE_LENGTH MAX_DATA_LENGTH - MAX_NAME * 2 - NONCE_SIZE -typedef struct packet_t { +typedef struct { uint8_t status; uint8_t type; uint32_t length; @@ -68,7 +68,7 @@ typedef struct packet_t { uint8_t *signature; } packet_t; -typedef struct message_t { +typedef struct { uint8_t author[MAX_NAME]; uint8_t recipient[MAX_NAME]; uint8_t *content; diff --git a/include/zen/user.h b/include/zen/user.h index 9b82657..c03ea09 100644 --- a/include/zen/user.h +++ b/include/zen/user.h @@ -5,12 +5,12 @@ #include #include -typedef struct user { +typedef struct { uint8_t name[MAX_NAME]; int color; } user; -typedef struct ArrayList { +typedef struct { size_t length; size_t capacity; user *items; diff --git a/include/zmr/zmr.h b/include/zmr/zmr.h index 7fafc93..ffb7745 100644 --- a/include/zmr/zmr.h +++ b/include/zmr/zmr.h @@ -4,13 +4,13 @@ #define MAX_CONNECTION_QUEUE 128 /* for listen() */ #define MAX_EVENTS 64 /* Max events can be returned simulataneouly by epoll */ -typedef struct client_t { +typedef struct { int fd; /* File descriptor for client socket */ uint8_t *shared_key; char username[MAX_NAME]; /* Username of client */ } client_t; -typedef struct thread_t { +typedef struct { int epoll_fd; /* epoll instance for each thread */ pthread_t thread; /* POSIX thread */ int num_clients; /* Number of active clients in thread */