From a83aee989b06729078e6ba7c8448b30a3bab4e1d Mon Sep 17 00:00:00 2001 From: Jonas Gunz Date: Sat, 4 Apr 2020 02:25:21 +0200 Subject: Moved server to server.h/.c, added tests - All server functions have been moved to server.h/.c - main call run_dns_server() or run_test() depending on makefile target - Makefile target test is now available - test.h/.c provide unit tests --- src/server.h | 37 +++++++++++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) create mode 100644 src/server.h (limited to 'src/server.h') diff --git a/src/server.h b/src/server.h new file mode 100644 index 0000000..388dbae --- /dev/null +++ b/src/server.h @@ -0,0 +1,37 @@ +/* server.h + * (c) Jonas Gunz, 2020 + * License: MIT + * */ + +#pragma once + +#include +#include +#include +#include +#include + +#include +#include +#include + +#include + +#include + +#include "dns.h" +#include "log.h" + +#define UDP_BUFFER_LEN 512 + +static int sock_server; + +void run_dns_server ( void ); + +int handle_connection ( int _socket, + struct sockaddr_in *sockaddr_client, + socklen_t sockaddr_client_len, + char* _buffer, + int _bufflen ); + +void signal_term ( ); -- cgit v1.2.3