tor_multipath_voip/src/net_tools.h
2019-03-27 16:24:39 +01:00

21 lines
700 B
C

#pragma once
#include <sys/socket.h>
#include <fcntl.h>
#include <unistd.h>
#include <netdb.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <sys/epoll.h>
#include <netinet/in.h>
#include <netinet/tcp.h>
int create_tcp_client(char* host, char* service);
int create_udp_client(char* host, char* service);
int create_tcp_server(char* host, char* service);
int create_udp_server(char* host, char* service);
int make_socket_non_blocking(int fd);
void add_fd_to_epoll(int epollfd, int fd, uint32_t flags);
void update_fd_epoll(int epollfd, int fd, uint32_t flags);
int read_entity(int fd, void* entity, int size);
void fill_buffer(size_t* written, char* dest, void *src, size_t n);