1divert(-1)
2dnl This file is part of GNU Radius.
3dnl Copyright (C) 2001,2003,2004,2007 Free Software Foundation, Inc.
4dnl
5dnl Written by Sergey Poznyakoff
6dnl
7dnl GNU Radius is free software; you can redistribute it and/or modify
8dnl it under the terms of the GNU General Public License as published by
9dnl the Free Software Foundation; either version 3 of the License, or
10dnl (at your option) any later version.
11dnl
12dnl GNU Radius is distributed in the hope that it will be useful,
13dnl but WITHOUT ANY WARRANTY; without even the implied warranty of
14dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15dnl GNU General Public License for more details.
16dnl
17dnl You should have received a copy of the GNU General Public License
18dnl along with GNU Radius; if not, write to the Free Software Foundation,
19dnl Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
20changequote({,})
21include(config.m4)
22include(INCLUDE)
23ifdef({DB_USER},,{define(DB_USER,{radius})})
24ifdef({DB_PWD},,{define({DB_PWD},{guessme})})
25divert{}dnl
26
27CREATEDATABASE(RADIUS)
28
29define({USER_COLUMN},
30       {user_name           VARCHAR_T(32) CI default '' not null})
31
32CREATETABLE(passwd, {
33  USER_COLUMN,
34  service             CHAR_T(16) default 'Framed-PPP' not null,
35  password            CHAR_T(64),
36  active              ENUM_T(1,'Y','N') default 'Y' not null COMMA
37  INDEX(uname, user_name,active) COMMA
38  UNIQUE(usrv, user_name,service,active)
39})
40CREATETABLE(groups, {
41  USER_COLUMN,
42  user_group          CHAR_T(32) COMMA
43  INDEX(grp, user_name)
44})
45CREATETABLE(authfail, {
46  USER_COLUMN,
47  count               SHORTINT_T,
48  time                TIME_T('1970-01-01 00:00:00') NOT NULL COMMA
49  UNIQUE(uname, user_name)
50})
51CREATETABLE(attrib, {
52  USER_COLUMN,
53  attr                CHAR_T(32) default '' not null,
54  value               CHAR_T(128),
55  op                  ENUM_T(2,'=','!=','<','>','<=','>=') default NULL COMMA
56  INDEX(uattr,user_name,attr,op)
57})
58CREATETABLE(calls, {
59  status              SHORTINT_T not null,
60  USER_COLUMN,
61  realm_name          VARCHAR_T(32) CI default '' not null,
62  event_date_time     TIME_T('1970-01-01 00:00:00') NOT NULL,
63  nas_ip_address      CHAR_T(17) default '0.0.0.0' not null,
64  nas_port_id         INT_T,
65  acct_session_id     CHAR_T(17) DEFAULT '' NOT NULL,
66  acct_session_time   LONGINT_T,
67  acct_input_octets   LONGINT_T,
68  acct_output_octets  LONGINT_T,
69  connect_term_reason INT_T,
70  framed_ip_address   CHAR_T(17),
71  called_station_id   CHAR_T(32),
72  calling_station_id  CHAR_T(32) COMMA
73  INDEX(name_sid, user_name,acct_session_id) COMMA
74  INDEX(name_stat_sid,user_name,status,acct_session_id) COMMA
75  INDEX(stat_nas,status,nas_ip_address) COMMA
76  INDEX(realm,realm_name)
77})
78
79CREATETABLE(naspools, {
80  nas CHAR_T(17) default '0.0.0.0' not null,
81  pool CHAR_T(8),
82  PRIMARY KEY (nas)
83})
84
85CREATETABLE(ippool, {
86  pool CHAR_T(8) default 'DEFAULT' NOT NULL,
87  ipaddr CHAR_T(17) default '' not null,
88  status ENUM_T(4,'FREE','BLCK','FIXD','ASGN','RSRV') default 'FREE' not null,
89  time TIME_T('1970-01-01 00:00:00') NOT NULL,
90  USER_COLUMN COMMA
91  INDEX(ippool_name,user_name) COMMA
92  INDEX(ippool_ipaddr,ipaddr)
93})
94
95DB_PRIV
96