Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Namespace Members | Class Members | File Members | Related Pages

if_tun.h

Go to the documentation of this file.
00001 /*
00002  *  Universal TUN/TAP device driver.
00003  *  Copyright (C) 1999-2000 Maxim Krasnyansky <max_mk@yahoo.com>
00004  *
00005  *  This program is free software; you can redistribute it and/or modify
00006  *  it under the terms of the GNU General Public License as published by
00007  *  the Free Software Foundation; either version 2 of the License, or
00008  *  (at your option) any later version.
00009  *
00010  *  This program is distributed in the hope that it will be useful,
00011  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
00012  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
00013  *  GNU General Public License for more details.
00014  *
00015  *  $Id: if_tun.h,v 1.1.2.2.2.1.4.1 2003/11/20 16:24:45 pphaneuf Exp $
00016  */
00017 
00018 #ifndef __IF_TUN_H
00019 #define __IF_TUN_H
00020 
00021 /* Uncomment to enable debugging */
00022 /* #define TUN_DEBUG 1 */
00023 
00024 #ifdef __KERNEL__
00025 
00026 #ifdef TUN_DEBUG
00027 #define DBG  if(tun->debug)printk
00028 #define DBG1 if(debug==2)printk
00029 #else
00030 #define DBG( a... )
00031 #define DBG1( a... )
00032 #endif
00033 
00034 struct tun_struct {
00035         char                    *name;
00036         unsigned long           flags;
00037         int                     attached;
00038         uid_t                   owner;
00039 
00040         wait_queue_head_t       read_wait;
00041         struct sk_buff_head     readq;
00042 
00043         struct net_device       dev;
00044         struct net_device_stats stats;
00045 
00046         struct fasync_struct    *fasync;
00047 
00048 #ifdef TUN_DEBUG        
00049         int debug;
00050 #endif  
00051 };
00052 
00053 #ifndef MIN
00054 #define MIN(a,b) ( (a)<(b) ? (a):(b) ) 
00055 #endif
00056 
00057 #endif /* __KERNEL__ */
00058 
00059 /* Read queue size */
00060 #define TUN_READQ_SIZE  10
00061 
00062 /* TUN device flags */
00063 #define TUN_TUN_DEV     0x0001  
00064 #define TUN_TAP_DEV     0x0002
00065 #define TUN_TYPE_MASK   0x000f
00066 
00067 #define TUN_FASYNC      0x0010
00068 #define TUN_NOCHECKSUM  0x0020
00069 #define TUN_NO_PI       0x0040
00070 #define TUN_ONE_QUEUE   0x0080
00071 #define TUN_PERSIST     0x0100  
00072 
00073 /* Ioctl defines */
00074 #define TUNSETNOCSUM  _IOW('T', 200, int) 
00075 #define TUNSETDEBUG   _IOW('T', 201, int) 
00076 #define TUNSETIFF     _IOW('T', 202, int) 
00077 #define TUNSETPERSIST _IOW('T', 203, int) 
00078 #define TUNSETOWNER   _IOW('T', 204, int)
00079 
00080 /* TUNSETIFF ifr flags */
00081 #define IFF_TUN         0x0001
00082 #define IFF_TAP         0x0002
00083 #define IFF_NO_PI       0x1000
00084 #define IFF_ONE_QUEUE   0x2000
00085 
00086 struct tun_pi {
00087         unsigned short flags;
00088         unsigned short proto;
00089 };
00090 #define TUN_PKT_STRIP   0x0001
00091 
00092 #endif /* __IF_TUN_H */

Generated on Wed Dec 15 15:08:10 2004 for WvStreams by  doxygen 1.3.9.1