-
Notifications
You must be signed in to change notification settings - Fork 0
/
expressc.h
45 lines (37 loc) · 880 Bytes
/
expressc.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
#ifndef EXPRESSC
#define EXPRESSC
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include <sys/types.h>
#include <sys/socket.h>
#include <netinet/in.h>
#include <errno.h>
#define BUFFER_SIZE 10196
#define CHUNK_SIZE 512
#define N 1000
struct Header{
char name[50];
char data[50];
};
struct Request{
int sockfd;
char type[8];
char address[50];
struct Header headers[50];
char body[500];
};
struct Callback{
char address[100];
void (*func_pointer)(struct Request *);
};
void expressc_server_initialise();
static void error(char *);
void expressc_add_get_handler(char *, void (*)(struct Request *));
void expressc_add_post_handler(char *, void (*)(struct Request *));
int expressc_send(struct Request, char *);
int expressc_send_file(struct Request, char *);
static void process_request(int);
void expressc_server_start(int);
#endif