xref: /freebsd/sys/net/if_tun.h (revision 5ebc7e6281887681c3a348a5a4c902e262ccd656)
1 /*	$NetBSD: if_tun.h,v 1.5 1994/06/29 06:36:27 cgd Exp $	*/
2 
3 /*
4  * Copyright (c) 1988, Julian Onions <jpo@cs.nott.ac.uk>
5  * Nottingham University 1987.
6  *
7  * This source may be freely distributed, however I would be interested
8  * in any changes that are made.
9  *
10  * This driver takes packets off the IP i/f and hands them up to a
11  * user process to have it's wicked way with. This driver has it's
12  * roots in a similar driver written by Phil Cockcroft (formerly) at
13  * UCL. This driver is based much more on read/write/select mode of
14  * operation though.
15  *
16  * : $Header: if_tnreg.h,v 1.1.2.1 1992/07/16 22:39:16 friedl Exp
17  */
18 
19 #ifndef _NET_IF_TUN_H_
20 #define _NET_IF_TUN_H_
21 
22 struct tun_softc {
23 	u_short	tun_flags;		/* misc flags */
24 #define	TUN_OPEN	0x0001
25 #define	TUN_INITED	0x0002
26 #define	TUN_RCOLL	0x0004
27 #define	TUN_IASET	0x0008
28 #define	TUN_DSTADDR	0x0010
29 #define	TUN_RWAIT	0x0040
30 #define	TUN_ASYNC	0x0080
31 #define	TUN_NBIO	0x0100
32 
33 #define	TUN_READY	(TUN_OPEN | TUN_INITED | TUN_IASET)
34 
35 	struct	ifnet tun_if;		/* the interface */
36 	int	tun_pgrp;		/* the process group - if any */
37 	struct	selinfo	tun_rsel;	/* read select */
38 	struct	selinfo	tun_wsel;	/* write select (not used) */
39 #if NBPFILTER > 0
40 	caddr_t		tun_bpf;
41 #endif
42 };
43 
44 /* Maximum packet size */
45 #define	TUNMTU		1500
46 
47 struct tuninfo {
48 	int	baudrate;		/* linespeed */
49 	short	mtu;			/* maximum transmission unit */
50 	u_char	type;			/* ethernet, tokenring, etc. */
51 	u_char	dummy;			/* place holder */
52 };
53 
54 /* ioctl's for get/set debug */
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 
60 #endif /* !_NET_IF_TUN_H_ */
61