-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathserver_helper.h
More file actions
45 lines (35 loc) · 822 Bytes
/
server_helper.h
File metadata and controls
45 lines (35 loc) · 822 Bytes
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
/* Header file for helper functions for server.c */
#include <sys/select.h>
#include <sys/types.h>
#include <sys/socket.h>
#include <netinet/in.h>
#include <arpa/inet.h>
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <errno.h>
#include <string.h>
#include <pthread.h>
#include <poll.h>
/**
* struct to transfer data b/w threads
*/
typedef struct Packet packet;
struct Packet
{
struct sockaddr_in client_addr;
int fd;
int quit_flag;
int is_Celsius;
pthread_mutex_t* lock;
char ctrl_signal;
int requesting;
};
void* handle_connection(void* p);
int is_get(char* request);
char* get_path(char* request);
char* get_post(char* request);
char parse_post(char* post);
char* read_html_file(char* filename);
void* close_server(void* p);
int get_filetype(char* filename);