blob: a000483e3e4d55c706c83c554a2f64d68642a56d [file] [log] [blame]
Chetan Gaonker7f4bf742016-05-04 15:56:08 -07001#! /usr/bin/env python
2#
3# Definitions for RADIUS programs
4#
5# Copyright 2002 Miguel A.L. Paraz <mparaz@mparaz.com>
6#
7# This should only be used when testing modules.
8# Inside freeradius, the 'radiusd' Python module is created by the C module
9# and the definitions are automatically created.
10#
11# $Id: 02e9f237cc0df3d7be08413238e504b90bf59b1a $
12
13# from modules.h
14
15RLM_MODULE_REJECT = 0
16RLM_MODULE_FAIL = 1
17RLM_MODULE_OK = 2
18RLM_MODULE_HANDLED = 3
19RLM_MODULE_INVALID = 4
20RLM_MODULE_USERLOCK = 5
21RLM_MODULE_NOTFOUND = 6
22RLM_MODULE_NOOP = 7
23RLM_MODULE_UPDATED = 8
24RLM_MODULE_NUMCODES = 9
25
26
27# from radiusd.h
28L_DBG = 1
29L_AUTH = 2
30L_INFO = 3
31L_ERR = 4
32L_PROXY = 5
33L_CONS = 128
34
35OP={ '{':2, '}':3, '(':4, ')':5, ',':6, ';':7, '+=':8, '-=':9, ':=':10,
36 '=':11, '!=':12, '>=':13, '>':14, '<=':15, '<':16, '=~':17, '!~':18, '=*':19, '!*':20,
37 '==':21 , '#':22 }
38
39OP_TRY = (':=', '+=', '-=', '=' )
40
41def resolve(*lines):
42 tuples = []
43 for line in lines:
44 for op in OP_TRY:
45 arr = line.rsplit(op)
46 if len(arr)==2:
47 tuples.append((str(arr[0].strip()),OP[op],str(arr[1].strip())))
48 break
49 return tuple(tuples)
50
51# log function
52def radlog(level, msg):
53 import sys
54 sys.stdout.write(msg + '\n')
55
56 level = level
57
58