1 /* 2 * Copyright 2003-2018 Haiku, Inc. All Rights Reserved. 3 * Distributed under the terms of the MIT License. 4 */ 5 6 #ifndef _NET_IF_TUN_H 7 #define _NET_IF_TUN_H 8 9 #include <sys/sockio.h> 10 11 /* 12 * public API for tun/tap device. 13 * This API is compatible with the Linux tun/tap driver from 14 * http://vtun.sourceforge.net/tun/index.html 15 */ 16 17 18 /* max of each type */ 19 #define TUN_MAX_DEV 10 20 /*255*/ 21 22 /* TX queue size */ 23 #define TUN_TXQ_SIZE 10 24 25 /* Max frame size */ 26 #define TUN_MAX_FRAME 4096 27 28 /* TUN device flags */ 29 #define TUN_TUN_DEV 0x0001 30 #define TUN_TAP_DEV 0x0002 31 #define TUN_TYPE_MASK 0x000f 32 33 /* not yet*//*#define TUN_FASYNC 0x0010*/ 34 #define TUN_NOCHECKSUM 0x0020 35 #define TUN_NO_PI 0x0040 36 37 #define TUN_IFF_SET 0x1000 38 39 /* Ioctl defines */ 40 /* XXX: NOT OFFICIAL */ 41 #define TUNSETNOCSUM (B_DEVICE_OP_CODES_END+0x90) 42 #define TUNSETDEBUG (B_DEVICE_OP_CODES_END+0x91) 43 #define TUNSETIFF (B_DEVICE_OP_CODES_END+0x92) 44 45 /* get/set MAC address */ 46 //#define SIOCGIFHWADDR (BONE_SOCKIO_IOCTL_BASE+0x95) 47 //#define SIOCSIFHWADDR (BONE_SOCKIO_IOCTL_BASE+0x96) 48 49 /* TUNSETIFF ifr flags */ 50 #define IFF_TUN 0x0001 51 #define IFF_TAP 0x0002 52 #define IFF_NO_PI 0x1000 53 /* XXX: fix the confusion about which *NO_PI go where ! */ 54 55 struct tun_pi { 56 unsigned short flags; 57 unsigned short proto; 58 }; 59 /* tun_pi::flags */ 60 #define TUN_PKT_STRIP 0x0001 61 62 #define TUN_DEVICE "/dev/config/tun" 63 64 #endif /* __IF_TUN_H */ 65