Teonet library
0.4.7
|
#include <sys/types.h>
#include <windows.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <time.h>
#include <strsafe.h>
#include "tuntap.h"
Macros | |
#define | TAP_CONTROL_CODE(request, method) CTL_CODE(FILE_DEVICE_UNKNOWN, request, method, FILE_ANY_ACCESS) |
#define | TAP_IOCTL_GET_MAC TAP_CONTROL_CODE (1, METHOD_BUFFERED) |
#define | TAP_IOCTL_GET_VERSION TAP_CONTROL_CODE (2, METHOD_BUFFERED) |
#define | TAP_IOCTL_GET_MTU TAP_CONTROL_CODE (3, METHOD_BUFFERED) |
#define | TAP_IOCTL_GET_INFO TAP_CONTROL_CODE (4, METHOD_BUFFERED) |
#define | TAP_IOCTL_CONFIG_POINT_TO_POINT TAP_CONTROL_CODE (5, METHOD_BUFFERED) |
#define | TAP_IOCTL_SET_MEDIA_STATUS TAP_CONTROL_CODE (6, METHOD_BUFFERED) |
#define | TAP_IOCTL_CONFIG_DHCP_MASQ TAP_CONTROL_CODE (7, METHOD_BUFFERED) |
#define | TAP_IOCTL_GET_LOG_LINE TAP_CONTROL_CODE (8, METHOD_BUFFERED) |
#define | TAP_IOCTL_CONFIG_DHCP_SET_OPT TAP_CONTROL_CODE (9, METHOD_BUFFERED) |
#define | TAP_IOCTL_CONFIG_TUN TAP_CONTROL_CODE (10, METHOD_BUFFERED) |
#define | MAX_KEY_LENGTH 255 |
#define | MAX_VALUE_NAME 16383 |
#define | NETWORK_ADAPTERS "SYSTEM\\CurrentControlSet\\Control\\Class\\{4D36E972-E325-11CE-BFC1-08002BE10318}" |
Typedefs | |
typedef unsigned long | IPADDR |
Functions | |
void | tuntap_sys_destroy (struct device *dev) |
int | tuntap_start (struct device *dev, int mode, int tun) |
void | tuntap_release (struct device *dev) |
char * | tuntap_get_hwaddr (struct device *dev) |
int | tuntap_set_hwaddr (struct device *dev, const char *hwaddr) |
int | tuntap_up (struct device *dev) |
int | tuntap_down (struct device *dev) |
int | tuntap_get_mtu (struct device *dev) |
int | tuntap_set_mtu (struct device *dev, int mtu) |
int | tuntap_sys_set_ipv4 (struct device *dev, t_tun_in_addr *s, uint32_t mask) |
int | tuntap_sys_set_ipv6 (struct device *dev, t_tun_in6_addr *s, uint32_t mask) |
int | tuntap_read (struct device *dev, void *buf, size_t size) |
int | tuntap_write (struct device *dev, void *buf, size_t size) |
int | tuntap_get_readable (struct device *dev) |
int | tuntap_set_nonblocking (struct device *dev, int set) |
int | tuntap_set_debug (struct device *dev, int set) |
int | tuntap_set_descr (struct device *dev, const char *descr) |
int | tuntap_set_ifname (struct device *dev, const char *name) |
#define MAX_KEY_LENGTH 255 |
#define MAX_VALUE_NAME 16383 |
#define NETWORK_ADAPTERS "SYSTEM\\CurrentControlSet\\Control\\Class\\{4D36E972-E325-11CE-BFC1-08002BE10318}" |
Referenced by tuntap_start().
#define TAP_CONTROL_CODE | ( | request, | |
method | |||
) | CTL_CODE(FILE_DEVICE_UNKNOWN, request, method, FILE_ANY_ACCESS) |
#define TAP_IOCTL_CONFIG_DHCP_MASQ TAP_CONTROL_CODE (7, METHOD_BUFFERED) |
Referenced by tuntap_sys_set_ipv4().
#define TAP_IOCTL_CONFIG_DHCP_SET_OPT TAP_CONTROL_CODE (9, METHOD_BUFFERED) |
#define TAP_IOCTL_CONFIG_POINT_TO_POINT TAP_CONTROL_CODE (5, METHOD_BUFFERED) |
#define TAP_IOCTL_CONFIG_TUN TAP_CONTROL_CODE (10, METHOD_BUFFERED) |
#define TAP_IOCTL_GET_INFO TAP_CONTROL_CODE (4, METHOD_BUFFERED) |
#define TAP_IOCTL_GET_LOG_LINE TAP_CONTROL_CODE (8, METHOD_BUFFERED) |
#define TAP_IOCTL_GET_MAC TAP_CONTROL_CODE (1, METHOD_BUFFERED) |
Referenced by tuntap_get_hwaddr().
#define TAP_IOCTL_GET_MTU TAP_CONTROL_CODE (3, METHOD_BUFFERED) |
Referenced by tuntap_get_mtu().
#define TAP_IOCTL_GET_VERSION TAP_CONTROL_CODE (2, METHOD_BUFFERED) |
#define TAP_IOCTL_SET_MEDIA_STATUS TAP_CONTROL_CODE (6, METHOD_BUFFERED) |
typedef unsigned long IPADDR |
int tuntap_down | ( | struct device * | dev | ) |
References device::ctrl_sock, device::flags, if(), and device::if_name.
char* tuntap_get_hwaddr | ( | struct device * | dev | ) |
References device::hwaddr, TAP_IOCTL_GET_MAC, device::tun_fd, tuntap_log, TUNTAP_LOG_DEBUG, and TUNTAP_LOG_ERR.
int tuntap_get_mtu | ( | struct device * | dev | ) |
References device::ctrl_sock, device::if_name, TAP_IOCTL_GET_MTU, device::tun_fd, tuntap_log, TUNTAP_LOG_ERR, and TUNTAP_LOG_NOTICE.
int tuntap_get_readable | ( | struct device * | dev | ) |
References device::tun_fd, tuntap_get_mtu(), tuntap_log, TUNTAP_LOG_INFO, and TUNTAP_LOG_NOTICE.
int tuntap_read | ( | struct device * | dev, |
void * | buf, | ||
size_t | size | ||
) |
References device::tun_fd, tuntap_log, TUNTAP_LOG_ERR, TUNTAP_LOG_NOTICE, and TUNTAP_LOG_WARN.
void tuntap_release | ( | struct device * | dev | ) |
References device::ctrl_sock, free(), and device::tun_fd.
int tuntap_set_debug | ( | struct device * | dev, |
int | set | ||
) |
References device::tun_fd, tuntap_log, TUNTAP_LOG_ERR, TUNTAP_LOG_NOTICE, and TUNTAP_LOG_WARN.
int tuntap_set_descr | ( | struct device * | dev, |
const char * | descr | ||
) |
References IF_DESCRSIZE, tuntap_log, TUNTAP_LOG_ERR, TUNTAP_LOG_NOTICE, TUNTAP_LOG_WARN, and tuntap_sys_set_descr().
int tuntap_set_hwaddr | ( | struct device * | dev, |
const char * | hwaddr | ||
) |
References device::hwaddr, tuntap_log, TUNTAP_LOG_NOTICE, and tuntap_sys_set_hwaddr().
int tuntap_set_ifname | ( | struct device * | dev, |
const char * | name | ||
) |
References device::if_name, IF_NAMESIZE, tuntap_log, TUNTAP_LOG_ERR, TUNTAP_LOG_NOTICE, and tuntap_sys_set_ifname().
int tuntap_set_mtu | ( | struct device * | dev, |
int | mtu | ||
) |
References device::ctrl_sock, device::if_name, device::tun_fd, tuntap_log, TUNTAP_LOG_ERR, and TUNTAP_LOG_NOTICE.
int tuntap_set_nonblocking | ( | struct device * | dev, |
int | set | ||
) |
References device::tun_fd, tuntap_log, TUNTAP_LOG_ERR, and TUNTAP_LOG_NOTICE.
int tuntap_start | ( | struct device * | dev, |
int | mode, | ||
int | tun | ||
) |
void tuntap_sys_destroy | ( | struct device * | dev | ) |
int tuntap_sys_set_ipv4 | ( | struct device * | dev, |
t_tun_in_addr * | s, | ||
uint32_t | mask | ||
) |
References TAP_IOCTL_CONFIG_DHCP_MASQ, device::tun_fd, tuntap_log, and TUNTAP_LOG_ERR.
int tuntap_sys_set_ipv6 | ( | struct device * | dev, |
t_tun_in6_addr * | s, | ||
uint32_t | mask | ||
) |
References tuntap_log, TUNTAP_LOG_INFO, and TUNTAP_LOG_NOTICE.
int tuntap_up | ( | struct device * | dev | ) |
References device::ctrl_sock, device::flags, if(), and device::if_name.
int tuntap_write | ( | struct device * | dev, |
void * | buf, | ||
size_t | size | ||
) |
References device::tun_fd, tuntap_log, TUNTAP_LOG_ERR, TUNTAP_LOG_NOTICE, and TUNTAP_LOG_WARN.