tun.h revision 31921
1169695Skan/*-
2169695Skan * Copyright (c) 1997 Brian Somers <brian@Awfulhak.org>
3169695Skan * All rights reserved.
4169695Skan *
5169695Skan * Redistribution and use in source and binary forms, with or without
6169695Skan * modification, are permitted provided that the following conditions
7169695Skan * are met:
8169695Skan * 1. Redistributions of source code must retain the above copyright
9169695Skan *    notice, this list of conditions and the following disclaimer.
10169695Skan * 2. Redistributions in binary form must reproduce the above copyright
11169695Skan *    notice, this list of conditions and the following disclaimer in the
12169695Skan *    documentation and/or other materials provided with the distribution.
13169695Skan *
14169695Skan * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
15169695Skan * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
16169695Skan * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
17169695Skan * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
18169695Skan * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
19169695Skan * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
20169695Skan * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
21169695Skan * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
22169695Skan * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
23169695Skan * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
24169695Skan * SUCH DAMAGE.
25169695Skan *
26169695Skan *	$Id$
27169695Skan */
28169695Skan
29169695Skanstruct tun_data {
30169695Skan#ifdef __OpenBSD__
31169695Skan  struct tunnel_header head;
32169695Skan#endif
33169695Skan  u_char data[MAX_MRU];
34169695Skan};
35169695Skan
36169695Skan#ifdef __OpenBSD__
37169695Skan#define tun_fill_header(f,proto) do { (f).head.tun_af = (proto); } while (0)
38169695Skan#define tun_check_header(f,proto) ((f).head.tun_af == (proto))
39169695Skan#else
40169695Skan#define tun_fill_header(f,proto) do { } while (0)
41169695Skan#define tun_check_header(f,proto) (1)
42169695Skan#endif
43169695Skan
44169695Skanextern void tun_configure(int, int);
45169695Skan