From 1f4fc1d66711bf4e0ea5562b4992fd36442847a7 Mon Sep 17 00:00:00 2001
From: Robert Anderson <randerson@lbsd.net>
Date: Fri, 27 Mar 2009 13:47:40 +0000
Subject: [PATCH] function to return string value for terminate cause code

---
 webui/includes/radiuscodes.php | 64 ++++++++++++++++++++++++++++++++++
 1 file changed, 64 insertions(+)
 create mode 100644 webui/includes/radiuscodes.php

diff --git a/webui/includes/radiuscodes.php b/webui/includes/radiuscodes.php
new file mode 100644
index 00000000..a9b85274
--- /dev/null
+++ b/webui/includes/radiuscodes.php
@@ -0,0 +1,64 @@
+<?php
+# Radius term code mappings
+#
+# Copyright (c) 2005-2008, AllWorldIT
+# 
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+# 
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+# 
+# You should have received a copy of the GNU General Public License along
+# with this program; if not, write to the Free Software Foundation, Inc.,
+# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+
+
+
+
+# Return string for radius term code
+function strRadiusTermCode($errCode) {
+
+	if (is_numeric($errCode)) {
+
+		switch ($errCode) {
+			case 0:
+				return "Still logged in";
+			case 45: # Unknown
+			case 46: # Unknown
+			case 63: # Unknown
+			case 1:
+				return "User request";
+			case 2:
+			case 816: # TCP connection reset? unknown
+				return "Carrier loss";
+			case 5:
+				return "Session timeout";
+			case 6: # Admin reset
+			case 10: # NAS request
+			case 11: # NAS reboot
+			case 831: # NAS request? unknown
+			case 841: # NAS request? unknown
+				return "Router reset/reboot";
+			case 8: # Port error
+				return "Port error";
+			case 180: # Unknown
+				return "Local hangup";
+			case 827: # Unknown
+				return "Service unavailable";
+			default:
+				return "Unkown";
+		}
+
+	} else {
+		return "Unknown";
+	}
+
+}
+
+
+?> 
-- 
GitLab