Use correct directory for installation.
[unet] / unet.h
CommitLineData
4e3819cf 1/* -*-c-*-
2 *
3 * $Id: unet.h,v 1.1 2001/01/25 22:03:39 mdw Exp $
4 *
5 * User-space network device support.
6 *
7 * (c) 1998 Mark Wooding
8 */
9
10/*----- Licensing notice --------------------------------------------------*
11 *
12 * This file is part of Usernet.
13 *
14 * Usernet is free software; you can redistribute it and/or modify
15 * it under the terms of the GNU General Public License as published by
16 * the Free Software Foundation; either version 2 of the License, or
17 * (at your option) any later version.
18 *
19 * Usernet is distributed in the hope that it will be useful,
20 * but WITHOUT ANY WARRANTY; without even the implied warranty of
21 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
22 * GNU General Public License for more details.
23 *
24 * You should have received a copy of the GNU General Public License
25 * along with Usernet; if not, write to the Free Software Foundation,
26 * Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
27 */
28
29/*----- Revision history --------------------------------------------------*
30 *
31 * $Log: unet.h,v $
32 * Revision 1.1 2001/01/25 22:03:39 mdw
33 * Initial check-in (somewhat belated).
34 *
35 */
36
37#ifndef _LINUX_UNET_H
38#define _LINUX_UNET_H
39
40#ifdef __cplusplus
41 extern "C" {
42#endif
43
44/*----- What's the story? -------------------------------------------------*
45 *
46 * Based on a conversation with Clive Jones about FreeBSD's tunnel device,
47 * I've decided to try to write something similar. The basic idea is to
48 * tie together a character device and a network interface, so that anything
49 * written to one pops out the other. I create a device /dev/unet.
50 * Each open(2) of my device creates a network device, whose name can be
51 * read by calling ioctl(2). A read(2) on the device fetches the next
52 * packet received from the network interface; conversely, a write(2) sends
53 * a network packet through the interface.
54 *
55 * Permissions on /dev/unet ought to be fairly strict. Remember that
56 * anyone who can get access to it can inject arbitrary IP packets.
57 *
58 * This is my first stab at hacking Linux, so there'll be mistakes and
59 * infelicities. All I ask is that you tell me what they are.
60 *
61 * [mdw]
62 * mdw@excessus.demon.co.uk
63 */
64
65/*----- @ioctl@(2) calls supported ----------------------------------------*/
66
67/* --- @UNIOCGINFO@ --- *
68 *
69 * Reads useful information about a unet. The argument is a pointer to a
70 * @unet_info@ structure, which is filled in by the call. As a special case,
71 * the argument may be a null pointer, in which case the call does nothing
72 * and may be used to verify that a file descriptor refers to a Usernet
73 * attachment.
74 */
75
76#define UNIOCGINFO _IOR('U', 0, sizeof(struct unet_info))
77
78#define UNET_NAMEMAX 20
79
80struct unet_info {
81 char uni_ifname[UNET_NAMEMAX]; /* Interface name string */
82 unsigned short uni_mtu; /* Maximum transmission unit */
83 unsigned short uni_family; /* My address family */
84 unsigned short uni_proto; /* Protocol to stamp on packets */
85 unsigned int uni_flags; /* Various useful flags */
86};
87
88#define UNIF_TRANS 1 /* This device is transient */
89#define UNIF_OPEN 2 /* Not useful to users */
90#define UNIF_DEBUG 4 /* Debugging enable flag */
91
92/* --- @UNIOCSDEBUG@ --- *
93 *
94 * Sets the debugging state for the attachment. When the debug flag is set,
95 * all packets sent and received by the device will be logged, as will other
96 * events.
97 */
98
99#define UNIOCSDEBUG _IO('U', 1)
100
101/* --- @UNIOCGPROTO@ --- *
102 *
103 * Reads the protocol stamped on packets received through the character
104 * device interface. The default is @ETH_P_IP@; the various values are
105 * defined in @<linux/if_ether.h>@.
106 */
107
108#define UNIOCGPROTO _IO('U', 2)
109
110/* --- @UNIOCSPROTO@ --- *
111 *
112 * Sets the protocol to be stamped on outgoing packets.
113 */
114
115#define UNIOCSPROTO _IO('U', 3)
116
117/* --- @UNIOCGGDEBUG@ --- *
118 *
119 * Gets the global debugging flag.
120 */
121
122#define UNIOCGGDEBUG _IO('U', 4)
123
124/* --- @UNIOCSGDEBUG@ --- *
125 *
126 * Sets the global debugging flag. This is only available when runtime
127 * debugging configuration is compiled in.
128 */
129
130#define UNIOCSGDEBUG _IO('U', 5)
131
132/* --- @UNIOCDUMP@ --- *
133 *
134 * Dumps a unet block's information to the debug device.
135 */
136
137#define UNIOCDUMP _IO('U', 6)
138
139/* --- @UNIOCGMAXIF@ --- *
140 *
141 * Returns the maximum number of interfaces allowed.
142 */
143
144#define UNIOCGMAXIF _IO('U', 7)
145
146/* --- @UNIOCGMAXIF@ --- *
147 *
148 * Sets the maximum number of interfaces allowed. It's an error to lower
149 * this below the number of the highest currently-used interface.
150 */
151
152#define UNIOCSMAXIF _IO('U', 8)
153
154/*----- That's all, folks -------------------------------------------------*/
155
156#ifdef __cplusplus
157 }
158#endif
159
160#endif