-
Notifications
You must be signed in to change notification settings - Fork 0
/
config.h
69 lines (57 loc) · 1.14 KB
/
config.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
56
57
58
59
60
61
62
63
64
65
66
67
68
69
//
// Created by lemito on 5/15/24.
//
#ifndef CWEBSERVER_CONFIG_H
#define CWEBSERVER_CONFIG_H
#ifdef __cplusplus
extern "C"
{
#endif
// standard includes
#ifdef _POSIX_C_SOURCE
#include <sys/socket.h>
#include <unistd.h>
#elif defined(WIN32)
#include <winsock2.h>
#endif
#include <string.h>
#include <time.h>
#include <fcntl.h>
#include <signal.h>
#include <stdio.h>
#include <stdlib.h>
// constants
#define PORT 8080
#define BUFFER_SIZE 4096
#define HTTP_OK 200
#define HTTP_NOT_FOUND 404
#define HTTP_BAD_REQUEST 400
#define HTTP_NOT_ALLOWED 405
#define STATUS_TEXT_OK "OK"
#define STATUS_TEXT_NOT_FOUND "Not Found"
#define STATUS_TEXT_BAD_REQUEST "Bad Request"
#define STATUS_TEXT_NOT_ALLOWED "Method Not Allowed"
#define JPEG "image/jpeg"
#define JS "text/javascript"
#define CSS "text/css"
// macros
#define FREE_AND_NULL(p) \
do \
{ \
free(p); \
(p) = NULL; \
} while (0)
#define BOOL char
#define TRUE 1
#define FALSE 0
// enums
typedef enum HTTP_METHODS {
GET,
POST,
HttpDelete,
PUT
} HTTP_METHODS;
#ifdef __cplusplus
}
#endif
#endif //CWEBSERVER_CONFIG_H