Hello Mike -
On Sat, 20 May 2000, Mike Nerone wrote:
>
> When using AcctColumnDef, you can tell Radiator to log a particular
> attribute by its integer value, which is what I want to do. Unfortunately,
> I'm not using AcctColumnDef, I'm using my own AcctSQLStatement for more
> flexibility. Specifically, I'm using the following:
> AcctSQLStatement \ insert into
> accounting set \ mailbox = '%U',
> \ domain = '%R', \ timestamp
> = from_unixtime(%{Timestamp}), \ statustype =
> '%{Acct-Status-Type}', \ ipaddress =
> '%{Framed-IP-Address}', \ inputoctets =
> '%{Acct-Input-Octets}', \ outputoctets =
> '%{Acct-Output-Octets}', \ sessionid =
> '%{Acct-Session-Id}', \ terminatecause =
> '%{Acct-Terminate-Cause}', \ ascendcause =
> '%{Ascend-Disconnect-Cause}', \ nasipaddress = '%N',
> \ nasport = '%{NAS-Port}', \
> nasporttype = '%{NAS-Port-Type}', \ servicetype =
> '%{Service-Type}', \ callednumber =
> '%{Called-Station-Id}', \ callingnumber =
> '%{Calling-Station-Id}'
> I've omitted the rest of the config...it all works fine. Note that 1)
> from_unixtime is a mysql function, so don't go looking for it, and 2) this
> "insert into table SET" syntax is not standard SQL, but mysql supports it,
> and this syntax works fine.
>
> My question is, how can I make certain attributes (specifically Status-Type,
> Terminate-Cause, and Ascend-Disconnect-Cause) log as integers instead of
> strings. Is there a corresponding %-substitution that would give me the
> integer?
>
> If there's is no such %-substitution, then it occurred to me to use a
> PreClientHook to add a pseudo-attribute containing the integer, and then log
> that in the SQL statement (or with AcctColumnDef, for that matter), so that
> no translation is done, with something like:
> $request->changeattr('Acct-Terminate-Cause-Int', \
> $request->getAttrByNum($Radius::Radius::ACCT_TERMINATE_CAUSE));
> I believe this would work fine for the well-known attributes, but one of the
> attributes I want to do this with is vendor-specific
> (Ascend-Disconnect-Cause), and being the neophyte perl programmer I am, I
> don't see a way to get to the integer information. Come to think of it, i
> would PREFER this solution, because I'm then free to massage the data a bit
> more and store either Acct-Terminate-Cause or Ascend-Disconnect-Cause in a
> single field in the database, since each NAS only sends one or the other. To
> tell them apart, I'd add 1000 to the value if its an
> Ascend-Disconnect-Cause.
>
> So my question becomes: Within a hook, how do I get the integer value of a
> vendor-specific-attribute instead of its string value from the dictionary?
>
Have a look at this and let me know how you get on:
"goodies/extendedMacros.patch"
This is in the "goodies" directory in the distribution.
There was also a discussion about this same topic on the list about six months
ago from memory - check the archive site and do a search:
http://www.starport.net/~radiator
On the topic of hooks, there is some example code here:
http://www.open.com.au/radiator/downloads/patches-2.15/hooks.txt
hth
Hugh
--
Radiator: the most portable, flexible and configurable RADIUS server
anywhere. SQL, proxy, DBM, files, LDAP, NIS+, password, NT, Emerald,
Platypus, Freeside, Interbiller, TACACS+, PAM, external, etc, etc.
Available on Unix, Linux, FreeBSD, Windows 95/98/2000, NT, MacOS X.
===
Archive at http://www.starport.net/~radiator/
Announcements on [EMAIL PROTECTED]
To unsubscribe, email '[EMAIL PROTECTED]' with
'unsubscribe radiator' in the body of the message.