-
Notifications
You must be signed in to change notification settings - Fork 0
/
Request.h
43 lines (33 loc) · 796 Bytes
/
Request.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
#ifndef _REQUEST_317_H
#define _REQUEST_317_H
#include <sys/socket.h>
#include <string.h>
#include <netdb.h>
#include <netinet/in.h>
#include <arpa/inet.h>
#include <unistd.h>
#include <stdio.h>
#include <stdlib.h>
#define BUFLEN 1024
typedef struct
{
char absolute_url[BUFLEN];
char server_host[BUFLEN];
char server_url[BUFLEN];
char server_port[BUFLEN];
char formatted_request[BUFLEN];
} Request;
typedef struct
{
int socket_descriptor;
Request r;
FILE* blacklist;
} Thread_Args;
void parse_request(Request* r, char* buf, int buf_len);
void* process_request(void* args);
// get sockaddr, IPv4 or IPv6:
void *get_in_addr(struct sockaddr *sa);
int check_blacklist(char* host, FILE* blacklist);
/* Reset Request Information */
void reset_request(Request* request);
#endif