]> git.saurik.com Git - apple/xnu.git/blob - bsd/netinet/if_tun.h
6e548368ad9753e21213b2a5f61dae54c414a3e8
[apple/xnu.git] / bsd / netinet / if_tun.h
1 /*
2 * Copyright (c) 2000 Apple Computer, Inc. All rights reserved.
3 *
4 * @APPLE_LICENSE_HEADER_START@
5 *
6 * The contents of this file constitute Original Code as defined in and
7 * are subject to the Apple Public Source License Version 1.1 (the
8 * "License"). You may not use this file except in compliance with the
9 * License. Please obtain a copy of the License at
10 * http://www.apple.com/publicsource and read it before using this file.
11 *
12 * This Original Code and all software distributed under the License are
13 * distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, EITHER
14 * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
15 * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
16 * FITNESS FOR A PARTICULAR PURPOSE OR NON-INFRINGEMENT. Please see the
17 * License for the specific language governing rights and limitations
18 * under the License.
19 *
20 * @APPLE_LICENSE_HEADER_END@
21 */
22 /* Copyright (c) 1997 Apple Computer, Inc. All Rights Reserved */
23 /*
24 * Copyright (c) 1988, Julian Onions <jpo@cs.nott.ac.uk>
25 * Nottingham University 1987.
26 *
27 * This source may be freely distributed, however I would be interested
28 * in any changes that are made.
29 *
30 * This driver takes packets off the IP i/f and hands them up to a
31 * user process to have it's wicked way with. This driver has it's
32 * roots in a similar driver written by Phil Cockcroft (formerly) at
33 * UCL. This driver is based much more on read/write/select mode of
34 * operation though.
35 *
36 */
37
38 #ifndef _NET_IF_TUN_H_
39 #define _NET_IF_TUN_H_
40
41 struct tun_softc {
42 u_short tun_flags; /* misc flags */
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
52 #define TUN_READY (TUN_OPEN | TUN_INITED | TUN_IASET)
53
54 struct ifnet tun_if; /* the interface */
55 int tun_pgrp; /* the process group - if any */
56 struct selinfo tun_rsel; /* read select */
57 struct selinfo tun_wsel; /* write select (not used) */
58 #if NBPFILTER > 0
59 caddr_t tun_bpf;
60 #endif
61 };
62
63 /* Maximum packet size */
64 #define TUNMTU 1500
65
66 /* ioctl's for get/set debug */
67 #define TUNSDEBUG _IOW('t', 90, int)
68 #define TUNGDEBUG _IOR('t', 89, int)
69
70 #endif /* !_NET_IF_TUN_H_ */