Make structs to be anonymous

This commit is contained in:
Night Kaly 2024-09-27 23:53:03 +01:00
parent f5ace440b2
commit c37e48007e
Signed by: night0721
GPG key ID: 957D67B8DB7A119B
5 changed files with 9 additions and 9 deletions

View file

@ -3,7 +3,7 @@
#define TABLE_SIZE 100
typedef struct client {
typedef struct {
int id;
char name[32];
//pthread_t thread;

View file

@ -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;

View file

@ -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;

View file

@ -5,12 +5,12 @@
#include <stdbool.h>
#include <stddef.h>
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;

View file

@ -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 */