DiplomaWork/dsvpn-master/include/os.h

48 lines
1.3 KiB
C
Raw Permalink Normal View History

2022-05-13 18:52:39 +00:00
/*
Organization: Technical University of Kosice (TUKE),
Department: Department of Electronics and Multimedia Telecommunications (DEMT/KEMT),
Faculties: Faculty of Electrical Engineering and Informatics (FEI),
Feld of study: Informatics,
Study program: Computer Networks,
School year: 4., Ing., 2021/2022
Author of corrections: Marek Rohac -- MR,
Last Update: 20.02.2022 -- add description
*/
#ifndef os_H
#define os_H 1
#include "vpn.h"
ssize_t safe_read(const int fd, void *const buf_, size_t count, const int timeout);
ssize_t safe_write(const int fd, const void *const buf_, size_t count, const int timeout);
ssize_t safe_read_partial(const int fd, void *const buf_, const size_t max_count);
ssize_t safe_write_partial(const int fd, void *const buf_, const size_t max_count);
typedef struct Cmds {
const char *const *set;
const char *const *unset;
} Cmds;
Cmds firewall_rules_cmds(int is_server);
int shell_cmd(const char *substs[][2], const char *args_str, int silent);
const char *get_default_gw_ip(void);
const char *get_default_ext_if_name(void);
int tcp_opts(int fd);
int tun_create(char if_name[IFNAMSIZ], const char *wanted_name);
int tun_set_mtu(const char *if_name, int mtu);
ssize_t tun_read(int fd, void *data, size_t size);
ssize_t tun_write(int fd, const void *data, size_t size);
#endif