diff options
Diffstat (limited to 'Semestr 4/sieci/pracownia2/router/utils.h')
-rw-r--r-- | Semestr 4/sieci/pracownia2/router/utils.h | 23 |
1 files changed, 23 insertions, 0 deletions
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 <stdint.h> +#include <time.h> +#include <poll.h> +#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 |