Rewrite in C. Simple TCP listener.
This commit is contained in:
36
src/httpserver.h
Normal file
36
src/httpserver.h
Normal file
@@ -0,0 +1,36 @@
|
||||
//
|
||||
// Created by nazar on 12.09.2025.
|
||||
//
|
||||
// https://datatracker.ietf.org/doc/html/rfc9112#name-message
|
||||
|
||||
#ifndef SIMPLEHTTPSERVER_H
|
||||
#define SIMPLEHTTPSERVER_H
|
||||
|
||||
#include <netdb.h>
|
||||
#include <netinet/in.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <sys/socket.h>
|
||||
#include <sys/types.h>
|
||||
#include <unistd.h>
|
||||
#include <arpa/inet.h>
|
||||
|
||||
struct HttpRequest
|
||||
{
|
||||
|
||||
};
|
||||
|
||||
struct HttpResponse
|
||||
{
|
||||
|
||||
};
|
||||
|
||||
struct HttpServer
|
||||
{
|
||||
struct HttpResponse* (*handleRequest)(struct HttpRequest* request);
|
||||
};
|
||||
|
||||
void start_http_server(struct HttpServer* http_server, const char *addr, short port);
|
||||
void process_conn(struct HttpServer* http_server, int server_fd, struct sockaddr* address, socklen_t* addr_len);
|
||||
|
||||
#endif //SIMPLEHTTPSERVER_H
|
||||
Reference in New Issue
Block a user