forked from MysteryOfPanda/leactor
-
Notifications
You must be signed in to change notification settings - Fork 0
/
http.h
80 lines (65 loc) · 1.64 KB
/
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
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
73
74
75
76
77
78
79
80
#include "event_lea.h"
#include <features.h>
#include <unistd.h>
#include <sys/socket.h>
#include <stdio.h>
#include <stdlib.h>
#include <sys/types.h>
#include <string.h>
#include <netdb.h>
#include <errno.h>
#include <fcntl.h>
#include <signal.h>
#include <sys/stat.h>
#include <sys/eventfd.h>
#define DEFAULT_HEADER_BUFFER_SIZE (1024)
typedef struct conf {
int efd_distributor;
int pfd[2];
} conf_t;
typedef struct request {
} request_t;
typedef struct connection {
int fd;
struct sockaddr peer_addr;
char *peer_port;
func_t callback;
void *conn_callback_arg;
func_t close_callback;
void *conn_callback_close_arg;
struct event *ev;
struct lt_memory_pool *request_pool;
struct lt_memory_pool request_pool_manager;
struct request *request_list;
func_t conn_handler;
struct connection *next;
int timeout;
int close;
//buffer
//header_size
//body_size
//state
} connection_t;
typedef struct listening {
int fd;
// struct addrinfo local_addr;
char *bind_addr;
char *bind_port;
struct sockaddr saddr;
struct lt_memory_pool *connection_pool;
struct lt_memory_pool *connection_pool_manager;
struct connection listen_conn;
struct connection *client_list;
struct connection *downstream_list;;
struct event *ev;
struct lt_memory_pool *buf_pool;
struct lt_memory_pool buf_pool_manager;
} listening_t;
typedef struct http {
struct base *base;
struct connection *connection_list;
struct listening listen;
int core_amount;
} http_t;
void ignore_sigpipe(void);
http_t *http_master_new(base_t *, conf_t *);