User's Manual

Calculate the number of sessions for accounting records matching a specific calling-station-id. The calling
station id address is looked up automatically from the RADIUS Access-Request (Calling-Station-ID attribute).
Because different NAS equipment can send differently-formatted MAC addresses in the Calling-Station-Id
attribute, the $mac_format argument may be specified. This should be a sprintf-style format string that
accepts 6 arguments (the octets of the MAC address). The default if not specified is the IEEE 802 standard
format, %02X-%02X-%02X-%02X-%02X-%02X – that is, uppercase hexadecimal with each octet separated
with a hyphen.
See "GetTraffic()" on page 490 for details on how to specify the time interval.
GetCallingStationTime()
GetCallingStationTime($callingstationid, $from_time, $to_time = null, $mac_format = null)
Calculate sum of session times in a specified time interval.
Because different NAS equipment can send differently-formatted MAC addresses in the Calling-Station-Id
attribute, the $mac_format argument may be specified. This should be a sprintf-style format string that
accepts 6 arguments (the octets of the MAC address). The default if not specified is the IEEE 802 standard
format, %02X-%02X-%02X-%02X-%02X-%02X – that is, uppercase hexadecimal with each octet separated
with a hyphen.
The calling station ID is looked up automatically from the RADIUS Access-Request (Calling-Station-ID attribute).
See "GetTraffic()" on page 490 for details on how to specify the time interval.
GetCallingStationTraffic()
GetCallingStationTraffic($callingstationid, $from_time, $to_time = null,
$in_out = null, $mac_format = null)
Calculate sum of traffic counters in a time interval. Sessions are summed if they have the same Calling-Station-
Id attribute as that specified in the RADIUS Access-Request.
If no Calling-Station-Id attribute was included in the request, returns zero.
Because different NAS equipment can send differently-formatted MAC addresses in the Calling-Station-Id
attribute, the $mac_format argument may be specified. This should be a sprintf-style format string that
accepts 6 arguments (the octets of the MAC address). The default if not specified is the IEEE 802 standard
format, %02X-%02X-%02X-%02X-%02X-%02X – that is, uppercase hexadecimal with each octet separated
with a hyphen. This string matches what ClearPass Guest sees from the NAS.
The time interval specified by $from_time and optionally $to_time is also used to narrow the search.
If $to_time is not specified, $from_time is a “look back” time, that is, the time interval in seconds before the
current time.
If $to_time is specified, the interval considered is between $from_time and $to_time.
$in_out may be in” to count only input octets, out” to count only output octets, or any other value to count
both input and output octets towards the traffic total.
Examples:
l Use the following as the condition expression for a RADIUS role attribute. Authorizes a user only if their
total traffic (in + out) in the past day does not exceed 10 MB. Be aware that the attribute with this condition
expression will never be included in the response!
l return GetUserTraffic(86400) > 10485760 && AccessReject()
l Like the above, but only considers output (that is, user downloads):
l return GetUserTraffic(86400,'out') > 10485760 && AccessReject()
l Another way to limit the past 30 days downloads to 100 MB:
Dell Networking W-ClearPass Guest 6.4 | User Guide Reference | 487