Files
sesimos/src/server.h
2022-12-29 17:02:57 +01:00

46 lines
988 B
C

/**
* sesimos - secure, simple, modern web server
* @brief Main executable (header file)
* @file src/server.h
* @author Lorenz Stechauner
* @date 2020-12-03
*/
#ifndef SESIMOS_SERVER_H
#define SESIMOS_SERVER_H
#include "lib/sock.h"
#include <sys/time.h>
#include <maxminddb.h>
#include <signal.h>
#include <arpa/inet.h>
#define NUM_SOCKETS 2
#define LISTEN_BACKLOG 16
#define REQ_PER_CONNECTION 200
#define CLIENT_TIMEOUT 3600
#define SERVER_TIMEOUT_INIT 4
#define SERVER_TIMEOUT 3600
#define MAX_CLIENTS 4096
#define CNX_HANDLER_WORKERS 8
#define REQ_HANDLER_WORKERS 16
typedef struct {
sock socket;
int req_num;
char *addr, *s_addr;
unsigned char in_use: 1, s_keep_alive:1, c_keep_alive:1;
char cc[3], host[256];
char req_host[256];
char log_prefix[512];
char _c_addr[INET6_ADDRSTRLEN + 1], _s_addr[INET6_ADDRSTRLEN + 1];
struct timespec begin, end;
} client_ctx_t;
extern volatile sig_atomic_t server_alive;
#endif //SESIMOS_SERVER_H