removed ERR_OK
This commit is contained in:
parent
6055103cdc
commit
f3c66ce449
3 changed files with 26 additions and 27 deletions
1
.gitignore
vendored
1
.gitignore
vendored
|
|
@ -1,4 +1,5 @@
|
||||||
**/*.o
|
**/*.o
|
||||||
|
**/*.db
|
||||||
**/*.swp
|
**/*.swp
|
||||||
**/*.pem
|
**/*.pem
|
||||||
asfur
|
asfur
|
||||||
|
|
|
||||||
25
PROTOCOL
25
PROTOCOL
|
|
@ -41,19 +41,18 @@ PACKET_ERROR (0)
|
||||||
[u8 code]
|
[u8 code]
|
||||||
|
|
||||||
Error codes:
|
Error codes:
|
||||||
0 = ERR_OK (no error)
|
0 = ERR_UNKNOWN (unknown error)
|
||||||
1 = ERR_UNKNOWN (unknown error)
|
1 = ERR_INVALID_PACKET (malformed packet)
|
||||||
2 = ERR_INVALID_PACKET (malformed packet)
|
2 = ERR_NOT_AUTHENTICATED (action requires authentication)
|
||||||
3 = ERR_NOT_AUTHENTICATED (action requires authentication)
|
3 = ERR_ALREADY_REGISTERED (username already taken)
|
||||||
4 = ERR_ALREADY_REGISTERED (username already taken)
|
4 = ERR_INVALID_CREDENTIALS (wrong username/password)
|
||||||
5 = ERR_INVALID_CREDENTIALS (wrong username/password)
|
5 = ERR_REGISTRATION_DISABLED (server disabled registration)
|
||||||
6 = ERR_REGISTRATION_DISABLED (server disabled registration)
|
6 = ERR_DATABASE (internal database error)
|
||||||
7 = ERR_DATABASE (internal database error)
|
7 = ERR_USER_NOT_FOUND (target user does not exist)
|
||||||
8 = ERR_USER_NOT_FOUND (target user does not exist)
|
8 = ERR_ACCESS_DENIED (not allowed to access resource)
|
||||||
9 = ERR_ACCESS_DENIED (not allowed to access resource)
|
9 = ERR_ROOM_NOT_FOUND (room does not exist)
|
||||||
10 = ERR_ROOM_NOT_FOUND (room does not exist)
|
10 = ERR_ROOM_NAME_TAKEN (room name already in use)
|
||||||
11 = ERR_ROOM_NAME_TAKEN (room name already in use)
|
11 = ERR_NOT_ROOM_OWNER (action requires room ownership)
|
||||||
12 = ERR_NOT_ROOM_OWNER (action requires room ownership)
|
|
||||||
|
|
||||||
PACKET_REGISTER (1)
|
PACKET_REGISTER (1)
|
||||||
Register a new user account.
|
Register a new user account.
|
||||||
|
|
|
||||||
27
network.h
27
network.h
|
|
@ -23,25 +23,24 @@ typedef enum {
|
||||||
} packet_type;
|
} packet_type;
|
||||||
|
|
||||||
typedef enum {
|
typedef enum {
|
||||||
ERR_OK = 0,
|
ERR_UNKNOWN = 0,
|
||||||
ERR_UNKNOWN = 1,
|
ERR_INVALID_PACKET = 1,
|
||||||
ERR_INVALID_PACKET = 2,
|
ERR_NOT_AUTHENTICATED = 2,
|
||||||
ERR_NOT_AUTHENTICATED = 3,
|
ERR_ALREADY_REGISTERED = 3,
|
||||||
ERR_ALREADY_REGISTERED = 4,
|
ERR_INVALID_CREDENTIALS = 4,
|
||||||
ERR_INVALID_CREDENTIALS = 5,
|
ERR_REGISTRATION_DISABLED = 5,
|
||||||
ERR_REGISTRATION_DISABLED = 6,
|
ERR_DATABASE = 5,
|
||||||
ERR_DATABASE = 7,
|
ERR_USER_NOT_FOUND = 7,
|
||||||
ERR_USER_NOT_FOUND = 8,
|
ERR_ACCESS_DENIED = 8,
|
||||||
ERR_ACCESS_DENIED = 9,
|
ERR_ROOM_NOT_FOUND = 9,
|
||||||
ERR_ROOM_NOT_FOUND = 10,
|
ERR_ROOM_NAME_TAKEN = 10,
|
||||||
ERR_ROOM_NAME_TAKEN = 11,
|
ERR_NOT_ROOM_OWNER = 11
|
||||||
ERR_NOT_ROOM_OWNER = 12
|
|
||||||
} error_code;
|
} error_code;
|
||||||
|
|
||||||
struct packet_header {
|
struct packet_header {
|
||||||
uint16_t size;
|
uint16_t size;
|
||||||
uint8_t type;
|
uint8_t type;
|
||||||
};
|
} __attribute__((packed));
|
||||||
|
|
||||||
struct packet_register {
|
struct packet_register {
|
||||||
char username[20];
|
char username[20];
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue