-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathhttpserver.h
More file actions
43 lines (35 loc) · 962 Bytes
/
httpserver.h
File metadata and controls
43 lines (35 loc) · 962 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
#include "rwlock.h"
#pragma once
typedef struct KeyValue {
char key[130];
char value[130];
} KeyValue;
typedef struct HeaderFieldList {
int numPairs;
KeyValue *pairs;
int contentLength;
int requestID;
} HeaderFieldList;
typedef struct RequestLine {
char method[10];
char uri[66];
char version[10];
} RequestLine;
typedef struct Request {
RequestLine requestLine;
HeaderFieldList headerFieldList;
char leftOverMessageBody[3000];
int numBytesLeftOverMessageBody;
} Request;
// --------------------------URI LOCK ARRAY FUNCTIONS/STRUCT-----------------------------
typedef struct rwlock_array_elem {
rwlock_t *read_write_lock;
char uri[1000];
struct rwlock_array_elem *next;
} rwlock_array_elem_t;
typedef struct rwlock_array {
rwlock_array_elem_t *head;
rwlock_array_elem_t *tail;
int length;
} rwlock_array_t;
rwlock_array_t *rwlock_array_append(rwlock_array_t *arr, char *uri);