Tchatator413
TripEnArvor instant messaging protocol - JSON-based
Loading...
Searching...
No Matches
types.h
Go to the documentation of this file.
1
5
6#ifndef TYPES_H
7#define TYPES_H
8
9#include "util.h"
10#include "uuid.h"
11#include <limits.h>
12#include <stdint.h>
13#include <time.h>
14
18typedef int64_t token_t;
20typedef int32_t page_number_t;
22typedef int32_t serial_t;
23
25#define EMAIL_LENGTH 319
27#define PSEUDO_LENGTH 255
28
35
37typedef enum ATTR_FLAG_ENUM {
38 role_admin = 1 << 0,
40 role_membre = 1 << 1,
41 role_pro = 1 << 2,
42 role_all = role_admin | role_membre | role_pro,
43 max_role = role_all,
45
54
61typedef struct {
62 char *content;
63 time_t sent_at;
64 int32_t read_age, edited_age, deleted_age;
65 serial_t id, user_id_sender, user_id_recipient;
66} msg_t;
67
68#endif // TYPES_H
Represents a message in the chat application.
Definition types.h:61
Information about the identity of an user.
Definition types.h:47
role_flags_t role
The roles of the user.
Definition types.h:49
serial_t id
The ID of the user or 0 for the administrator.
Definition types.h:52
Version 4 UUID.
Definition uuid.h:15
user_kind_t
The kind of an user.
Definition types.h:30
@ user_kind_pro_public
Public professionnal.
Definition types.h:33
@ user_kind_member
Member (client).
Definition types.h:31
@ user_kind_pro_prive
Private professionnal.
Definition types.h:32
uuid4_t api_key_t
An user API key.
Definition types.h:16
int32_t serial_t
A PosrgreSQL SERIAL primary key value starting at 1. (1..2^31-1)
Definition types.h:22
enum ATTR_FLAG_ENUM role_flags_t
A bit flags enumeration representing the roles of an user.
int64_t token_t
A session token.
Definition types.h:18
int32_t page_number_t
A page number (1..2^31-1)
Definition types.h:20
ATTR_FLAG_ENUM
A bit flags enumeration representing the roles of an user.
Definition types.h:37
@ role_admin
Administrator role.
Definition types.h:38
@ min_role
Smallest value of the enumeration.
Definition types.h:39
@ max_role
Largest value of the enumeration.
Definition types.h:43
@ role_membre
Member role.
Definition types.h:40
@ role_pro
Professional role.
Definition types.h:41
General utilities - Standalone hedaer.
UUID library - Interface.