1 /**	$MirOS: src/sys/net/if_tun.h,v 1.3 2005/07/04 00:29:45 tg Exp $ */
2 /*	$OpenBSD: if_tun.h,v 1.13 2004/06/25 04:09:03 claudio Exp $	*/
3 
4 /*
5  * Copyright (c) 1988, Julian Onions <Julian.Onions@nexor.co.uk>
6  * Nottingham University 1987.
7  * All rights reserved.
8  *
9  * Redistribution and use in source and binary forms, with or without
10  * modification, are permitted provided that the following conditions
11  * are met:
12  * 1. Redistributions of source code must retain the above copyright
13  *    notice, this list of conditions and the following disclaimer.
14  * 2. Redistributions in binary form must reproduce the above copyright
15  *    notice, this list of conditions and the following disclaimer in the
16  *    documentation and/or other materials provided with the distribution.
17  *
18  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
19  * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
20  * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
21  * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
22  * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
23  * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
24  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
25  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
26  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
27  * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
28  */
29 
30 /*
31  * This driver takes packets off the IP i/f and hands them up to a
32  * user process to have its wicked way with. This driver has its
33  * roots in a similar driver written by Phil Cockcroft (formerly) at
34  * UCL. This driver is based much more on read/write/select mode of
35  * operation though.
36  */
37 
38 #ifndef	_NET_IF_TUN_H_
39 #define	_NET_IF_TUN_H_
40 
41 #include <sys/ioccom.h>
42 
43 #define	TUN_OPEN	0x0001
44 #define	TUN_INITED	0x0002
45 #define	TUN_RCOLL	0x0004
46 #define	TUN_IASET	0x0008
47 #define	TUN_DSTADDR	0x0010
48 #define	TUN_RWAIT	0x0040
49 #define	TUN_ASYNC	0x0080
50 #define	TUN_NBIO	0x0100
51 #define TUN_BRDADDR	0x0200
52 #define TUN_STAYUP	0x0400
53 #define TUN_LAYER2	0x0800
54 
55 #define	TUN_READY	(TUN_OPEN | TUN_INITED)
56 
57 /* Maximum packet size */
58 #define	TUNMTU		5120
59 
60 /* Maximum receive packet size (hard limit) */
61 #define	TUNMRU          16384
62 
63 /* iface info */
64 struct tuninfo {
65 	u_int	mtu;
66 	u_short	type;
67 	u_short	flags;
68 	u_int	baudrate;
69 };
70 #define	TUNSIFINFO	_IOW('t', 91, struct tuninfo)
71 #define	TUNGIFINFO	_IOR('t', 92, struct tuninfo)
72 
73 /* ioctl for changing the broadcast/point-to-point status */
74 #define	TUNSIFMODE      _IOW('t', 93, int)
75 
76 /* ioctls for get/set debug */
77 #define	TUNSDEBUG	_IOW('t', 94, int)
78 #define	TUNGDEBUG	_IOR('t', 95, int)
79 
80 #endif /* _NET_IF_TUN_H_ */
81