-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathutils.h
55 lines (44 loc) · 963 Bytes
/
utils.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
/*
* conexiones.h
*
* Created on: 3 mar. 2019
* Author: utnso
*/
#ifndef CONEXIONES_H_
#define CONEXIONES_H_
#include<stdio.h>
#include<stdlib.h>
#include<sys/socket.h>
#include<unistd.h>
#include<netdb.h>
#include<commons/log.h>
#include<commons/collections/list.h>
#include<string.h>
#include<pthread.h>
#define IP "127.0.0.1"
#define PUERTO "4444"
typedef enum
{
MENSAJE=1
}op_code;
typedef struct
{
int size;
void* stream;
} t_buffer;
typedef struct
{
op_code codigo_operacion;
t_buffer* buffer;
} t_paquete;
pthread_t thread;
void* recibir_buffer(int*, int);
void iniciar_servidor(void);
void esperar_cliente(int);
void* recibir_mensaje(int socket_cliente, int* size);
int recibir_operacion(int);
void process_request(int cod_op, int cliente_fd);
void serve_client(int *socket);
void* serializar_paquete(t_paquete* paquete, int bytes);
void devolver_mensaje(void* payload, int size, int socket_cliente);
#endif /* CONEXIONES_H_ */