Teonet library  0.4.7
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
tuntap-windows.c File Reference
#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)
 

Macro Definition Documentation

#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 Documentation

typedef unsigned long IPADDR

Function Documentation

int tuntap_down ( struct device dev)
char* tuntap_get_hwaddr ( struct device dev)
int tuntap_get_readable ( struct device dev)
int tuntap_read ( struct device dev,
void *  buf,
size_t  size 
)
void tuntap_release ( struct device dev)
int tuntap_set_debug ( struct device dev,
int  set 
)
int tuntap_set_descr ( struct device dev,
const char *  descr 
)
int tuntap_set_hwaddr ( struct device dev,
const char *  hwaddr 
)
int tuntap_set_ifname ( struct device dev,
const char *  name 
)
int tuntap_set_mtu ( struct device dev,
int  mtu 
)
int tuntap_set_nonblocking ( struct device dev,
int  set 
)
void tuntap_sys_destroy ( struct device dev)
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_up ( struct device dev)
int tuntap_write ( struct device dev,
void *  buf,
size_t  size 
)