summaryrefslogtreecommitdiffstats
path: root/include/linux/ax25_userdev.h
blob: cc58a3e5ee1b44f3681b0b55c74a80a4e6b22e9f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
/*
 *  AX.25 usermode device driver.
 *  Copyright (C) 1999-2000 Maxim Krasnyansky <max_mk@yahoo.com>
 *  Copyright 2001, by Joerg Reuter <jreuter@yaina.de>
 *
 *  This program is free software; you can redistribute it and/or modify
 *  it under the terms of the GNU General Public License as published by
 *  the Free Software Foundation; either version 2 of the License, or
 *  (at your option) any later version.
 *
 *  This program is distributed in the hope that it will be useful,
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
 *  GNU General Public License for more details.
 *
 */

#ifndef __IF_AX25_UDEV_H
#define __IF_AX25_UDEV_H

#define AX25_UDEV_VER "0.1"
#define AX25_UDEV_DEBUG

/* Uncomment to enable debugging */
/* #define AX25_UDEV_DEBUG 1 */

#ifdef __KERNEL__

#ifdef AX25_UDEV_DEBUG
#define DBG  if(ax25_udev->debug)printk
#define DBG1 if(debug==2)printk
#else
#define DBG( a... )
#define DBG1( a... )
#endif

struct ax25_udev_struct {
	char 			name[IFNAMSIZ];
	unsigned long 		flags;

	struct fasync_struct    *fasync;
	wait_queue_head_t	read_wait;

	struct net_device	dev;
	struct sk_buff_head	txq;
        struct net_device_stats	stats;
	struct ax25_dev		ax25_dev;

	struct {
		int duplex;
		int arbitration;
	} capabilities;

	struct {
		int dcd:1;
		int cts:1;
		int rts:1;
		int ptt:1;
	} status;

#ifdef AX25_UDEV_DEBUG
	int debug;
#endif
};

#endif /* __KERNEL__ */

/* Number of devices */
#define AX25_UDEV_MAX_DEV	255

/* TX queue size */
#define AX25_UDEV_TXQ_SIZE	10

/* Max frame size */
#define AX25_UDEV_MAX_FRAME	4096

/* AX25_UDEV device flags */
#define AX25_UDEV_TYPE_MASK	0x000f
#define AX25_UDEV_FASYNC	0x0010
#define AX25_UDEV_IFF_SET	0x1000

/* AX25_UDEV IFF ioctl */
#define AX25_UDEV_SETIFF	_IOW(0x25, 0, void *)
#define AX25_UDEV_SETDEBUG	_IOW(0x25, 1, int)

/* Packet layout:
 *
 * (int) packet_type
 * (int) data
 * ...
 *
 * Exception for AX25_UDEV_DATA:
 * (int) 0
 * (char) octet
 * ...
 *
 */

typedef enum ax25_user_dev_commands_e {
	AX25_UDEV_DATA,
	AX25_UDEV_CAPABILITIES,
	AX25_UDEV_DCD_STATUS,
	AX25_UDEV_CTS_STATUS,
	AX25_UDEV_PTT_STATUS,
	AX25_UDEV_SET_MAC_VALUE,
	AX25_UDEV_REQUEST_RTS
} ax25_user_dev_commands_t;

typedef enum ax25_user_dev_capabilities_e {
	AX25_UDEV_CAP_HALF_DUPLEX,
	AX25_UDEV_CAP_FULL_DUPLEX,
	AX25_UDEV_CAP_ADVANCED_ARBITRATION,
	AX25_UDEV_CAP_OWN_ARBITRATION,
	AX25_UDEV_CAP_SIMPLE_ARBITRATION
} ax25_user_dev_capabilities_t;

typedef int ax25_udev_pt_t;
typedef int ax25_udev_val_t;

#endif /* __IF_AX25_UDEV_H */