Fix typo
[freeradius.git] / man / man5 / rlm_expr.5
1 .\"     # DS - begin display
2 .de DS
3 .RS
4 .nf
5 .sp
6 ..
7 .\"     # DE - end display
8 .de DE
9 .fi
10 .RE
11 .sp
12 ..
13 .TH rlm_expr 5 "5 February 2004" "" "FreeRADIUS Module"
14 .SH NAME
15 rlm_expr \- FreeRADIUS Module
16 .SH DESCRIPTION
17 The \fIrlm_expr\fP module allows the server to perform
18 limited mathematical calculations.  This module is not called
19 directly in any section, it is invoked through the dynamic expansion
20 of strings.
21 .PP
22 For example, some NAS boxes send a NAS-Port attribute
23 which is a 32-bit number composed of port, card, and interface, all in
24 different bytes.  To see these attributes split into pieces, you can
25 have an entry in the 'users' file like:
26
27 .DS
28 DEFAULT
29 .br
30     Vendor-Interface = `%{expr: %{NAS-Port} / (256 * 256)}`,
31 .br
32     Vendor-Card = `%{expr: (%{NAS-Port} / 256) %% 256}`,
33 .br
34     Vendor-Port = `%{expr: %{NAS-Port} %% 256}`
35 .br
36
37 .DE
38 where the attributes Vendor-Interface, Vendor-Card, and Vendor-Port
39 are attributes created by either you or a vendor-supplied
40 dictionary.
41
42 The methematical operators supported by the expression module are:
43 .TP
44 .B +
45 addition
46 .TP
47 .B -
48 subtraction
49 .TP
50 .B /
51 division
52 .TP
53 .B %%
54 modulo remainder
55 .TP
56 .B *
57 multiplication
58 .TP
59 .B &
60 boolean AND
61 .TP
62 .B |
63 boolean OR
64 .TP
65 .B ()
66 grouping of sub-expressions
67 .PP
68 NOTE: The modulo remainder operator is '%%', and not '%'.  This
69 is due to the '%' character being used as a special character for
70 dynamic translation.
71 .PP
72 NOTE: These operators do NOT have precedence.  The parsing
73 of the input string, and the calculation of the answer, is done
74 strictly left to right.  If you wish to order the expressions, you
75 MUST group them into sub-expression, as shown in the previous
76 example.
77 .PP
78 All of the calculations are performed as unsigned 32-bit integers.
79 .DE
80 .SH CONFIGURATION
81 .DS
82 modules {
83   ...
84 .br
85   expr {
86 .br
87   }
88 .br
89   ...
90 .br
91 }
92 .br
93  ...
94 .br
95 instantiate {
96   ...
97 .br
98   expr
99   ...
100 .br
101 }
102 .SH SECTIONS
103 .BR instantiate
104 .PP
105 .SH FILES
106 .I /etc/raddb/radiusd.conf
107 .PP
108 .SH "SEE ALSO"
109 .BR radiusd (8),
110 .BR radiusd.conf (5)
111 .SH AUTHOR
112 Chris Parker, cparker@segv.org
113