Go to the first, previous, next, last section, table of contents.


Accounting with Scheme

The Scheme accounting procedure must be declared as follows:

Function Template: acct-function-name request-list
Its arguments are:
request-list
The list of A/V pairs from the incoming request

The function must return a boolean value. The accounting succeeds only if it returned #t.

Here is an example of Scheme accounting function. The function dumps the contents of the incoming request to a file:

    (define radius-acct-file "/var/log/acct/radius")
    
    (define (acct req)
      (call-with-output-file radius-acct-file
        (lambda (port)
          (for-each (lambda (pair)
                      (display (car pair) port)
                      (display "=" port)
                      (display (cdr pair) port)
                      (newline port))
                    req)
          (newline port)))
      #t)


Go to the first, previous, next, last section, table of contents.