xref: /freebsd/sys/net/if_tun.h (revision 17ee9d00bc1ae1e598c38f25826f861e4bc6c3ce)
1 /*
2  * Copyright (c) 1988, Julian Onions <jpo@cs.nott.ac.uk>
3  * Nottingham University 1987.
4  *
5  * This source may be freely distributed, however I would be interested
6  * in any changes that are made.
7  *
8  * This driver takes packets off the IP i/f and hands them up to a
9  * user process to have it's wicked way with. This driver has it's
10  * roots in a similar driver written by Phil Cockcroft (formerly) at
11  * UCL. This driver is based much more on read/write/select mode of
12  * operation though.
13  *
14  * from: $Header: if_tnreg.h,v 1.1.2.1 1992/07/16 22:39:16 friedl Exp
15  * $Id: if_tun.h,v 1.3 1993/12/13 14:27:01 deraadt Exp $
16  */
17 
18 #ifndef _NET_IF_TUN_H_
19 #define _NET_IF_TUN_H_
20 
21 struct tun_softc {
22 	u_short	tun_flags;		/* misc flags */
23 #define	TUN_OPEN	0x0001
24 #define	TUN_INITED	0x0002
25 #define	TUN_RCOLL	0x0004
26 #define	TUN_IASET	0x0008
27 #define	TUN_DSTADDR	0x0010
28 #ifdef notdef
29 #define	TUN_READY	0x0020
30 #else
31 #define TUN_READY       (TUN_IASET|TUN_OPEN|TUN_DSTADDR)
32 #endif
33 #define	TUN_RWAIT	0x0040
34 #define	TUN_ASYNC	0x0080
35 #define	TUN_NBIO	0x0100
36 	struct	ifnet tun_if;		/* the interface */
37 	int	tun_pgrp;		/* the process group - if any */
38 #if BSD < 199103
39 	struct  proc    *tun_rsel;
40 	struct  proc	*tun_wsel;
41 #else
42 	u_char		tun_pad;	/* explicit alignment */
43 	struct selinfo  tun_sel;	/* bsd select info */
44 #endif
45 #if NBPFILTER > 0
46 	caddr_t		tun_bpf;
47 #endif
48 };
49 
50 /* Maximum packet size */
51 #define	TUNMTU		1500
52 
53 /* ioctl's for get/set debug */
54 #ifdef __NetBSD__
55 #define	TUNSDEBUG	_IOW('t', 90, int)
56 #define	TUNGDEBUG	_IOR('t', 89, int)
57 #define	TUNSIFINFO	_IOW('t', 91, struct tuninfo)
58 #define	TUNGIFINFO	_IOR('t', 92, struct tuninfo)
59 #else	/* Assume BSDI */
60 #define	TUNSDEBUG	_IOW('T', 90, int)
61 #define	TUNGDEBUG	_IOR('T', 89, int)
62 #define	TUNSIFINFO	_IOW('T', 91, struct tuninfo)
63 #define	TUNGIFINFO	_IOR('T', 92, struct tuninfo)
64 #endif
65 
66 struct tuninfo {
67 	int	tif_baudrate;		/* linespeed */
68 	short	tif_mtu;		/* maximum transmission unit */
69 	u_char	tif_type;		/* ethernet, tokenring, etc. */
70 	u_char	tif_dummy;		/* place holder */
71 };
72 #endif /* !_NET_IF_TUN_H_ */
73