removed ERR_OK

This commit is contained in:
Lorenzo Torres 2026-01-08 19:18:33 +01:00
parent 6055103cdc
commit f3c66ce449
3 changed files with 26 additions and 27 deletions

1
.gitignore vendored
View file

@ -1,4 +1,5 @@
**/*.o
**/*.db
**/*.swp
**/*.pem
asfur

View file

@ -41,19 +41,18 @@ PACKET_ERROR (0)
[u8 code]
Error codes:
0 = ERR_OK (no error)
1 = ERR_UNKNOWN (unknown error)
2 = ERR_INVALID_PACKET (malformed packet)
3 = ERR_NOT_AUTHENTICATED (action requires authentication)
4 = ERR_ALREADY_REGISTERED (username already taken)
5 = ERR_INVALID_CREDENTIALS (wrong username/password)
6 = ERR_REGISTRATION_DISABLED (server disabled registration)
7 = ERR_DATABASE (internal database error)
8 = ERR_USER_NOT_FOUND (target user does not exist)
9 = ERR_ACCESS_DENIED (not allowed to access resource)
10 = ERR_ROOM_NOT_FOUND (room does not exist)
11 = ERR_ROOM_NAME_TAKEN (room name already in use)
12 = ERR_NOT_ROOM_OWNER (action requires room ownership)
0 = ERR_UNKNOWN (unknown error)
1 = ERR_INVALID_PACKET (malformed packet)
2 = ERR_NOT_AUTHENTICATED (action requires authentication)
3 = ERR_ALREADY_REGISTERED (username already taken)
4 = ERR_INVALID_CREDENTIALS (wrong username/password)
5 = ERR_REGISTRATION_DISABLED (server disabled registration)
6 = ERR_DATABASE (internal database error)
7 = ERR_USER_NOT_FOUND (target user does not exist)
8 = ERR_ACCESS_DENIED (not allowed to access resource)
9 = ERR_ROOM_NOT_FOUND (room does not exist)
10 = ERR_ROOM_NAME_TAKEN (room name already in use)
11 = ERR_NOT_ROOM_OWNER (action requires room ownership)
PACKET_REGISTER (1)
Register a new user account.

View file

@ -23,25 +23,24 @@ typedef enum {
} packet_type;
typedef enum {
ERR_OK = 0,
ERR_UNKNOWN = 1,
ERR_INVALID_PACKET = 2,
ERR_NOT_AUTHENTICATED = 3,
ERR_ALREADY_REGISTERED = 4,
ERR_INVALID_CREDENTIALS = 5,
ERR_REGISTRATION_DISABLED = 6,
ERR_DATABASE = 7,
ERR_USER_NOT_FOUND = 8,
ERR_ACCESS_DENIED = 9,
ERR_ROOM_NOT_FOUND = 10,
ERR_ROOM_NAME_TAKEN = 11,
ERR_NOT_ROOM_OWNER = 12
ERR_UNKNOWN = 0,
ERR_INVALID_PACKET = 1,
ERR_NOT_AUTHENTICATED = 2,
ERR_ALREADY_REGISTERED = 3,
ERR_INVALID_CREDENTIALS = 4,
ERR_REGISTRATION_DISABLED = 5,
ERR_DATABASE = 5,
ERR_USER_NOT_FOUND = 7,
ERR_ACCESS_DENIED = 8,
ERR_ROOM_NOT_FOUND = 9,
ERR_ROOM_NAME_TAKEN = 10,
ERR_NOT_ROOM_OWNER = 11
} error_code;
struct packet_header {
uint16_t size;
uint8_t type;
};
} __attribute__((packed));
struct packet_register {
char username[20];