1/*	$OpenBSD: radius.h,v 1.3 2001/08/21 06:21:29 jakob Exp $	*/
2
3/* RADIUS support for tcpdump, Thomas Ptacek <tqbf@enteract.com> */
4
5/*
6 * Copyright (c) 1997 Thomas H. Ptacek. All rights reserved.
7 *
8 * Redistribution and use in source and binary forms, with or without
9 * modification, are permitted provided that the following conditions
10 * are met:
11 *
12 * 1. Redistributions of source code must retain the above copyright
13 *    notice, this list of conditions and the following disclaimer.
14 *
15 * 2. Redistributions in binary form must reproduce the above copyright
16 *    notice, this list of conditions and the following disclaimer in the
17 *    documentation and/or other materials provided with the distribution.
18 *
19 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
20 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
21 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
22 * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
23 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
24 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
25 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
28 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29 *
30 */
31
32/* ------------------------------------------------------------ */
33
34/* RADIUS attribute encoding types */
35
36#define RD_INT				1
37#define RD_DATE				2
38#define RD_ADDRESS			3
39#define RD_STRING			4
40#define RD_HEX				5
41
42/* ------------------------------------------------------------ */
43
44/* RADIUS packet opcodes */
45
46#define RADIUS_CODE_ACCESS_REQUEST		1
47#define RADIUS_CODE_ACCESS_ACCEPT		2
48#define RADIUS_CODE_ACCESS_REJECT		3
49#define RADIUS_CODE_ACCOUNT_REQUEST		4
50#define RADIUS_CODE_ACCOUNT_RESPONSE		5
51#define RADIUS_CODE_ACCOUNT_STATUS		6
52#define RADIUS_CODE_PASSCHG_REQUEST		7
53#define RADIUS_CODE_PASSCHG_ACCEPT		8
54#define RADIUS_CODE_PASSCHG_REJECT		9
55#define RADIUS_CODE_ACCOUNT_MESSAGE		10
56#define RADIUS_CODE_ACCESS_CHALLENGE		11
57
58/* ------------------------------------------------------------ */
59
60/* slew o' attributes */
61
62#define RADIUS_ATT_USER_NAME			1
63#define RADIUS_ATT_PASSWORD			2
64#define RADIUS_ATT_CHAP_PASS			3
65#define RADIUS_ATT_NAS_IP			4
66#define RADIUS_ATT_NAS_PORT			5
67#define RADIUS_ATT_USER_SERVICE			6
68#define RADIUS_ATT_PROTOCOL			7
69#define RADIUS_ATT_FRAMED_ADDRESS		8
70#define RADIUS_ATT_NETMASK			9
71#define RADIUS_ATT_ROUTING			10
72#define RADIUS_ATT_FILTER			11
73#define RADIUS_ATT_MTU				12
74#define RADIUS_ATT_COMPRESSION			13
75#define RADIUS_ATT_LOGIN_HOST			14
76#define RADIUS_ATT_LOGIN_SERVICE		15
77#define RADIUS_ATT_LOGIN_TCP_PORT		16
78#define RADIUS_ATT_OLD_PASSWORD			17
79#define RADIUS_ATT_PORT_MESSAGE			18
80#define RADIUS_ATT_DIALBACK_NO			19
81#define RADIUS_ATT_DIALBACK_NAME		20
82#define RADIUS_ATT_EXPIRATION			21
83#define RADIUS_ATT_FRAMED_ROUTE			22
84#define RADIUS_ATT_FRAMED_IPX			23
85#define RADIUS_ATT_CHALLENGE_STATE		24
86#define RADIUS_ATT_CLASS			25
87#define RADIUS_ATT_VENDOR_SPECIFIC		26
88#define RADIUS_ATT_SESSION_TIMEOUT		27
89#define RADIUS_ATT_IDLE_TIMEOUT			28
90#define RADIUS_ATT_TERMINATE_ACTION		29
91#define RADIUS_ATT_CALLED_ID			30
92#define RADIUS_ATT_CALLER_ID			31
93
94#define RADIUS_ATT_STATUS_TYPE			40
95
96/* the accounting attributes change way too much
97 * for me to want to hardcode them in.
98 */
99
100/* ------------------------------------------------------------ */
101
102/* RADIUS packet header */
103
104#define RADFIXEDSZ		20
105
106struct radius_header {
107	u_char	code;
108	u_char 	id;
109	u_short len;
110	u_char 	auth[16];
111};
112
113/* ------------------------------------------------------------ */
114