26 lines
522 B
C
26 lines
522 B
C
#ifndef SERVER_H
|
|
#define SERVER_H
|
|
|
|
#include <arpa/inet.h>
|
|
#include <errno.h>
|
|
#include <stdio.h>
|
|
#include <string.h>
|
|
#include <sys/socket.h>
|
|
#include <unistd.h>
|
|
|
|
#define BUFFER_SIZE 1024
|
|
|
|
// This code has been borrowed from this github repo https://bruinsslot.jp/post/simple-http-webserver-in-c/ and modified by me.
|
|
|
|
struct setup {
|
|
struct sockaddr_in host_addr;
|
|
struct sockaddr_in client_addr;
|
|
int sockfd;
|
|
int host_addrlen;
|
|
int client_addrlen;
|
|
char *response;
|
|
};
|
|
|
|
void serve(struct setup s);
|
|
|
|
#endif |