tor_multipath_voip/src/net_tools.h

22 lines
700 B
C
Raw Normal View History

2019-02-08 16:37:02 +00:00
#pragma once
2019-02-08 13:28:39 +00:00
#include <sys/socket.h>
2019-02-11 15:23:20 +00:00
#include <fcntl.h>
2019-02-08 13:28:39 +00:00
#include <unistd.h>
#include <netdb.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
2019-02-11 21:40:00 +00:00
#include <sys/epoll.h>
2019-03-27 15:24:39 +00:00
#include <netinet/in.h>
#include <netinet/tcp.h>
2019-02-08 13:28:39 +00:00
int create_tcp_client(char* host, char* service);
2019-02-11 22:40:37 +00:00
int create_udp_client(char* host, char* service);
2019-02-22 15:01:22 +00:00
int create_tcp_server(char* host, char* service);
int create_udp_server(char* host, char* service);
2019-02-11 15:23:20 +00:00
int make_socket_non_blocking(int fd);
2019-02-12 16:12:20 +00:00
void add_fd_to_epoll(int epollfd, int fd, uint32_t flags);
2019-03-22 16:14:35 +00:00
void update_fd_epoll(int epollfd, int fd, uint32_t flags);
2019-02-08 13:28:39 +00:00
int read_entity(int fd, void* entity, int size);
void fill_buffer(size_t* written, char* dest, void *src, size_t n);