---[[
-
-LuCI - Configuration Bind Interface - Datatype Tests
-(c) 2010 Jo-Philipp Wich <xm@subsignal.org>
-
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
-$Id$
-
-]]--
+-- Copyright 2010 Jo-Philipp Wich <jow@openwrt.org>
+-- Licensed to the public under the Apache License 2.0.
local fs = require "nixio.fs"
local ip = require "luci.ip"
return uciname(val) or host(val)
end
+function hostport(val)
+ local h, p = val:match("^([^:]+):([^:]+)$")
+ return not not (h and p and host(h) and port(p))
+end
+
+function ipaddrport(val)
+ local h, p = val:match("^([^:]+):([^:]+)$")
+ return not not (h and p and ipaddr(h) and port(p))
+end
+
function wpakey(val)
if #val == 64 then
return (val:match("^[a-fA-F0-9]+$") ~= nil)