2019-10-28 19:49:25 +00:00
|
|
|
#define TAM_TITULO 128
|
|
|
|
#define TAM_CORPO 1001
|
|
|
|
#define TAM_NOME 100
|
2019-11-13 22:41:19 +00:00
|
|
|
#define TAM_SUB 32 //maximo nr de topics subscritos por utilizador
|
2019-11-13 19:03:13 +00:00
|
|
|
//tamanhos comunicacao cl<>sv
|
|
|
|
#define TAM_CMD 64
|
|
|
|
#define TAM_OPTS 128
|
|
|
|
#define TAM_RESP 512
|
2019-10-28 19:49:25 +00:00
|
|
|
|
2019-11-14 19:55:36 +00:00
|
|
|
typedef struct st_mensagem{
|
2019-10-28 19:49:25 +00:00
|
|
|
int id;
|
|
|
|
char titulo[TAM_TITULO];
|
|
|
|
char corpo[TAM_CORPO];
|
|
|
|
int duracao;
|
|
|
|
int time_added;
|
|
|
|
|
2019-11-23 23:22:02 +00:00
|
|
|
struct st_topic * topico;
|
|
|
|
struct st_mensagem * prox;
|
2019-11-13 19:03:13 +00:00
|
|
|
}mensagem;
|
2019-10-28 19:49:25 +00:00
|
|
|
|
2019-11-14 19:55:36 +00:00
|
|
|
typedef struct st_topic{
|
2019-10-28 19:49:25 +00:00
|
|
|
int id;
|
|
|
|
char nome[TAM_NOME];
|
2019-11-23 23:22:02 +00:00
|
|
|
struct st_mensagem * mensg;
|
|
|
|
struct st_topic * prox;
|
2019-10-28 19:49:25 +00:00
|
|
|
}topic;
|
2019-11-23 23:22:02 +00:00
|
|
|
|
|
|
|
|
2019-11-13 19:03:13 +00:00
|
|
|
//guardar clientes
|
2019-11-14 19:55:36 +00:00
|
|
|
typedef struct st_clients{
|
2019-11-13 19:03:13 +00:00
|
|
|
int pid;
|
|
|
|
char nome[TAM_NOME];
|
|
|
|
char fifostr[TAM_NOME];
|
2019-11-13 22:41:19 +00:00
|
|
|
int topics[TAM_SUB];
|
|
|
|
|
2019-11-23 23:22:02 +00:00
|
|
|
struct st_clients *prox;
|
2019-11-13 19:03:13 +00:00
|
|
|
}clients;
|
|
|
|
|
|
|
|
//estructura dados de cliente --> servidor
|
|
|
|
struct clmsg{
|
|
|
|
char titulo[TAM_TITULO];
|
|
|
|
char corpo[TAM_CORPO];
|
|
|
|
int duracao;
|
|
|
|
};
|
2019-11-14 19:55:36 +00:00
|
|
|
typedef struct st_cl2sv{
|
2019-11-13 19:03:13 +00:00
|
|
|
char fifostr[TAM_NOME];
|
|
|
|
//base
|
|
|
|
int pid;
|
|
|
|
char cmd[TAM_CMD];
|
|
|
|
char opts[TAM_OPTS];
|
|
|
|
int nopt;
|
|
|
|
//mensagem
|
|
|
|
struct clmsg msg;
|
|
|
|
}cl2sv;
|
|
|
|
|
|
|
|
//estructura de dados servidor --> cliente
|
2019-11-14 19:55:36 +00:00
|
|
|
typedef struct st_sv2cl{
|
2019-11-13 19:03:13 +00:00
|
|
|
int code;
|
|
|
|
char type[TAM_CMD];
|
|
|
|
char resp[TAM_RESP];
|
|
|
|
}sv2cl;
|