-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathserver.h
More file actions
72 lines (63 loc) · 1.81 KB
/
Copy pathserver.h
File metadata and controls
72 lines (63 loc) · 1.81 KB
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
70
71
72
#ifndef _SERVER_H_
#define _SERVER_H_
#include <unistd.h>
#include <stdlib.h>
#include <stdarg.h>
#include <stdio.h>
#include <string.h>
#include <syslog.h>
#include <limits.h>
#include <errno.h>
#include <ctype.h>
#include <fcntl.h>
#include <netdb.h>
#include <dirent.h>
#include <time.h>
#include <netdb.h>
#include <sys/epoll.h>
#include <sys/param.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <sys/wait.h>
#include <sys/socket.h>
#include <netinet/in.h>
#include <netinet/tcp.h>
#include <arpa/inet.h>
#include <getopt.h>
/* constant define */
#define SERVER_NAME "httpd_lisenlin/1.0.0"
#define VERSION "1.0.0 http_server"
#define BUFFER_SIZE 8192
#define REQUEST_MAX_SIZE 10240
/* configure constant */
#define IS_DEBUG 1 /* Is open debug mode */
#define PORT 8099 /* Server listen port */
#define DEFAULT_MAX_CLIENT 100 /* Max connection requests */
#define DEFAULT_DOCUMENT_ROOT "./" /* Web document root directory */
#define DEFAULT_DIRECTORY_INDEX "index.html" /* Directory default index file name */
#define DEFAULT_LOG_PATH "/tmp/tmhttpd.log" /* Access log path */
#define BACKLOG 20 /*最大监听数*/
#define MAX_PATH 512
#define RC_SUCC 0
#define RC_FAIL -1
/* data struct define */
struct st_request_info
{
char *szMethod;
char *szPathInfo;
char *szQuery;
char *szProtocal;
char *szPath;
char *szFile;
char *szPhysicalPath;
};
typedef struct __connection
{
int iSocketfd;
size_t iReadLen;
size_t iSendLen;
int iCmdFlag;
int iDataFlag;
char szBuf[1024];
} TConn;
#endif