From 4167f191cec04314082896ca4618663e97b4f4f1 Mon Sep 17 00:00:00 2001 From: Franciszek Malinka Date: Sun, 18 Apr 2021 10:26:08 +0200 Subject: Router modularity --- Semestr 4/sieci/pracownia2/router/utils.h | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100644 Semestr 4/sieci/pracownia2/router/utils.h (limited to 'Semestr 4/sieci/pracownia2/router/utils.h') diff --git a/Semestr 4/sieci/pracownia2/router/utils.h b/Semestr 4/sieci/pracownia2/router/utils.h new file mode 100644 index 0000000..3d36aed --- /dev/null +++ b/Semestr 4/sieci/pracownia2/router/utils.h @@ -0,0 +1,23 @@ +#ifndef UTILS_H +#define UTILS_H +#define UTILS_H + +#include +#include +#include +#include "router_addr.h" + +#define NS_TO_MS(X) ((long)(X) / (long)1000000) +#define S_TO_MS(X) ((long)(X) * (long)1000) + +int get_socket(); + +void bind_to_port(int sockfd, uint16_t port); + +long get_time_interval(struct timespec start, struct timespec finish); + +int poll_socket_modify_timeout(int sockfd, int *timeout); + +void recv_and_print(int sockfd, int networks_number, struct router_addr *networks); + +#endif \ No newline at end of file -- cgit v1.2.3