-
Notifications
You must be signed in to change notification settings - Fork 0
/
servidor_http.h
30 lines (25 loc) · 900 Bytes
/
servidor_http.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
#ifndef __SERVIDOR_HTTP_H__
#define __SERVIDOR_HTTP_H__
/* Estas funciones se han definido como macros por cuestiones de sencillez y
de rendimiento. También podrían ser funciones normales con un inline */
#define set_max_fd(__max_fd, __new_fd) if (__max_fd < __new_fd) __max_fd = __new_fd
#define decrementa_max_fd(__max_fd, __closed_fd) if (__max_fd == __closed_fd) --__max_fd
/* Constantes */
#define PUERTO 5432
#define TAM_BUFFER 1024
#define WHITELIST_PATH "whitelist.txt"
/* Estados */
#define ESTADO_INICIAL -1
#define GET_RECIBIDO 1
#define METODO_DESC_RECIBIDO 2
#define RECURSO_CONOCIDO 3
#define RECURSO_DESC 4
#define ERROR_INTERNO 5
#define FIN 0
/* Funciones auxiliares */
ssize_t write_n(int desc, void *buf, size_t bytes);
ssize_t read_n(int desc, void *buf, size_t bytes);
void maneja_int(int s);
void maq_estados(int desc);
void enviar_recurso(char rec[], int desc);
#endif