openwrt: initial import of 8.09 packages files patches and config
This commit is contained in:
parent
2fe11597eb
commit
f33ae0db29
File diff suppressed because it is too large
Load Diff
|
@ -0,0 +1,23 @@
|
|||
config dnsmasq
|
||||
option domainneeded 1
|
||||
option boguspriv 1
|
||||
option filterwin2k '0' #enable for dial on demand
|
||||
option localise_queries 1
|
||||
option local '/lan/'
|
||||
option domain 'home'
|
||||
option expandhosts 1
|
||||
option nonegcache 0
|
||||
option authoritative 1
|
||||
option readethers 1
|
||||
option leasefile '/tmp/dhcp.leases'
|
||||
option resolvfile '/tmp/resolv.conf.auto'
|
||||
|
||||
config dhcp
|
||||
option interface lan
|
||||
option start 100
|
||||
option limit 150
|
||||
option leasetime 12h
|
||||
|
||||
config dhcp
|
||||
option interface wan
|
||||
option ignore 1
|
|
@ -0,0 +1,3 @@
|
|||
config dropbear
|
||||
option PasswordAuth 'off'
|
||||
option Port '22'
|
|
@ -0,0 +1,87 @@
|
|||
config defaults
|
||||
option syn_flood 1
|
||||
option input ACCEPT
|
||||
option output ACCEPT
|
||||
option forward REJECT
|
||||
|
||||
config zone
|
||||
option name lan
|
||||
option input ACCEPT
|
||||
option output ACCEPT
|
||||
option forward REJECT
|
||||
|
||||
config zone
|
||||
option name wan
|
||||
option input REJECT
|
||||
option output ACCEPT
|
||||
option forward REJECT
|
||||
option masq 1
|
||||
|
||||
config forwarding
|
||||
option src lan
|
||||
option dest wan
|
||||
|
||||
## Enable this option if you encounter any MTU problems
|
||||
## e.g. some websites work, others do not, submitting
|
||||
## forms causes problems, ...
|
||||
# option mtu_fix 1
|
||||
|
||||
|
||||
### EXAMPLE CONFIG SECTIONS
|
||||
# do not allow a specific ip to access wan
|
||||
#config rule
|
||||
# option src lan
|
||||
# option src_ip 192.168.45.2
|
||||
# option dest wan
|
||||
# option proto tcp
|
||||
# option target REJECT
|
||||
|
||||
# block a specific mac on wan
|
||||
#config rule
|
||||
# option dest wan
|
||||
# option src_mac 00:11:22:33:44:66
|
||||
# option target REJECT
|
||||
|
||||
# block incoming ICMP traffic on a zone
|
||||
#config rule
|
||||
# option src lan
|
||||
# option proto ICMP
|
||||
# option target DROP
|
||||
|
||||
# port redirect port coming in on wan to lan
|
||||
#config redirect
|
||||
# option src wan
|
||||
# option src_dport 80
|
||||
# option dest lan
|
||||
# option dest_ip 192.168.16.235
|
||||
# option dest_port 80
|
||||
# option proto tcp
|
||||
|
||||
# include a file with users custom iptables rules
|
||||
config include
|
||||
option path /etc/firewall.user
|
||||
|
||||
|
||||
### FULL CONFIG SECTIONS
|
||||
#config rule
|
||||
# option src lan
|
||||
# option src lan
|
||||
# option src_ip 192.168.45.2
|
||||
# option src_mac 00:11:22:33:44:55
|
||||
# option src_port 80
|
||||
# option dest wan
|
||||
# option dest_ip 194.25.2.129
|
||||
# option dest_port 120
|
||||
# option proto tcp
|
||||
# option target REJECT
|
||||
|
||||
#config redirect
|
||||
# option src lan
|
||||
# option src_ip 192.168.45.2
|
||||
# option src_mac 00:11:22:33:44:55
|
||||
# option src_port 1024
|
||||
# option src_dport 80
|
||||
# option dest_ip 194.25.2.129
|
||||
# option dest_port 120
|
||||
# option proto tcp
|
||||
|
|
@ -0,0 +1,17 @@
|
|||
# Copyright (C) 2006 OpenWrt.org
|
||||
|
||||
config interface loopback
|
||||
option ifname lo
|
||||
option proto static
|
||||
option ipaddr 127.0.0.1
|
||||
option netmask 255.0.0.0
|
||||
|
||||
config interface wan
|
||||
option ifname ath0
|
||||
option proto dhcp
|
||||
|
||||
config interface lan
|
||||
option ifname eth0
|
||||
option proto static
|
||||
option ipaddr 192.168.255.1
|
||||
option netmask 255.255.255.0
|
|
@ -0,0 +1,10 @@
|
|||
config system
|
||||
option hostname flukso
|
||||
option device 0123456789abcdef0123456789abcdef
|
||||
option key 00112233445566778899aabbccddeeff
|
||||
option version 5
|
||||
|
||||
config button
|
||||
option button reset
|
||||
option action pressed
|
||||
option handler 'gpioctl set 7; gpioctl clear 7'
|
|
@ -0,0 +1,19 @@
|
|||
config wifi-device wifi0
|
||||
option type atheros
|
||||
option channel auto
|
||||
option diversity 0
|
||||
option txantenna 1
|
||||
option rxantenna 1
|
||||
option disabled 0
|
||||
|
||||
config wifi-iface
|
||||
option device wifi0
|
||||
option network wan
|
||||
option mode sta
|
||||
option nosbeacon 1
|
||||
option hidden 0
|
||||
option txpower 16
|
||||
option ssid zwaluw
|
||||
option encryption wep
|
||||
option key 4ae56b7820f6b6b3cba78da46b
|
||||
|
|
@ -0,0 +1,2 @@
|
|||
127.0.0.1 localhost
|
||||
192.168.255.1 flukso
|
|
@ -0,0 +1,2 @@
|
|||
::sysinit:/etc/init.d/rcS S boot
|
||||
::shutdown:/etc/init.d/rcS K stop
|
|
@ -0,0 +1,3 @@
|
|||
root:$1$VtdkJasi$HdGYp/XcbJmQ3BInhA/ki/:0:0:root:/root:/bin/ash
|
||||
nobody:*:65534:65534:nobody:/var:/bin/false
|
||||
daemon:*:65534:65534:daemon:/var:/bin/false
|
|
@ -0,0 +1,58 @@
|
|||
#
|
||||
# Copyright (C) 2006 OpenWrt.org
|
||||
#
|
||||
# This is free software, licensed under the GNU General Public License v2.
|
||||
# See /LICENSE for more information.
|
||||
#
|
||||
# $Id: Makefile 9947 2007-12-27 02:12:04Z nbd $
|
||||
|
||||
include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=expat
|
||||
PKG_VERSION:=1.95.8
|
||||
PKG_RELEASE:=1
|
||||
|
||||
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
|
||||
PKG_MD5SUM:=aff487543845a82fe262e6e2922b4c8e
|
||||
PKG_SOURCE_URL:=@SF/expat
|
||||
|
||||
PKG_FIXUP = libtool
|
||||
|
||||
include $(INCLUDE_DIR)/package.mk
|
||||
|
||||
|
||||
define Package/libexpat
|
||||
SECTION:=libs
|
||||
CATEGORY:=Libraries
|
||||
TITLE:=An XML parsing library
|
||||
URL:=http://expat.sourceforge.net/
|
||||
endef
|
||||
|
||||
define Package/libexpat/description
|
||||
A fast, non-validating, stream-oriented XML parsing library.
|
||||
endef
|
||||
|
||||
|
||||
CONFIGURE_ARGS += \
|
||||
--enable-shared \
|
||||
--enable-static
|
||||
|
||||
define Build/Compile
|
||||
$(MAKE) -C $(PKG_BUILD_DIR) DESTDIR="$(PKG_INSTALL_DIR)" install
|
||||
endef
|
||||
|
||||
define Build/InstallDev
|
||||
mkdir -p $(1)/usr/include
|
||||
$(CP) $(PKG_INSTALL_DIR)/usr/include/expat{,_external}.h $(1)/usr/include/
|
||||
mkdir -p $(1)/usr/lib
|
||||
$(CP) $(PKG_INSTALL_DIR)/usr/lib/libexpat.{a,so*} $(1)/usr/lib/
|
||||
endef
|
||||
|
||||
define Package/libexpat/install
|
||||
$(INSTALL_DIR) $(1)/usr/lib
|
||||
$(CP) $(PKG_INSTALL_DIR)/usr/lib/libexpat.so.* $(1)/usr/lib/
|
||||
endef
|
||||
|
||||
|
||||
$(eval $(call BuildPackage,libexpat))
|
||||
|
|
@ -0,0 +1,45 @@
|
|||
diff -ruN expat-1.95.8-orig/Makefile.in expat-1.95.8-1/Makefile.in
|
||||
--- expat-1.95.8-orig/Makefile.in 2004-05-07 22:00:48.000000000 +0200
|
||||
+++ expat-1.95.8-1/Makefile.in 2005-04-04 22:53:09.000000000 +0200
|
||||
@@ -34,6 +34,8 @@
|
||||
|
||||
top_builddir = .
|
||||
|
||||
+DESTDIR =
|
||||
+
|
||||
|
||||
INSTALL = @INSTALL@
|
||||
INSTALL_PROGRAM = @INSTALL_PROGRAM@
|
||||
@@ -73,22 +75,22 @@
|
||||
tests/runtests
|
||||
|
||||
install: xmlwf/xmlwf installlib
|
||||
- $(mkinstalldirs) $(bindir) $(man1dir)
|
||||
- $(LIBTOOL) --mode=install $(INSTALL_PROGRAM) xmlwf/xmlwf $(bindir)/xmlwf
|
||||
- $(INSTALL_DATA) $(MANFILE) $(man1dir)
|
||||
+ $(mkinstalldirs) $(DESTDIR)$(bindir) $(DESTDIR)$(man1dir)
|
||||
+ $(LIBTOOL) --mode=install $(INSTALL_PROGRAM) xmlwf/xmlwf $(DESTDIR)$(bindir)/xmlwf
|
||||
+ $(INSTALL_DATA) $(MANFILE) $(DESTDIR)$(man1dir)
|
||||
|
||||
installlib: $(LIBRARY) $(APIHEADER)
|
||||
- $(mkinstalldirs) $(libdir) $(includedir)
|
||||
- $(LIBTOOL) --mode=install $(INSTALL) $(LIBRARY) $(libdir)/$(LIBRARY)
|
||||
- $(INSTALL_DATA) $(APIHEADER) $(includedir)
|
||||
+ $(mkinstalldirs) $(DESTDIR)$(libdir) $(DESTDIR)$(includedir)
|
||||
+ $(LIBTOOL) --mode=install $(INSTALL) $(LIBRARY) $(DESTDIR)$(libdir)/$(LIBRARY)
|
||||
+ $(INSTALL_DATA) $(APIHEADER) $(DESTDIR)$(includedir)
|
||||
|
||||
uninstall: uninstalllib
|
||||
- $(LIBTOOL) --mode=uninstall rm -f $(bindir)/xmlwf
|
||||
- rm -f $(man1dir)/xmlwf.1
|
||||
+ $(LIBTOOL) --mode=uninstall rm -f $(DESTDIR)$(bindir)/xmlwf
|
||||
+ rm -f $(DESTDIR)$(man1dir)/xmlwf.1
|
||||
|
||||
uninstalllib:
|
||||
- $(LIBTOOL) --mode=uninstall rm -f $(libdir)/$(LIBRARY)
|
||||
- rm -f $(includedir)/$(APIHEADER)
|
||||
+ $(LIBTOOL) --mode=uninstall rm -f $(DESTDIR)$(libdir)/$(LIBRARY)
|
||||
+ rm -f $(DESTDIR)$(includedir)/$(APIHEADER)
|
||||
|
||||
# for VPATH builds (invoked by configure)
|
||||
mkdir-init:
|
|
@ -0,0 +1,21 @@
|
|||
diff -urN expat-1.95.8.orig/conftools/config.sub expat-1.95.8/conftools/config.sub
|
||||
--- expat-1.95.8.orig/conftools/config.sub 2002-06-02 00:29:30.000000000 +0200
|
||||
+++ expat-1.95.8/conftools/config.sub 2008-04-14 18:27:28.000000000 +0200
|
||||
@@ -251,7 +251,7 @@
|
||||
| a29k \
|
||||
| alpha | alphaev[4-8] | alphaev56 | alphaev6[78] | alphapca5[67] \
|
||||
| alpha64 | alpha64ev[4-8] | alpha64ev56 | alpha64ev6[78] | alpha64pca5[67] \
|
||||
- | arc | arm | arm[bl]e | arme[lb] | armv[2345] | armv[345][lb] | avr \
|
||||
+ | arc | arm | arm[bl]e | arme[lb] | armv[2345] | armv[345][lb] | avr | avr32 \
|
||||
| c4x | clipper \
|
||||
| d10v | d30v | dsp16xx \
|
||||
| fr30 \
|
||||
@@ -305,7 +305,7 @@
|
||||
| alpha64-* | alpha64ev[4-8]-* | alpha64ev56-* | alpha64ev6[78]-* \
|
||||
| alphapca5[67]-* | alpha64pca5[67]-* | arc-* \
|
||||
| arm-* | armbe-* | armle-* | armv*-* \
|
||||
- | avr-* \
|
||||
+ | avr-* | avr32-* \
|
||||
| bs2000-* \
|
||||
| c[123]* | c30-* | [cjt]90-* | c54x-* \
|
||||
| clipper-* | cydra-* \
|
|
@ -0,0 +1,44 @@
|
|||
# Copyright (c) 2008 jokamajo.org
|
||||
# $Id: Makefile 3 2008-08-07 16:00:00Z icarus75 $
|
||||
|
||||
include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=flukso
|
||||
PKG_VERSION:=0.1
|
||||
PKG_RELEASE:=5
|
||||
|
||||
PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)-$(PKG_VERSION)
|
||||
|
||||
include $(INCLUDE_DIR)/package.mk
|
||||
|
||||
define Package/flukso
|
||||
SECTION:=utils
|
||||
CATEGORY:=Utilities
|
||||
DEPENDS:=+liblua-xmlrpc +ntpclient +netcat
|
||||
TITLE:=Flukso - community metering
|
||||
endef
|
||||
|
||||
define Package/flukso/description
|
||||
This package contains the necessary openwrt files for the Flukso [www.flukso.net] community metering application.
|
||||
endef
|
||||
|
||||
define Build/Prepare
|
||||
mkdir -p $(PKG_BUILD_DIR)
|
||||
$(CP) ./src/* $(PKG_BUILD_DIR)/
|
||||
endef
|
||||
|
||||
define Build/Compile
|
||||
endef
|
||||
|
||||
define Package/flukso/install
|
||||
$(INSTALL_DIR) $(1)/usr/share/lua/flukso/
|
||||
$(CP) $(PKG_BUILD_DIR)/flukso.lua $(1)/usr/share/lua/flukso/
|
||||
$(CP) $(PKG_BUILD_DIR)/data.lua $(1)/usr/share/lua/flukso/
|
||||
$(CP) $(PKG_BUILD_DIR)/dbg.lua $(1)/usr/share/lua/flukso/
|
||||
$(CP) $(PKG_BUILD_DIR)/auth.lua $(1)/usr/share/lua/flukso/
|
||||
$(CP) $(PKG_BUILD_DIR)/heartbeat.lua $(1)/usr/share/lua/flukso/
|
||||
$(INSTALL_DIR) $(1)/etc/init.d/
|
||||
$(CP) $(PKG_BUILD_DIR)/flukso.init $(1)/etc/init.d/flukso
|
||||
endef
|
||||
|
||||
$(eval $(call BuildPackage,flukso))
|
|
@ -0,0 +1,73 @@
|
|||
--
|
||||
-- auth.lua: property and methods for generating hmac-sha1 authentication
|
||||
-- Copyright (c) 2009 jokamajo.org
|
||||
--
|
||||
-- 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.
|
||||
--
|
||||
-- $Id: auth.lua 1 2009-03-13 13:40:00Z icarus75 $
|
||||
--
|
||||
|
||||
require 'luci.model.uci'
|
||||
require 'lxyssl'
|
||||
|
||||
local string, table, os, luci, lxyssl =
|
||||
string, table, os, luci, lxyssl
|
||||
|
||||
local getfenv, setmetatable, type, pairs, tostring =
|
||||
getfenv, setmetatable, type, pairs, tostring
|
||||
|
||||
module(...)
|
||||
local modenv = getfenv()
|
||||
|
||||
function new()
|
||||
return setmetatable({}, {__index = modenv})
|
||||
end
|
||||
|
||||
function load(T)
|
||||
local uci = luci.model.uci.cursor()
|
||||
uci:foreach ('system', 'system',
|
||||
function(section)
|
||||
T.device, T.key, T.version = section.device, section.key, section.version
|
||||
end
|
||||
)
|
||||
end
|
||||
|
||||
function hmac(T, M, timestamp)
|
||||
function string.hex(x)
|
||||
local t={}
|
||||
for c in x:gmatch('(.)') do t[#t+1]=string.format('%02x', c:byte()) end
|
||||
return table.concat(t,'')
|
||||
end
|
||||
|
||||
function serialise(M)
|
||||
if type(M) == 'table' then
|
||||
local sequence = ''
|
||||
for k, v in pairs(M) do
|
||||
if v ~= nil then
|
||||
sequence = sequence..tostring(k)..serialise(v)
|
||||
end
|
||||
end
|
||||
return sequence
|
||||
else
|
||||
return tostring(M)
|
||||
end
|
||||
end
|
||||
|
||||
T.timestamp = timestamp or os.time()
|
||||
T.message = T.timestamp..':'..serialise(M)..':'..T.key -- or T.timestamp..':'..T.nonce..':'..T.key
|
||||
T.signature = lxyssl.hash('hmac-sha1', T.key):digest(T.message):hex()
|
||||
|
||||
T.message, T.key, T.version = nil, nil, nil
|
||||
end
|
|
@ -0,0 +1,62 @@
|
|||
--
|
||||
-- data.lua: property and methods for manipulating incoming measurements
|
||||
-- Copyright (c) 2009 jokamajo.org
|
||||
--
|
||||
-- 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.
|
||||
--
|
||||
-- $Id: data.lua 1 2009-01-31 22:30:00Z icarus75 $
|
||||
--
|
||||
|
||||
local os, math, table =
|
||||
os, math, table
|
||||
|
||||
local getfenv, setmetatable, pairs =
|
||||
getfenv, setmetatable, pairs
|
||||
|
||||
module (...)
|
||||
local modenv = getfenv() -- module environment
|
||||
|
||||
function new()
|
||||
return setmetatable({}, {__index = modenv})
|
||||
end
|
||||
|
||||
function add(M, meter, timestamp, value)
|
||||
if not M[meter] then M[meter] = {} end
|
||||
M[meter][timestamp] = value
|
||||
end
|
||||
|
||||
function clear(M)
|
||||
for meter in pairs(M) do
|
||||
M[meter] = nil
|
||||
end
|
||||
end
|
||||
|
||||
function filter(M, span, offset)
|
||||
for meter, T in pairs(M) do
|
||||
local H = {} -- helper table, an indexed array containing all the measurement's timestamps
|
||||
for timestamp in pairs(T) do H[#H+1] = timestamp end
|
||||
table.sort(H) -- sort in ascending order, oldest timestamps will be treated first
|
||||
|
||||
local i = 2
|
||||
while not (H[i+1] == nil or H[i] > os.time()-offset) do
|
||||
if math.floor(H[i-1]/span) == math.floor(H[i]/span) and math.floor(H[i]/span) == math.floor(H[i+1]/span) then
|
||||
T[H[i]] = nil
|
||||
table.remove(H, i)
|
||||
else
|
||||
i = i+1
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
|
@ -0,0 +1,50 @@
|
|||
--
|
||||
-- dbg.lua: library for debugging with vardump in Lua
|
||||
-- Lua Programming Gems Chapter 3
|
||||
-- Vardump: The Power of Seeing What's Behind
|
||||
-- Copyright 2008 by Tobias Sülzenbrück and Christoph Beckmann
|
||||
--
|
||||
-- $Id: dbg.lua 1 2009-01-31 22:30:00Z icarus75 $
|
||||
--
|
||||
|
||||
local getfenv, getmetatable, print, pairs, type, tostring = getfenv, getmetatable, print, pairs, type, tostring
|
||||
|
||||
module(...)
|
||||
local modenv = getfenv() -- module environment
|
||||
|
||||
function vardump(value, depth, key)
|
||||
local linePrefix = ""
|
||||
local spaces = ""
|
||||
|
||||
if key ~= nil then
|
||||
linePrefix = "["..key.."] = "
|
||||
end
|
||||
|
||||
if depth == nil then
|
||||
depth = 0
|
||||
else
|
||||
depth = depth + 1
|
||||
for i = 1,depth do spaces = spaces.." " end
|
||||
end
|
||||
|
||||
if type(value) == 'table' then
|
||||
-- mTable = getmetatable(value)
|
||||
-- if mTable == nil then
|
||||
print(spaces..linePrefix.."(table) ")
|
||||
-- else
|
||||
-- print(spaces.."(metatable) ")
|
||||
-- value = mTable
|
||||
-- end
|
||||
for tableKey, tableValue in pairs(value) do
|
||||
vardump(tableValue, depth, tableKey)
|
||||
end
|
||||
elseif type(value) == 'function'
|
||||
or type(value) == 'thread'
|
||||
or type(value) == 'userdata'
|
||||
or value == nil
|
||||
then
|
||||
print(spaces..tostring(value))
|
||||
else
|
||||
print(spaces..linePrefix.."("..type(value)..") "..tostring(value))
|
||||
end
|
||||
end
|
|
@ -0,0 +1,17 @@
|
|||
#!/bin/sh /etc/rc.common
|
||||
# Copyroght (c) 2008 jokamajo.org
|
||||
# $Id: flukso.init 7 2009-02-16 23:13:00Z icarus75 $
|
||||
|
||||
START=98
|
||||
|
||||
start() {
|
||||
stty 4800 < /dev/ttyS0
|
||||
/usr/share/lua/flukso/flukso.lua >&- 2>&- <&- &
|
||||
/usr/share/lua/flukso/heartbeat.lua 1 >&- 2>&- <&-
|
||||
echo -e "$(date '+%M') * * * * /usr/share/lua/flukso/heartbeat.lua 0\n"'*/15 * * * * [ -z "$(ps | grep '\'fluks[o]\'')" ] && reboot' | crontab -
|
||||
}
|
||||
|
||||
stop() {
|
||||
crontab -r
|
||||
kill $(ps | grep 'fluks[o]' | awk '{print $1}')
|
||||
}
|
|
@ -0,0 +1,154 @@
|
|||
#!/usr/bin/env lua
|
||||
|
||||
--
|
||||
-- flukso.lua: flukso deamon running on openwrt
|
||||
-- Copyright (c) 2008-2009 jokamajo.org
|
||||
--
|
||||
-- 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.
|
||||
--
|
||||
-- $Id: deamon.lua 12 2009-03-04 22:30:00Z icarus75 $
|
||||
--
|
||||
|
||||
require 'posix'
|
||||
require 'xmlrpc.http'
|
||||
|
||||
data = require 'flukso.data'
|
||||
auth = require 'flukso.auth'
|
||||
dbg = require 'flukso.dbg'
|
||||
|
||||
local param = {xmlrpcaddress = 'http://logger.flukso.net/xmlrpc',
|
||||
xmlrpcversion = '1',
|
||||
xmlrpcmethod = 'logger.measurementAdd',
|
||||
device = '/dev/ttyS0',
|
||||
interval = 300}
|
||||
|
||||
function receive(device)
|
||||
return coroutine.wrap(function()
|
||||
-- open the connection to the syslog deamon, specifying our identity
|
||||
posix.openlog('flukso')
|
||||
posix.syslog(30, 'starting the flukso deamon')
|
||||
posix.syslog(30, 'listening for pulses on '..device..'...')
|
||||
|
||||
for line in io.lines(device) do
|
||||
if line:sub(1, 3) == 'pls' and line:len() == 47 and line:find(':') == 37 then -- user data + additional data integrity checks
|
||||
posix.syslog(30, 'received pulse from '..device..': '..line:sub(5))
|
||||
|
||||
-- flash the power led for 50ms
|
||||
os.execute('gpioctl set 7')
|
||||
socket.select(nil, nil, 0.05)
|
||||
os.execute('gpioctl clear 7')
|
||||
|
||||
local meter, value = line:sub(5, 36), tonumber(line:sub(38))
|
||||
coroutine.yield(meter, os.time(), value)
|
||||
elseif line:sub(1, 3) == 'msg' then -- control data
|
||||
posix.syslog(31, 'received message from '..device..': '..line:sub(5))
|
||||
else
|
||||
posix.syslog(27, 'input error on '..device..': '..line)
|
||||
end
|
||||
end
|
||||
|
||||
posix.syslog(30, 'closing down the flukso deamon')
|
||||
os.exit()
|
||||
end)
|
||||
end
|
||||
|
||||
function buffer(source, interval)
|
||||
return coroutine.wrap(function()
|
||||
local measurements = data.new()
|
||||
local threshold = os.time() + interval
|
||||
|
||||
while true do
|
||||
local meter, timestamp, value = source()
|
||||
if meter ~= nil and timestamp > 1234567890 then measurements:add(meter, timestamp, value) end
|
||||
if timestamp > threshold and next(measurements) then --checking whether table is not empty
|
||||
coroutine.yield(measurements)
|
||||
threshold = timestamp + interval
|
||||
end
|
||||
end
|
||||
end)
|
||||
end
|
||||
|
||||
function filter(source, span, offset)
|
||||
return coroutine.wrap(function()
|
||||
while true do
|
||||
local measurements = source()
|
||||
measurements:filter(span, offset)
|
||||
coroutine.yield(measurements)
|
||||
end
|
||||
end)
|
||||
end
|
||||
|
||||
function send(source, address, version, method)
|
||||
return coroutine.wrap(function()
|
||||
while true do
|
||||
local measurements = source()
|
||||
local auth = auth.new()
|
||||
auth:load()
|
||||
auth:hmac(measurements)
|
||||
|
||||
local status, ret_or_err, res = pcall(xmlrpc.http.call,
|
||||
address..'/'..version,
|
||||
method,
|
||||
auth,
|
||||
measurements)
|
||||
|
||||
if status then
|
||||
posix.syslog(30, tostring(res))
|
||||
if ret_or_err then --successful xmlrpc call
|
||||
measurements:clear()
|
||||
end
|
||||
else
|
||||
posix.syslog(27, tostring(ret_or_err)..' '..address..' '..tostring(res))
|
||||
end
|
||||
coroutine.yield(measurements)
|
||||
end
|
||||
end)
|
||||
end
|
||||
|
||||
function gc(source)
|
||||
return coroutine.wrap(function()
|
||||
while true do
|
||||
local measurements = source()
|
||||
posix.syslog(31, tostring(collectgarbage('count')*1024)..' bytes of memory used by Lua before garbage collection cycle')
|
||||
collectgarbage() -- force a complete garbage collection cycle
|
||||
posix.syslog(31, tostring(collectgarbage('count')*1024)..' bytes of memory used by Lua after garbage collection cycle')
|
||||
coroutine.yield(measurements)
|
||||
end
|
||||
end)
|
||||
end
|
||||
|
||||
-- receive: listen to the serial port for incoming pulses
|
||||
-- buffer: buffer the pulses in a measurement object
|
||||
-- filter: sweep recursively to filter all redundant entries
|
||||
-- send: report the measurements to the server via xmlrpc
|
||||
-- gc: perform a full garbage collection cycle
|
||||
|
||||
local aggregator = gc(
|
||||
send(
|
||||
filter(
|
||||
filter(
|
||||
filter(
|
||||
buffer(
|
||||
receive(param.device)
|
||||
, param.interval)
|
||||
, 60, 0)
|
||||
, 900, 7200)
|
||||
, 86400, 172800)
|
||||
, param.xmlrpcaddress, param.xmlrpcversion, param.xmlrpcmethod)
|
||||
)
|
||||
|
||||
while true do
|
||||
dbg.vardump(aggregator())
|
||||
end
|
|
@ -0,0 +1,90 @@
|
|||
#!/usr/bin/env lua
|
||||
|
||||
--
|
||||
-- Lua 5.1 heartbeat script running on openwrt
|
||||
-- Copyright (c) 2008-2009 jokamajo.org
|
||||
--
|
||||
-- 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.
|
||||
--
|
||||
-- $Id: heartbeat.lua 6 2008-03-17 21:17:00Z icarus75 $
|
||||
--
|
||||
|
||||
if not arg[1] then
|
||||
print ('Please pass the reset argument as a boolean to the script.')
|
||||
else
|
||||
-- load libraries
|
||||
require 'posix'
|
||||
require 'xmlrpc.http'
|
||||
require 'luci.sys'
|
||||
|
||||
auth = require 'flukso.auth'
|
||||
dbg = require 'flukso.dbg'
|
||||
|
||||
-- config parameters
|
||||
local param = {server = 'logger.flukso.net',
|
||||
xmlrpcaddress = 'http://logger.flukso.net/xmlrpc',
|
||||
xmlrpcversion = '1',
|
||||
xmlrpcmethod = 'logger.heartbeat'}
|
||||
|
||||
local monitor = {reset = tonumber(arg[1])}
|
||||
|
||||
-- open the connection to the syslog deamon, specifying our identity
|
||||
posix.openlog('heartbeat')
|
||||
|
||||
-- calculate hmac and collect relevant monitoring points
|
||||
local auth = auth.new()
|
||||
auth:load()
|
||||
monitor.version = tonumber(auth.version)
|
||||
|
||||
monitor.uptime = math.floor(luci.sys.uptime())
|
||||
monitor.uart_oe = string.match(luci.sys.exec('cat /proc/tty/driver/serial'), 'oe:(%d+)') or 0
|
||||
system, model, monitor.memtotal, monitor.memcached, monitor.membuffers, monitor.memfree = luci.sys.sysinfo()
|
||||
|
||||
auth:hmac(monitor)
|
||||
|
||||
dbg.vardump(auth)
|
||||
dbg.vardump(monitor)
|
||||
|
||||
-- send a heartbeat method call
|
||||
local pcall_ok, return_or_err, pong = pcall(xmlrpc.http.call,
|
||||
param.xmlrpcaddress..'/'..param.xmlrpcversion,
|
||||
param.xmlrpcmethod,
|
||||
auth,
|
||||
monitor)
|
||||
|
||||
dbg.vardump(pong)
|
||||
|
||||
if pcall_ok and return_or_err then
|
||||
auth:load()
|
||||
auth:hmac(pong.upgrade, pong.timestamp)
|
||||
|
||||
if auth.signature == pong.signature and pong.timestamp > os.time() - 300 then
|
||||
posix.syslog(31, 'successful heartbeat authentication')
|
||||
|
||||
if tonumber(pong.upgrade) == monitor.version then --reset device
|
||||
os.execute('reboot')
|
||||
elseif tonumber(pong.upgrade) > monitor.version then -- upgrade device to specified version
|
||||
os.execute('wget -P /tmp http://'..param.server..'/files/upgrade/upgrade.'..pong.upgrade)
|
||||
os.execute('chmod a+x /tmp/upgrade.'..pong.upgrade)
|
||||
os.execute('/tmp/upgrade.'..pong.upgrade)
|
||||
os.execute('rm /tmp/upgrade.'..pong.upgrade)
|
||||
end
|
||||
end
|
||||
else
|
||||
posix.syslog(11, tostring(return_or_err))
|
||||
end
|
||||
-- close the connection to the syslog deamon
|
||||
posix.closelog()
|
||||
end
|
|
@ -0,0 +1,14 @@
|
|||
#! /usr/bin/env lua
|
||||
|
||||
require 'socket'
|
||||
|
||||
local fd = assert(io.open('/dev/ttyUSB0', 'w'))
|
||||
|
||||
for i = tonumber(arg[1]), tonumber(arg[2]) do
|
||||
local data = 'pls ' .. arg[3] .. ':' .. string.sub(string.rep('0', 10) .. i, -10, -1) .. '\n'
|
||||
fd:write(data)
|
||||
socket.select(nil, nil, 0.001)
|
||||
|
||||
end
|
||||
|
||||
fd:close()
|
|
@ -0,0 +1,93 @@
|
|||
#
|
||||
# Copyright (C) 2006 OpenWrt.org
|
||||
#
|
||||
# This is free software, licensed under the GNU General Public License v2.
|
||||
# See /LICENSE for more information.
|
||||
#
|
||||
# $Id: Makefile 6994 2007-04-18 00:46:40Z nico $
|
||||
|
||||
include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=luaexpat
|
||||
PKG_VERSION:=1.0.2
|
||||
PKG_RELEASE:=2
|
||||
|
||||
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
|
||||
PKG_SOURCE_URL:=http://luaforge.net/frs/download.php/1506/
|
||||
PKG_MD5SUM:=e99892c4b6b879ae649a491a07c3bed6
|
||||
PKG_CAT:=zcat
|
||||
|
||||
PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)-$(PKG_VERSION)
|
||||
PKG_INSTALL_DIR:=$(PKG_BUILD_DIR)/ipkg-install
|
||||
|
||||
include $(INCLUDE_DIR)/package.mk
|
||||
|
||||
define Package/liblua-expat
|
||||
SECTION:=lang
|
||||
SUBMENU:=LUA
|
||||
CATEGORY:=Languages
|
||||
TITLE:=luaexpat library for the LUA programming language
|
||||
URL:=http://www.luaforge.net/projects/luaexpat
|
||||
DEPENDS:=+liblua +libexpat
|
||||
endef
|
||||
|
||||
define Package/liblua-expat/description
|
||||
This package contains the luaexpat library, a binding for the expat XML parser for lua.
|
||||
endef
|
||||
|
||||
define Build/Configure
|
||||
endef
|
||||
|
||||
define Build/Compile
|
||||
cd $(PKG_BUILD_DIR)/ && \
|
||||
$(TARGET_CROSS)gcc -shared -o luaexpat.so src/lxplib.c -Wall -fPIC \
|
||||
$(EXTRA_CFLAGS) $(EXTRA_LDFLAGS) \
|
||||
$(TARGET_CFLAGS) $(TARGET_LDFLAGS) \
|
||||
-I$(STAGING_DIR)/usr/include \
|
||||
-lexpat -llua -lm -ldl &&\
|
||||
$(TARGET_CROSS)strip luaexpat.so &&\
|
||||
$(TARGET_CROSS)gcc -c src/lxplib.c -Wall \
|
||||
$(EXTRA_CFLAGS) $(EXTRA_LDFLAGS) \
|
||||
$(TARGET_CFLAGS) $(TARGET_LDFLAGS) \
|
||||
-I$(STAGING_DIR)/usr/include &&\
|
||||
$(TARGET_CROSS)ar r liblua-expat.a lxplib.o
|
||||
endef
|
||||
|
||||
define Build/InstallDev
|
||||
mkdir -p $(STAGING_DIR)/usr/include
|
||||
mkdir -p $(STAGING_DIR)/usr/lib/lua
|
||||
mkdir -p $(STAGING_DIR)/usr/share/lua/lxp
|
||||
$(CP) $(PKG_BUILD_DIR)/src/lxplib.h $(STAGING_DIR)/usr/include
|
||||
$(CP) $(PKG_BUILD_DIR)/src/lxp/lom.lua $(STAGING_DIR)/usr/share/lua/lxp/
|
||||
$(CP) $(PKG_BUILD_DIR)/luaexpat.so \
|
||||
$(STAGING_DIR)/usr/lib/liblua-expat.so.0.0.0
|
||||
cd $(STAGING_DIR)/usr/lib/ && \
|
||||
ln -fs liblua-expat.so.0.0.0 liblua-expat.so
|
||||
cd $(STAGING_DIR)/usr/lib/ && \
|
||||
ln -fs liblua-expat.so.0.0.0 liblua-expat.so.0
|
||||
cd $(STAGING_DIR)/usr/lib/lua/ && \
|
||||
ln -fs ../liblua-expat.so.0.0.0 lxp.so
|
||||
$(CP) $(PKG_BUILD_DIR)/liblua-expat.a $(STAGING_DIR)/usr/lib
|
||||
endef
|
||||
|
||||
define Build/UninstallDev
|
||||
$(RM) -f $(STAGING_DIR)/usr/include/lxplib.h
|
||||
$(RM) -f $(STAGING_DIR)/usr/lib/liblua-expat.so.0.0.0
|
||||
$(RM) -f $(STAGING_DIR)/usr/lib/liblua-expat.so.0
|
||||
$(RM) -f $(STAGING_DIR)/usr/lib/liblua-expat.a
|
||||
$(RM) -f $(STAGING_DIR)/usr/lib/lua/lxp.so
|
||||
$(RM) -rf $(STAGING_DIR)/usr/share/lua/lxp/
|
||||
endef
|
||||
|
||||
define Package/liblua-expat/install
|
||||
$(INSTALL_DIR) $(1)/usr/lib/lua
|
||||
$(INSTALL_DIR) $(1)/usr/share/lua/lxp
|
||||
$(CP) $(PKG_BUILD_DIR)/luaexpat.so \
|
||||
$(1)/usr/lib/liblua-expat.so.0.0.0
|
||||
cd $(1)/usr/lib/lua/ && \
|
||||
ln -fs ../liblua-expat.so.0.0.0 lxp.so
|
||||
cd $(1)/usr/lib/ && ln -sf liblua-expat.so.0.0.0 liblua-expat.so
|
||||
$(CP) $(PKG_BUILD_DIR)/src/lxp/lom.lua $(1)/usr/share/lua/lxp/
|
||||
endef
|
||||
|
||||
$(eval $(call BuildPackage,liblua-expat))
|
|
@ -0,0 +1,22 @@
|
|||
diff -urNad trunk~/src/lxplib.c trunk/src/lxplib.c
|
||||
--- trunk~/src/lxplib.c 2006-03-20 20:55:53.000000000 +0100
|
||||
+++ trunk/src/lxplib.c 2006-09-03 10:10:14.000000000 +0200
|
||||
@@ -13,7 +13,6 @@
|
||||
|
||||
#include "lua.h"
|
||||
#include "lauxlib.h"
|
||||
-#include "compat-5.1.h"
|
||||
|
||||
|
||||
#include "lxplib.h"
|
||||
@@ -530,8 +529,8 @@
|
||||
lua_pushliteral(L, "__index");
|
||||
lua_pushvalue(L, -2);
|
||||
lua_rawset(L, -3);
|
||||
- luaL_openlib (L, NULL, lxp_meths, 0);
|
||||
- luaL_openlib (L, "lxp", lxp_funcs, 0);
|
||||
+ luaL_register (L, NULL, lxp_meths);
|
||||
+ luaL_register (L, "lxp", lxp_funcs);
|
||||
set_info (L);
|
||||
|
||||
return 1;
|
|
@ -0,0 +1,18 @@
|
|||
diff -urNad trunk~/src/lxplib.c trunk/src/lxplib.c
|
||||
--- trunk~/src/lxplib.c 2006-03-20 20:55:53.000000000 +0100
|
||||
+++ trunk/src/lxplib.c 2006-08-22 14:00:43.000000000 +0200
|
||||
@@ -18,7 +18,13 @@
|
||||
|
||||
#include "lxplib.h"
|
||||
|
||||
-
|
||||
+static int luaL_findstring (const char *name, const char *const list[]) {
|
||||
+ int i;
|
||||
+ for (i=0; list[i]; i++)
|
||||
+ if (strcmp(list[i], name) == 0)
|
||||
+ return i;
|
||||
+ return -1; /* name not found */
|
||||
+}
|
||||
|
||||
enum XPState {
|
||||
XPSpre, /* parser just initialized */
|
|
@ -0,0 +1,184 @@
|
|||
#
|
||||
# Copyright (C) 2006 OpenWrt.org
|
||||
#
|
||||
# This is free software, licensed under the GNU General Public License v2.
|
||||
# See /LICENSE for more information.
|
||||
#
|
||||
# $Id: Makefile 6994 2007-04-18 00:46:40Z nico $
|
||||
|
||||
include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=luasocket
|
||||
PKG_VERSION:=2.0.2
|
||||
PKG_VERSION_MAJOR:=$(shell echo $(PKG_VERSION) | cut -d . -f 1)
|
||||
PKG_RELEASE:=1
|
||||
|
||||
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
|
||||
PKG_SOURCE_URL:=http://luaforge.net/frs/download.php/2664/
|
||||
PKG_MD5SUM:=41445b138deb7bcfe97bff957503da8e
|
||||
PKG_CAT:=zcat
|
||||
|
||||
PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)-$(PKG_VERSION)
|
||||
PKG_INSTALL_DIR:=$(PKG_BUILD_DIR)/ipkg-install
|
||||
|
||||
include $(INCLUDE_DIR)/package.mk
|
||||
|
||||
define Package/liblua-socket
|
||||
SECTION:=lang
|
||||
SUBMENU:=LUA
|
||||
CATEGORY:=Languages
|
||||
DEPENDS:=+liblua
|
||||
URL:=http://luasocket.luaforge.net/
|
||||
TITLE:=TCP/UDP socket library for LUA programming language
|
||||
endef
|
||||
|
||||
define Package/liblua-socket/description
|
||||
Luasocket provides a TCP/UDP socket library for Lua 5.1. Also provided are HTTP and SMTP implementations, a simple FTP implementation and some URL parsing functions. Luasocket supports blocking and non-blocking sockets and also provides a select() interface to the language.
|
||||
|
||||
endef
|
||||
|
||||
define Build/Configure
|
||||
endef
|
||||
|
||||
# omitted static libraries
|
||||
define Build/Compile
|
||||
cd $(PKG_BUILD_DIR)/ && \
|
||||
$(TARGET_CROSS)gcc -shared -o src/socket.so \
|
||||
src/luasocket.c \
|
||||
src/timeout.c \
|
||||
src/buffer.c \
|
||||
src/io.c \
|
||||
src/auxiliar.c \
|
||||
src/options.c \
|
||||
src/inet.c \
|
||||
src/tcp.c \
|
||||
src/udp.c \
|
||||
src/except.c \
|
||||
src/select.c \
|
||||
src/usocket.c -Wall -fPIC \
|
||||
$(EXTRA_CFLAGS) $(EXTRA_LDFLAGS) \
|
||||
$(TARGET_CFLAGS) $(TARGET_LDFLAGS) \
|
||||
-I$(STAGING_DIR)/usr/include \
|
||||
-llua -lm -ldl &&\
|
||||
$(TARGET_CROSS)strip src/socket.so &&\
|
||||
$(TARGET_CROSS)gcc -shared -o src/mime.so \
|
||||
src/mime.c -Wall -fPIC \
|
||||
$(EXTRA_CFLAGS) $(EXTRA_LDFLAGS) \
|
||||
$(TARGET_CFLAGS) $(TARGET_LDFLAGS) \
|
||||
-I$(STAGING_DIR)/usr/include \
|
||||
-llua -lm -ldl &&\
|
||||
$(TARGET_CROSS)strip src/mime.so &&\
|
||||
$(TARGET_CROSS)gcc -shared -o src/unix.so \
|
||||
src/buffer.c \
|
||||
src/auxiliar.c \
|
||||
src/options.c \
|
||||
src/timeout.c \
|
||||
src/io.c \
|
||||
src/usocket.c \
|
||||
src/unix.c -Wall -fPIC \
|
||||
$(EXTRA_CFLAGS) $(EXTRA_LDFLAGS) \
|
||||
$(TARGET_CFLAGS) $(TARGET_LDFLAGS) \
|
||||
-I$(STAGING_DIR)/usr/include \
|
||||
-llua -lm -ldl &&\
|
||||
$(TARGET_CROSS)strip src/unix.so
|
||||
endef
|
||||
|
||||
# omitted static libraries
|
||||
define Build/InstallDev
|
||||
mkdir -p $(STAGING_DIR)/usr/include/lua
|
||||
mkdir -p $(STAGING_DIR)/usr/lib/lua/mime
|
||||
mkdir -p $(STAGING_DIR)/usr/lib/lua/socket
|
||||
mkdir -p $(STAGING_DIR)/usr/share/lua/socket
|
||||
$(CP) $(PKG_BUILD_DIR)/src/ltn12.lua $(STAGING_DIR)/usr/share/lua/
|
||||
$(CP) $(PKG_BUILD_DIR)/src/mime.lua $(STAGING_DIR)/usr/share/lua/
|
||||
$(CP) $(PKG_BUILD_DIR)/src/socket.lua $(STAGING_DIR)/usr/share/lua/
|
||||
$(CP) $(PKG_BUILD_DIR)/src/ftp.lua $(STAGING_DIR)/usr/share/lua/socket/
|
||||
$(CP) $(PKG_BUILD_DIR)/src/http.lua $(STAGING_DIR)/usr/share/lua/socket/
|
||||
$(CP) $(PKG_BUILD_DIR)/src/smtp.lua $(STAGING_DIR)/usr/share/lua/socket/
|
||||
$(CP) $(PKG_BUILD_DIR)/src/tp.lua $(STAGING_DIR)/usr/share/lua/socket/
|
||||
$(CP) $(PKG_BUILD_DIR)/src/url.lua $(STAGING_DIR)/usr/share/lua/socket/
|
||||
$(CP) $(PKG_BUILD_DIR)/src/socket.h $(STAGING_DIR)/usr/include/lua
|
||||
$(CP) $(PKG_BUILD_DIR)/src/socket.so \
|
||||
$(STAGING_DIR)/usr/lib/liblua-socket.so.$(PKG_VERSION)
|
||||
cd $(STAGING_DIR)/usr/lib/ && \
|
||||
ln -fs liblua-socket.so.$(PKG_VERSION) liblua-socket.so
|
||||
cd $(STAGING_DIR)/usr/lib/ && \
|
||||
ln -fs liblua-socket.so.$(PKG_VERSION) liblua-socket.so.$(PKG_VERSION_MAJOR)
|
||||
cd $(STAGING_DIR)/usr/lib/lua/socket && \
|
||||
ln -fs ../../liblua-socket.so.$(PKG_VERSION) core.so
|
||||
$(CP) $(PKG_BUILD_DIR)/src/mime.h $(STAGING_DIR)/usr/include/lua
|
||||
$(CP) $(PKG_BUILD_DIR)/src/mime.so \
|
||||
$(STAGING_DIR)/usr/lib/liblua-socket-mime.so.$(PKG_VERSION)
|
||||
cd $(STAGING_DIR)/usr/lib/ && \
|
||||
ln -fs liblua-socket-mime.so.$(PKG_VERSION) liblua-socket-mime.so
|
||||
cd $(STAGING_DIR)/usr/lib/ && \
|
||||
ln -fs liblua-socket-mime.so.$(PKG_VERSION) liblua-socket-mime.so.$(PKG_VERSION_MAJOR)
|
||||
cd $(STAGING_DIR)/usr/lib/lua/mime && \
|
||||
ln -fs ../../liblua-socket-mime.so.$(PKG_VERSION) core.so
|
||||
$(CP) $(PKG_BUILD_DIR)/src/unix.h $(STAGING_DIR)/usr/include/lua
|
||||
$(CP) $(PKG_BUILD_DIR)/src/unix.so \
|
||||
$(STAGING_DIR)/usr/lib/liblua-socket-unix.so.$(PKG_VERSION)
|
||||
cd $(STAGING_DIR)/usr/lib/ && \
|
||||
ln -fs liblua-socket-unix.so.$(PKG_VERSION) liblua-socket-unix.so
|
||||
cd $(STAGING_DIR)/usr/lib/ && \
|
||||
ln -fs liblua-socket-unix.so.$(PKG_VERSION) liblua-socket-unix.so.$(PKG_VERSION_MAJOR)
|
||||
cd $(STAGING_DIR)/usr/lib/lua/socket && \
|
||||
ln -fs ../../liblua-socket-unix.so.$(PKG_VERSION) unix.so
|
||||
endef
|
||||
|
||||
define Build/UninstallDev
|
||||
$(RM) -f $(STAGING_DIR)/usr/share/lua/ltn12.lua
|
||||
$(RM) -f $(STAGING_DIR)/usr/share/lua/mime.lua
|
||||
$(RM) -f $(STAGING_DIR)/usr/share/lua/socket.lua
|
||||
$(RM) -f $(STAGING_DIR)/usr/share/lua/socket/ftp.lua
|
||||
$(RM) -f $(STAGING_DIR)/usr/share/lua/socket/http.lua
|
||||
$(RM) -f $(STAGING_DIR)/usr/share/lua/socket/smtp.lua
|
||||
$(RM) -f $(STAGING_DIR)/usr/share/lua/socket/tp.lua
|
||||
$(RM) -f $(STAGING_DIR)/usr/share/lua/socket/url.lua
|
||||
$(RM) -f $(STAGING_DIR)/usr/include/lua/socket.h
|
||||
$(RM) -f $(STAGING_DIR)/usr/lib/liblua-socket.so.$(PKG_VERSION)
|
||||
$(RM) -f $(STAGING_DIR)/usr/lib/liblua-socket.so.$(PKG_VERSION_MAJOR)
|
||||
$(RM) -f $(STAGING_DIR)/usr/lib/lua/socket/core.so
|
||||
$(RM) -f $(STAGING_DIR)/usr/include/lua/mime.h
|
||||
$(RM) -f $(STAGING_DIR)/usr/lib/liblua-socket-mime.so.$(PKG_VERSION)
|
||||
$(RM) -f $(STAGING_DIR)/usr/lib/liblua-socket-mime.so.$(PKG_VERSION_MAJOR)
|
||||
$(RM) -f $(STAGING_DIR)/usr/lib/lua/mime/core.so
|
||||
$(RM) -f $(STAGING_DIR)/usr/include/lua/unix.h
|
||||
$(RM) -f $(STAGING_DIR)/usr/lib/liblua-socket-unix.so.$(PKG_VERSION)
|
||||
$(RM) -f $(STAGING_DIR)/usr/lib/liblua-socket-unix.so.$(PKG_VERSION_MAJOR)
|
||||
$(RM) -f $(STAGING_DIR)/usr/lib/lua/socket/unix.so
|
||||
endef
|
||||
|
||||
define Package/liblua-socket/install
|
||||
$(INSTALL_DIR) $(1)/usr/lib/lua/mime
|
||||
$(INSTALL_DIR) $(1)/usr/lib/lua/socket
|
||||
$(INSTALL_DIR) $(1)/usr/share/lua/socket
|
||||
$(CP) $(PKG_BUILD_DIR)/src/ltn12.lua $(1)/usr/share/lua/
|
||||
$(CP) $(PKG_BUILD_DIR)/src/mime.lua $(1)/usr/share/lua/
|
||||
$(CP) $(PKG_BUILD_DIR)/src/socket.lua $(1)/usr/share/lua/
|
||||
$(CP) $(PKG_BUILD_DIR)/src/ftp.lua $(1)/usr/share/lua/socket/
|
||||
$(CP) $(PKG_BUILD_DIR)/src/http.lua $(1)/usr/share/lua/socket/
|
||||
$(CP) $(PKG_BUILD_DIR)/src/smtp.lua $(1)/usr/share/lua/socket/
|
||||
$(CP) $(PKG_BUILD_DIR)/src/tp.lua $(1)/usr/share/lua/socket/
|
||||
$(CP) $(PKG_BUILD_DIR)/src/url.lua $(1)/usr/share/lua/socket/
|
||||
$(CP) $(PKG_BUILD_DIR)/src/socket.so \
|
||||
$(1)/usr/lib/liblua-socket.so.$(PKG_VERSION)
|
||||
cd $(1)/usr/lib/ && \
|
||||
ln -fs liblua-socket.so.$(PKG_VERSION) liblua-socket.so
|
||||
cd $(1)/usr/lib/lua/socket && \
|
||||
ln -fs ../../liblua-socket.so.$(PKG_VERSION) core.so
|
||||
$(CP) $(PKG_BUILD_DIR)/src/mime.so \
|
||||
$(1)/usr/lib/liblua-socket-mime.so.$(PKG_VERSION)
|
||||
cd $(1)/usr/lib/ && \
|
||||
ln -fs liblua-socket-mime.so.$(PKG_VERSION) liblua-socket-mime.so
|
||||
cd $(1)/usr/lib/lua/mime && \
|
||||
ln -fs ../../liblua-socket-mime.so.$(PKG_VERSION) core.so
|
||||
$(CP) $(PKG_BUILD_DIR)/src/unix.so \
|
||||
$(1)/usr/lib/liblua-socket-unix.so.$(PKG_VERSION)
|
||||
cd $(1)/usr/lib/ && \
|
||||
ln -fs liblua-socket-unix.so.$(PKG_VERSION) liblua-socket-unix.so
|
||||
cd $(1)/usr/lib/lua/socket && \
|
||||
ln -fs ../../liblua-socket-unix.so.$(PKG_VERSION) unix.so
|
||||
endef
|
||||
|
||||
$(eval $(call BuildPackage,liblua-socket))
|
|
@ -0,0 +1,14 @@
|
|||
diff -urNad trunk~/src/luasocket.c trunk/src/luasocket.c
|
||||
--- trunk~/src/luasocket.c 2006-04-27 05:23:22.000000000 +0200
|
||||
+++ trunk/src/luasocket.c 2007-08-12 23:57:43.000000000 +0200
|
||||
@@ -20,10 +20,6 @@
|
||||
#include "lua.h"
|
||||
#include "lauxlib.h"
|
||||
|
||||
-#if !defined(LUA_VERSION_NUM) || (LUA_VERSION_NUM < 501)
|
||||
-#include "compat-5.1.h"
|
||||
-#endif
|
||||
-
|
||||
/*=========================================================================*\
|
||||
* LuaSocket includes
|
||||
\*=========================================================================*/
|
|
@ -0,0 +1,45 @@
|
|||
#
|
||||
# Copyright (C) 2006 OpenWrt.org
|
||||
#
|
||||
# This is free software, licensed under the GNU General Public License v2.
|
||||
# See /LICENSE for more information.
|
||||
#
|
||||
# $Id: Makefile 6994 2008-07-31 21:12:40Z icarus75 $
|
||||
|
||||
include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=luaxmlrpc
|
||||
PKG_VERSION:=1.0x
|
||||
PKG_RELEASE:=1
|
||||
|
||||
PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)-$(PKG_VERSION)
|
||||
|
||||
include $(INCLUDE_DIR)/package.mk
|
||||
|
||||
define Package/liblua-xmlrpc
|
||||
SECTION:=lang
|
||||
SUBMENU:=LUA
|
||||
CATEGORY:=Languages
|
||||
DEPENDS:=+liblua-expat +liblua-socket
|
||||
URL:=http://luaforge.net/projects/luaxmlrpc/
|
||||
TITLE:=XML-RPC library for LUA programming language
|
||||
endef
|
||||
|
||||
define Package/liblua-xmlrpc/description
|
||||
LuaXMLRPC is a Lua library to make remote procedure calls using XML-RPC.
|
||||
endef
|
||||
|
||||
define Build/Prepare
|
||||
mkdir -p $(PKG_BUILD_DIR)/src/
|
||||
$(CP) ./src/* $(PKG_BUILD_DIR)/src/
|
||||
endef
|
||||
|
||||
define Build/Compile
|
||||
endef
|
||||
|
||||
define Package/liblua-xmlrpc/install
|
||||
$(INSTALL_DIR) $(1)/usr/share/lua/xmlrpc/
|
||||
$(CP) $(PKG_BUILD_DIR)/src/*.lua $(1)/usr/share/lua/xmlrpc/
|
||||
endef
|
||||
|
||||
$(eval $(call BuildPackage,liblua-xmlrpc))
|
|
@ -0,0 +1,44 @@
|
|||
---------------------------------------------------------------------
|
||||
-- XML-RPC over HTTP.
|
||||
-- See Copyright Notice in license.html
|
||||
-- $Id: http.lua,v 1.5 2007/03/30 04:17:14 tomas Exp $
|
||||
---------------------------------------------------------------------
|
||||
|
||||
local error, tonumber, tostring, unpack = error, tonumber, tostring, unpack
|
||||
|
||||
local ltn12 = require"ltn12"
|
||||
local request = require"socket.http".request
|
||||
local string = require"string"
|
||||
local table = require"table"
|
||||
local xmlrpc = require"xmlrpc"
|
||||
|
||||
module("xmlrpc.http")
|
||||
|
||||
---------------------------------------------------------------------
|
||||
-- Call a remote method.
|
||||
-- @param url String with the location of the server.
|
||||
-- @param method String with the name of the method to be called.
|
||||
-- @return Table with the response (could be a `fault' or a `params'
|
||||
-- XML-RPC element).
|
||||
---------------------------------------------------------------------
|
||||
function call (url, method, ...)
|
||||
local request_sink, tbody = ltn12.sink.table()
|
||||
local request_body = xmlrpc.clEncode(method, ...)
|
||||
local err, code, headers, status = request {
|
||||
url = url,
|
||||
method = "POST",
|
||||
source = ltn12.source.string (request_body),
|
||||
sink = request_sink,
|
||||
headers = {
|
||||
["User-agent"] = "LuaXMLRPC",
|
||||
["Content-type"] = "text/xml",
|
||||
["content-length"] = tostring (string.len (request_body)),
|
||||
},
|
||||
}
|
||||
local body = table.concat (tbody)
|
||||
if tonumber (code) == 200 then
|
||||
return xmlrpc.clDecode (body)
|
||||
else
|
||||
error (tostring (err or code).."\n\n"..tostring(body))
|
||||
end
|
||||
end
|
|
@ -0,0 +1,593 @@
|
|||
---------------------------------------------------------------------
|
||||
-- XML-RPC implementation for Lua.
|
||||
-- See Copyright Notice in license.html
|
||||
-- $Id: init.lua,v 1.2 2007/03/30 04:18:54 tomas Exp $
|
||||
---------------------------------------------------------------------
|
||||
|
||||
local lxp = require "lxp"
|
||||
local lom = require "lxp.lom"
|
||||
|
||||
local assert, error, ipairs, pairs, select, type, tonumber, unpack = assert, error, ipairs, pairs, select, type, tonumber, unpack
|
||||
local format, gsub, strfind, strsub = string.format, string.gsub, string.find, string.sub
|
||||
local concat, tinsert = table.concat, table.insert
|
||||
local ceil = math.ceil
|
||||
local parse = lxp.lom.parse
|
||||
|
||||
module (...)
|
||||
|
||||
_COPYRIGHT = "Copyright (C) 2003-2007 Kepler Project"
|
||||
_DESCRIPTION = "LuaXMLRPC is a library to make remote procedure calls using XML-RPC"
|
||||
_VERSION = "LuaXMLRPC 1.1.0"
|
||||
|
||||
---------------------------------------------------------------------
|
||||
-- XML-RPC Parser
|
||||
---------------------------------------------------------------------
|
||||
|
||||
---------------------------------------------------------------------
|
||||
local function trim (s)
|
||||
return (type(s) == "string" and gsub (s, "^%s*(.-)%s*$", "%1"))
|
||||
end
|
||||
|
||||
---------------------------------------------------------------------
|
||||
local function is_space (s)
|
||||
return type(s) == "string" and trim(s) == ""
|
||||
end
|
||||
|
||||
---------------------------------------------------------------------
|
||||
-- Get next non-space element from tab starting from index i.
|
||||
-- @param tab Table.
|
||||
-- @param i Numeric index.
|
||||
-- @return Object and its position on table; nil and an invalid index
|
||||
-- when there is no more elements.
|
||||
---------------------------------------------------------------------
|
||||
function next_nonspace (tab, i)
|
||||
if not i then i = 1 end
|
||||
while is_space (tab[i]) do i = i+1 end
|
||||
return tab[i], i
|
||||
end
|
||||
|
||||
---------------------------------------------------------------------
|
||||
-- Get next element of tab with the given tag starting from index i.
|
||||
-- @param tab Table.
|
||||
-- @param tag String with the name of the tag.
|
||||
-- @param i Numeric index.
|
||||
-- @return Object and its position on table; nil and an invalid index
|
||||
-- when there is no more elements.
|
||||
---------------------------------------------------------------------
|
||||
local function next_tag (tab, tag, i)
|
||||
if not i then i = 1 end
|
||||
while tab[i] do
|
||||
if type (tab[i]) == "table" and tab[i].tag == tag then
|
||||
return tab[i], i
|
||||
end
|
||||
i = i + 1
|
||||
end
|
||||
return nil, i
|
||||
end
|
||||
|
||||
---------------------------------------------------------------------
|
||||
local function x2number (tab)
|
||||
if tab.tag == "int" or tab.tag == "i4" or tab.tag == "double" then
|
||||
return tonumber (next_nonspace (tab, 1), 10)
|
||||
end
|
||||
end
|
||||
|
||||
---------------------------------------------------------------------
|
||||
local function x2boolean (tab)
|
||||
if tab.tag == "boolean" then
|
||||
local v = next_nonspace (tab, 1)
|
||||
return tonumber (v) == 1 or false
|
||||
end
|
||||
end
|
||||
|
||||
---------------------------------------------------------------------
|
||||
local function x2string (tab)
|
||||
return tab.tag == "string" and tab[1]
|
||||
end
|
||||
|
||||
---------------------------------------------------------------------
|
||||
local function x2date (tab)
|
||||
return tab.tag == "dateTime.iso8601" and next_nonspace (tab, 1)
|
||||
end
|
||||
|
||||
---------------------------------------------------------------------
|
||||
local function x2base64 (tab)
|
||||
return tab.tag == "base64" and next_nonspace (tab, 1)
|
||||
end
|
||||
|
||||
---------------------------------------------------------------------
|
||||
local function x2name (tab)
|
||||
return tab.tag == "name" and next_nonspace (tab, 1)
|
||||
end
|
||||
|
||||
local x2value
|
||||
|
||||
---------------------------------------------------------------------
|
||||
-- Disassemble a member object in its name and value parts.
|
||||
-- @param tab Table with a DOM representation.
|
||||
-- @return String (name) and Object (value).
|
||||
-- @see x2name, x2value.
|
||||
---------------------------------------------------------------------
|
||||
local function x2member (tab)
|
||||
return
|
||||
x2name (next_tag(tab,"name")),
|
||||
x2value (next_tag(tab,"value"))
|
||||
end
|
||||
|
||||
---------------------------------------------------------------------
|
||||
-- Disassemble a struct object into a Lua table.
|
||||
-- @param tab Table with DOM representation.
|
||||
-- @return Table with "name = value" pairs.
|
||||
---------------------------------------------------------------------
|
||||
local function x2struct (tab)
|
||||
if tab.tag == "struct" then
|
||||
local res = {}
|
||||
for i = 1, #tab do
|
||||
if not is_space (tab[i]) then
|
||||
local name, val = x2member (tab[i])
|
||||
res[name] = val
|
||||
end
|
||||
end
|
||||
return res
|
||||
end
|
||||
end
|
||||
|
||||
---------------------------------------------------------------------
|
||||
-- Disassemble an array object into a Lua table.
|
||||
-- @param tab Table with DOM representation.
|
||||
-- @return Table.
|
||||
---------------------------------------------------------------------
|
||||
local function x2array (tab)
|
||||
if tab.tag == "array" then
|
||||
local d = next_tag (tab, "data")
|
||||
local res = {}
|
||||
for i = 1, #d do
|
||||
if not is_space (d[i]) then
|
||||
tinsert (res, x2value (d[i]))
|
||||
end
|
||||
end
|
||||
return res
|
||||
end
|
||||
end
|
||||
|
||||
---------------------------------------------------------------------
|
||||
local xmlrpc_types = {
|
||||
int = x2number,
|
||||
i4 = x2number,
|
||||
boolean = x2boolean,
|
||||
string = x2string,
|
||||
double = x2number,
|
||||
["dateTime.iso8601"] = x2date,
|
||||
base64 = x2base64,
|
||||
struct = x2struct,
|
||||
array = x2array,
|
||||
}
|
||||
|
||||
local x2param, x2fault
|
||||
|
||||
---------------------------------------------------------------------
|
||||
-- Disassemble a methodResponse into a Lua object.
|
||||
-- @param tab Table with DOM representation.
|
||||
-- @return Boolean (indicating wether the response was successful)
|
||||
-- and (a Lua object representing the return values OR the fault
|
||||
-- string and the fault code).
|
||||
---------------------------------------------------------------------
|
||||
local function x2methodResponse (tab)
|
||||
assert (type(tab) == "table", "Not a table")
|
||||
assert (tab.tag == "methodResponse",
|
||||
"Not a `methodResponse' tag: "..tab.tag)
|
||||
local t = next_nonspace (tab, 1)
|
||||
if t.tag == "params" then
|
||||
return true, unpack (x2param (t))
|
||||
elseif t.tag == "fault" then
|
||||
local f = x2fault (t)
|
||||
return false, f.faultString, f.faultCode
|
||||
else
|
||||
error ("Couldn't find a <params> nor a <fault> element")
|
||||
end
|
||||
end
|
||||
|
||||
---------------------------------------------------------------------
|
||||
-- Disassemble a value element into a Lua object.
|
||||
-- @param tab Table with DOM representation.
|
||||
-- @return Object.
|
||||
---------------------------------------------------------------------
|
||||
x2value = function (tab)
|
||||
local t = tab.tag
|
||||
assert (t == "value", "Not a `value' tag: "..t)
|
||||
local n = next_nonspace (tab)
|
||||
if type(n) == "string" or type(n) == "number" then
|
||||
return n
|
||||
elseif type (n) == "table" then
|
||||
local t = n.tag
|
||||
local get = xmlrpc_types[t]
|
||||
if not get then error ("Invalid <"..t.."> element") end
|
||||
return get (next_nonspace (tab))
|
||||
end
|
||||
end
|
||||
|
||||
---------------------------------------------------------------------
|
||||
-- Disassemble a fault element into a Lua object.
|
||||
-- @param tab Table with DOM representation.
|
||||
-- @return Object.
|
||||
---------------------------------------------------------------------
|
||||
x2fault = function (tab)
|
||||
assert (tab.tag == "fault", "Not a `fault' tag: "..tab.tag)
|
||||
return x2value (next_nonspace (tab))
|
||||
end
|
||||
|
||||
---------------------------------------------------------------------
|
||||
-- Disassemble a param element into a Lua object.
|
||||
-- Ignore white spaces between elements.
|
||||
-- @param tab Table with DOM representation.
|
||||
-- @return Object.
|
||||
---------------------------------------------------------------------
|
||||
x2param = function (tab)
|
||||
assert (tab.tag == "params", "Not a `params' tag")
|
||||
local res = {}
|
||||
local p, i = next_nonspace (tab, 1)
|
||||
while p do
|
||||
if p.tag == "param" then
|
||||
tinsert (res, x2value (next_tag (p, "value")))
|
||||
end
|
||||
p, i = next_nonspace (tab, i+1)
|
||||
end
|
||||
return res
|
||||
end
|
||||
|
||||
---------------------------------------------------------------------
|
||||
-- Disassemble a methodName element into a Lua object.
|
||||
-- @param tab Table with DOM representation.
|
||||
-- @return Object.
|
||||
---------------------------------------------------------------------
|
||||
local function x2methodName (tab)
|
||||
assert (tab.tag == "methodName", "Not a `methodName' tag: "..tab.tag)
|
||||
return (next_nonspace (tab, 1))
|
||||
end
|
||||
|
||||
---------------------------------------------------------------------
|
||||
-- Disassemble a methodCall element into its name and a list of parameters.
|
||||
-- @param tab Table with DOM representation.
|
||||
-- @return Object.
|
||||
---------------------------------------------------------------------
|
||||
local function x2methodCall (tab)
|
||||
assert (tab.tag == "methodCall", "Not a `methodCall' tag: "..tab.tag)
|
||||
return
|
||||
x2methodName (next_tag (tab,"methodName")),
|
||||
x2param (next_tag (tab,"params"))
|
||||
end
|
||||
|
||||
---------------------------------------------------------------------
|
||||
-- End of XML-RPC Parser
|
||||
---------------------------------------------------------------------
|
||||
|
||||
---------------------------------------------------------------------
|
||||
-- Convert a Lua Object into an XML-RPC string.
|
||||
---------------------------------------------------------------------
|
||||
|
||||
---------------------------------------------------------------------
|
||||
local formats = {
|
||||
boolean = "<boolean>%d</boolean>",
|
||||
number = "<double>%d</double>",
|
||||
string = "<string>%s</string>",
|
||||
|
||||
array = "<array><data>\n%s\n</data></array>",
|
||||
double = "<double>%s</double>",
|
||||
int = "<int>%s</int>",
|
||||
struct = "<struct>%s</struct>",
|
||||
|
||||
member = "<member><name>%s</name>%s</member>",
|
||||
value = "<value>%s</value>",
|
||||
|
||||
param = "<param>%s</param>",
|
||||
|
||||
params = [[
|
||||
<params>
|
||||
%s
|
||||
</params>]],
|
||||
|
||||
fault = [[
|
||||
<fault>
|
||||
%s
|
||||
</fault>]],
|
||||
|
||||
methodCall = [[
|
||||
<?xml version="1.0"?>
|
||||
<methodCall>
|
||||
<methodName>%s</methodName>
|
||||
%s
|
||||
</methodCall>
|
||||
]],
|
||||
|
||||
methodResponse = [[
|
||||
<?xml version="1.0"?>
|
||||
<methodResponse>
|
||||
%s
|
||||
</methodResponse>]],
|
||||
}
|
||||
formats.table = formats.struct
|
||||
|
||||
local toxml = {}
|
||||
toxml.double = function (v,t) return format (formats.double, v) end
|
||||
toxml.int = function (v,t) return format (formats.int, v) end
|
||||
toxml.string = function (v,t) return format (formats.string, v) end
|
||||
|
||||
---------------------------------------------------------------------
|
||||
-- Build a XML-RPC representation of a boolean.
|
||||
-- @param v Object.
|
||||
-- @return String.
|
||||
---------------------------------------------------------------------
|
||||
function toxml.boolean (v)
|
||||
local n = (v and 1) or 0
|
||||
return format (formats.boolean, n)
|
||||
end
|
||||
|
||||
---------------------------------------------------------------------
|
||||
-- Build a XML-RPC representation of a number.
|
||||
-- @param v Object.
|
||||
-- @param t Object representing the XML-RPC type of the value.
|
||||
-- @return String.
|
||||
---------------------------------------------------------------------
|
||||
function toxml.number (v, t)
|
||||
local tt = (type(t) == "table") and t["*type"]
|
||||
if tt == "int" or tt == "i4" then
|
||||
return toxml.int (v, t)
|
||||
elseif tt == "double" then
|
||||
return toxml.double (v, t)
|
||||
elseif v == ceil(v) then
|
||||
return toxml.int (v, t)
|
||||
else
|
||||
return toxml.double (v, t)
|
||||
end
|
||||
end
|
||||
|
||||
---------------------------------------------------------------------
|
||||
-- @param typ Object representing a type.
|
||||
-- @return Function that generate an XML element of the given type.
|
||||
-- The object could be a string (as usual in Lua) or a table with
|
||||
-- a field named "type" that should be a string with the XML-RPC
|
||||
-- type name.
|
||||
---------------------------------------------------------------------
|
||||
local function format_func (typ)
|
||||
if type (typ) == "table" then
|
||||
return toxml[typ.type]
|
||||
else
|
||||
return toxml[typ]
|
||||
end
|
||||
end
|
||||
|
||||
---------------------------------------------------------------------
|
||||
-- @param val Object representing an array of values.
|
||||
-- @param typ Object representing the type of the value.
|
||||
-- @return String representing the equivalent XML-RPC value.
|
||||
---------------------------------------------------------------------
|
||||
function toxml.array (val, typ)
|
||||
local ret = {}
|
||||
local et = typ.elemtype
|
||||
local f = format_func (et)
|
||||
for i,v in ipairs (val) do
|
||||
tinsert (ret, format (formats.value, f (v, et)))
|
||||
end
|
||||
return format (formats.array, concat (ret, '\n'))
|
||||
end
|
||||
|
||||
---------------------------------------------------------------------
|
||||
---------------------------------------------------------------------
|
||||
function toxml.struct (val, typ)
|
||||
local ret = {}
|
||||
if type (typ) == "table" then
|
||||
for n,t in pairs (typ.elemtype) do
|
||||
local f = format_func (t)
|
||||
tinsert (ret, format (formats.member, n, f (val[n], t)))
|
||||
end
|
||||
else
|
||||
for i, v in pairs (val) do
|
||||
tinsert (ret, toxml.member (i, v))
|
||||
end
|
||||
end
|
||||
return format (formats.struct, concat (ret))
|
||||
end
|
||||
|
||||
toxml.table = toxml.struct
|
||||
|
||||
---------------------------------------------------------------------
|
||||
---------------------------------------------------------------------
|
||||
function toxml.member (n, v)
|
||||
return format (formats.member, n, toxml.value (v))
|
||||
end
|
||||
|
||||
---------------------------------------------------------------------
|
||||
-- Get type and value of object.
|
||||
---------------------------------------------------------------------
|
||||
local function type_val (obj)
|
||||
local t = type (obj)
|
||||
local v = obj
|
||||
if t == "table" then
|
||||
t = obj["*type"] or "table"
|
||||
v = obj["*value"] or obj
|
||||
end
|
||||
return t, v
|
||||
end
|
||||
|
||||
---------------------------------------------------------------------
|
||||
-- Convert a Lua object to a XML-RPC object (plain string).
|
||||
---------------------------------------------------------------------
|
||||
function toxml.value (obj)
|
||||
local to, val = type_val (obj)
|
||||
if type(to) == "table" then
|
||||
return format (formats.value, toxml[to.type] (val, to))
|
||||
else
|
||||
-- primitive (not structured) types.
|
||||
--return format (formats[to], val)
|
||||
return format (formats.value, toxml[to] (val, to))
|
||||
end
|
||||
end
|
||||
|
||||
---------------------------------------------------------------------
|
||||
-- @param ... List of parameters.
|
||||
-- @return String representing the `params' XML-RPC element.
|
||||
---------------------------------------------------------------------
|
||||
function toxml.params (...)
|
||||
local params_list = {}
|
||||
for i = 1, select ("#", ...) do
|
||||
params_list[i] = format (formats.param, toxml.value (select (i, ...)))
|
||||
end
|
||||
return format (formats.params, concat (params_list, '\n '))
|
||||
end
|
||||
|
||||
---------------------------------------------------------------------
|
||||
-- @param method String with method's name.
|
||||
-- @param ... List of parameters.
|
||||
-- @return String representing the `methodCall' XML-RPC element.
|
||||
---------------------------------------------------------------------
|
||||
function toxml.methodCall (method, ...)
|
||||
local idx = strfind (method, "[^A-Za-z_.:/0-9]")
|
||||
if idx then
|
||||
error (format ("Invalid character `%s'", strsub (method, idx, idx)))
|
||||
end
|
||||
return format (formats.methodCall, method, toxml.params (...))
|
||||
end
|
||||
|
||||
---------------------------------------------------------------------
|
||||
-- @param err String with error message.
|
||||
-- @return String representing the `fault' XML-RPC element.
|
||||
---------------------------------------------------------------------
|
||||
function toxml.fault (err)
|
||||
local code
|
||||
local message = err
|
||||
if type (err) == "table" then
|
||||
code = err.code
|
||||
message = err.message
|
||||
end
|
||||
return format (formats.fault, toxml.value {
|
||||
faultCode = { ["*type"] = "int", ["*value"] = code or err.faultCode or 1 },
|
||||
faultString = message or err.faultString or "fatal error",
|
||||
})
|
||||
end
|
||||
|
||||
---------------------------------------------------------------------
|
||||
-- @param ok Boolean indicating if the response was correct or a
|
||||
-- fault one.
|
||||
-- @param params Object containing the response contents.
|
||||
-- @return String representing the `methodResponse' XML-RPC element.
|
||||
---------------------------------------------------------------------
|
||||
function toxml.methodResponse (ok, params)
|
||||
local resp
|
||||
if ok then
|
||||
resp = toxml.params (params)
|
||||
else
|
||||
resp = toxml.fault (params)
|
||||
end
|
||||
return format (formats.methodResponse, resp)
|
||||
end
|
||||
|
||||
---------------------------------------------------------------------
|
||||
-- End of converter from Lua to XML-RPC.
|
||||
---------------------------------------------------------------------
|
||||
|
||||
|
||||
---------------------------------------------------------------------
|
||||
-- Create a representation of an array with the given element type.
|
||||
---------------------------------------------------------------------
|
||||
function newArray (elemtype)
|
||||
return { type = "array", elemtype = elemtype, }
|
||||
end
|
||||
|
||||
---------------------------------------------------------------------
|
||||
-- Create a representation of a structure with the given members.
|
||||
---------------------------------------------------------------------
|
||||
function newStruct (members)
|
||||
return { type = "struct", elemtype = members, }
|
||||
end
|
||||
|
||||
---------------------------------------------------------------------
|
||||
-- Create a representation of a value according to a type.
|
||||
-- @param val Any Lua value.
|
||||
-- @param typ A XML-RPC type.
|
||||
---------------------------------------------------------------------
|
||||
function newTypedValue (val, typ)
|
||||
return { ["*type"] = typ, ["*value"] = val }
|
||||
end
|
||||
|
||||
---------------------------------------------------------------------
|
||||
-- Create the XML-RPC string used to call a method.
|
||||
-- @param method String with method name.
|
||||
-- @param ... Parameters to the call.
|
||||
-- @return String with the XML string/document.
|
||||
---------------------------------------------------------------------
|
||||
function clEncode (method, ...)
|
||||
return toxml.methodCall (method, ...)
|
||||
end
|
||||
|
||||
---------------------------------------------------------------------
|
||||
-- Convert the method response document to a Lua table.
|
||||
-- @param meth_resp String with XML document.
|
||||
-- @return Boolean indicating whether the call was successful or not;
|
||||
-- and a Lua object with the converted response element.
|
||||
---------------------------------------------------------------------
|
||||
function clDecode (meth_resp)
|
||||
local d = parse (meth_resp)
|
||||
if type(d) ~= "table" then
|
||||
error ("Not an XML document: "..meth_resp)
|
||||
end
|
||||
return x2methodResponse (d)
|
||||
end
|
||||
|
||||
---------------------------------------------------------------------
|
||||
-- Convert the method call (client request) document to a name and
|
||||
-- a list of parameters.
|
||||
-- @param request String with XML document.
|
||||
-- @return String with method's name AND the table of arguments.
|
||||
---------------------------------------------------------------------
|
||||
function srvDecode (request)
|
||||
local d = parse (request)
|
||||
if type(d) ~= "table" then
|
||||
error ("Not an XML document: "..request)
|
||||
end
|
||||
return x2methodCall (d)
|
||||
end
|
||||
|
||||
---------------------------------------------------------------------
|
||||
-- Convert a table into an XML-RPC methodReponse element.
|
||||
-- @param obj Lua object.
|
||||
-- @param is_fault Boolean indicating wether the result should be
|
||||
-- a `fault' element (default = false).
|
||||
-- @return String with XML-RPC response.
|
||||
---------------------------------------------------------------------
|
||||
function srvEncode (obj, is_fault)
|
||||
local ok = not (is_fault or false)
|
||||
return toxml.methodResponse (ok, obj)
|
||||
end
|
||||
|
||||
---------------------------------------------------------------------
|
||||
-- Register the methods.
|
||||
-- @param tab_or_func Table or mapping function.
|
||||
-- If a table is given, it can have one level of objects and then the
|
||||
-- methods;
|
||||
-- if a function is given, it will be used as the dispatcher.
|
||||
-- The given function should return a Lua function that implements.
|
||||
---------------------------------------------------------------------
|
||||
dispatch = error
|
||||
function srvMethods (tab_or_func)
|
||||
local t = type (tab_or_func)
|
||||
if t == "function" then
|
||||
dispatch = tab_or_func
|
||||
elseif t == "table" then
|
||||
dispatch = function (name)
|
||||
local ok, _, obj, method = strfind (name, "^([^.]+)%.(.+)$")
|
||||
if not ok then
|
||||
return tab_or_func[name]
|
||||
else
|
||||
if tab_or_func[obj] and tab_or_func[obj][method] then
|
||||
return function (...)
|
||||
return tab_or_func[obj][method] (obj, ...)
|
||||
end
|
||||
else
|
||||
return nil
|
||||
end
|
||||
end
|
||||
end
|
||||
else
|
||||
error ("Argument is neither a table nor a function")
|
||||
end
|
||||
end
|
|
@ -0,0 +1,90 @@
|
|||
---------------------------------------------------------------------
|
||||
-- XML-RPC server
|
||||
-- See Copyright Notice in license.html
|
||||
-- $Id: server.lua,v 1.4 2007/03/30 04:18:54 tomas Exp $
|
||||
---------------------------------------------------------------------
|
||||
|
||||
local assert, pcall, setmetatable, type, unpack = assert, pcall, setmetatable, type, unpack
|
||||
local cgilua = require"cgilua"
|
||||
local os = require"os"
|
||||
local string = require"string"
|
||||
local table = require"table"
|
||||
local xmlrpc = require"xmlrpc"
|
||||
|
||||
module("xmlrpc.server")
|
||||
|
||||
---------------------------------------------------------------------
|
||||
local function respond (resp)
|
||||
cgilua.header ("Date", os.date())
|
||||
cgilua.header ("Server", "Me")
|
||||
cgilua.header ("Content-length", string.len (resp))
|
||||
cgilua.header ("Connection", "close")
|
||||
cgilua.contentheader ("text", "xml")
|
||||
cgilua.put (resp)
|
||||
end
|
||||
|
||||
---------------------------------------------------------------------
|
||||
function assert (cond, msg)
|
||||
if not cond then
|
||||
respond (xmlrpc.srvEncode (
|
||||
{ code = 2, message = msg, },
|
||||
true
|
||||
))
|
||||
--os.exit() -- !!!!!!!!!!!
|
||||
end
|
||||
end
|
||||
|
||||
cgilua.seterroroutput (function (msg)
|
||||
respond (xmlrpc.srvEncode ({ code = 2, message = msg, }, true))
|
||||
end)
|
||||
|
||||
---------------------------------------------------------------------
|
||||
local function decodedata (doc)
|
||||
local method, arg_table = xmlrpc.srvDecode (doc)
|
||||
assert (type(method) == "string", "Invalid `method': string expected")
|
||||
local t = type(arg_table)
|
||||
assert (t == "table" or t == "nil", "Invalid table of arguments: not a table nor nil")
|
||||
|
||||
local func = xmlrpc.dispatch (method)
|
||||
assert (type(func) == "function", "Unavailable method")
|
||||
|
||||
return func, (arg_table or {})
|
||||
end
|
||||
|
||||
---------------------------------------------------------------------
|
||||
local function callfunc (func, arg_table)
|
||||
local result = { pcall (func, unpack (arg_table)) }
|
||||
local ok = result[1]
|
||||
if not ok then
|
||||
result = { code = 3, message = result[2], }
|
||||
else
|
||||
table.remove (result, 1)
|
||||
if #result == 1 then
|
||||
result = result[1]
|
||||
end
|
||||
end
|
||||
return ok, result
|
||||
end
|
||||
|
||||
---------------------------------------------------------------------
|
||||
function xmlrpc.server:new()
|
||||
local o = { methods = { } }
|
||||
setmetatable (o, self)
|
||||
self.__index = self
|
||||
return o
|
||||
end
|
||||
|
||||
---------------------------------------------------------------------
|
||||
function xmlrpc.server:register(name, service)
|
||||
assert (type(name) == "string", "Invalid `name': string expected")
|
||||
self.methods[name] = service
|
||||
end
|
||||
|
||||
---------------------------------------------------------------------
|
||||
function xmlrpc.server:handle()
|
||||
xmlrpc.srvMethods (self.methods)
|
||||
local func, arg_table = decodedata (cgi[1])
|
||||
local ok, result = callfunc (func, arg_table)
|
||||
local r = xmlrpc.srvEncode (result, not ok)
|
||||
respond (r)
|
||||
end
|
|
@ -0,0 +1,43 @@
|
|||
include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_BRANCH:=trunk
|
||||
PKG_NAME:=luaxyssl
|
||||
PKG_RELEASE:=1
|
||||
PKG_SOURCE_URL:=http://luaxyssl.googlecode.com/svn/$(PKG_BRANCH)
|
||||
PKG_REV:=65
|
||||
PKG_VERSION:=0.2+svn$(PKG_REV)
|
||||
PKG_SOURCE_SUBDIR:=$(PKG_NAME)-$(PKG_VERSION)
|
||||
PKG_SOURCE:=$(PKG_SOURCE_SUBDIR).tar.gz
|
||||
PKG_SOURCE_PROTO:=svn
|
||||
PKG_SOURCE_VERSION:=$(PKG_REV)
|
||||
|
||||
PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)-$(PKG_VERSION)
|
||||
PKG_INSTALL_DIR:=$(PKG_BUILD_DIR)/ipkg-install
|
||||
|
||||
include $(INCLUDE_DIR)/package.mk
|
||||
|
||||
define Package/luaxyssl
|
||||
SECTION:=lang
|
||||
CATEGORY:=Languages
|
||||
SUBMENU:=LUA
|
||||
TITLE:=xyssl-Bindings for Lua
|
||||
URL:=http://code.google.com/p/luaxyssl
|
||||
DEPENDS:=+liblua +libxyssl
|
||||
endef
|
||||
|
||||
define Build/Configure
|
||||
endef
|
||||
|
||||
define Build/Compile
|
||||
$(TARGET_CC) $(TARGET_CFLAGS) $(TARGET_LDFLAGS) -shared -fpic -pedantic -Wall \
|
||||
-I$(STAGING_DIR)/usr/include \
|
||||
-DXYSSL=9 \
|
||||
-o $(PKG_BUILD_DIR)/lxyssl.so -lxyssl $(PKG_BUILD_DIR)/lxyssl.c
|
||||
endef
|
||||
|
||||
define Package/luaxyssl/install
|
||||
$(INSTALL_DIR) $(1)/usr/lib/lua
|
||||
$(INSTALL_DATA) $(PKG_BUILD_DIR)/lxyssl.so $(1)/usr/lib/lua
|
||||
endef
|
||||
|
||||
$(eval $(call BuildPackage,luaxyssl))
|
|
@ -0,0 +1,273 @@
|
|||
Index: luaxyssl-0.2+svn65/lxyssl.c
|
||||
===================================================================
|
||||
--- luaxyssl-0.2+svn65.orig/lxyssl.c 2008-07-01 17:28:52.000000000 +0200
|
||||
+++ luaxyssl-0.2+svn65/lxyssl.c 2008-07-01 17:32:00.000000000 +0200
|
||||
@@ -5,6 +5,7 @@
|
||||
* This code can be distributed under the LGPL license
|
||||
*/
|
||||
|
||||
+#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
#include <memory.h>
|
||||
#include <fcntl.h>
|
||||
@@ -12,6 +13,7 @@
|
||||
#include <sys/socket.h>
|
||||
#include <sys/wait.h>
|
||||
#include <sys/time.h>
|
||||
+#include <unistd.h>
|
||||
#else
|
||||
#include <time.h>
|
||||
#include <winsock.h>
|
||||
@@ -326,7 +328,7 @@
|
||||
return 1;
|
||||
}
|
||||
if (lua_isstring(L, -1)) {
|
||||
- int len;
|
||||
+ size_t len;
|
||||
const char *master = luaL_checklstring(L, -1, &len);
|
||||
memcpy(ssl->session->master, master, len < sizeof(ssl->session->master) ? len : sizeof(ssl->session->master));
|
||||
lua_pop(L, 1);
|
||||
@@ -479,7 +481,7 @@
|
||||
|
||||
static int Laes(lua_State *L)
|
||||
{
|
||||
- int klen;
|
||||
+ size_t klen;
|
||||
const unsigned char *key = luaL_checklstring(L, 1, &klen);
|
||||
int bits = luaL_optinteger(L, 2, 128);
|
||||
dual_aes_context *aes = lua_newuserdata(L,sizeof(dual_aes_context));
|
||||
@@ -503,7 +505,7 @@
|
||||
|
||||
static int Lrc4(lua_State *L)
|
||||
{
|
||||
- int klen;
|
||||
+ size_t klen;
|
||||
const unsigned char *key = luaL_checklstring(L, 1, &klen);
|
||||
arc4_context *rc4 = lua_newuserdata(L,sizeof(arc4_context));
|
||||
arc4_setup(rc4, (unsigned char *)key, klen);
|
||||
@@ -750,7 +752,7 @@
|
||||
static int Lhash(lua_State *L)
|
||||
{
|
||||
const char *type = luaL_checkstring(L,1);
|
||||
- int klen=0;
|
||||
+ size_t klen=0;
|
||||
const unsigned char *key = luaL_optlstring(L, 2, NULL, &klen);
|
||||
hash_context *obj = lua_newuserdata(L,sizeof(hash_context));
|
||||
|
||||
@@ -869,7 +871,7 @@
|
||||
static int Laes_encrypt(lua_State *L)
|
||||
{
|
||||
dual_aes_context *obj=Pget_aes(L,1);
|
||||
- int len;
|
||||
+ size_t len;
|
||||
const char *data = luaL_checklstring(L, 2, &len);
|
||||
int i;
|
||||
luaL_Buffer B;
|
||||
@@ -890,7 +892,7 @@
|
||||
static int Laes_decrypt(lua_State *L)
|
||||
{
|
||||
dual_aes_context *obj=Pget_aes(L,1);
|
||||
- int len;
|
||||
+ size_t len;
|
||||
const char *data = luaL_checklstring(L, 2, &len);
|
||||
int i;
|
||||
luaL_Buffer B;
|
||||
@@ -911,7 +913,7 @@
|
||||
static int Lrc4_crypt(lua_State *L)
|
||||
{
|
||||
arc4_context *obj=Pget_rc4(L,1);
|
||||
- int len;
|
||||
+ size_t len;
|
||||
const char *data = luaL_checklstring(L, 2, &len);
|
||||
luaL_Buffer B;
|
||||
unsigned char temp[256];
|
||||
@@ -938,9 +940,9 @@
|
||||
static int Laes_cbc_encrypt(lua_State *L)
|
||||
{
|
||||
dual_aes_context *obj=Pget_aes(L,1);
|
||||
- int len;
|
||||
+ size_t len;
|
||||
const char *data = luaL_checklstring(L, 2, &len);
|
||||
- int iv_len;
|
||||
+ size_t iv_len;
|
||||
const char *IV = luaL_checklstring(L, 3, &iv_len);
|
||||
int i=0;
|
||||
luaL_Buffer B;
|
||||
@@ -970,9 +972,9 @@
|
||||
static int Laes_cbc_decrypt(lua_State *L)
|
||||
{
|
||||
dual_aes_context *obj=Pget_aes(L,1);
|
||||
- int len;
|
||||
+ size_t len;
|
||||
const char *data = luaL_checklstring(L, 2, &len);
|
||||
- int iv_len;
|
||||
+ size_t iv_len;
|
||||
const char *IV = luaL_checklstring(L, 3, &iv_len);
|
||||
int i;
|
||||
luaL_Buffer B;
|
||||
@@ -1002,9 +1004,9 @@
|
||||
static int Laes_cfb_encrypt(lua_State *L)
|
||||
{
|
||||
dual_aes_context *obj=Pget_aes(L,1);
|
||||
- int len;
|
||||
+ size_t len;
|
||||
const char *data = luaL_checklstring(L, 2, &len);
|
||||
- int iv_len;
|
||||
+ size_t iv_len;
|
||||
const char *IV = luaL_checklstring(L, 3, &iv_len);
|
||||
int start = luaL_optinteger(L,4,0);
|
||||
int i;
|
||||
@@ -1039,9 +1041,9 @@
|
||||
static int Laes_cfb_decrypt(lua_State *L)
|
||||
{
|
||||
dual_aes_context *obj=Pget_aes(L,1);
|
||||
- int len;
|
||||
+ size_t len;
|
||||
const char *data = luaL_checklstring(L, 2, &len);
|
||||
- int iv_len;
|
||||
+ size_t iv_len;
|
||||
const char *IV = luaL_checklstring(L, 3, &iv_len);
|
||||
int start = luaL_optinteger(L,4,0);
|
||||
int i;
|
||||
@@ -1079,7 +1081,7 @@
|
||||
static int Lhash_update(lua_State *L)
|
||||
{
|
||||
hash_context *obj=Pget_hash(L,1);
|
||||
- int len;
|
||||
+ size_t len;
|
||||
const char *data = luaL_checklstring(L, 2, &len);
|
||||
obj->update(&obj->eng, (unsigned char *)data, len);
|
||||
lua_pushvalue(L, 1);
|
||||
@@ -1091,7 +1093,7 @@
|
||||
{
|
||||
hash_context *obj=Pget_hash(L,1);
|
||||
unsigned char out[64];
|
||||
- int len;
|
||||
+ size_t len;
|
||||
const char *data = luaL_optlstring(L, 2, "", &len);
|
||||
obj->update(&obj->eng, (unsigned char *)data, len);
|
||||
obj->finish(&obj->eng, out);
|
||||
@@ -1166,7 +1168,7 @@
|
||||
static int LaddTrustedCA(lua_State *L)
|
||||
{
|
||||
int ret;
|
||||
- int ca_len;
|
||||
+ size_t ca_len;
|
||||
const char *ca = luaL_checklstring(L, 1, &ca_len);
|
||||
|
||||
ret = x509_add_certs( &trustedCA, (unsigned char *) ca, ca_len);
|
||||
@@ -1311,9 +1313,9 @@
|
||||
static int Lsessinfo(lua_State *L) /** sessinfo(c) */
|
||||
{
|
||||
xyssl_context *xyssl=Pget(L,1);
|
||||
- int id_len;
|
||||
+ size_t id_len;
|
||||
char *sessid = (char *)luaL_optlstring(L, 2, NULL, &id_len);
|
||||
- int master_len;
|
||||
+ size_t master_len;
|
||||
char *master = (char *)luaL_optlstring(L, 3, NULL, &master_len);
|
||||
int cipher = (int) luaL_optnumber(L,4,0);
|
||||
time_t start = (time_t) luaL_optnumber(L,5,time(NULL));
|
||||
@@ -1597,7 +1599,7 @@
|
||||
static int LsessionCA(lua_State *L) /** setca(ca) **/
|
||||
{
|
||||
int top = lua_gettop(L);
|
||||
- int ca_len;
|
||||
+ size_t ca_len;
|
||||
int ret;
|
||||
xyssl_context *xyssl=Pget(L,1);
|
||||
x509_cert *cacert = &xyssl->cacert;
|
||||
@@ -1624,9 +1626,9 @@
|
||||
ssl_context *ssl=&xyssl->ssl;
|
||||
x509_cert *mycert= &xyssl->mycert;
|
||||
rsa_context *rsa = &xyssl->mykey;
|
||||
- int cert_len;
|
||||
- int key_len;
|
||||
- int pwd_len;
|
||||
+ size_t cert_len;
|
||||
+ size_t key_len;
|
||||
+ size_t pwd_len;
|
||||
int ret;
|
||||
const char *cert = luaL_optlstring(L, 2, ssl->endpoint ? test_srv_crt: NULL, &cert_len);
|
||||
const char *key = luaL_optlstring(L, 3, ssl->endpoint ? test_srv_key: NULL, &key_len);
|
||||
@@ -1694,7 +1696,7 @@
|
||||
ssl_context *ssl=&xyssl->ssl;
|
||||
x509_cert *cacert = &xyssl->cacert;
|
||||
int verification = luaL_optinteger(L,2,0);
|
||||
- int peer_len;
|
||||
+ size_t peer_len;
|
||||
const char *expected_peer= luaL_optlstring(L, 3, NULL, &peer_len);
|
||||
ssl_set_authmode( ssl, verification );
|
||||
if (xyssl->peer_cn) free(xyssl->peer_cn);
|
||||
@@ -1748,8 +1750,8 @@
|
||||
static int Lx509verify(lua_State *L) /** x509verify(ca, crt) */
|
||||
{
|
||||
int top = lua_gettop(L);
|
||||
- int crt_size;
|
||||
- int ca_size;
|
||||
+ size_t crt_size;
|
||||
+ size_t ca_size;
|
||||
int ret;
|
||||
int flag;
|
||||
x509_cert ca;
|
||||
@@ -1797,9 +1799,9 @@
|
||||
static int Lrsaverify(lua_State *L) /** rsaverify(data, sig, [crt]) */
|
||||
{
|
||||
int top = lua_gettop(L);
|
||||
- int crt_size;
|
||||
- int data_size;
|
||||
- int sig_size;
|
||||
+ size_t crt_size;
|
||||
+ size_t data_size;
|
||||
+ size_t sig_size;
|
||||
int ret;
|
||||
x509_cert cert;
|
||||
const char *data = luaL_checklstring(L, 1, &data_size);
|
||||
@@ -1833,8 +1835,8 @@
|
||||
static int Lrsaencrypt(lua_State *L) /** rsaencrypt(data, [crt]) */
|
||||
{
|
||||
int top = lua_gettop(L);
|
||||
- int crt_size;
|
||||
- int data_size;
|
||||
+ size_t crt_size;
|
||||
+ size_t data_size;
|
||||
unsigned char m[512];
|
||||
int ret;
|
||||
x509_cert cert;
|
||||
@@ -1868,9 +1870,9 @@
|
||||
static int Lrsasign(lua_State *L) /** rsasign(data, [key, [pw]]) */
|
||||
{
|
||||
int top = lua_gettop(L);
|
||||
- int key_size;
|
||||
- int data_size;
|
||||
- int pwd_len;
|
||||
+ size_t key_size;
|
||||
+ size_t data_size;
|
||||
+ size_t pwd_len;
|
||||
int ret;
|
||||
unsigned char sig[512];
|
||||
rsa_context rsa;
|
||||
@@ -1905,9 +1907,9 @@
|
||||
static int Lrsadecrypt(lua_State *L) /** rsadecrypt(data, [key, [pw]]) */
|
||||
{
|
||||
int top = lua_gettop(L);
|
||||
- int key_size;
|
||||
- int data_size;
|
||||
- int pwd_len;
|
||||
+ size_t key_size;
|
||||
+ size_t data_size;
|
||||
+ size_t pwd_len;
|
||||
int out_len;
|
||||
int ret;
|
||||
unsigned char m[512];
|
||||
@@ -2076,8 +2078,8 @@
|
||||
static int Ldhmsecret(lua_State *L) /** dhsecret(public, private, [P, [G]]) */
|
||||
{
|
||||
int top = lua_gettop(L);
|
||||
- int public_size;
|
||||
- int private_size;
|
||||
+ size_t public_size;
|
||||
+ size_t private_size;
|
||||
int ret;
|
||||
dhm_context dhm;
|
||||
unsigned char buf[512];
|
|
@ -0,0 +1,5 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<buildpath>
|
||||
<buildpathentry kind="src" path="src"/>
|
||||
<buildpathentry kind="con" path="org.eclipse.dltk.launching.INTERPRETER_CONTAINER"/>
|
||||
</buildpath>
|
|
@ -0,0 +1,221 @@
|
|||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||
<?fileVersion 4.0.0?>
|
||||
|
||||
<cproject>
|
||||
<storageModule moduleId="org.eclipse.cdt.core.settings">
|
||||
<cconfiguration id="preference.org.eclipse.cdt.managedbuilder.core.configurationDataProvider.1510318341">
|
||||
<storageModule moduleId="cdtBuildSystem" version="4.0.0">
|
||||
<configuration artifactName="luci" buildProperties="" description="" id="preference.org.eclipse.cdt.managedbuilder.core.configurationDataProvider.1510318341" name="Preference Configuration" parent="org.eclipse.cdt.build.core.prefbase.cfg">
|
||||
<folderInfo id="preference.org.eclipse.cdt.managedbuilder.core.configurationDataProvider.1510318341." name="/" resourcePath="">
|
||||
<toolChain id="org.eclipse.cdt.build.core.prefbase.toolchain.407447051" name="No ToolChain" resourceTypeBasedDiscovery="false" superClass="org.eclipse.cdt.build.core.prefbase.toolchain">
|
||||
<targetPlatform id="org.eclipse.cdt.build.core.prefbase.toolchain.407447051.1470931541" name=""/>
|
||||
<builder id="org.eclipse.cdt.build.core.settings.default.builder.823611263" keepEnvironmentInBuildfile="false" name="Gnu Make Builder" superClass="org.eclipse.cdt.build.core.settings.default.builder"/>
|
||||
<tool id="org.eclipse.cdt.build.core.settings.holder.libs.1685234798" name="holder for library settings" superClass="org.eclipse.cdt.build.core.settings.holder.libs"/>
|
||||
<tool id="org.eclipse.cdt.build.core.settings.holder.570824141" name="Assembly" superClass="org.eclipse.cdt.build.core.settings.holder">
|
||||
<option id="org.eclipse.cdt.build.core.settings.holder.incpaths.491129717" name="Include Paths" superClass="org.eclipse.cdt.build.core.settings.holder.incpaths" valueType="includePath">
|
||||
<listOptionValue builtIn="false" value="/usr/include/lua5.1"/>
|
||||
<listOptionValue builtIn="false" value="/usr/include"/>
|
||||
</option>
|
||||
<inputType id="org.eclipse.cdt.build.core.settings.holder.inType.858094059" languageId="org.eclipse.cdt.core.assembly" languageName="Assembly" sourceContentType="org.eclipse.cdt.core.asmSource" superClass="org.eclipse.cdt.build.core.settings.holder.inType"/>
|
||||
</tool>
|
||||
<tool id="org.eclipse.cdt.build.core.settings.holder.344617955" name="GNU C++" superClass="org.eclipse.cdt.build.core.settings.holder">
|
||||
<option id="org.eclipse.cdt.build.core.settings.holder.incpaths.564526987" name="Include Paths" superClass="org.eclipse.cdt.build.core.settings.holder.incpaths" valueType="includePath">
|
||||
<listOptionValue builtIn="false" value="/usr/include/lua5.1"/>
|
||||
<listOptionValue builtIn="false" value="/usr/include"/>
|
||||
</option>
|
||||
<inputType id="org.eclipse.cdt.build.core.settings.holder.inType.1426860237" languageId="org.eclipse.cdt.core.g++" languageName="GNU C++" sourceContentType="org.eclipse.cdt.core.cxxSource,org.eclipse.cdt.core.cxxHeader" superClass="org.eclipse.cdt.build.core.settings.holder.inType"/>
|
||||
</tool>
|
||||
<tool id="org.eclipse.cdt.build.core.settings.holder.869454750" name="GNU C" superClass="org.eclipse.cdt.build.core.settings.holder">
|
||||
<option id="org.eclipse.cdt.build.core.settings.holder.incpaths.838425449" name="Include Paths" superClass="org.eclipse.cdt.build.core.settings.holder.incpaths" valueType="includePath">
|
||||
<listOptionValue builtIn="false" value="/usr/include/lua5.1"/>
|
||||
<listOptionValue builtIn="false" value="/usr/include"/>
|
||||
</option>
|
||||
<inputType id="org.eclipse.cdt.build.core.settings.holder.inType.1755775295" languageId="org.eclipse.cdt.core.gcc" languageName="GNU C" sourceContentType="org.eclipse.cdt.core.cSource,org.eclipse.cdt.core.cHeader" superClass="org.eclipse.cdt.build.core.settings.holder.inType"/>
|
||||
</tool>
|
||||
</toolChain>
|
||||
</folderInfo>
|
||||
</configuration>
|
||||
</storageModule>
|
||||
<storageModule buildSystemId="org.eclipse.cdt.managedbuilder.core.configurationDataProvider" id="preference.org.eclipse.cdt.managedbuilder.core.configurationDataProvider.1510318341" moduleId="org.eclipse.cdt.core.settings" name="Preference Configuration">
|
||||
<externalSettings/>
|
||||
<extensions>
|
||||
<extension id="org.eclipse.cdt.core.VCErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
|
||||
<extension id="org.eclipse.cdt.core.MakeErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
|
||||
<extension id="org.eclipse.cdt.core.GCCErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
|
||||
<extension id="org.eclipse.cdt.core.GASErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
|
||||
<extension id="org.eclipse.cdt.core.GLDErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
|
||||
</extensions>
|
||||
</storageModule>
|
||||
<storageModule moduleId="org.eclipse.cdt.core.externalSettings"/>
|
||||
<storageModule moduleId="scannerConfiguration">
|
||||
<autodiscovery enabled="true" problemReportingEnabled="true" selectedProfileId="org.eclipse.cdt.make.core.GCCStandardMakePerProjectProfile"/>
|
||||
<profile id="org.eclipse.cdt.make.core.GCCStandardMakePerProjectProfile">
|
||||
<buildOutputProvider>
|
||||
<openAction enabled="true" filePath=""/>
|
||||
<parser enabled="true"/>
|
||||
</buildOutputProvider>
|
||||
<scannerInfoProvider id="specsFile">
|
||||
<runAction arguments="-E -P -v -dD ${plugin_state_location}/${specs_file}" command="gcc" useDefault="true"/>
|
||||
<parser enabled="true"/>
|
||||
</scannerInfoProvider>
|
||||
</profile>
|
||||
<profile id="org.eclipse.cdt.make.core.GCCStandardMakePerFileProfile">
|
||||
<buildOutputProvider>
|
||||
<openAction enabled="true" filePath=""/>
|
||||
<parser enabled="true"/>
|
||||
</buildOutputProvider>
|
||||
<scannerInfoProvider id="makefileGenerator">
|
||||
<runAction arguments="-f ${project_name}_scd.mk" command="make" useDefault="true"/>
|
||||
<parser enabled="true"/>
|
||||
</scannerInfoProvider>
|
||||
</profile>
|
||||
<profile id="org.eclipse.cdt.managedbuilder.core.GCCManagedMakePerProjectProfile">
|
||||
<buildOutputProvider>
|
||||
<openAction enabled="true" filePath=""/>
|
||||
<parser enabled="true"/>
|
||||
</buildOutputProvider>
|
||||
<scannerInfoProvider id="specsFile">
|
||||
<runAction arguments="-E -P -v -dD ${plugin_state_location}/${specs_file}" command="gcc" useDefault="true"/>
|
||||
<parser enabled="true"/>
|
||||
</scannerInfoProvider>
|
||||
</profile>
|
||||
<profile id="org.eclipse.cdt.managedbuilder.core.GCCManagedMakePerProjectProfileCPP">
|
||||
<buildOutputProvider>
|
||||
<openAction enabled="true" filePath=""/>
|
||||
<parser enabled="true"/>
|
||||
</buildOutputProvider>
|
||||
<scannerInfoProvider id="specsFile">
|
||||
<runAction arguments="-E -P -v -dD ${plugin_state_location}/specs.cpp" command="g++" useDefault="true"/>
|
||||
<parser enabled="true"/>
|
||||
</scannerInfoProvider>
|
||||
</profile>
|
||||
<profile id="org.eclipse.cdt.managedbuilder.core.GCCManagedMakePerProjectProfileC">
|
||||
<buildOutputProvider>
|
||||
<openAction enabled="true" filePath=""/>
|
||||
<parser enabled="true"/>
|
||||
</buildOutputProvider>
|
||||
<scannerInfoProvider id="specsFile">
|
||||
<runAction arguments="-E -P -v -dD ${plugin_state_location}/specs.c" command="gcc" useDefault="true"/>
|
||||
<parser enabled="true"/>
|
||||
</scannerInfoProvider>
|
||||
</profile>
|
||||
<profile id="org.eclipse.cdt.managedbuilder.core.GCCWinManagedMakePerProjectProfile">
|
||||
<buildOutputProvider>
|
||||
<openAction enabled="true" filePath=""/>
|
||||
<parser enabled="true"/>
|
||||
</buildOutputProvider>
|
||||
<scannerInfoProvider id="specsFile">
|
||||
<runAction arguments="-E -P -v -dD ${plugin_state_location}/${specs_file}" command="gcc" useDefault="true"/>
|
||||
<parser enabled="true"/>
|
||||
</scannerInfoProvider>
|
||||
</profile>
|
||||
<profile id="org.eclipse.cdt.managedbuilder.core.GCCWinManagedMakePerProjectProfileCPP">
|
||||
<buildOutputProvider>
|
||||
<openAction enabled="true" filePath=""/>
|
||||
<parser enabled="true"/>
|
||||
</buildOutputProvider>
|
||||
<scannerInfoProvider id="specsFile">
|
||||
<runAction arguments="-E -P -v -dD ${plugin_state_location}/specs.cpp" command="g++" useDefault="true"/>
|
||||
<parser enabled="true"/>
|
||||
</scannerInfoProvider>
|
||||
</profile>
|
||||
<profile id="org.eclipse.cdt.managedbuilder.core.GCCWinManagedMakePerProjectProfileC">
|
||||
<buildOutputProvider>
|
||||
<openAction enabled="true" filePath=""/>
|
||||
<parser enabled="true"/>
|
||||
</buildOutputProvider>
|
||||
<scannerInfoProvider id="specsFile">
|
||||
<runAction arguments="-E -P -v -dD ${plugin_state_location}/specs.c" command="gcc" useDefault="true"/>
|
||||
<parser enabled="true"/>
|
||||
</scannerInfoProvider>
|
||||
</profile>
|
||||
<scannerConfigBuildInfo instanceId="preference.org.eclipse.cdt.managedbuilder.core.configurationDataProvider.1510318341">
|
||||
<autodiscovery enabled="true" problemReportingEnabled="true" selectedProfileId="org.eclipse.cdt.make.core.GCCStandardMakePerProjectProfile"/>
|
||||
<profile id="org.eclipse.cdt.make.core.GCCStandardMakePerProjectProfile">
|
||||
<buildOutputProvider>
|
||||
<openAction enabled="true" filePath=""/>
|
||||
<parser enabled="true"/>
|
||||
</buildOutputProvider>
|
||||
<scannerInfoProvider id="specsFile">
|
||||
<runAction arguments="-E -P -v -dD ${plugin_state_location}/${specs_file}" command="gcc" useDefault="true"/>
|
||||
<parser enabled="true"/>
|
||||
</scannerInfoProvider>
|
||||
</profile>
|
||||
<profile id="org.eclipse.cdt.make.core.GCCStandardMakePerFileProfile">
|
||||
<buildOutputProvider>
|
||||
<openAction enabled="true" filePath=""/>
|
||||
<parser enabled="true"/>
|
||||
</buildOutputProvider>
|
||||
<scannerInfoProvider id="makefileGenerator">
|
||||
<runAction arguments="-f ${project_name}_scd.mk" command="make" useDefault="true"/>
|
||||
<parser enabled="true"/>
|
||||
</scannerInfoProvider>
|
||||
</profile>
|
||||
<profile id="org.eclipse.cdt.managedbuilder.core.GCCManagedMakePerProjectProfile">
|
||||
<buildOutputProvider>
|
||||
<openAction enabled="true" filePath=""/>
|
||||
<parser enabled="true"/>
|
||||
</buildOutputProvider>
|
||||
<scannerInfoProvider id="specsFile">
|
||||
<runAction arguments="-E -P -v -dD ${plugin_state_location}/${specs_file}" command="gcc" useDefault="true"/>
|
||||
<parser enabled="true"/>
|
||||
</scannerInfoProvider>
|
||||
</profile>
|
||||
<profile id="org.eclipse.cdt.managedbuilder.core.GCCManagedMakePerProjectProfileCPP">
|
||||
<buildOutputProvider>
|
||||
<openAction enabled="true" filePath=""/>
|
||||
<parser enabled="true"/>
|
||||
</buildOutputProvider>
|
||||
<scannerInfoProvider id="specsFile">
|
||||
<runAction arguments="-E -P -v -dD ${plugin_state_location}/specs.cpp" command="g++" useDefault="true"/>
|
||||
<parser enabled="true"/>
|
||||
</scannerInfoProvider>
|
||||
</profile>
|
||||
<profile id="org.eclipse.cdt.managedbuilder.core.GCCManagedMakePerProjectProfileC">
|
||||
<buildOutputProvider>
|
||||
<openAction enabled="true" filePath=""/>
|
||||
<parser enabled="true"/>
|
||||
</buildOutputProvider>
|
||||
<scannerInfoProvider id="specsFile">
|
||||
<runAction arguments="-E -P -v -dD ${plugin_state_location}/specs.c" command="gcc" useDefault="true"/>
|
||||
<parser enabled="true"/>
|
||||
</scannerInfoProvider>
|
||||
</profile>
|
||||
<profile id="org.eclipse.cdt.managedbuilder.core.GCCWinManagedMakePerProjectProfile">
|
||||
<buildOutputProvider>
|
||||
<openAction enabled="true" filePath=""/>
|
||||
<parser enabled="true"/>
|
||||
</buildOutputProvider>
|
||||
<scannerInfoProvider id="specsFile">
|
||||
<runAction arguments="-E -P -v -dD ${plugin_state_location}/${specs_file}" command="gcc" useDefault="true"/>
|
||||
<parser enabled="true"/>
|
||||
</scannerInfoProvider>
|
||||
</profile>
|
||||
<profile id="org.eclipse.cdt.managedbuilder.core.GCCWinManagedMakePerProjectProfileCPP">
|
||||
<buildOutputProvider>
|
||||
<openAction enabled="true" filePath=""/>
|
||||
<parser enabled="true"/>
|
||||
</buildOutputProvider>
|
||||
<scannerInfoProvider id="specsFile">
|
||||
<runAction arguments="-E -P -v -dD ${plugin_state_location}/specs.cpp" command="g++" useDefault="true"/>
|
||||
<parser enabled="true"/>
|
||||
</scannerInfoProvider>
|
||||
</profile>
|
||||
<profile id="org.eclipse.cdt.managedbuilder.core.GCCWinManagedMakePerProjectProfileC">
|
||||
<buildOutputProvider>
|
||||
<openAction enabled="true" filePath=""/>
|
||||
<parser enabled="true"/>
|
||||
</buildOutputProvider>
|
||||
<scannerInfoProvider id="specsFile">
|
||||
<runAction arguments="-E -P -v -dD ${plugin_state_location}/specs.c" command="gcc" useDefault="true"/>
|
||||
<parser enabled="true"/>
|
||||
</scannerInfoProvider>
|
||||
</profile>
|
||||
</scannerConfigBuildInfo>
|
||||
</storageModule>
|
||||
</cconfiguration>
|
||||
</storageModule>
|
||||
<storageModule moduleId="cdtBuildSystem" version="4.0.0">
|
||||
<project id="luci.null.949486034" name="luci"/>
|
||||
</storageModule>
|
||||
</cproject>
|
|
@ -0,0 +1,6 @@
|
|||
dist/
|
||||
/host
|
||||
*.o
|
||||
*.so
|
||||
*.swp
|
||||
/docs
|
|
@ -0,0 +1,78 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<projectDescription>
|
||||
<name>luci</name>
|
||||
<comment></comment>
|
||||
<projects>
|
||||
</projects>
|
||||
<buildSpec>
|
||||
<buildCommand>
|
||||
<name>org.eclipse.cdt.managedbuilder.core.genmakebuilder</name>
|
||||
<triggers>clean,full,incremental,</triggers>
|
||||
<arguments>
|
||||
<dictionary>
|
||||
<key>?name?</key>
|
||||
<value></value>
|
||||
</dictionary>
|
||||
<dictionary>
|
||||
<key>org.eclipse.cdt.make.core.append_environment</key>
|
||||
<value>true</value>
|
||||
</dictionary>
|
||||
<dictionary>
|
||||
<key>org.eclipse.cdt.make.core.autoBuildTarget</key>
|
||||
<value>all</value>
|
||||
</dictionary>
|
||||
<dictionary>
|
||||
<key>org.eclipse.cdt.make.core.buildArguments</key>
|
||||
<value></value>
|
||||
</dictionary>
|
||||
<dictionary>
|
||||
<key>org.eclipse.cdt.make.core.buildCommand</key>
|
||||
<value>make</value>
|
||||
</dictionary>
|
||||
<dictionary>
|
||||
<key>org.eclipse.cdt.make.core.cleanBuildTarget</key>
|
||||
<value>clean</value>
|
||||
</dictionary>
|
||||
<dictionary>
|
||||
<key>org.eclipse.cdt.make.core.contents</key>
|
||||
<value>org.eclipse.cdt.make.core.activeConfigSettings</value>
|
||||
</dictionary>
|
||||
<dictionary>
|
||||
<key>org.eclipse.cdt.make.core.enableAutoBuild</key>
|
||||
<value>false</value>
|
||||
</dictionary>
|
||||
<dictionary>
|
||||
<key>org.eclipse.cdt.make.core.enableCleanBuild</key>
|
||||
<value>true</value>
|
||||
</dictionary>
|
||||
<dictionary>
|
||||
<key>org.eclipse.cdt.make.core.enableFullBuild</key>
|
||||
<value>true</value>
|
||||
</dictionary>
|
||||
<dictionary>
|
||||
<key>org.eclipse.cdt.make.core.fullBuildTarget</key>
|
||||
<value>all</value>
|
||||
</dictionary>
|
||||
<dictionary>
|
||||
<key>org.eclipse.cdt.make.core.stopOnError</key>
|
||||
<value>true</value>
|
||||
</dictionary>
|
||||
<dictionary>
|
||||
<key>org.eclipse.cdt.make.core.useDefaultBuildCmd</key>
|
||||
<value>true</value>
|
||||
</dictionary>
|
||||
</arguments>
|
||||
</buildCommand>
|
||||
<buildCommand>
|
||||
<name>org.eclipse.cdt.managedbuilder.core.ScannerConfigBuilder</name>
|
||||
<arguments>
|
||||
</arguments>
|
||||
</buildCommand>
|
||||
</buildSpec>
|
||||
<natures>
|
||||
<nature>org.eclipse.cdt.managedbuilder.core.ScannerConfigNature</nature>
|
||||
<nature>org.eclipse.cdt.managedbuilder.core.managedBuildNature</nature>
|
||||
<nature>org.eclipse.cdt.core.cnature</nature>
|
||||
<nature>org.eclipse.dltk.lua.core.nature</nature>
|
||||
</natures>
|
||||
</projectDescription>
|
|
@ -0,0 +1,27 @@
|
|||
LuCI Installation Instructions
|
||||
|
||||
TOC:
|
||||
1. Kamikaze Feed
|
||||
2. Kamikaze Packages
|
||||
|
||||
|
||||
1. Kamikaze Feed
|
||||
1. Change to your OpenWrt buildroot
|
||||
|
||||
2. Add the following line to your OpenWrt feeds.conf:
|
||||
src-svn luci http://svn.luci.subsignal.org/luci/trunk/contrib/package
|
||||
|
||||
3. Run ./scripts/feeds update
|
||||
|
||||
4. Run ./scripts/feeds install -a -p luci
|
||||
|
||||
5. Type make menuconfig and you will find luci in the menu "Administration"
|
||||
|
||||
|
||||
2. Kamikaze Packages
|
||||
1. cd to the "package" directory of your kamikaze buildroot
|
||||
|
||||
3. Type: ln -s /path/to/luci/contrib/package/* ./
|
||||
|
||||
4. cd to your kamikaze build root and type: make menuconfig
|
||||
You will find luci in the menu "Administration"
|
|
@ -0,0 +1,201 @@
|
|||
Apache License
|
||||
Version 2.0, January 2004
|
||||
http://www.apache.org/licenses/
|
||||
|
||||
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
||||
|
||||
1. Definitions.
|
||||
|
||||
"License" shall mean the terms and conditions for use, reproduction,
|
||||
and distribution as defined by Sections 1 through 9 of this document.
|
||||
|
||||
"Licensor" shall mean the copyright owner or entity authorized by
|
||||
the copyright owner that is granting the License.
|
||||
|
||||
"Legal Entity" shall mean the union of the acting entity and all
|
||||
other entities that control, are controlled by, or are under common
|
||||
control with that entity. For the purposes of this definition,
|
||||
"control" means (i) the power, direct or indirect, to cause the
|
||||
direction or management of such entity, whether by contract or
|
||||
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
||||
outstanding shares, or (iii) beneficial ownership of such entity.
|
||||
|
||||
"You" (or "Your") shall mean an individual or Legal Entity
|
||||
exercising permissions granted by this License.
|
||||
|
||||
"Source" form shall mean the preferred form for making modifications,
|
||||
including but not limited to software source code, documentation
|
||||
source, and configuration files.
|
||||
|
||||
"Object" form shall mean any form resulting from mechanical
|
||||
transformation or translation of a Source form, including but
|
||||
not limited to compiled object code, generated documentation,
|
||||
and conversions to other media types.
|
||||
|
||||
"Work" shall mean the work of authorship, whether in Source or
|
||||
Object form, made available under the License, as indicated by a
|
||||
copyright notice that is included in or attached to the work
|
||||
(an example is provided in the Appendix below).
|
||||
|
||||
"Derivative Works" shall mean any work, whether in Source or Object
|
||||
form, that is based on (or derived from) the Work and for which the
|
||||
editorial revisions, annotations, elaborations, or other modifications
|
||||
represent, as a whole, an original work of authorship. For the purposes
|
||||
of this License, Derivative Works shall not include works that remain
|
||||
separable from, or merely link (or bind by name) to the interfaces of,
|
||||
the Work and Derivative Works thereof.
|
||||
|
||||
"Contribution" shall mean any work of authorship, including
|
||||
the original version of the Work and any modifications or additions
|
||||
to that Work or Derivative Works thereof, that is intentionally
|
||||
submitted to Licensor for inclusion in the Work by the copyright owner
|
||||
or by an individual or Legal Entity authorized to submit on behalf of
|
||||
the copyright owner. For the purposes of this definition, "submitted"
|
||||
means any form of electronic, verbal, or written communication sent
|
||||
to the Licensor or its representatives, including but not limited to
|
||||
communication on electronic mailing lists, source code control systems,
|
||||
and issue tracking systems that are managed by, or on behalf of, the
|
||||
Licensor for the purpose of discussing and improving the Work, but
|
||||
excluding communication that is conspicuously marked or otherwise
|
||||
designated in writing by the copyright owner as "Not a Contribution."
|
||||
|
||||
"Contributor" shall mean Licensor and any individual or Legal Entity
|
||||
on behalf of whom a Contribution has been received by Licensor and
|
||||
subsequently incorporated within the Work.
|
||||
|
||||
2. Grant of Copyright License. Subject to the terms and conditions of
|
||||
this License, each Contributor hereby grants to You a perpetual,
|
||||
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
||||
copyright license to reproduce, prepare Derivative Works of,
|
||||
publicly display, publicly perform, sublicense, and distribute the
|
||||
Work and such Derivative Works in Source or Object form.
|
||||
|
||||
3. Grant of Patent License. Subject to the terms and conditions of
|
||||
this License, each Contributor hereby grants to You a perpetual,
|
||||
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
||||
(except as stated in this section) patent license to make, have made,
|
||||
use, offer to sell, sell, import, and otherwise transfer the Work,
|
||||
where such license applies only to those patent claims licensable
|
||||
by such Contributor that are necessarily infringed by their
|
||||
Contribution(s) alone or by combination of their Contribution(s)
|
||||
with the Work to which such Contribution(s) was submitted. If You
|
||||
institute patent litigation against any entity (including a
|
||||
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
||||
or a Contribution incorporated within the Work constitutes direct
|
||||
or contributory patent infringement, then any patent licenses
|
||||
granted to You under this License for that Work shall terminate
|
||||
as of the date such litigation is filed.
|
||||
|
||||
4. Redistribution. You may reproduce and distribute copies of the
|
||||
Work or Derivative Works thereof in any medium, with or without
|
||||
modifications, and in Source or Object form, provided that You
|
||||
meet the following conditions:
|
||||
|
||||
(a) You must give any other recipients of the Work or
|
||||
Derivative Works a copy of this License; and
|
||||
|
||||
(b) You must cause any modified files to carry prominent notices
|
||||
stating that You changed the files; and
|
||||
|
||||
(c) You must retain, in the Source form of any Derivative Works
|
||||
that You distribute, all copyright, patent, trademark, and
|
||||
attribution notices from the Source form of the Work,
|
||||
excluding those notices that do not pertain to any part of
|
||||
the Derivative Works; and
|
||||
|
||||
(d) If the Work includes a "NOTICE" text file as part of its
|
||||
distribution, then any Derivative Works that You distribute must
|
||||
include a readable copy of the attribution notices contained
|
||||
within such NOTICE file, excluding those notices that do not
|
||||
pertain to any part of the Derivative Works, in at least one
|
||||
of the following places: within a NOTICE text file distributed
|
||||
as part of the Derivative Works; within the Source form or
|
||||
documentation, if provided along with the Derivative Works; or,
|
||||
within a display generated by the Derivative Works, if and
|
||||
wherever such third-party notices normally appear. The contents
|
||||
of the NOTICE file are for informational purposes only and
|
||||
do not modify the License. You may add Your own attribution
|
||||
notices within Derivative Works that You distribute, alongside
|
||||
or as an addendum to the NOTICE text from the Work, provided
|
||||
that such additional attribution notices cannot be construed
|
||||
as modifying the License.
|
||||
|
||||
You may add Your own copyright statement to Your modifications and
|
||||
may provide additional or different license terms and conditions
|
||||
for use, reproduction, or distribution of Your modifications, or
|
||||
for any such Derivative Works as a whole, provided Your use,
|
||||
reproduction, and distribution of the Work otherwise complies with
|
||||
the conditions stated in this License.
|
||||
|
||||
5. Submission of Contributions. Unless You explicitly state otherwise,
|
||||
any Contribution intentionally submitted for inclusion in the Work
|
||||
by You to the Licensor shall be under the terms and conditions of
|
||||
this License, without any additional terms or conditions.
|
||||
Notwithstanding the above, nothing herein shall supersede or modify
|
||||
the terms of any separate license agreement you may have executed
|
||||
with Licensor regarding such Contributions.
|
||||
|
||||
6. Trademarks. This License does not grant permission to use the trade
|
||||
names, trademarks, service marks, or product names of the Licensor,
|
||||
except as required for reasonable and customary use in describing the
|
||||
origin of the Work and reproducing the content of the NOTICE file.
|
||||
|
||||
7. Disclaimer of Warranty. Unless required by applicable law or
|
||||
agreed to in writing, Licensor provides the Work (and each
|
||||
Contributor provides its Contributions) on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
||||
implied, including, without limitation, any warranties or conditions
|
||||
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
||||
PARTICULAR PURPOSE. You are solely responsible for determining the
|
||||
appropriateness of using or redistributing the Work and assume any
|
||||
risks associated with Your exercise of permissions under this License.
|
||||
|
||||
8. Limitation of Liability. In no event and under no legal theory,
|
||||
whether in tort (including negligence), contract, or otherwise,
|
||||
unless required by applicable law (such as deliberate and grossly
|
||||
negligent acts) or agreed to in writing, shall any Contributor be
|
||||
liable to You for damages, including any direct, indirect, special,
|
||||
incidental, or consequential damages of any character arising as a
|
||||
result of this License or out of the use or inability to use the
|
||||
Work (including but not limited to damages for loss of goodwill,
|
||||
work stoppage, computer failure or malfunction, or any and all
|
||||
other commercial damages or losses), even if such Contributor
|
||||
has been advised of the possibility of such damages.
|
||||
|
||||
9. Accepting Warranty or Additional Liability. While redistributing
|
||||
the Work or Derivative Works thereof, You may choose to offer,
|
||||
and charge a fee for, acceptance of support, warranty, indemnity,
|
||||
or other liability obligations and/or rights consistent with this
|
||||
License. However, in accepting such obligations, You may act only
|
||||
on Your own behalf and on Your sole responsibility, not on behalf
|
||||
of any other Contributor, and only if You agree to indemnify,
|
||||
defend, and hold each Contributor harmless for any liability
|
||||
incurred by, or claims asserted against, such Contributor by reason
|
||||
of your accepting any such warranty or additional liability.
|
||||
|
||||
END OF TERMS AND CONDITIONS
|
||||
|
||||
APPENDIX: How to apply the Apache License to your work.
|
||||
|
||||
To apply the Apache License to your work, attach the following
|
||||
boilerplate notice, with the fields enclosed by brackets "[]"
|
||||
replaced with your own identifying information. (Don't include
|
||||
the brackets!) The text should be enclosed in the appropriate
|
||||
comment syntax for the file format. We also recommend that a
|
||||
file or class name and description of purpose be included on the
|
||||
same "printed page" as the copyright notice for easier
|
||||
identification within third-party archives.
|
||||
|
||||
Copyright [yyyy] [name of copyright owner]
|
||||
|
||||
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
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
|
@ -0,0 +1,84 @@
|
|||
include build/config.mk
|
||||
|
||||
MODULES = contrib/* applications/* libs/* modules/* themes/* i18n/*
|
||||
|
||||
OS:=$(shell uname)
|
||||
export OS
|
||||
|
||||
.PHONY: all build gccbuild luabuild clean host gcchost luahost hostcopy hostclean
|
||||
|
||||
all: build
|
||||
|
||||
build: gccbuild luabuild
|
||||
|
||||
gccbuild:
|
||||
for i in $(MODULES); do make -C$$i compile; done
|
||||
|
||||
luabuild:
|
||||
for i in $(MODULES); do make -C$$i luabuild; done
|
||||
|
||||
clean:
|
||||
rm -rf docs
|
||||
for i in $(MODULES); do make -C$$i clean; done
|
||||
|
||||
|
||||
host: build hostcopy
|
||||
|
||||
gcchost: gccbuild hostcopy
|
||||
|
||||
luahost: luabuild hostcopy
|
||||
|
||||
hostcopy:
|
||||
mkdir -p host/tmp
|
||||
for i in $(MODULES); do cp -pR $$i/dist/* host/ 2>/dev/null || true; done
|
||||
for i in $(MODULES); do cp -pR $$i/hostfiles/* host/ 2>/dev/null || true; done
|
||||
rm -f host/luci
|
||||
ln -s .$(LUCI_MODULEDIR) host/luci
|
||||
rm -rf /tmp/luci-* || true
|
||||
|
||||
hostenv: host ucidefaults
|
||||
|
||||
ucidefaults:
|
||||
build/hostenv.sh $(realpath host) $(LUA_MODULEDIR) $(LUA_LIBRARYDIR) "$(realpath host)/bin/uci-defaults --exclude luci-freifunk-*"
|
||||
|
||||
runboa: hostenv
|
||||
libs/sgi-webuci/host/buildconfig.sh $(realpath host) > host/etc/boa/boa.conf
|
||||
build/hostenv.sh $(realpath host) $(LUA_MODULEDIR) $(LUA_LIBRARYDIR) "$(realpath host/usr/bin/boa) -c $(realpath host/etc/boa) -d"
|
||||
|
||||
runhttpd: hostenv
|
||||
build/hostenv.sh $(realpath host) $(LUA_MODULEDIR) $(LUA_LIBRARYDIR) "$(realpath host/usr/bin/lucittpd) $(realpath host)/usr/lib/lucittpd/plugins"
|
||||
|
||||
runluci: luahost
|
||||
build/hostenv.sh $(realpath host) $(LUA_MODULEDIR) $(LUA_LIBRARYDIR) "$(realpath libs/httpd/host/runluci) $(realpath host) $(HTDOCS)"
|
||||
|
||||
runlua: hostenv
|
||||
build/hostenv.sh $(realpath host) $(LUA_MODULEDIR) $(LUA_LIBRARYDIR) lua
|
||||
|
||||
runshell: hostenv
|
||||
build/hostenv.sh $(realpath host) $(LUA_MODULEDIR) $(LUA_LIBRARYDIR) $$SHELL
|
||||
|
||||
hostclean: clean
|
||||
rm -rf host
|
||||
|
||||
apidocs: hostenv
|
||||
build/hostenv.sh $(realpath host) $(LUA_MODULEDIR) $(LUA_LIBRARYDIR) "build/makedocs.sh host/luci/ docs"
|
||||
|
||||
uvldocs: hostenv
|
||||
build/hostenv.sh $(realpath host) $(LUA_MODULEDIR) $(LUA_LIBRARYDIR) \
|
||||
"build/uvldoc $(realpath host) $(UVL_SCHEMEDIR) uvldocs $(DOCS)"
|
||||
|
||||
run:
|
||||
# make run is deprecated #
|
||||
# Please use: #
|
||||
# #
|
||||
# To run LuCI WebUI using LuCIttpd #
|
||||
# make runhttpd #
|
||||
# #
|
||||
# To run LuCI WebUI using Boa/Webuci #
|
||||
# make runboa #
|
||||
# #
|
||||
# To start a shell in the LuCI environment #
|
||||
# make runshell #
|
||||
# #
|
||||
# To run Lua CLI in the LuCI environment #
|
||||
# make runlua #
|
|
@ -0,0 +1,8 @@
|
|||
LuCI - Lua Configuration Interface
|
||||
Copyright 2008 Steven Barth <steven@midlink.org>
|
||||
Copyright 2008 Jo-Philipp Wich <xm@leipzig.freifunk.net>
|
||||
Licensed under the Apache License, Version 2.0.
|
||||
|
||||
Contains code from:
|
||||
coxpcall - Copyright 2005 - Kepler Project (www.keplerproject.org)
|
||||
ltn12/luasocket - Copyright 2004-2007 Diego Nehab
|
|
@ -0,0 +1,26 @@
|
|||
I'd like to thank the following people for contributing to this software:
|
||||
|
||||
* Anton Popov
|
||||
- for rewriting the openwrt.org theme
|
||||
|
||||
* Florian Fainelli (OpenWrt)
|
||||
- for the french translation
|
||||
|
||||
* Alina Friedrichsen
|
||||
- for the reworked translation system, help on standards compliance and accessibility
|
||||
|
||||
* Yanira
|
||||
- several applications and bugreports
|
||||
|
||||
|
||||
Also a big thank you goes to:
|
||||
|
||||
* Mono (Freifunk Halle)
|
||||
- for donating a Linksys WRT54GL for development purposes
|
||||
|
||||
* tetzlav (Freifunk Leipzig)
|
||||
- for donating several boards for testing and his feedback
|
||||
|
||||
* Mickey (Freifunk Hannover)
|
||||
- for his feedback and fixes for the OpenWrt builds
|
||||
|
|
@ -0,0 +1,2 @@
|
|||
include ../../build/config.mk
|
||||
include ../../build/module.mk
|
|
@ -0,0 +1,10 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
|
||||
<html xmlns="http://www.w3.org/1999/xhtml">
|
||||
<head>
|
||||
<meta http-equiv="refresh" content="0; URL=/cgi-bin/luci/freifunk/olsr" />
|
||||
</head>
|
||||
<body style="background-color: black">
|
||||
<a style="color: white; text-decoration: none" href="/cgi-bin/luci/freifunk/olsr">LuCI - Lua Configuration Interface</a>
|
||||
</body>
|
||||
</html>
|
|
@ -0,0 +1,10 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
|
||||
<html xmlns="http://www.w3.org/1999/xhtml">
|
||||
<head>
|
||||
<meta http-equiv="refresh" content="0; URL=/cgi-bin/luci/freifunk/olsr" />
|
||||
</head>
|
||||
<body style="background-color: black">
|
||||
<a style="color: white; text-decoration: none" href="/cgi-bin/luci/freifunk/olsr">LuCI - Lua Configuration Interface</a>
|
||||
</body>
|
||||
</html>
|
|
@ -0,0 +1,2 @@
|
|||
include ../../build/config.mk
|
||||
include ../../build/module.mk
|
|
@ -0,0 +1,32 @@
|
|||
--[[
|
||||
LuCI - Lua Configuration Interface
|
||||
|
||||
Copyright 2008 Steven Barth <steven@midlink.org>
|
||||
Copyright 2008 Jo-Philipp Wich <xm@leipzig.freifunk.net>
|
||||
|
||||
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: ddns.lua 3987 2009-01-02 21:35:25Z Cyrus $
|
||||
]]--
|
||||
module("luci.controller.ddns", package.seeall)
|
||||
|
||||
function index()
|
||||
require("luci.i18n")
|
||||
luci.i18n.loadc("ddns")
|
||||
if not luci.fs.access("/etc/config/ddns") then
|
||||
return
|
||||
end
|
||||
|
||||
local page = entry({"admin", "services", "ddns"}, cbi("ddns/ddns"), luci.i18n.translate("ddns"), 60)
|
||||
page.i18n = "ddns"
|
||||
page.dependent = true
|
||||
|
||||
|
||||
local page = entry({"mini", "network", "ddns"}, cbi("ddns/ddnsmini", {autoapply=true}), luci.i18n.translate("ddns"), 60)
|
||||
page.i18n = "ddns"
|
||||
page.dependent = true
|
||||
end
|
|
@ -0,0 +1,8 @@
|
|||
ddns = 'Dynamisches DNS'
|
||||
ddns_desc = 'Dynamisches DNS erlaubt es, den Router bei dynamischer IP-Adresse über einen festen DNS-Namen zu erreichen.'
|
||||
ddns_service_ipsource = 'Quelle der IP-Adresse'
|
||||
ddns_service_checkinterval = 'Teste auf neue IP alle'
|
||||
ddns_service_checkunit = 'Test-Zeiteinheit'
|
||||
ddns_service_forceinterval = 'Erzwinge Aktualisierung alle'
|
||||
ddns_service_forceunit = 'Erzwinge-Zeiteinheit'
|
||||
ddns_service_updateurl = 'Eigene Update-URL'
|
|
@ -0,0 +1,13 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
|
||||
<i18n:msgs xmlns:i18n="http://luci.freifunk-halle.net/2008/i18n#" xmlns="http://www.w3.org/1999/xhtml">
|
||||
|
||||
<i18n:msg xml:id="ddns">Dynamisches DNS</i18n:msg>
|
||||
<i18n:msg xml:id="ddns_desc">Dynamisches DNS erlaubt es, den Router bei dynamischer IP-Adresse über einen festen DNS-Namen zu erreichen.</i18n:msg>
|
||||
<i18n:msg xml:id="ddns_service_ipsource">Quelle der IP-Adresse</i18n:msg>
|
||||
<i18n:msg xml:id="ddns_service_checkinterval">Teste auf neue IP alle</i18n:msg>
|
||||
<i18n:msg xml:id="ddns_service_checkunit">Test-Zeiteinheit</i18n:msg>
|
||||
<i18n:msg xml:id="ddns_service_forceinterval">Erzwinge Aktualisierung alle</i18n:msg>
|
||||
<i18n:msg xml:id="ddns_service_forceunit">Erzwinge-Zeiteinheit</i18n:msg>
|
||||
<i18n:msg xml:id="ddns_service_updateurl">Eigene Update-URL</i18n:msg>
|
||||
</i18n:msgs>
|
|
@ -0,0 +1,8 @@
|
|||
ddns = 'Dynamic DNS'
|
||||
ddns_desc = 'Dynamic DNS allows that your router can be reached with a fixed hostname while having a dynamically changing IP-Address.'
|
||||
ddns_service_ipsource = 'Source of IP-Address'
|
||||
ddns_service_checkinterval = 'Check for changed IP every'
|
||||
ddns_service_checkunit = 'Check-Time unit'
|
||||
ddns_service_forceinterval = 'Force update every'
|
||||
ddns_service_forceunit = 'Force-Time unit'
|
||||
ddns_service_updateurl = 'Custom Update-URL'
|
|
@ -0,0 +1,13 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
|
||||
<i18n:msgs xmlns:i18n="http://luci.freifunk-halle.net/2008/i18n#" xmlns="http://www.w3.org/1999/xhtml">
|
||||
|
||||
<i18n:msg xml:id="ddns">Dynamic DNS</i18n:msg>
|
||||
<i18n:msg xml:id="ddns_desc">Dynamic DNS allows that your router can be reached with a fixed hostname while having a dynamically changing IP-Address.</i18n:msg>
|
||||
<i18n:msg xml:id="ddns_service_ipsource">Source of IP-Address</i18n:msg>
|
||||
<i18n:msg xml:id="ddns_service_checkinterval">Check for changed IP every</i18n:msg>
|
||||
<i18n:msg xml:id="ddns_service_checkunit">Check-Time unit</i18n:msg>
|
||||
<i18n:msg xml:id="ddns_service_forceinterval">Force update every</i18n:msg>
|
||||
<i18n:msg xml:id="ddns_service_forceunit">Force-Time unit</i18n:msg>
|
||||
<i18n:msg xml:id="ddns_service_updateurl">Custom Update-URL</i18n:msg>
|
||||
</i18n:msgs>
|
|
@ -0,0 +1,8 @@
|
|||
ddns = 'DNS Dynamique'
|
||||
ddns_desc = 'Le DNS Dynamique permet au routeur d'être joint avec un nom d'hôte fixe bien que changeant dynamiquement d'adresse IP.'
|
||||
ddns_service_ipsource = 'Source de l'adresse IP'
|
||||
ddns_service_checkinterval = 'Vérifier l'adresse IP toutes les'
|
||||
ddns_service_checkunit = 'Unité de temps'
|
||||
ddns_service_forceinterval = 'Vérification forcée toutes les'
|
||||
ddns_service_forceunit = 'Unité de temps'
|
||||
ddns_service_updateurl = 'Url de mise à jour personnalisée'
|
|
@ -0,0 +1,13 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
|
||||
<i18n:msgs xmlns:i18n="http://luci.freifunk-halle.net/2008/i18n#" xmlns="http://www.w3.org/1999/xhtml">
|
||||
|
||||
<i18n:msg xml:id="ddns">DNS Dynamique</i18n:msg>
|
||||
<i18n:msg xml:id="ddns_desc">Le DNS Dynamique permet au routeur d'être joint avec un nom d'hôte fixe bien que changeant dynamiquement d'adresse IP.</i18n:msg>
|
||||
<i18n:msg xml:id="ddns_service_ipsource">Source de l'adresse IP</i18n:msg>
|
||||
<i18n:msg xml:id="ddns_service_checkinterval">Vérifier l'adresse IP toutes les</i18n:msg>
|
||||
<i18n:msg xml:id="ddns_service_checkunit">Unité de temps</i18n:msg>
|
||||
<i18n:msg xml:id="ddns_service_forceinterval">Vérification forcée toutes les</i18n:msg>
|
||||
<i18n:msg xml:id="ddns_service_forceunit">Unité de temps</i18n:msg>
|
||||
<i18n:msg xml:id="ddns_service_updateurl">Url de mise à jour personnalisée</i18n:msg>
|
||||
</i18n:msgs>
|
|
@ -0,0 +1,8 @@
|
|||
ddns = 'DNS Dinâmico'
|
||||
ddns_desc = 'DNS dinâmico permite que o seu router possa ser encontrado a partir de um hostname fixo, mesmo usando um Endereço-IP dinâmico.'
|
||||
ddns_service_ipsource = 'Origem do Endereço-IP'
|
||||
ddns_service_checkinterval = 'Verificar a cada mudança de IP'
|
||||
ddns_service_checkunit = 'Unidade de tempo para verificação'
|
||||
ddns_service_forceinterval = 'Forçar atualização a cada'
|
||||
ddns_service_forceunit = 'Unidade de tempo para atualização forçada'
|
||||
ddns_service_updateurl = 'URL para atualização customizada'
|
|
@ -0,0 +1,13 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
|
||||
<i18n:msgs xmlns:i18n="http://luci.freifunk-halle.net/2008/i18n#" xmlns="http://www.w3.org/1999/xhtml">
|
||||
|
||||
<i18n:msg xml:id="ddns">DNS Dinâmico</i18n:msg>
|
||||
<i18n:msg xml:id="ddns_desc">DNS dinâmico permite que o seu router possa ser encontrado a partir de um hostname fixo, mesmo usando um Endereço-IP dinâmico.</i18n:msg>
|
||||
<i18n:msg xml:id="ddns_service_ipsource">Origem do Endereço-IP</i18n:msg>
|
||||
<i18n:msg xml:id="ddns_service_checkinterval">Verificar a cada mudança de IP</i18n:msg>
|
||||
<i18n:msg xml:id="ddns_service_checkunit">Unidade de tempo para verificação</i18n:msg>
|
||||
<i18n:msg xml:id="ddns_service_forceinterval">Forçar atualização a cada</i18n:msg>
|
||||
<i18n:msg xml:id="ddns_service_forceunit">Unidade de tempo para atualização forçada</i18n:msg>
|
||||
<i18n:msg xml:id="ddns_service_updateurl">URL para atualização customizada</i18n:msg>
|
||||
</i18n:msgs>
|
|
@ -0,0 +1,74 @@
|
|||
--[[
|
||||
LuCI - Lua Configuration Interface
|
||||
|
||||
Copyright 2008 Steven Barth <steven@midlink.org>
|
||||
Copyright 2008 Jo-Philipp Wich <xm@leipzig.freifunk.net>
|
||||
|
||||
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: ddns.lua 3643 2008-10-29 05:34:34Z jow $
|
||||
]]--
|
||||
require("luci.tools.webadmin")
|
||||
m = Map("ddns", translate("ddns"), translate("ddns_desc"))
|
||||
|
||||
s = m:section(TypedSection, "service", "")
|
||||
s.addremove = true
|
||||
|
||||
s:option(Flag, "enabled", translate("enable"))
|
||||
|
||||
svc = s:option(ListValue, "service_name", translate("service"))
|
||||
svc.rmempty = true
|
||||
svc:value("")
|
||||
svc:value("dyndns.org")
|
||||
svc:value("changeip.com")
|
||||
svc:value("zoneedit.com")
|
||||
svc:value("no-ip.com")
|
||||
svc:value("freedns.afraid.org")
|
||||
|
||||
s:option(Value, "domain", translate("hostname")).rmempty = true
|
||||
s:option(Value, "username", translate("username")).rmempty = true
|
||||
pw = s:option(Value, "password", translate("password"))
|
||||
pw.rmempty = true
|
||||
pw.password = true
|
||||
|
||||
src = s:option(ListValue, "ip_source")
|
||||
src:value("network", translate("network"))
|
||||
src:value("interface", translate("interface"))
|
||||
src:value("web", "URL")
|
||||
|
||||
iface = s:option(ListValue, "ip_network", translate("network"))
|
||||
iface:depends("ip_source", "network")
|
||||
iface.rmempty = true
|
||||
luci.tools.webadmin.cbi_add_networks(iface)
|
||||
|
||||
iface = s:option(ListValue, "ip_interface", translate("interface"))
|
||||
iface:depends("ip_source", "interface")
|
||||
iface.rmempty = true
|
||||
for k, v in pairs(luci.sys.net.devices()) do
|
||||
iface:value(v)
|
||||
end
|
||||
|
||||
web = s:option(Value, "ip_url", "URL")
|
||||
web:depends("ip_source", "web")
|
||||
web.rmempty = true
|
||||
|
||||
s:option(Value, "update_url").optional = true
|
||||
|
||||
s:option(Value, "check_interval").default = 10
|
||||
unit = s:option(ListValue, "check_unit")
|
||||
unit.default = "minutes"
|
||||
unit:value("minutes", "min")
|
||||
unit:value("hours", "h")
|
||||
|
||||
s:option(Value, "force_interval").default = 72
|
||||
unit = s:option(ListValue, "force_unit")
|
||||
unit.default = "hours"
|
||||
unit:value("minutes", "min")
|
||||
unit:value("hours", "h")
|
||||
|
||||
|
||||
return m
|
|
@ -0,0 +1,52 @@
|
|||
--[[
|
||||
LuCI - Lua Configuration Interface
|
||||
|
||||
Copyright 2008 Steven Barth <steven@midlink.org>
|
||||
Copyright 2008 Jo-Philipp Wich <xm@leipzig.freifunk.net>
|
||||
|
||||
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: ddnsmini.lua 3643 2008-10-29 05:34:34Z jow $
|
||||
]]--
|
||||
m = Map("ddns", translate("ddns"), translate("ddns_desc"))
|
||||
|
||||
s = m:section(TypedSection, "service", "")
|
||||
s.addremove = true
|
||||
|
||||
s:option(Flag, "enabled", translate("enable"))
|
||||
|
||||
svc = s:option(ListValue, "service_name", translate("service"))
|
||||
svc.rmempty = true
|
||||
svc:value("dyndns.org")
|
||||
svc:value("changeip.com")
|
||||
svc:value("zoneedit.com")
|
||||
svc:value("no-ip.com")
|
||||
svc:value("freedns.afraid.org")
|
||||
|
||||
s:option(Value, "domain", translate("hostname")).rmempty = true
|
||||
s:option(Value, "username", translate("username")).rmempty = true
|
||||
pw = s:option(Value, "password", translate("password"))
|
||||
pw.rmempty = true
|
||||
pw.password = true
|
||||
|
||||
s.defaults.ip_source = "network"
|
||||
s.defaults.ip_network = "wan"
|
||||
|
||||
s:option(Value, "check_interval").default = 10
|
||||
unit = s:option(ListValue, "check_unit")
|
||||
unit.default = "minutes"
|
||||
unit:value("minutes", "min")
|
||||
unit:value("hours", "h")
|
||||
|
||||
s:option(Value, "force_interval").default = 72
|
||||
unit = s:option(ListValue, "force_unit")
|
||||
unit.default = "hours"
|
||||
unit:value("minutes", "min")
|
||||
unit:value("hours", "h")
|
||||
|
||||
|
||||
return m
|
|
@ -0,0 +1,147 @@
|
|||
package ddns
|
||||
|
||||
config package
|
||||
option title 'Dynamic DNS configuration'
|
||||
|
||||
config section
|
||||
option name 'service'
|
||||
option title 'DynDNS service entry'
|
||||
option package 'ddns'
|
||||
option named true
|
||||
option required true
|
||||
|
||||
config variable
|
||||
option name 'enabled'
|
||||
option title 'Enable this service entry'
|
||||
option section 'ddns.service'
|
||||
option datatype 'boolean'
|
||||
|
||||
config variable
|
||||
option name 'service_name'
|
||||
option title 'Name of the DynDNS provider'
|
||||
option section 'ddns.service'
|
||||
option datatype 'string'
|
||||
|
||||
config variable
|
||||
option name 'domain'
|
||||
option title 'Own DynDNS domain'
|
||||
option section 'ddns.service'
|
||||
option required true
|
||||
|
||||
config variable
|
||||
option name 'username'
|
||||
option title 'Account username'
|
||||
option section 'ddns.service'
|
||||
option required true
|
||||
|
||||
config variable
|
||||
option name 'password'
|
||||
option title 'Account password'
|
||||
option section 'ddns.service'
|
||||
option required true
|
||||
|
||||
config variable
|
||||
option name 'ip_source'
|
||||
option title 'Method to determine current IP address'
|
||||
option section 'ddns.service'
|
||||
option type 'enum'
|
||||
option required true
|
||||
|
||||
config enum
|
||||
option variable 'ddns.service.ip_source'
|
||||
option value 'network'
|
||||
option title 'Read ip address from /etc/config/network'
|
||||
|
||||
config enum
|
||||
option variable 'ddns.service.ip_source'
|
||||
option value 'interface'
|
||||
option title 'Determine ip address from given hardware interface'
|
||||
|
||||
config enum
|
||||
option variable 'ddns.service.ip_source'
|
||||
option value 'web'
|
||||
option title 'Determine own IP using a remote web page'
|
||||
|
||||
config variable
|
||||
option name 'ip_network'
|
||||
option title 'Configured network to use IP from'
|
||||
option section 'ddns.service'
|
||||
option depends 'ip_source=network'
|
||||
option valueof 'network.interface'
|
||||
|
||||
config variable
|
||||
option name 'ip_interface'
|
||||
option title 'Physical network interface to read IP from'
|
||||
option section 'ddns.service'
|
||||
option depends 'ip_source=interface'
|
||||
|
||||
config variable
|
||||
option name 'ip_url'
|
||||
option title 'Web page used to determine IP address'
|
||||
option section 'ddns.service'
|
||||
option depends 'ip_source=web'
|
||||
|
||||
config variable
|
||||
option name 'update_url'
|
||||
option title 'URL format to use for updating DNS information (for yet-unknown providers)'
|
||||
option section 'ddns.service'
|
||||
|
||||
config variable
|
||||
option name 'check_interval'
|
||||
option title 'Update check interval'
|
||||
option section 'ddns.service'
|
||||
option datatype 'integer'
|
||||
option required true
|
||||
|
||||
config variable
|
||||
option name 'check_unit'
|
||||
option title 'Unit for update check interval'
|
||||
option section 'ddns.service'
|
||||
option type 'enum'
|
||||
option required true
|
||||
|
||||
config enum
|
||||
option variable 'ddns.service.check_unit'
|
||||
option value 'seconds'
|
||||
|
||||
config enum
|
||||
option variable 'ddns.service.check_unit'
|
||||
option value 'minutes'
|
||||
|
||||
config enum
|
||||
option variable 'ddns.service.check_unit'
|
||||
option value 'hours'
|
||||
|
||||
config enum
|
||||
option variable 'ddns.service.check_unit'
|
||||
option value 'days'
|
||||
|
||||
config variable
|
||||
option name 'force_interval'
|
||||
option title 'Forced update interval'
|
||||
option section 'ddns.service'
|
||||
option datatype 'integer'
|
||||
option required true
|
||||
|
||||
config variable
|
||||
option name 'force_unit'
|
||||
option title 'Unit of forced update interval'
|
||||
option section 'ddns.service'
|
||||
option type 'enum'
|
||||
option required true
|
||||
|
||||
config enum
|
||||
option variable 'ddns.service.force_unit'
|
||||
option value 'seconds'
|
||||
|
||||
config enum
|
||||
option variable 'ddns.service.force_unit'
|
||||
option value 'minutes'
|
||||
|
||||
config enum
|
||||
option variable 'ddns.service.force_unit'
|
||||
option value 'hours'
|
||||
|
||||
config enum
|
||||
option variable 'ddns.service.force_unit'
|
||||
option value 'days'
|
|
@ -0,0 +1,2 @@
|
|||
include ../../build/config.mk
|
||||
include ../../build/module.mk
|
|
@ -0,0 +1,21 @@
|
|||
--[[
|
||||
LuCI - Lua Configuration Interface
|
||||
|
||||
Copyright 2008 Steven Barth <steven@midlink.org>
|
||||
Copyright 2008 Jo-Philipp Wich <xm@leipzig.freifunk.net>
|
||||
|
||||
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: ffwizard.lua 3941 2008-12-23 21:39:38Z jow $
|
||||
|
||||
]]--
|
||||
|
||||
module "luci.controller.ffwizard"
|
||||
|
||||
function index()
|
||||
entry({"admin", "freifunk", "ffwizard"}, form("ffwizard"), "Freifunkassistent", 50)
|
||||
end
|
|
@ -0,0 +1,391 @@
|
|||
--[[
|
||||
LuCI - Lua Configuration Interface
|
||||
|
||||
Copyright 2008 Steven Barth <steven@midlink.org>
|
||||
Copyright 2008 Jo-Philipp Wich <xm@leipzig.freifunk.net>
|
||||
|
||||
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: ffwizard.lua 4187 2009-01-30 15:07:36Z jow $
|
||||
|
||||
]]--
|
||||
|
||||
|
||||
local uci = require "luci.model.uci".cursor()
|
||||
local tools = require "luci.tools.ffwizard"
|
||||
local util = require "luci.util"
|
||||
local sys = require "luci.sys"
|
||||
|
||||
|
||||
-------------------- View --------------------
|
||||
f = SimpleForm("ffwizward", "Freifunkassistent",
|
||||
"Dieser Assistent unterstüzt bei der Einrichtung des Routers für das Freifunknetz.")
|
||||
|
||||
|
||||
dev = f:field(ListValue, "device", "WLAN-Gerät")
|
||||
uci:foreach("wireless", "wifi-device",
|
||||
function(section)
|
||||
dev:value(section[".name"])
|
||||
end)
|
||||
|
||||
|
||||
main = f:field(Flag, "wifi", "Freifunkzugang einrichten")
|
||||
|
||||
net = f:field(Value, "net", "Freifunknetz", "1. Teil der IP-Adresse")
|
||||
net.rmempty = true
|
||||
net:depends("wifi", "1")
|
||||
uci:foreach("freifunk", "community", function(s)
|
||||
net:value(s[".name"], "%s (%s)" % {s.name, s.prefix})
|
||||
end)
|
||||
|
||||
function net.cfgvalue(self, section)
|
||||
return uci:get("freifunk", "wizard", "net")
|
||||
end
|
||||
function net.write(self, section, value)
|
||||
uci:set("freifunk", "wizard", "net", value)
|
||||
uci:save("freifunk")
|
||||
end
|
||||
|
||||
|
||||
subnet = f:field(Value, "subnet", "Subnetz (Projekt)", "2. Teil der IP-Adresse")
|
||||
subnet.rmempty = true
|
||||
subnet:depends("wifi", "1")
|
||||
function subnet.cfgvalue(self, section)
|
||||
return uci:get("freifunk", "wizard", "subnet")
|
||||
end
|
||||
function subnet.write(self, section, value)
|
||||
uci:set("freifunk", "wizard", "subnet", value)
|
||||
uci:save("freifunk")
|
||||
end
|
||||
|
||||
node = f:field(Value, "node", "Knoten", "3. Teil der IP-Adresse")
|
||||
node.rmempty = true
|
||||
node:depends("wifi", "1")
|
||||
for i=1, 51 do
|
||||
node:value(i)
|
||||
end
|
||||
function node.cfgvalue(self, section)
|
||||
return uci:get("freifunk", "wizard", "node")
|
||||
end
|
||||
function node.write(self, section, value)
|
||||
uci:set("freifunk", "wizard", "node", value)
|
||||
uci:save("freifunk")
|
||||
end
|
||||
|
||||
client = f:field(Flag, "client", "WLAN-DHCP anbieten")
|
||||
client:depends("wifi", "1")
|
||||
client.rmempty = true
|
||||
|
||||
|
||||
olsr = f:field(Flag, "olsr", "OLSR einrichten")
|
||||
olsr.rmempty = true
|
||||
|
||||
share = f:field(Flag, "sharenet", "Eigenen Internetzugang freigeben")
|
||||
share.rmempty = true
|
||||
|
||||
|
||||
|
||||
-------------------- Control --------------------
|
||||
function f.handle(self, state, data)
|
||||
if state == FORM_VALID then
|
||||
luci.http.redirect(luci.dispatcher.build_url("admin", "uci", "changes"))
|
||||
return false
|
||||
elseif state == FORM_INVALID then
|
||||
self.errmessage = "Ungültige Eingabe: Bitte die Formularfelder auf Fehler prüfen."
|
||||
end
|
||||
return true
|
||||
end
|
||||
|
||||
local function _strip_internals(tbl)
|
||||
tbl = tbl or {}
|
||||
for k, v in pairs(tbl) do
|
||||
if k:sub(1, 1) == "." then
|
||||
tbl[k] = nil
|
||||
end
|
||||
end
|
||||
return tbl
|
||||
end
|
||||
|
||||
-- Configure Freifunk checked
|
||||
function main.write(self, section, value)
|
||||
if value == "0" then
|
||||
return
|
||||
end
|
||||
|
||||
local device = dev:formvalue(section)
|
||||
local community, external
|
||||
|
||||
-- Collect IP-Address
|
||||
local inet = net:formvalue(section)
|
||||
local isubnet = subnet:formvalue(section)
|
||||
local inode = node:formvalue(section)
|
||||
|
||||
-- Invalidate fields
|
||||
if not inet then
|
||||
net.tag_missing[section] = true
|
||||
else
|
||||
community = inet
|
||||
external = uci:get("freifunk", community, "external") or ""
|
||||
inet = uci:get("freifunk", community, "prefix") or inet
|
||||
end
|
||||
if not isubnet then
|
||||
subnet.tag_missing[section] = true
|
||||
end
|
||||
if not inode then
|
||||
node.tag_missing[section] = true
|
||||
end
|
||||
|
||||
if not inet or not isubnet or not inode then
|
||||
return
|
||||
end
|
||||
|
||||
local ip = "%s.%s.%s" % {inet, isubnet, inode}
|
||||
|
||||
|
||||
-- Cleanup
|
||||
tools.wifi_delete_ifaces(device)
|
||||
tools.network_remove_interface(device)
|
||||
tools.firewall_zone_remove_interface("freifunk", device)
|
||||
|
||||
-- Tune community settings
|
||||
if community and uci:get("freifunk", community) then
|
||||
uci:tset("freifunk", "community", uci:get_all("freifunk", community))
|
||||
end
|
||||
|
||||
-- Tune wifi device
|
||||
local devconfig = uci:get_all("freifunk", "wifi_device")
|
||||
util.update(devconfig, uci:get_all(external, "wifi_device") or {})
|
||||
uci:tset("wireless", device, devconfig)
|
||||
|
||||
-- Create wifi iface
|
||||
local ifconfig = uci:get_all("freifunk", "wifi_iface")
|
||||
util.update(ifconfig, uci:get_all(external, "wifi_iface") or {})
|
||||
ifconfig.device = device
|
||||
ifconfig.network = device
|
||||
ifconfig.ssid = uci:get("freifunk", community, "ssid")
|
||||
uci:section("wireless", "wifi-iface", nil, ifconfig)
|
||||
|
||||
-- Save wifi
|
||||
uci:save("wireless")
|
||||
|
||||
-- Create firewall zone and add default rules (first time)
|
||||
local newzone = tools.firewall_create_zone("freifunk", "REJECT", "ACCEPT", "REJECT", true)
|
||||
if newzone then
|
||||
uci:foreach("freifunk", "fw_forwarding", function(section)
|
||||
uci:section("firewall", "forwarding", nil, section)
|
||||
end)
|
||||
uci:foreach(external, "fw_forwarding", function(section)
|
||||
uci:section("firewall", "forwarding", nil, section)
|
||||
end)
|
||||
|
||||
uci:foreach("freifunk", "fw_rule", function(section)
|
||||
uci:section("firewall", "rule", nil, section)
|
||||
end)
|
||||
uci:foreach(external, "fw_rule", function(section)
|
||||
uci:section("firewall", "rule", nil, section)
|
||||
end)
|
||||
end
|
||||
|
||||
-- Enforce firewall include
|
||||
local has_include = false
|
||||
uci:foreach("firewall", "include",
|
||||
function(section)
|
||||
if section.path == "/etc/firewall.freifunk" then
|
||||
has_include = true
|
||||
end
|
||||
end)
|
||||
|
||||
if not has_include then
|
||||
uci:section("firewall", "include", nil,
|
||||
{ path = "/etc/firewall.freifunk" })
|
||||
end
|
||||
|
||||
-- Allow state: invalid packets
|
||||
uci:foreach("firewall", "defaults",
|
||||
function(section)
|
||||
uci:set("firewall", section[".name"], "drop_invalid", "0")
|
||||
end)
|
||||
|
||||
-- Prepare advanced config
|
||||
local has_advanced = false
|
||||
uci:foreach("firewall", "advanced",
|
||||
function(section) has_advanced = true end)
|
||||
|
||||
if not has_advanced then
|
||||
uci:section("firewall", "advanced", nil,
|
||||
{ tcp_ecn = "0" })
|
||||
end
|
||||
|
||||
uci:save("firewall")
|
||||
|
||||
|
||||
-- Create network interface
|
||||
local netconfig = uci:get_all("freifunk", "interface")
|
||||
util.update(netconfig, uci:get_all(external, "interface") or {})
|
||||
netconfig.proto = "static"
|
||||
netconfig.ipaddr = ip
|
||||
uci:section("network", "interface", device, netconfig)
|
||||
|
||||
uci:save("network")
|
||||
|
||||
tools.firewall_zone_add_interface("freifunk", device)
|
||||
|
||||
|
||||
-- Set hostname
|
||||
local new_hostname = ip:gsub("%.", "-")
|
||||
local old_hostname = sys.hostname()
|
||||
|
||||
if old_hostname == "OpenWrt" or old_hostname:match("^%d+-%d+-%d+-%d+$") then
|
||||
uci:foreach("system", "system",
|
||||
function(s)
|
||||
uci:set("system", s['.name'], "hostname", new_hostname)
|
||||
end)
|
||||
|
||||
luci.fs.writefile( "/proc/sys/kernel/hostname", new_hostname.."\n" )
|
||||
uci:save("system")
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
function olsr.write(self, section, value)
|
||||
if value == "0" then
|
||||
return
|
||||
end
|
||||
|
||||
|
||||
local device = dev:formvalue(section)
|
||||
|
||||
local community = net:formvalue(section)
|
||||
local external = community and uci:get("freifunk", community, "external") or ""
|
||||
|
||||
-- Configure nameservice
|
||||
local hostname
|
||||
uci:foreach("system", "system", function(s) hostname = s.hostname end)
|
||||
|
||||
if hostname then
|
||||
uci:foreach("olsrd", "LoadPlugin",
|
||||
function(s)
|
||||
if s.library == "olsrd_nameservice.so.0.3" then
|
||||
uci:set("olsrd", s['.name'], "name", hostname)
|
||||
end
|
||||
end)
|
||||
end
|
||||
|
||||
-- Delete old interface
|
||||
uci:delete_all("olsrd", "Interface", {interface=device})
|
||||
|
||||
-- Write new interface
|
||||
local olsrbase = uci:get_all("freifunk", "olsr_interface")
|
||||
util.update(olsrbase, uci:get_all(external, "olsr_interface") or {})
|
||||
olsrbase.interface = device
|
||||
olsrbase.ignore = "0"
|
||||
uci:section("olsrd", "Interface", nil, olsrbase)
|
||||
uci:save("olsrd")
|
||||
|
||||
-- Import hosts
|
||||
uci:foreach("dhcp", "dnsmasq", function(s)
|
||||
uci:set("dhcp", s[".name"], "addnhosts", "/var/etc/hosts.olsr")
|
||||
end)
|
||||
uci:save("dhcp")
|
||||
end
|
||||
|
||||
|
||||
function share.write(self, section, value)
|
||||
uci:delete_all("firewall", "forwarding", {src="freifunk", dest="wan"})
|
||||
uci:delete_all("olsrd", "LoadPlugin", {library="olsrd_dyn_gw_plain.so.0.4"})
|
||||
|
||||
if value == "1" then
|
||||
uci:section("firewall", "forwarding", nil, {src="freifunk", dest="wan"})
|
||||
uci:section("olsrd", "LoadPlugin", nil, {library="olsrd_dyn_gw_plain.so.0.4"})
|
||||
end
|
||||
uci:save("firewall")
|
||||
uci:save("olsrd")
|
||||
end
|
||||
|
||||
|
||||
function client.write(self, section, value)
|
||||
if value == "0" then
|
||||
return
|
||||
end
|
||||
|
||||
local device = dev:formvalue(section)
|
||||
|
||||
-- Collect IP-Address
|
||||
local inet = net:formvalue(section)
|
||||
local isubnet = subnet:formvalue(section)
|
||||
local inode = node:formvalue(section)
|
||||
|
||||
if not inet or not isubnet or not inode then
|
||||
return
|
||||
end
|
||||
local community = inet
|
||||
local external = community and uci:get("freifunk", community, "external") or ""
|
||||
inet = uci:get("freifunk", community, "prefix") or inet
|
||||
|
||||
local dhcpbeg = 48 + tonumber(inode) * 4
|
||||
local dclient = "%s.%s.%s" % {inet:gsub("^[0-9]+", "10"), isubnet, dhcpbeg}
|
||||
local limit = dhcpbeg < 252 and 3 or 2
|
||||
|
||||
-- Delete old alias
|
||||
uci:delete("network", device .. "dhcp")
|
||||
|
||||
-- Create alias
|
||||
local aliasbase = uci:get_all("freifunk", "alias")
|
||||
util.update(aliasbase, uci:get_all(external, "alias") or {})
|
||||
aliasbase.interface = device
|
||||
aliasbase.ipaddr = dclient
|
||||
aliasbase.proto = "static"
|
||||
uci:section("network", "alias", device .. "dhcp", aliasbase)
|
||||
uci:save("network")
|
||||
|
||||
|
||||
-- Create dhcp
|
||||
local dhcpbase = uci:get_all("freifunk", "dhcp")
|
||||
util.update(dhcpbase, uci:get_all(external, "dhcp") or {})
|
||||
dhcpbase.interface = device .. "dhcp"
|
||||
dhcpbase.start = dhcpbeg
|
||||
dhcpbase.limit = limit
|
||||
|
||||
uci:section("dhcp", "dhcp", device .. "dhcp", dhcpbase)
|
||||
uci:save("dhcp")
|
||||
|
||||
uci:delete_all("firewall", "rule", {
|
||||
src="freifunk",
|
||||
proto="udp",
|
||||
src_port="68",
|
||||
dest_port="67"
|
||||
})
|
||||
uci:section("firewall", "rule", nil, {
|
||||
src="freifunk",
|
||||
proto="udp",
|
||||
src_port="68",
|
||||
dest_port="67",
|
||||
target="ACCEPT"
|
||||
})
|
||||
uci:delete_all("firewall", "rule", {
|
||||
src="freifunk",
|
||||
proto="tcp",
|
||||
dest_port="8082",
|
||||
})
|
||||
uci:section("firewall", "rule", nil, {
|
||||
src="freifunk",
|
||||
proto="tcp",
|
||||
dest_port="8082",
|
||||
target="ACCEPT"
|
||||
})
|
||||
|
||||
|
||||
|
||||
-- Delete old splash
|
||||
uci:delete_all("luci_splash", "iface", {net=device, zone="freifunk"})
|
||||
|
||||
-- Register splash
|
||||
uci:section("luci_splash", "iface", nil, {net=device, zone="freifunk"})
|
||||
uci:save("luci_splash")
|
||||
end
|
||||
|
||||
return f
|
|
@ -0,0 +1,149 @@
|
|||
--[[
|
||||
LuCI - Lua Configuration Interface
|
||||
|
||||
Copyright 2008 Steven Barth <steven@midlink.org>
|
||||
Copyright 2008 Jo-Philipp Wich <xm@leipzig.freifunk.net>
|
||||
|
||||
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: ffwizard.lua 3941 2008-12-23 21:39:38Z jow $
|
||||
|
||||
]]--
|
||||
|
||||
local uci = require "luci.model.uci"
|
||||
local util = require "luci.util"
|
||||
local table = require "table"
|
||||
|
||||
local type = type
|
||||
|
||||
module "luci.tools.ffwizard"
|
||||
|
||||
-- Deletes all references of a wifi device
|
||||
function wifi_delete_ifaces(device)
|
||||
local cursor = uci.cursor()
|
||||
cursor:delete_all("wireless", "wifi-iface", {device=device})
|
||||
cursor:save("wireless")
|
||||
end
|
||||
|
||||
-- Deletes a network interface and all occurences of it in firewall zones and dhcp
|
||||
function network_remove_interface(iface)
|
||||
local cursor = uci.cursor()
|
||||
|
||||
if not cursor:delete("network", iface) then
|
||||
return false
|
||||
end
|
||||
|
||||
local aliases = {iface}
|
||||
cursor:foreach("network", "alias",
|
||||
function(section)
|
||||
if section.interface == iface then
|
||||
table.insert(aliases, section[".name"])
|
||||
end
|
||||
end)
|
||||
|
||||
-- Delete Aliases and Routes
|
||||
cursor:delete_all("network", "route", {interface=iface})
|
||||
cursor:delete_all("network", "alias", {interface=iface})
|
||||
|
||||
-- Delete DHCP sections
|
||||
cursor:delete_all("dhcp", "dhcp",
|
||||
function(section)
|
||||
return util.contains(aliases, section.interface)
|
||||
end)
|
||||
|
||||
-- Remove OLSR sections
|
||||
cursor:delete_all("olsrd", "Interface", {Interface=iface})
|
||||
|
||||
-- Remove Splash sections
|
||||
cursor:delete_all("luci-splash", "iface", {network=iface})
|
||||
|
||||
cursor:save("network")
|
||||
cursor:save("olsr")
|
||||
cursor:save("dhcp")
|
||||
cursor:save("luci-splash")
|
||||
end
|
||||
|
||||
-- Creates a firewall zone
|
||||
function firewall_create_zone(zone, input, output, forward, masq)
|
||||
local cursor = uci.cursor()
|
||||
if not firewall_find_zone(zone) then
|
||||
local stat = cursor:section("firewall", "zone", nil, {
|
||||
input = input,
|
||||
output = output,
|
||||
forward = forward,
|
||||
masq = masq and "1",
|
||||
name = zone
|
||||
})
|
||||
cursor:save("firewall")
|
||||
return stat
|
||||
end
|
||||
end
|
||||
|
||||
-- Adds interface to zone, creates zone on-demand
|
||||
function firewall_zone_add_interface(name, interface)
|
||||
local cursor = uci.cursor()
|
||||
local zone = firewall_find_zone(name)
|
||||
local net = cursor:get("firewall", zone, "network")
|
||||
local old = net or (cursor:get("network", name) and name)
|
||||
cursor:set("firewall", zone, "network", (old and old .. " " or "") .. interface)
|
||||
cursor:save("firewall")
|
||||
end
|
||||
|
||||
-- Removes interface from zone
|
||||
function firewall_zone_remove_interface(name, interface)
|
||||
local cursor = uci.cursor()
|
||||
local zone = firewall_find_zone(name)
|
||||
if zone then
|
||||
local net = cursor:get("firewall", zone, "network")
|
||||
local new = remove_list_entry(net, interface)
|
||||
if new then
|
||||
if #new > 0 then
|
||||
cursor:set("firewall", zone, "network", new)
|
||||
else
|
||||
cursor:delete("firewall", zone, "network")
|
||||
end
|
||||
cursor:save("firewall")
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
-- Finds the firewall zone with given name
|
||||
function firewall_find_zone(name)
|
||||
local find
|
||||
|
||||
uci.cursor():foreach("firewall", "zone",
|
||||
function (section)
|
||||
if section.name == name then
|
||||
find = section[".name"]
|
||||
end
|
||||
end)
|
||||
|
||||
return find
|
||||
end
|
||||
|
||||
|
||||
|
||||
-- Helpers --
|
||||
|
||||
-- Removes a listentry, handles real and pseduo lists transparently
|
||||
function remove_list_entry(value, entry)
|
||||
if type(value) == "nil" then
|
||||
return nil
|
||||
end
|
||||
|
||||
local result = type(value) == "table" and value or util.split(value, " ")
|
||||
local key = util.contains(result, entry)
|
||||
|
||||
while key do
|
||||
table.remove(result, key)
|
||||
key = util.contains(result, entry)
|
||||
end
|
||||
|
||||
result = type(value) == "table" and result or table.concat(result, " ")
|
||||
return result ~= value and result
|
||||
end
|
|
@ -0,0 +1,2 @@
|
|||
include ../../build/config.mk
|
||||
include ../../build/module.mk
|
|
@ -0,0 +1,13 @@
|
|||
module("luci.controller.luci_fw.luci_fw", package.seeall)
|
||||
|
||||
function index()
|
||||
require("luci.i18n").loadc("luci-fw")
|
||||
local i18n = luci.i18n.translate
|
||||
|
||||
entry({"admin", "network", "firewall"}, alias("admin", "network", "firewall", "zones"), i18n("fw_fw"), 60).i18n = "luci-fw"
|
||||
entry({"admin", "network", "firewall", "zones"}, cbi("luci_fw/zones"), i18n("fw_zones"), 10)
|
||||
entry({"admin", "network", "firewall", "redirect"}, arcombine(cbi("luci_fw/redirect"), cbi("luci_fw/rrule")), i18n("fw_redirect"), 30).leaf = true
|
||||
entry({"admin", "network", "firewall", "rule"}, arcombine(cbi("luci_fw/traffic"), cbi("luci_fw/trule")), i18n("fw_traffic"), 20).leaf = true
|
||||
|
||||
entry({"mini", "network", "portfw"}, cbi("luci_fw/miniportfw", {autoapply=true}), i18n("fw_portfw", "Portweiterleitung"), 70).i18n = "luci-fw"
|
||||
end
|
|
@ -0,0 +1,56 @@
|
|||
fw_portfw = 'Portweiterleitung'
|
||||
fw_redirect = 'Umleitungen'
|
||||
fw_redirect_desc = 'Umleitungen erlauben es das Ziel von weitergeleiteten Paketen zu verändern.'
|
||||
fw_forwarding = 'Zone-zu-Zone Verkehr'
|
||||
fw_fw = 'Firewall'
|
||||
fw_zone = 'Zone'
|
||||
fw_zones = 'Zonen'
|
||||
fw_custfwd = 'Erweiterte Weiterleitung'
|
||||
firewall_rule = 'Erweiterte Regeln'
|
||||
firewall_rule_desc = 'Mit erweiterten Regeln kann die Firewall an die eigenen Bedürfnisse angepasst werden. Es werden nur neue Verbindungen betrachtet. Pakete, die zu bereits bestehenden Verbindungen gehören werden automatisch akzeptiert.'
|
||||
fw_fw1 = 'Die Firewall erstellt Netzwerkzonen über bestimmte Netzwerkschnittstellen um den Netzverkehr zu trennen.'
|
||||
fw_src = 'Quelle'
|
||||
fw_dest = 'Ziel'
|
||||
fw_traffic = 'Verkehrskontrolle'
|
||||
fw_mtufix = 'MSS Clamping'
|
||||
fw_dropinvalid = 'Ungültige Pakete verwerfen'
|
||||
firewall_rule_src = 'Eingangszone'
|
||||
firewall_rule_dest = 'Ausgangszone'
|
||||
firewall_rule_srcip = 'Quelladresse'
|
||||
firewall_rule_destip = 'Zieladresse'
|
||||
firewall_rule_srcmac = 'Quell-MAC-Adresse'
|
||||
firewall_rule_srcport = 'Quellport'
|
||||
firewall_rule_destport = 'Zielport'
|
||||
firewall_rule_target = 'Aktion'
|
||||
fw_accept = 'annehmen'
|
||||
fw_reject = 'zurückweisen'
|
||||
fw_drop = 'verwerfen'
|
||||
fw_portfw1 = 'Portweiterleitungen ermöglichen es interne Netzwerkdienste aus einem externen Netzwerk heraus erreichbar zu machen.'
|
||||
firewall_redirect_src_desc = 'Externe Zone'
|
||||
firewall_redirect_srcdport = 'Externer Port'
|
||||
firewall_redirect_srcdport_desc = 'Port od. Erster-Letzter Port'
|
||||
firewall_redirect_destip = 'Interne Adresse'
|
||||
firewall_redirect_destip_desc = 'IP-Adresse'
|
||||
firewall_redirect_destport = 'Interner Port (optional)'
|
||||
firewall_redirect_destport_desc = 'Port od. Erster-Letzter Port'
|
||||
firewall_redirect_srcip = 'Quelladresse'
|
||||
firewall_redirect_srcmac = 'Quell-MAC-Adresse'
|
||||
fw_forwarding1 = 'An dieser Stelle kann festgelegt zwischen welchen Zonen Netzverkehr hin und her fließen kann. Es werden nur neue Verbindungen betrachtet. Pakete, die zu bereits bestehenden Verbindungen gehören werden automatisch akzeptiert. Bei gelegentlich auftretenden Verbindungsproblemen kann MSS Clamping helfen, ansonsten sollte dies aus Performancegründen deaktiviert bleiben.'
|
||||
firewall_forwarding_src = 'Eingang'
|
||||
firewall_forwarding_dest = 'Ausgang'
|
||||
firewall_defaults = 'Grundeinstellungen'
|
||||
firewall_defaults_desc = 'Grundeinstellungen die verwendet werden, wenn keine andere Regel angewandt werden kann.'
|
||||
firewall_defaults_synflood = 'Schutz vor SYN-flood-Attacken'
|
||||
firewall_defaults_input = 'Eingehender Verkehr'
|
||||
firewall_defaults_output = 'Ausgehender Verkehr'
|
||||
firewall_defaults_forward = 'Weitergeleiteter Verkehr'
|
||||
firewall_zone_desc = 'Zonen teilen das Netzwerk in mehrere Bereiche ein um Netzverkehr sicher zu trennen. Ein oder mehrere Netzwerke gehören zu einer Zone. Das MASQ-Flag legt fest, dass aller ausgehende Netzverkehr einer Zone NAT-maskiert wird.'
|
||||
firewall_zone_input = 'Eingehender Verkehr'
|
||||
firewall_zone_input_desc = 'Standardaktion'
|
||||
firewall_zone_output = 'Ausgehender Verkehr'
|
||||
firewall_zone_output_desc = 'Standardaktion'
|
||||
firewall_zone_forward = 'Weitergeleiteter Verkehr'
|
||||
firewall_zone_forward_desc = 'Standardaktion'
|
||||
firewall_zone_masq = 'MASQ'
|
||||
firewall_zone_network = 'Netzwerke'
|
||||
firewall_zone_network_desc = 'verbundene Netzwerke'
|
|
@ -0,0 +1,67 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
|
||||
<i18n:msgs xmlns:i18n="http://luci.freifunk-halle.net/2008/i18n#" xmlns="http://www.w3.org/1999/xhtml">
|
||||
|
||||
<i18n:msg xml:id="fw_portfw">Portweiterleitung</i18n:msg>
|
||||
<i18n:msg xml:id="fw_redirect">Umleitungen</i18n:msg>
|
||||
<i18n:msg xml:id="fw_redirect_desc">Umleitungen erlauben es das Ziel von weitergeleiteten Paketen zu verändern.</i18n:msg>
|
||||
<i18n:msg xml:id="fw_forwarding">Zone-zu-Zone Verkehr</i18n:msg>
|
||||
<i18n:msg xml:id="fw_fw">Firewall</i18n:msg>
|
||||
<i18n:msg xml:id="fw_zone">Zone</i18n:msg>
|
||||
<i18n:msg xml:id="fw_zones">Zonen</i18n:msg>
|
||||
<i18n:msg xml:id="fw_custfwd">Erweiterte Weiterleitung</i18n:msg>
|
||||
<i18n:msg xml:id="firewall_rule">Erweiterte Regeln</i18n:msg>
|
||||
<i18n:msg xml:id="firewall_rule_desc">Mit erweiterten Regeln kann die Firewall an die eigenen Bedürfnisse angepasst werden. Es werden nur neue Verbindungen betrachtet. Pakete, die zu bereits bestehenden Verbindungen gehören werden automatisch akzeptiert.</i18n:msg>
|
||||
<i18n:msg xml:id="fw_fw1">Die Firewall erstellt Netzwerkzonen über bestimmte Netzwerkschnittstellen um den Netzverkehr zu trennen.</i18n:msg>
|
||||
<i18n:msg xml:id="fw_src">Quelle</i18n:msg>
|
||||
<i18n:msg xml:id="fw_dest">Ziel</i18n:msg>
|
||||
<i18n:msg xml:id="fw_traffic">Verkehrskontrolle</i18n:msg>
|
||||
<i18n:msg xml:id="fw_mtufix">MSS Clamping</i18n:msg>
|
||||
<i18n:msg xml:id="fw_dropinvalid">Ungültige Pakete verwerfen</i18n:msg>
|
||||
<i18n:msg xml:id="firewall_rule_src">Eingangszone</i18n:msg>
|
||||
<i18n:msg xml:id="firewall_rule_dest">Ausgangszone</i18n:msg>
|
||||
<i18n:msg xml:id="firewall_rule_srcip">Quelladresse</i18n:msg>
|
||||
<i18n:msg xml:id="firewall_rule_destip">Zieladresse</i18n:msg>
|
||||
<i18n:msg xml:id="firewall_rule_srcmac">Quell-MAC-Adresse</i18n:msg>
|
||||
<i18n:msg xml:id="firewall_rule_srcport">Quellport</i18n:msg>
|
||||
<i18n:msg xml:id="firewall_rule_destport">Zielport</i18n:msg>
|
||||
<i18n:msg xml:id="firewall_rule_target">Aktion</i18n:msg>
|
||||
<i18n:msg xml:id="fw_accept">annehmen</i18n:msg>
|
||||
<i18n:msg xml:id="fw_reject">zurückweisen</i18n:msg>
|
||||
<i18n:msg xml:id="fw_drop">verwerfen</i18n:msg>
|
||||
|
||||
<i18n:msg xml:id="fw_portfw1">Portweiterleitungen ermöglichen es interne Netzwerkdienste aus einem externen Netzwerk heraus erreichbar zu machen.</i18n:msg>
|
||||
<i18n:msg xml:id="firewall_redirect_src_desc">Externe Zone</i18n:msg>
|
||||
<i18n:msg xml:id="firewall_redirect_srcdport">Externer Port</i18n:msg>
|
||||
<i18n:msg xml:id="firewall_redirect_srcdport_desc">Port od. Erster-Letzter Port</i18n:msg>
|
||||
<i18n:msg xml:id="firewall_redirect_destip">Interne Adresse</i18n:msg>
|
||||
<i18n:msg xml:id="firewall_redirect_destip_desc">IP-Adresse</i18n:msg>
|
||||
<i18n:msg xml:id="firewall_redirect_destport">Interner Port (optional)</i18n:msg>
|
||||
<i18n:msg xml:id="firewall_redirect_destport_desc">Port od. Erster-Letzter Port</i18n:msg>
|
||||
<i18n:msg xml:id="firewall_redirect_srcip">Quelladresse</i18n:msg>
|
||||
<i18n:msg xml:id="firewall_redirect_srcmac">Quell-MAC-Adresse</i18n:msg>
|
||||
|
||||
|
||||
<i18n:msg xml:id="fw_forwarding1">An dieser Stelle kann festgelegt zwischen welchen Zonen Netzverkehr hin und her fließen kann. Es werden nur neue Verbindungen betrachtet. Pakete, die zu bereits bestehenden Verbindungen gehören werden automatisch akzeptiert. Bei gelegentlich auftretenden Verbindungsproblemen kann MSS Clamping helfen, ansonsten sollte dies aus Performancegründen deaktiviert bleiben.</i18n:msg>
|
||||
<i18n:msg xml:id="firewall_forwarding_src">Eingang</i18n:msg>
|
||||
<i18n:msg xml:id="firewall_forwarding_dest">Ausgang</i18n:msg>
|
||||
|
||||
<i18n:msg xml:id="firewall_defaults">Grundeinstellungen</i18n:msg>
|
||||
<i18n:msg xml:id="firewall_defaults_desc">Grundeinstellungen die verwendet werden, wenn keine andere Regel angewandt werden kann.</i18n:msg>
|
||||
<i18n:msg xml:id="firewall_defaults_synflood">Schutz vor SYN-flood-Attacken</i18n:msg>
|
||||
<i18n:msg xml:id="firewall_defaults_input">Eingehender Verkehr</i18n:msg>
|
||||
<i18n:msg xml:id="firewall_defaults_output">Ausgehender Verkehr</i18n:msg>
|
||||
<i18n:msg xml:id="firewall_defaults_forward">Weitergeleiteter Verkehr</i18n:msg>
|
||||
|
||||
<i18n:msg xml:id="firewall_zone_desc">Zonen teilen das Netzwerk in mehrere Bereiche ein um Netzverkehr sicher zu trennen. Ein oder mehrere Netzwerke gehören zu einer Zone. Das MASQ-Flag legt fest, dass aller ausgehende Netzverkehr einer Zone NAT-maskiert wird.</i18n:msg>
|
||||
<i18n:msg xml:id="firewall_zone_input">Eingehender Verkehr</i18n:msg>
|
||||
<i18n:msg xml:id="firewall_zone_input_desc">Standardaktion</i18n:msg>
|
||||
<i18n:msg xml:id="firewall_zone_output">Ausgehender Verkehr</i18n:msg>
|
||||
<i18n:msg xml:id="firewall_zone_output_desc">Standardaktion</i18n:msg>
|
||||
<i18n:msg xml:id="firewall_zone_forward">Weitergeleiteter Verkehr</i18n:msg>
|
||||
<i18n:msg xml:id="firewall_zone_forward_desc">Standardaktion</i18n:msg>
|
||||
<i18n:msg xml:id="firewall_zone_masq">MASQ</i18n:msg>
|
||||
<i18n:msg xml:id="firewall_zone_network">Netzwerke</i18n:msg>
|
||||
<i18n:msg xml:id="firewall_zone_network_desc">verbundene Netzwerke</i18n:msg>
|
||||
|
||||
</i18n:msgs>
|
|
@ -0,0 +1,56 @@
|
|||
fw_portfw = 'Port forwarding'
|
||||
fw_redirect = 'Traffic Redirection'
|
||||
fw_redirect_desc = 'Traffic redirection allows you to change the destination address of forwarded packets.'
|
||||
fw_forwarding = 'Zone-to-Zone traffic'
|
||||
fw_fw = 'Firewall'
|
||||
fw_zone = 'Zone'
|
||||
fw_zones = 'Zones'
|
||||
fw_custfwd = 'Custom forwarding'
|
||||
fw_fw1 = 'The firewall creates zones over your network interfaces to control network traffic flow.'
|
||||
firewall_rule = 'Advanced Rules'
|
||||
firewall_rule_desc = 'Advanced rules let you customize the firewall to your needs. Only new connections will be matched. Packets belonging to already open connections are automatically allowed to pass the firewall.'
|
||||
firewall_rule_src = 'Input Zone'
|
||||
firewall_rule_dest = 'Output Zone'
|
||||
firewall_rule_srcip = 'Source address'
|
||||
firewall_rule_destip = 'Destination address'
|
||||
firewall_rule_srcmac = 'Source MAC-Address'
|
||||
firewall_rule_srcport = 'Source port'
|
||||
firewall_rule_destport = 'Destination port'
|
||||
firewall_rule_target = 'Action'
|
||||
fw_accept = 'accept'
|
||||
fw_reject = 'reject'
|
||||
fw_drop = 'drop'
|
||||
fw_src = 'Source'
|
||||
fw_dest = 'Destination'
|
||||
fw_traffic = 'Traffic Control'
|
||||
fw_mtufix = 'MSS Clamping'
|
||||
fw_dropinvalid = 'Drop invalid packets'
|
||||
fw_portfw1 = 'Port forwarding allows to provide network services in the internal network to an external network.'
|
||||
firewall_redirect_src_desc = 'External Zone'
|
||||
firewall_redirect_srcdport = 'External port'
|
||||
firewall_redirect_srcdport_desc = 'port or range as first-last'
|
||||
firewall_redirect_srcip = 'Source address'
|
||||
firewall_redirect_srcmac = 'Source MAC'
|
||||
firewall_redirect_destip = 'Internal address'
|
||||
firewall_redirect_destip_desc = 'IP-Address'
|
||||
firewall_redirect_destport = 'Internal port (optional)'
|
||||
firewall_redirect_destport_desc = 'port or range as first-last'
|
||||
fw_forwarding1 = 'Here you can specify which network traffic is allowed to flow between network zones. Only new connections will be matched. Packets belonging to already open connections are automatically allowed to pass the firewall. If you experience occasional connection problems try enabling MSS Clamping otherwise disable it for performance reasons.'
|
||||
firewall_forwarding_src = 'Input'
|
||||
firewall_forwarding_dest = 'Output'
|
||||
firewall_defaults = 'Defaults'
|
||||
firewall_defaults_desc = 'These are the default settings that are used if no other rules match.'
|
||||
firewall_defaults_synflood = 'SYN-flood protection'
|
||||
firewall_defaults_input = 'Incoming Traffic'
|
||||
firewall_defaults_output = 'Outgoing Traffic'
|
||||
firewall_defaults_forward = 'Forwarded Traffic'
|
||||
firewall_zone_desc = 'Zones part the network interfaces into certain isolated areas to separate network traffic. One or more networks can belong to a zone. The MASQ-flag enables NAT masquerading for all outgoing traffic on this zone.'
|
||||
firewall_zone_input = 'Incoming Traffic'
|
||||
firewall_zone_input_desc = 'Default Policy'
|
||||
firewall_zone_output = 'Outgoing Traffic'
|
||||
firewall_zone_output_desc = 'Default Policy'
|
||||
firewall_zone_forward = 'Forwarded Traffic'
|
||||
firewall_zone_forward_desc = 'Default Policy'
|
||||
firewall_zone_masq = 'MASQ'
|
||||
firewall_zone_network = 'Networks'
|
||||
firewall_zone_network_desc = 'contained networks'
|
|
@ -0,0 +1,66 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
|
||||
<i18n:msgs xmlns:i18n="http://luci.freifunk-halle.net/2008/i18n#" xmlns="http://www.w3.org/1999/xhtml">
|
||||
|
||||
<i18n:msg xml:id="fw_portfw">Port forwarding</i18n:msg>
|
||||
<i18n:msg xml:id="fw_redirect">Traffic Redirection</i18n:msg>
|
||||
<i18n:msg xml:id="fw_redirect_desc">Traffic redirection allows you to change the destination address of forwarded packets.</i18n:msg>
|
||||
<i18n:msg xml:id="fw_forwarding">Zone-to-Zone traffic</i18n:msg>
|
||||
<i18n:msg xml:id="fw_fw">Firewall</i18n:msg>
|
||||
<i18n:msg xml:id="fw_zone">Zone</i18n:msg>
|
||||
<i18n:msg xml:id="fw_zones">Zones</i18n:msg>
|
||||
<i18n:msg xml:id="fw_custfwd">Custom forwarding</i18n:msg>
|
||||
<i18n:msg xml:id="fw_fw1">The firewall creates zones over your network interfaces to control network traffic flow.</i18n:msg>
|
||||
<i18n:msg xml:id="firewall_rule">Advanced Rules</i18n:msg>
|
||||
<i18n:msg xml:id="firewall_rule_desc">Advanced rules let you customize the firewall to your needs. Only new connections will be matched. Packets belonging to already open connections are automatically allowed to pass the firewall.</i18n:msg>
|
||||
<i18n:msg xml:id="firewall_rule_src">Input Zone</i18n:msg>
|
||||
<i18n:msg xml:id="firewall_rule_dest">Output Zone</i18n:msg>
|
||||
<i18n:msg xml:id="firewall_rule_srcip">Source address</i18n:msg>
|
||||
<i18n:msg xml:id="firewall_rule_destip">Destination address</i18n:msg>
|
||||
<i18n:msg xml:id="firewall_rule_srcmac">Source MAC-Address</i18n:msg>
|
||||
<i18n:msg xml:id="firewall_rule_srcport">Source port</i18n:msg>
|
||||
<i18n:msg xml:id="firewall_rule_destport">Destination port</i18n:msg>
|
||||
<i18n:msg xml:id="firewall_rule_target">Action</i18n:msg>
|
||||
<i18n:msg xml:id="fw_accept">accept</i18n:msg>
|
||||
<i18n:msg xml:id="fw_reject">reject</i18n:msg>
|
||||
<i18n:msg xml:id="fw_drop">drop</i18n:msg>
|
||||
<i18n:msg xml:id="fw_src">Source</i18n:msg>
|
||||
<i18n:msg xml:id="fw_dest">Destination</i18n:msg>
|
||||
<i18n:msg xml:id="fw_traffic">Traffic Control</i18n:msg>
|
||||
<i18n:msg xml:id="fw_mtufix">MSS Clamping</i18n:msg>
|
||||
<i18n:msg xml:id="fw_dropinvalid">Drop invalid packets</i18n:msg>
|
||||
|
||||
<i18n:msg xml:id="fw_portfw1">Port forwarding allows to provide network services in the internal network to an external network.</i18n:msg>
|
||||
<i18n:msg xml:id="firewall_redirect_src_desc">External Zone</i18n:msg>
|
||||
<i18n:msg xml:id="firewall_redirect_srcdport">External port</i18n:msg>
|
||||
<i18n:msg xml:id="firewall_redirect_srcdport_desc">port or range as first-last</i18n:msg>
|
||||
<i18n:msg xml:id="firewall_redirect_srcip">Source address</i18n:msg>
|
||||
<i18n:msg xml:id="firewall_redirect_srcmac">Source MAC</i18n:msg>
|
||||
<i18n:msg xml:id="firewall_redirect_destip">Internal address</i18n:msg>
|
||||
<i18n:msg xml:id="firewall_redirect_destip_desc">IP-Address</i18n:msg>
|
||||
<i18n:msg xml:id="firewall_redirect_destport">Internal port (optional)</i18n:msg>
|
||||
<i18n:msg xml:id="firewall_redirect_destport_desc">port or range as first-last</i18n:msg>
|
||||
|
||||
<i18n:msg xml:id="fw_forwarding1">Here you can specify which network traffic is allowed to flow between network zones. Only new connections will be matched. Packets belonging to already open connections are automatically allowed to pass the firewall. If you experience occasional connection problems try enabling MSS Clamping otherwise disable it for performance reasons.</i18n:msg>
|
||||
<i18n:msg xml:id="firewall_forwarding_src">Input</i18n:msg>
|
||||
<i18n:msg xml:id="firewall_forwarding_dest">Output</i18n:msg>
|
||||
|
||||
<i18n:msg xml:id="firewall_defaults">Defaults</i18n:msg>
|
||||
<i18n:msg xml:id="firewall_defaults_desc">These are the default settings that are used if no other rules match.</i18n:msg>
|
||||
<i18n:msg xml:id="firewall_defaults_synflood">SYN-flood protection</i18n:msg>
|
||||
<i18n:msg xml:id="firewall_defaults_input">Incoming Traffic</i18n:msg>
|
||||
<i18n:msg xml:id="firewall_defaults_output">Outgoing Traffic</i18n:msg>
|
||||
<i18n:msg xml:id="firewall_defaults_forward">Forwarded Traffic</i18n:msg>
|
||||
|
||||
<i18n:msg xml:id="firewall_zone_desc">Zones part the network interfaces into certain isolated areas to separate network traffic. One or more networks can belong to a zone. The MASQ-flag enables NAT masquerading for all outgoing traffic on this zone.</i18n:msg>
|
||||
<i18n:msg xml:id="firewall_zone_input">Incoming Traffic</i18n:msg>
|
||||
<i18n:msg xml:id="firewall_zone_input_desc">Default Policy</i18n:msg>
|
||||
<i18n:msg xml:id="firewall_zone_output">Outgoing Traffic</i18n:msg>
|
||||
<i18n:msg xml:id="firewall_zone_output_desc">Default Policy</i18n:msg>
|
||||
<i18n:msg xml:id="firewall_zone_forward">Forwarded Traffic</i18n:msg>
|
||||
<i18n:msg xml:id="firewall_zone_forward_desc">Default Policy</i18n:msg>
|
||||
<i18n:msg xml:id="firewall_zone_masq">MASQ</i18n:msg>
|
||||
<i18n:msg xml:id="firewall_zone_network">Networks</i18n:msg>
|
||||
<i18n:msg xml:id="firewall_zone_network_desc">contained networks</i18n:msg>
|
||||
|
||||
</i18n:msgs>
|
|
@ -0,0 +1,56 @@
|
|||
fw_portfw = 'Redirection de port'
|
||||
fw_redirect = 'Redirection de trafic'
|
||||
fw_redirect_desc = 'La redirection de trafic vous permet de changer l'adresse de destination des paquets transférés.'
|
||||
fw_forwarding = 'Trafic inter-zone'
|
||||
fw_fw = 'Pare-Feu'
|
||||
fw_zone = 'Zone'
|
||||
fw_zones = 'Zones'
|
||||
fw_custfwd = 'Transfert particulière'
|
||||
fw_fw1 = 'Le pare-feu crée des zone à partir des interfaces réseaux pour controller le trafic réseau.'
|
||||
firewall_rule = 'Règles Avancées'
|
||||
firewall_rule_desc = 'Les règles avancées vous laisse personnaliser le pare-feu selon vos besoins. Seules les nouvelles connexions seront prises en compte. Les paquets appartenant à des connexions déjà ouvertes sont automatiquement admises à passer le pare-feu.'
|
||||
firewall_rule_src = 'Zone d'Entrée (Input)'
|
||||
firewall_rule_dest = 'Zone de Sortie (Output)'
|
||||
firewall_rule_srcip = 'Adresse source'
|
||||
firewall_rule_destip = 'Adresse de destination'
|
||||
firewall_rule_srcmac = 'Adresse MAC source'
|
||||
firewall_rule_srcport = 'Port source'
|
||||
firewall_rule_destport = 'Port de destination'
|
||||
firewall_rule_target = 'Action'
|
||||
fw_accept = 'accepter'
|
||||
fw_reject = 'rejeter'
|
||||
fw_drop = 'ignorer (drop)'
|
||||
fw_src = 'Source'
|
||||
fw_dest = 'Destination'
|
||||
fw_traffic = 'Contrôle de Trafic'
|
||||
fw_mtufix = 'MSS-Correction'
|
||||
fw_dropinvalid = 'Drop incorrect packets'
|
||||
fw_portfw1 = 'La redirection de port vous permet d'exposer des services réseaux de votre réseau local au réseau externe.'
|
||||
firewall_redirect_src_desc = 'Zone externe'
|
||||
firewall_redirect_srcdport = 'Port externe'
|
||||
firewall_redirect_srcdport_desc = 'port ou plage de ports (premier-dernier)'
|
||||
firewall_redirect_srcip = 'Adresse source'
|
||||
firewall_redirect_srcmac = 'MAC source'
|
||||
firewall_redirect_destip = 'Adresse interne'
|
||||
firewall_redirect_destip_desc = 'Adresse IP'
|
||||
firewall_redirect_destport = 'Port interne'
|
||||
firewall_redirect_destport_desc = 'port ou plage de ports (premier-dernier)'
|
||||
fw_forwarding1 = 'Ici, vous pouvez spécifier quel trafic réseau est autorisé à transiter entre les zones réseaux. Seules les nouvelles connexions seront prises en compte. Les paquets appartenant à des connexions déjà ouvertes sont automatiquement admises à passer le pare-feu.'
|
||||
firewall_forwarding_src = 'Entrée (Input)'
|
||||
firewall_forwarding_dest = 'Sortie (Output)'
|
||||
firewall_defaults = 'Défauts'
|
||||
firewall_defaults_desc = 'Ceci sont les paramètres par défaut qui sont utilisés si aucune autre règle ne s'applique.'
|
||||
firewall_defaults_synflood = 'Protection anti SYN-flood'
|
||||
firewall_defaults_input = 'Trafic Entrant'
|
||||
firewall_defaults_output = 'Trafic Sortant'
|
||||
firewall_defaults_forward = 'Trafic Transféré'
|
||||
firewall_zone_desc = 'Les zones partagent les interfaces réseaux en régions isolées pour séparer les trafic réseaux. Seules les nouvelles connexions seront prises en compte. Les paquets appartenant à des connexions déjà ouvertes sont automatiquement admises à passer le pare-feu.'
|
||||
firewall_zone_input = 'Trafic Entrant'
|
||||
firewall_zone_input_desc = 'Politique par Défaut'
|
||||
firewall_zone_output = 'Trafic Sortant'
|
||||
firewall_zone_output_desc = 'Politique par Défaut'
|
||||
firewall_zone_forward = 'Trafic Transféré'
|
||||
firewall_zone_forward_desc = 'Politique par Défaut'
|
||||
firewall_zone_masq = 'MASQ'
|
||||
firewall_zone_network = 'Réseaux'
|
||||
firewall_zone_network_desc = 'réseaux compris'
|
|
@ -0,0 +1,66 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
|
||||
<i18n:msgs xmlns:i18n="http://luci.freifunk-halle.net/2008/i18n#" xmlns="http://www.w3.org/1999/xhtml">
|
||||
|
||||
<i18n:msg xml:id="fw_portfw">Redirection de port</i18n:msg>
|
||||
<i18n:msg xml:id="fw_redirect">Redirection de trafic</i18n:msg>
|
||||
<i18n:msg xml:id="fw_redirect_desc">La redirection de trafic vous permet de changer l'adresse de destination des paquets transférés.</i18n:msg>
|
||||
<i18n:msg xml:id="fw_forwarding">Trafic inter-zone</i18n:msg>
|
||||
<i18n:msg xml:id="fw_fw">Pare-Feu</i18n:msg>
|
||||
<i18n:msg xml:id="fw_zone">Zone</i18n:msg>
|
||||
<i18n:msg xml:id="fw_zones">Zones</i18n:msg>
|
||||
<i18n:msg xml:id="fw_custfwd">Transfert particulière</i18n:msg>
|
||||
<i18n:msg xml:id="fw_fw1">Le pare-feu crée des zone à partir des interfaces réseaux pour controller le trafic réseau.</i18n:msg>
|
||||
<i18n:msg xml:id="firewall_rule">Règles Avancées</i18n:msg>
|
||||
<i18n:msg xml:id="firewall_rule_desc">Les règles avancées vous laisse personnaliser le pare-feu selon vos besoins. Seules les nouvelles connexions seront prises en compte. Les paquets appartenant à des connexions déjà ouvertes sont automatiquement admises à passer le pare-feu.</i18n:msg>
|
||||
<i18n:msg xml:id="firewall_rule_src">Zone d'Entrée (Input)</i18n:msg>
|
||||
<i18n:msg xml:id="firewall_rule_dest">Zone de Sortie (Output)</i18n:msg>
|
||||
<i18n:msg xml:id="firewall_rule_srcip">Adresse source</i18n:msg>
|
||||
<i18n:msg xml:id="firewall_rule_destip">Adresse de destination</i18n:msg>
|
||||
<i18n:msg xml:id="firewall_rule_srcmac">Adresse MAC source</i18n:msg>
|
||||
<i18n:msg xml:id="firewall_rule_srcport">Port source</i18n:msg>
|
||||
<i18n:msg xml:id="firewall_rule_destport">Port de destination</i18n:msg>
|
||||
<i18n:msg xml:id="firewall_rule_target">Action</i18n:msg>
|
||||
<i18n:msg xml:id="fw_accept">accepter</i18n:msg>
|
||||
<i18n:msg xml:id="fw_reject">rejeter</i18n:msg>
|
||||
<i18n:msg xml:id="fw_drop">ignorer (drop)</i18n:msg>
|
||||
<i18n:msg xml:id="fw_src">Source</i18n:msg>
|
||||
<i18n:msg xml:id="fw_dest">Destination</i18n:msg>
|
||||
<i18n:msg xml:id="fw_traffic">Contrôle de Trafic</i18n:msg>
|
||||
<i18n:msg xml:id="fw_mtufix">MSS-Correction</i18n:msg>
|
||||
<i18n:msg xml:id="fw_dropinvalid">Drop incorrect packets</i18n:msg>
|
||||
|
||||
<i18n:msg xml:id="fw_portfw1">La redirection de port vous permet d'exposer des services réseaux de votre réseau local au réseau externe.</i18n:msg>
|
||||
<i18n:msg xml:id="firewall_redirect_src_desc">Zone externe</i18n:msg>
|
||||
<i18n:msg xml:id="firewall_redirect_srcdport">Port externe</i18n:msg>
|
||||
<i18n:msg xml:id="firewall_redirect_srcdport_desc">port ou plage de ports (premier-dernier)</i18n:msg>
|
||||
<i18n:msg xml:id="firewall_redirect_srcip">Adresse source</i18n:msg>
|
||||
<i18n:msg xml:id="firewall_redirect_srcmac">MAC source</i18n:msg>
|
||||
<i18n:msg xml:id="firewall_redirect_destip">Adresse interne</i18n:msg>
|
||||
<i18n:msg xml:id="firewall_redirect_destip_desc">Adresse IP</i18n:msg>
|
||||
<i18n:msg xml:id="firewall_redirect_destport">Port interne</i18n:msg>
|
||||
<i18n:msg xml:id="firewall_redirect_destport_desc">port ou plage de ports (premier-dernier)</i18n:msg>
|
||||
|
||||
<i18n:msg xml:id="fw_forwarding1">Ici, vous pouvez spécifier quel trafic réseau est autorisé à transiter entre les zones réseaux. Seules les nouvelles connexions seront prises en compte. Les paquets appartenant à des connexions déjà ouvertes sont automatiquement admises à passer le pare-feu.</i18n:msg>
|
||||
<i18n:msg xml:id="firewall_forwarding_src">Entrée (Input)</i18n:msg>
|
||||
<i18n:msg xml:id="firewall_forwarding_dest">Sortie (Output)</i18n:msg>
|
||||
|
||||
<i18n:msg xml:id="firewall_defaults">Défauts</i18n:msg>
|
||||
<i18n:msg xml:id="firewall_defaults_desc">Ceci sont les paramètres par défaut qui sont utilisés si aucune autre règle ne s'applique.</i18n:msg>
|
||||
<i18n:msg xml:id="firewall_defaults_synflood">Protection anti SYN-flood</i18n:msg>
|
||||
<i18n:msg xml:id="firewall_defaults_input">Trafic Entrant</i18n:msg>
|
||||
<i18n:msg xml:id="firewall_defaults_output">Trafic Sortant</i18n:msg>
|
||||
<i18n:msg xml:id="firewall_defaults_forward">Trafic Transféré</i18n:msg>
|
||||
|
||||
<i18n:msg xml:id="firewall_zone_desc">Les zones partagent les interfaces réseaux en régions isolées pour séparer les trafic réseaux. Seules les nouvelles connexions seront prises en compte. Les paquets appartenant à des connexions déjà ouvertes sont automatiquement admises à passer le pare-feu.</i18n:msg>
|
||||
<i18n:msg xml:id="firewall_zone_input">Trafic Entrant</i18n:msg>
|
||||
<i18n:msg xml:id="firewall_zone_input_desc">Politique par Défaut</i18n:msg>
|
||||
<i18n:msg xml:id="firewall_zone_output">Trafic Sortant</i18n:msg>
|
||||
<i18n:msg xml:id="firewall_zone_output_desc">Politique par Défaut</i18n:msg>
|
||||
<i18n:msg xml:id="firewall_zone_forward">Trafic Transféré</i18n:msg>
|
||||
<i18n:msg xml:id="firewall_zone_forward_desc">Politique par Défaut</i18n:msg>
|
||||
<i18n:msg xml:id="firewall_zone_masq">MASQ</i18n:msg>
|
||||
<i18n:msg xml:id="firewall_zone_network">Réseaux</i18n:msg>
|
||||
<i18n:msg xml:id="firewall_zone_network_desc">réseaux compris</i18n:msg>
|
||||
|
||||
</i18n:msgs>
|
|
@ -0,0 +1,56 @@
|
|||
fw_portfw = 'Redirecionamento de portas'
|
||||
fw_redirect = 'Redirecionamento de Tráfego'
|
||||
fw_redirect_desc = 'Redirecionamento do tráfego permite que você altere o endereço de destino dos pacotes enviados.'
|
||||
fw_forwarding = 'Tráfego de Zona-para-Zona'
|
||||
fw_fw = 'Firewall'
|
||||
fw_zone = 'Zona'
|
||||
fw_zones = 'Zonas'
|
||||
fw_custfwd = 'Redirecionamento customizado'
|
||||
fw_fw1 = 'O firewall cria zonas sobre suas interfaces de rede para controlar o fluxo do tráfego.'
|
||||
firewall_rule = 'Regras Avançadas'
|
||||
firewall_rule_desc = 'As regras avançadas permitem que você personalize o firewall de acordo com suas necessidades. Somente novas conexões serão processadas. Pacotes pertencentes às conexões já abertas estão automaticamente permitidos para passar pelo firewall.'
|
||||
firewall_rule_src = 'Zona de Entrada'
|
||||
firewall_rule_dest = 'Zona de Saída'
|
||||
firewall_rule_srcip = 'Endereço de origem'
|
||||
firewall_rule_destip = 'Endereço de destino'
|
||||
firewall_rule_srcmac = 'Endereço-MAC de origem'
|
||||
firewall_rule_srcport = 'Porta de origem'
|
||||
firewall_rule_destport = 'Porta de destino'
|
||||
firewall_rule_target = 'Ação'
|
||||
fw_accept = 'aceitar'
|
||||
fw_reject = 'rejeitar'
|
||||
fw_drop = 'dropar'
|
||||
fw_src = 'Origem'
|
||||
fw_dest = 'Destino'
|
||||
fw_traffic = 'Controle de Tráfego'
|
||||
fw_mtufix = 'MSS-Correction'
|
||||
fw_dropinvalid = 'Drop invalid packets'
|
||||
fw_portfw1 = 'O redirecionamento de portas permite prover serviços de rede na rede interna para uma rede externa.'
|
||||
firewall_redirect_src_desc = 'Zona Externa'
|
||||
firewall_redirect_srcdport = 'Porta Externa'
|
||||
firewall_redirect_srcdport_desc = 'porta ou intervalo primeira-última'
|
||||
firewall_redirect_srcip = 'Endereço de origem'
|
||||
firewall_redirect_srcmac = 'MAC de origem'
|
||||
firewall_redirect_destip = 'Endereço interno'
|
||||
firewall_redirect_destip_desc = 'Endereço-IP'
|
||||
firewall_redirect_destport = 'Porta interna (opcional)'
|
||||
firewall_redirect_destport_desc = 'porta ou intervalo primeira-última'
|
||||
fw_forwarding1 = 'Aqui você pode especificar qual tráfego de rede será permitido para o fluxo entre zonas das redes. Somente novas conexões serão processadas. Pacotes pertencentes à conexões já abertas estão automaticamente permitidos para passar pelo firewall.'
|
||||
firewall_forwarding_src = 'Entrada'
|
||||
firewall_forwarding_dest = 'Saída'
|
||||
firewall_defaults = 'Padrões'
|
||||
firewall_defaults_desc = 'Estas são as configurações padrões, que serão usadas se não houver outras regras.'
|
||||
firewall_defaults_synflood = 'Proteção SYN-flood'
|
||||
firewall_defaults_input = 'Tráfego de Entrada'
|
||||
firewall_defaults_output = 'Tráfego de Saída'
|
||||
firewall_defaults_forward = 'Tráfego Redirecionado'
|
||||
firewall_zone_desc = 'Zonas são interfaces de redes usadas para separar o tráfego da rede. Uma ou mais redes podem pertencer a uma zona. A flag-MASQ ativa o mascaramento NAT para todo o tráfego de saída desta zona.'
|
||||
firewall_zone_input = 'Tráfego de Entrada'
|
||||
firewall_zone_input_desc = 'Política Padrão'
|
||||
firewall_zone_output = 'Tráfego de Saída'
|
||||
firewall_zone_output_desc = 'Política Padrão'
|
||||
firewall_zone_forward = 'Tráfego Redirecionado'
|
||||
firewall_zone_forward_desc = 'Política Padrão'
|
||||
firewall_zone_masq = 'MASQ'
|
||||
firewall_zone_network = 'Redes'
|
||||
firewall_zone_network_desc = 'redes contidas'
|
|
@ -0,0 +1,66 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
|
||||
<i18n:msgs xmlns:i18n="http://luci.freifunk-halle.net/2008/i18n#" xmlns="http://www.w3.org/1999/xhtml">
|
||||
|
||||
<i18n:msg xml:id="fw_portfw">Redirecionamento de portas</i18n:msg>
|
||||
<i18n:msg xml:id="fw_redirect">Redirecionamento de Tráfego</i18n:msg>
|
||||
<i18n:msg xml:id="fw_redirect_desc">Redirecionamento do tráfego permite que você altere o endereço de destino dos pacotes enviados.</i18n:msg>
|
||||
<i18n:msg xml:id="fw_forwarding">Tráfego de Zona-para-Zona</i18n:msg>
|
||||
<i18n:msg xml:id="fw_fw">Firewall</i18n:msg>
|
||||
<i18n:msg xml:id="fw_zone">Zona</i18n:msg>
|
||||
<i18n:msg xml:id="fw_zones">Zonas</i18n:msg>
|
||||
<i18n:msg xml:id="fw_custfwd">Redirecionamento customizado</i18n:msg>
|
||||
<i18n:msg xml:id="fw_fw1">O firewall cria zonas sobre suas interfaces de rede para controlar o fluxo do tráfego.</i18n:msg>
|
||||
<i18n:msg xml:id="firewall_rule">Regras Avançadas</i18n:msg>
|
||||
<i18n:msg xml:id="firewall_rule_desc">As regras avançadas permitem que você personalize o firewall de acordo com suas necessidades. Somente novas conexões serão processadas. Pacotes pertencentes às conexões já abertas estão automaticamente permitidos para passar pelo firewall.</i18n:msg>
|
||||
<i18n:msg xml:id="firewall_rule_src">Zona de Entrada</i18n:msg>
|
||||
<i18n:msg xml:id="firewall_rule_dest">Zona de Saída</i18n:msg>
|
||||
<i18n:msg xml:id="firewall_rule_srcip">Endereço de origem</i18n:msg>
|
||||
<i18n:msg xml:id="firewall_rule_destip">Endereço de destino</i18n:msg>
|
||||
<i18n:msg xml:id="firewall_rule_srcmac">Endereço-MAC de origem</i18n:msg>
|
||||
<i18n:msg xml:id="firewall_rule_srcport">Porta de origem</i18n:msg>
|
||||
<i18n:msg xml:id="firewall_rule_destport">Porta de destino</i18n:msg>
|
||||
<i18n:msg xml:id="firewall_rule_target">Ação</i18n:msg>
|
||||
<i18n:msg xml:id="fw_accept">aceitar</i18n:msg>
|
||||
<i18n:msg xml:id="fw_reject">rejeitar</i18n:msg>
|
||||
<i18n:msg xml:id="fw_drop">dropar</i18n:msg>
|
||||
<i18n:msg xml:id="fw_src">Origem</i18n:msg>
|
||||
<i18n:msg xml:id="fw_dest">Destino</i18n:msg>
|
||||
<i18n:msg xml:id="fw_traffic">Controle de Tráfego</i18n:msg>
|
||||
<i18n:msg xml:id="fw_mtufix">MSS-Correction</i18n:msg>
|
||||
<i18n:msg xml:id="fw_dropinvalid">Drop invalid packets</i18n:msg>
|
||||
|
||||
<i18n:msg xml:id="fw_portfw1">O redirecionamento de portas permite prover serviços de rede na rede interna para uma rede externa.</i18n:msg>
|
||||
<i18n:msg xml:id="firewall_redirect_src_desc">Zona Externa</i18n:msg>
|
||||
<i18n:msg xml:id="firewall_redirect_srcdport">Porta Externa</i18n:msg>
|
||||
<i18n:msg xml:id="firewall_redirect_srcdport_desc">porta ou intervalo primeira-última</i18n:msg>
|
||||
<i18n:msg xml:id="firewall_redirect_srcip">Endereço de origem</i18n:msg>
|
||||
<i18n:msg xml:id="firewall_redirect_srcmac">MAC de origem</i18n:msg>
|
||||
<i18n:msg xml:id="firewall_redirect_destip">Endereço interno</i18n:msg>
|
||||
<i18n:msg xml:id="firewall_redirect_destip_desc">Endereço-IP</i18n:msg>
|
||||
<i18n:msg xml:id="firewall_redirect_destport">Porta interna (opcional)</i18n:msg>
|
||||
<i18n:msg xml:id="firewall_redirect_destport_desc">porta ou intervalo primeira-última</i18n:msg>
|
||||
|
||||
<i18n:msg xml:id="fw_forwarding1">Aqui você pode especificar qual tráfego de rede será permitido para o fluxo entre zonas das redes. Somente novas conexões serão processadas. Pacotes pertencentes à conexões já abertas estão automaticamente permitidos para passar pelo firewall.</i18n:msg>
|
||||
<i18n:msg xml:id="firewall_forwarding_src">Entrada</i18n:msg>
|
||||
<i18n:msg xml:id="firewall_forwarding_dest">Saída</i18n:msg>
|
||||
|
||||
<i18n:msg xml:id="firewall_defaults">Padrões</i18n:msg>
|
||||
<i18n:msg xml:id="firewall_defaults_desc">Estas são as configurações padrões, que serão usadas se não houver outras regras.</i18n:msg>
|
||||
<i18n:msg xml:id="firewall_defaults_synflood">Proteção SYN-flood</i18n:msg>
|
||||
<i18n:msg xml:id="firewall_defaults_input">Tráfego de Entrada</i18n:msg>
|
||||
<i18n:msg xml:id="firewall_defaults_output">Tráfego de Saída</i18n:msg>
|
||||
<i18n:msg xml:id="firewall_defaults_forward">Tráfego Redirecionado</i18n:msg>
|
||||
|
||||
<i18n:msg xml:id="firewall_zone_desc">Zonas são interfaces de redes usadas para separar o tráfego da rede. Uma ou mais redes podem pertencer a uma zona. A flag-MASQ ativa o mascaramento NAT para todo o tráfego de saída desta zona.</i18n:msg>
|
||||
<i18n:msg xml:id="firewall_zone_input">Tráfego de Entrada</i18n:msg>
|
||||
<i18n:msg xml:id="firewall_zone_input_desc">Política Padrão</i18n:msg>
|
||||
<i18n:msg xml:id="firewall_zone_output">Tráfego de Saída</i18n:msg>
|
||||
<i18n:msg xml:id="firewall_zone_output_desc">Política Padrão</i18n:msg>
|
||||
<i18n:msg xml:id="firewall_zone_forward">Tráfego Redirecionado</i18n:msg>
|
||||
<i18n:msg xml:id="firewall_zone_forward_desc">Política Padrão</i18n:msg>
|
||||
<i18n:msg xml:id="firewall_zone_masq">MASQ</i18n:msg>
|
||||
<i18n:msg xml:id="firewall_zone_network">Redes</i18n:msg>
|
||||
<i18n:msg xml:id="firewall_zone_network_desc">redes contidas</i18n:msg>
|
||||
|
||||
</i18n:msgs>
|
|
@ -0,0 +1,45 @@
|
|||
--[[
|
||||
LuCI - Lua Configuration Interface
|
||||
|
||||
Copyright 2008 Steven Barth <steven@midlink.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: miniportfw.lua 3070 2008-09-02 11:27:00Z Cyrus $
|
||||
]]--
|
||||
require("luci.sys")
|
||||
m = Map("firewall", translate("fw_portfw"), translate("fw_portfw1"))
|
||||
|
||||
|
||||
s = m:section(TypedSection, "redirect", "")
|
||||
s:depends("src", "wan")
|
||||
s.defaults.src = "wan"
|
||||
|
||||
s.template = "cbi/tblsection"
|
||||
s.addremove = true
|
||||
s.anonymous = true
|
||||
|
||||
name = s:option(Value, "_name", translate("name"), translate("cbi_optional"))
|
||||
name.size = 10
|
||||
|
||||
proto = s:option(ListValue, "proto", translate("protocol"))
|
||||
proto:value("tcp", "TCP")
|
||||
proto:value("udp", "UDP")
|
||||
proto:value("tcpudp", "TCP+UDP")
|
||||
|
||||
dport = s:option(Value, "src_dport")
|
||||
dport.size = 5
|
||||
|
||||
to = s:option(Value, "dest_ip")
|
||||
for i, dataset in ipairs(luci.sys.net.arptable()) do
|
||||
to:value(dataset["IP address"])
|
||||
end
|
||||
|
||||
toport = s:option(Value, "dest_port")
|
||||
toport.size = 5
|
||||
|
||||
return m
|
|
@ -0,0 +1,50 @@
|
|||
--[[
|
||||
LuCI - Lua Configuration Interface
|
||||
|
||||
Copyright 2008 Steven Barth <steven@midlink.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: redirect.lua 3500 2008-10-03 16:23:43Z Cyrus $
|
||||
]]--
|
||||
require("luci.sys")
|
||||
m = Map("firewall", translate("fw_redirect"), translate("fw_redirect_desc"))
|
||||
|
||||
|
||||
s = m:section(TypedSection, "redirect", "")
|
||||
s.template = "cbi/tblsection"
|
||||
s.addremove = true
|
||||
s.anonymous = true
|
||||
s.extedit = luci.dispatcher.build_url("admin", "network", "firewall", "redirect", "%s")
|
||||
|
||||
name = s:option(Value, "_name", translate("name"), translate("cbi_optional"))
|
||||
name.size = 10
|
||||
|
||||
iface = s:option(ListValue, "src", translate("fw_zone"))
|
||||
iface.default = "wan"
|
||||
luci.model.uci.cursor():foreach("firewall", "zone",
|
||||
function (section)
|
||||
iface:value(section.name)
|
||||
end)
|
||||
|
||||
proto = s:option(ListValue, "proto", translate("protocol"))
|
||||
proto:value("tcp", "TCP")
|
||||
proto:value("udp", "UDP")
|
||||
proto:value("tcpudp", "TCP+UDP")
|
||||
|
||||
dport = s:option(Value, "src_dport")
|
||||
dport.size = 5
|
||||
|
||||
to = s:option(Value, "dest_ip")
|
||||
for i, dataset in ipairs(luci.sys.net.arptable()) do
|
||||
to:value(dataset["IP address"])
|
||||
end
|
||||
|
||||
toport = s:option(Value, "dest_port")
|
||||
toport.size = 5
|
||||
|
||||
return m
|
|
@ -0,0 +1,69 @@
|
|||
--[[
|
||||
LuCI - Lua Configuration Interface
|
||||
|
||||
Copyright 2008 Steven Barth <steven@midlink.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: rrule.lua 4200 2009-01-30 18:57:14Z Cyrus $
|
||||
]]--
|
||||
require("luci.sys")
|
||||
arg[1] = arg[1] or ""
|
||||
|
||||
m = Map("firewall", translate("fw_redirect"), translate("fw_redirect_desc"))
|
||||
|
||||
|
||||
s = m:section(NamedSection, arg[1], "redirect", "")
|
||||
s.anonymous = true
|
||||
s.addremove = false
|
||||
|
||||
back = s:option(DummyValue, "_overview", translate("overview"))
|
||||
back.value = ""
|
||||
back.titleref = luci.dispatcher.build_url("admin", "network", "firewall", "redirect")
|
||||
|
||||
name = s:option(Value, "_name", translate("name"))
|
||||
name.rmempty = true
|
||||
name.size = 10
|
||||
|
||||
iface = s:option(ListValue, "src", translate("fw_zone"))
|
||||
iface.default = "wan"
|
||||
luci.model.uci.cursor():foreach("firewall", "zone",
|
||||
function (section)
|
||||
iface:value(section.name)
|
||||
end)
|
||||
|
||||
s:option(Value, "src_ip", translate("firewall_redirect_srcip")).optional = true
|
||||
s:option(Value, "src_mac", translate("firewall_redirect_srcmac")).optional = true
|
||||
|
||||
sport = s:option(Value, "src_port", translate("firewall_rule_srcport"))
|
||||
sport:depends("proto", "tcp")
|
||||
sport:depends("proto", "udp")
|
||||
sport:depends("proto", "tcpudp")
|
||||
|
||||
proto = s:option(ListValue, "proto", translate("protocol"))
|
||||
proto.optional = true
|
||||
proto:value("")
|
||||
proto:value("tcp", "TCP")
|
||||
proto:value("udp", "UDP")
|
||||
proto:value("tcpudp", "TCP+UDP")
|
||||
|
||||
dport = s:option(Value, "src_dport", translate("firewall_redirect_srcdport"))
|
||||
dport.size = 5
|
||||
dport:depends("proto", "tcp")
|
||||
dport:depends("proto", "udp")
|
||||
dport:depends("proto", "tcpudp")
|
||||
|
||||
to = s:option(Value, "dest_ip", translate("firewall_redirect_destip"))
|
||||
for i, dataset in ipairs(luci.sys.net.arptable()) do
|
||||
to:value(dataset["IP address"])
|
||||
end
|
||||
|
||||
toport = s:option(Value, "dest_port", translate("firewall_redirect_destport"))
|
||||
toport.optional = true
|
||||
toport.size = 5
|
||||
|
||||
return m
|
|
@ -0,0 +1,82 @@
|
|||
--[[
|
||||
LuCI - Lua Configuration Interface
|
||||
|
||||
Copyright 2008 Steven Barth <steven@midlink.org>
|
||||
Copyright 2008 Jo-Philipp Wich <xm@leipzig.freifunk.net>
|
||||
|
||||
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: traffic.lua 4181 2009-01-29 15:04:16Z Cyrus $
|
||||
]]--
|
||||
|
||||
m = Map("firewall", translate("fw_traffic"))
|
||||
s = m:section(TypedSection, "forwarding", translate("fw_forwarding"), translate("fw_forwarding1"))
|
||||
s.template = "cbi/tblsection"
|
||||
s.addremove = true
|
||||
s.anonymous = true
|
||||
|
||||
iface = s:option(ListValue, "src", translate("fw_src"))
|
||||
oface = s:option(ListValue, "dest", translate("fw_dest"))
|
||||
s:option(Flag, "mtu_fix", translate("fw_mtufix"))
|
||||
|
||||
luci.model.uci.cursor():foreach("firewall", "zone",
|
||||
function (section)
|
||||
iface:value(section.name)
|
||||
oface:value(section.name)
|
||||
end)
|
||||
|
||||
|
||||
|
||||
s = m:section(TypedSection, "rule")
|
||||
s.addremove = true
|
||||
s.anonymous = true
|
||||
s.template = "cbi/tblsection"
|
||||
s.extedit = luci.dispatcher.build_url("admin", "network", "firewall", "rule", "%s")
|
||||
s.defaults.target = "ACCEPT"
|
||||
|
||||
local created = nil
|
||||
|
||||
function s.create(self, section)
|
||||
created = TypedSection.create(self, section)
|
||||
end
|
||||
|
||||
function s.parse(self, ...)
|
||||
TypedSection.parse(self, ...)
|
||||
if created then
|
||||
m.uci:save("firewall")
|
||||
luci.http.redirect(luci.dispatcher.build_url(
|
||||
"admin", "network", "firewall", "rule", created
|
||||
))
|
||||
end
|
||||
end
|
||||
|
||||
s:option(DummyValue, "_name", translate("name"))
|
||||
s:option(DummyValue, "proto", translate("protocol"))
|
||||
|
||||
src = s:option(DummyValue, "src", translate("fw_src"))
|
||||
function src.cfgvalue(self, s)
|
||||
return "%s:%s:%s" % {
|
||||
self.map:get(s, "src") or "*",
|
||||
self.map:get(s, "src_ip") or "0.0.0.0/0",
|
||||
self.map:get(s, "src_port") or "*"
|
||||
}
|
||||
end
|
||||
|
||||
dest = s:option(DummyValue, "dest", translate("fw_dest"))
|
||||
function dest.cfgvalue(self, s)
|
||||
return "%s:%s:%s" % {
|
||||
self.map:get(s, "dest") or translate("device", "device"),
|
||||
self.map:get(s, "dest_ip") or "0.0.0.0/0",
|
||||
self.map:get(s, "dest_port") or "*"
|
||||
}
|
||||
end
|
||||
|
||||
|
||||
s:option(DummyValue, "target")
|
||||
|
||||
|
||||
return m
|
|
@ -0,0 +1,72 @@
|
|||
--[[
|
||||
LuCI - Lua Configuration Interface
|
||||
|
||||
Copyright 2008 Steven Barth <steven@midlink.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: trule.lua 4012 2009-01-09 10:05:59Z Cyrus $
|
||||
]]--
|
||||
arg[1] = arg[1] or ""
|
||||
m = Map("firewall", translate("firewall_rule"), translate("firewall_rule_desc"))
|
||||
|
||||
s = m:section(NamedSection, arg[1], "rule", "")
|
||||
s.anonymous = true
|
||||
s.addremove = false
|
||||
|
||||
back = s:option(DummyValue, "_overview", translate("overview"))
|
||||
back.value = ""
|
||||
back.titleref = luci.dispatcher.build_url("admin", "network", "firewall", "rule")
|
||||
|
||||
|
||||
name = s:option(Value, "_name", translate("name")..translate("cbi_optional"))
|
||||
name.rmempty = true
|
||||
|
||||
iface = s:option(ListValue, "src", translate("fw_src"))
|
||||
iface.rmempty = true
|
||||
|
||||
oface = s:option(ListValue, "dest", translate("fw_dest"))
|
||||
oface:value("", translate("device", "device"))
|
||||
oface.rmempty = true
|
||||
|
||||
luci.model.uci.cursor():foreach("firewall", "zone",
|
||||
function (section)
|
||||
iface:value(section.name)
|
||||
oface:value(section.name)
|
||||
end)
|
||||
|
||||
proto = s:option(Value, "proto", translate("protocol"))
|
||||
proto.optional = true
|
||||
proto:value("")
|
||||
proto:value("tcpudp", "TCP+UDP")
|
||||
proto:value("tcp", "TCP")
|
||||
proto:value("udp", "UDP")
|
||||
proto:value("icmp", "ICMP")
|
||||
|
||||
s:option(Value, "src_ip", translate("firewall_rule_srcip")).optional = true
|
||||
s:option(Value, "dest_ip", translate("firewall_rule_destip")).optional = true
|
||||
s:option(Value, "src_mac", translate("firewall_rule_srcmac")).optional = true
|
||||
|
||||
sport = s:option(Value, "src_port", translate("firewall_rule_srcport"))
|
||||
sport:depends("proto", "tcp")
|
||||
sport:depends("proto", "udp")
|
||||
sport:depends("proto", "tcpudp")
|
||||
|
||||
dport = s:option(Value, "dest_port", translate("firewall_rule_destport"))
|
||||
dport:depends("proto", "tcp")
|
||||
dport:depends("proto", "udp")
|
||||
dport:depends("proto", "tcpudp")
|
||||
|
||||
jump = s:option(ListValue, "target", translate("firewall_rule_target"))
|
||||
jump.rmempty = true
|
||||
jump.default = "ACCEPT"
|
||||
jump:value("DROP", translate("fw_drop"))
|
||||
jump:value("ACCEPT", translate("fw_accept"))
|
||||
jump:value("REJECT", translate("fw_reject"))
|
||||
|
||||
|
||||
return m
|
|
@ -0,0 +1,71 @@
|
|||
--[[
|
||||
LuCI - Lua Configuration Interface
|
||||
|
||||
Copyright 2008 Steven Barth <steven@midlink.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: zones.lua 4051 2009-01-16 20:29:47Z Cyrus $
|
||||
]]--
|
||||
require("luci.tools.webadmin")
|
||||
m = Map("firewall", translate("fw_fw"), translate("fw_fw1"))
|
||||
|
||||
s = m:section(TypedSection, "defaults")
|
||||
s.anonymous = true
|
||||
|
||||
s:option(Flag, "syn_flood")
|
||||
|
||||
local di = s:option(Flag, "drop_invalid", translate("fw_dropinvalid"))
|
||||
di.rmempty = false
|
||||
function di.cfgvalue(...)
|
||||
return AbstractValue.cfgvalue(...) or "1"
|
||||
end
|
||||
|
||||
p = {}
|
||||
p[1] = s:option(ListValue, "input")
|
||||
p[2] = s:option(ListValue, "output")
|
||||
p[3] = s:option(ListValue, "forward")
|
||||
|
||||
for i, v in ipairs(p) do
|
||||
v:value("REJECT", translate("fw_reject"))
|
||||
v:value("DROP", translate("fw_drop"))
|
||||
v:value("ACCEPT", translate("fw_accept"))
|
||||
end
|
||||
|
||||
|
||||
s = m:section(TypedSection, "zone", translate("fw_zones"))
|
||||
s.template = "cbi/tblsection"
|
||||
s.anonymous = true
|
||||
s.addremove = true
|
||||
|
||||
name = s:option(Value, "name", translate("name"))
|
||||
name.size = 8
|
||||
|
||||
p = {}
|
||||
p[1] = s:option(ListValue, "input")
|
||||
p[2] = s:option(ListValue, "output")
|
||||
p[3] = s:option(ListValue, "forward")
|
||||
|
||||
for i, v in ipairs(p) do
|
||||
v:value("REJECT", translate("fw_reject"))
|
||||
v:value("DROP", translate("fw_drop"))
|
||||
v:value("ACCEPT", translate("fw_accept"))
|
||||
end
|
||||
|
||||
s:option(Flag, "masq")
|
||||
|
||||
net = s:option(MultiValue, "network")
|
||||
net.widget = "select"
|
||||
net.rmempty = true
|
||||
luci.tools.webadmin.cbi_add_networks(net)
|
||||
|
||||
function net.cfgvalue(self, section)
|
||||
local value = MultiValue.cfgvalue(self, section)
|
||||
return value or name:cfgvalue(section)
|
||||
end
|
||||
|
||||
return m
|
|
@ -0,0 +1,255 @@
|
|||
package firewall
|
||||
|
||||
config package
|
||||
option title 'Firewall configuration'
|
||||
|
||||
config section
|
||||
option name 'zone'
|
||||
option title 'Firewall zones'
|
||||
option package 'firewall'
|
||||
|
||||
config variable
|
||||
option name 'name'
|
||||
option title 'Name'
|
||||
option section 'firewall.zone'
|
||||
option required true
|
||||
|
||||
config variable
|
||||
option name 'network'
|
||||
option title 'Networks belonging to this zone'
|
||||
option section 'firewall.zone'
|
||||
option valueof 'network.interface'
|
||||
option multival true
|
||||
|
||||
config variable
|
||||
option name 'forward'
|
||||
option title 'Zone specific action for forwarded traffic'
|
||||
option section 'firewall.zone'
|
||||
option required true
|
||||
|
||||
config variable
|
||||
option name 'input'
|
||||
option title 'Zone specific action for incoming traffic'
|
||||
option section 'firewall.zone'
|
||||
option required true
|
||||
|
||||
config variable
|
||||
option name 'output'
|
||||
option title 'Zone specific action for outgoing traffic'
|
||||
option section 'firewall.zone'
|
||||
option required true
|
||||
|
||||
config variable
|
||||
option name 'masq'
|
||||
option title 'Enable masquerading for outgoing zone traffic'
|
||||
option section 'firewall.zone'
|
||||
option datatype 'boolean'
|
||||
|
||||
|
||||
|
||||
config section
|
||||
option name 'defaults'
|
||||
option title 'Global firewall defaults'
|
||||
option package 'firewall'
|
||||
option unique true
|
||||
option required true
|
||||
|
||||
config variable
|
||||
option name 'forward'
|
||||
option title 'Action for forwarded traffic'
|
||||
option section 'firewall.defaults'
|
||||
option required true
|
||||
|
||||
config variable
|
||||
option name 'input'
|
||||
option title 'Action for incoming traffic'
|
||||
option section 'firewall.defaults'
|
||||
option required true
|
||||
|
||||
config variable
|
||||
option name 'output'
|
||||
option title 'Action for outgoing traffic'
|
||||
option section 'firewall.defaults'
|
||||
option required true
|
||||
|
||||
config variable
|
||||
option name 'syn_flood'
|
||||
option title 'Enable syn-flood protection'
|
||||
option section 'firewall.defaults'
|
||||
option datatype 'boolean'
|
||||
|
||||
config variable
|
||||
option name 'drop_invalid'
|
||||
option title 'Do not drop packages with state invalid'
|
||||
option section 'firewall.defaults'
|
||||
option datatype 'boolean'
|
||||
|
||||
|
||||
|
||||
config section
|
||||
option name 'forwarding'
|
||||
option title 'Forwarding rules'
|
||||
option package 'firewall'
|
||||
|
||||
config variable
|
||||
option name 'src'
|
||||
option title 'Source zone'
|
||||
option section 'firewall.forwarding'
|
||||
option valueof 'firewall.zone.name'
|
||||
option required true
|
||||
|
||||
config variable
|
||||
option name 'dest'
|
||||
option title 'Destination zone'
|
||||
option section 'firewall.forwarding'
|
||||
option valueof 'firewall.zone.name'
|
||||
option required true
|
||||
|
||||
config variable
|
||||
option name 'mtu_fix'
|
||||
option title 'Fixup MTU of outgoing packages'
|
||||
option section 'firewall.forwarding'
|
||||
option datatype 'boolean'
|
||||
|
||||
|
||||
|
||||
config section
|
||||
option name 'rule'
|
||||
option title 'Custom rules'
|
||||
option package 'firewall'
|
||||
list depends 'target, src'
|
||||
list depends 'target, dest'
|
||||
list depends 'target, src_ip'
|
||||
list depends 'target, src_port'
|
||||
list depends 'target, src_mac'
|
||||
list depends 'target, dest_ip'
|
||||
list depends 'target, dest_port'
|
||||
list depends 'target, proto'
|
||||
|
||||
config variable
|
||||
option name 'src'
|
||||
option title 'Source zone'
|
||||
option section 'firewall.rule'
|
||||
option valueof 'firewall.zone.name'
|
||||
|
||||
config variable
|
||||
option name 'src_ip'
|
||||
option title 'Source IP address'
|
||||
option section 'firewall.rule'
|
||||
option datatype 'ipaddr'
|
||||
|
||||
config variable
|
||||
option name 'src_port'
|
||||
option title 'Source port'
|
||||
option section 'firewall.rule'
|
||||
option datatype 'portrange'
|
||||
|
||||
config variable
|
||||
option name 'src_mac'
|
||||
option title 'Source MAC address'
|
||||
option section 'firewall.rule'
|
||||
option datatype 'macaddr'
|
||||
|
||||
config variable
|
||||
option name 'dest'
|
||||
option title 'Destination zone'
|
||||
option section 'firewall.rule'
|
||||
option valueof 'firewall.zone.name'
|
||||
|
||||
config variable
|
||||
option name 'dest_ip'
|
||||
option title 'Destination IP address'
|
||||
option section 'firewall.rule'
|
||||
option datatype 'ipaddr'
|
||||
|
||||
config variable
|
||||
option name 'dest_port'
|
||||
option title 'Destination port'
|
||||
option section 'firewall.rule'
|
||||
option datatype 'portrange'
|
||||
|
||||
config variable
|
||||
option name 'proto'
|
||||
option title 'Protocol'
|
||||
option section 'firewall.rule'
|
||||
option datatype 'string'
|
||||
|
||||
config variable
|
||||
option name 'target'
|
||||
option title 'Option target'
|
||||
option section 'firewall.rule'
|
||||
option datatype 'string'
|
||||
|
||||
|
||||
|
||||
config section
|
||||
option name 'redirect'
|
||||
option title 'Redirection rules'
|
||||
option package 'firewall'
|
||||
|
||||
config variable
|
||||
option name 'src'
|
||||
option title 'Source zone'
|
||||
option section 'firewall.redirect'
|
||||
option valueof 'firewall.zone.name'
|
||||
|
||||
config variable
|
||||
option name 'src_ip'
|
||||
option title 'Source IP address'
|
||||
option section 'firewall.redirect'
|
||||
option datatype 'ipaddr'
|
||||
|
||||
config variable
|
||||
option name 'src_port'
|
||||
option title 'Source port'
|
||||
option section 'firewall.redirect'
|
||||
option datatype 'portrange'
|
||||
|
||||
config variable
|
||||
option name 'src_dport'
|
||||
option title 'Source destination port'
|
||||
option section 'firewall.redirect'
|
||||
option datatype 'portrange'
|
||||
|
||||
config variable
|
||||
option name 'src_mac'
|
||||
option title 'Option src_mac'
|
||||
option section 'firewall.redirect'
|
||||
option datatype 'macaddr'
|
||||
|
||||
config variable
|
||||
option name 'dest'
|
||||
option title 'Destination zone'
|
||||
option section 'firewall.redirect'
|
||||
option valueof 'firewall.zone.name'
|
||||
|
||||
config variable
|
||||
option name 'dest_ip'
|
||||
option title 'Destination IP address'
|
||||
option section 'firewall.redirect'
|
||||
option datatype 'ipaddr'
|
||||
|
||||
config variable
|
||||
option name 'dest_port'
|
||||
option title 'Destination port'
|
||||
option section 'firewall.redirect'
|
||||
option datatype 'portrange'
|
||||
|
||||
config variable
|
||||
option name 'proto'
|
||||
option title 'Protocol'
|
||||
option section 'firewall.redirect'
|
||||
option datatype 'string'
|
||||
|
||||
|
||||
|
||||
config section
|
||||
option name 'include'
|
||||
option title 'User defined config includes'
|
||||
option package 'firewall'
|
||||
|
||||
config variable
|
||||
option name 'path'
|
||||
option title 'Path to the include file'
|
||||
option section 'firewall.include'
|
||||
option datatype 'file'
|
|
@ -0,0 +1,2 @@
|
|||
include ../../build/config.mk
|
||||
include ../../build/module.mk
|
|
@ -0,0 +1,4 @@
|
|||
#!/bin/sh
|
||||
[ -n "${IPKG_INSTROOT}" ] || {
|
||||
( . /etc/uci-defaults/luci-hd_idle ) && rm -f /etc/uci-defaults/luci-hd_idle
|
||||
}
|
|
@ -0,0 +1,28 @@
|
|||
--[[
|
||||
|
||||
LuCI hd-idle
|
||||
(c) 2008 Yanira <forum-2008@email.de>
|
||||
|
||||
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: hd_idle.lua 3987 2009-01-02 21:35:25Z Cyrus $
|
||||
|
||||
]]--
|
||||
|
||||
module("luci.controller.hd_idle", package.seeall)
|
||||
|
||||
function index()
|
||||
require("luci.i18n")
|
||||
luci.i18n.loadc("hd_idle")
|
||||
if not luci.fs.access("/etc/config/hd-idle") then
|
||||
return
|
||||
end
|
||||
|
||||
local page = entry({"admin", "services", "hd_idle"}, cbi("hd_idle"), luci.i18n.translate("hd_idle", "hd-idle"), 60)
|
||||
page.i18n = "hd_idle"
|
||||
page.dependent = true
|
||||
end
|
|
@ -0,0 +1,7 @@
|
|||
disk = 'Festplatte'
|
||||
enable_debug = 'Debug-Ausgaben aktivieren'
|
||||
hd_idle = 'hd-idle'
|
||||
hd_idle_desc = 'hd-idle ist ein Hilfsprogramm um externe Festplatten nach einer festgelegten Leerlaufzeit herunter zu fahren.'
|
||||
idle_time_interval = 'Leerlaufzeit'
|
||||
idle_time_unit = 'Leerlaufzeiteinheit'
|
||||
settings = 'Einstellungen'
|
|
@ -0,0 +1,13 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
|
||||
<i18n:msgs xmlns:i18n="http://luci.freifunk-halle.net/2008/i18n#" xmlns="http://www.w3.org/1999/xhtml">
|
||||
|
||||
<i18n:msg xml:id="disk">Festplatte</i18n:msg>
|
||||
<i18n:msg xml:id="enable_debug">Debug-Ausgaben aktivieren</i18n:msg>
|
||||
<i18n:msg xml:id="hd_idle">hd-idle</i18n:msg>
|
||||
<i18n:msg xml:id="hd_idle_desc">hd-idle ist ein Hilfsprogramm um externe Festplatten nach einer festgelegten Leerlaufzeit herunter zu fahren.</i18n:msg>
|
||||
<i18n:msg xml:id="idle_time_interval">Leerlaufzeit</i18n:msg>
|
||||
<i18n:msg xml:id="idle_time_unit">Leerlaufzeiteinheit</i18n:msg>
|
||||
<i18n:msg xml:id="settings">Einstellungen</i18n:msg>
|
||||
|
||||
</i18n:msgs>
|
|
@ -0,0 +1,7 @@
|
|||
disk = 'Disk'
|
||||
enable_debug = 'Enable debug'
|
||||
hd_idle = 'hd-idle'
|
||||
hd_idle_desc = 'hd-idle is a utility program for spinning-down external disks after a period of idle time.'
|
||||
idle_time_interval = 'Idle-Time'
|
||||
idle_time_unit = 'Idle-Time unit'
|
||||
settings = 'Settings'
|
|
@ -0,0 +1,13 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
|
||||
<i18n:msgs xmlns:i18n="http://luci.freifunk-halle.net/2008/i18n#" xmlns="http://www.w3.org/1999/xhtml">
|
||||
|
||||
<i18n:msg xml:id="disk">Disk</i18n:msg>
|
||||
<i18n:msg xml:id="enable_debug">Enable debug</i18n:msg>
|
||||
<i18n:msg xml:id="hd_idle">hd-idle</i18n:msg>
|
||||
<i18n:msg xml:id="hd_idle_desc">hd-idle is a utility program for spinning-down external disks after a period of idle time.</i18n:msg>
|
||||
<i18n:msg xml:id="idle_time_interval">Idle-Time</i18n:msg>
|
||||
<i18n:msg xml:id="idle_time_unit">Idle-Time unit</i18n:msg>
|
||||
<i18n:msg xml:id="settings">Settings</i18n:msg>
|
||||
|
||||
</i18n:msgs>
|
|
@ -0,0 +1,7 @@
|
|||
disk = 'Disco'
|
||||
enable_debug = 'Habilitar debug'
|
||||
hd_idle = 'Hd-idle'
|
||||
hd_idle_desc = 'Hd-idle é um programa utilitário para ativar o modo "economia de energia" (spinning-down) de discos externos após um período de ociosidade.'
|
||||
idle_time_interval = 'Tempo de ociosidade'
|
||||
idle_time_unit = 'Unidade do tempo de ociosidade'
|
||||
settings = 'Configurações'
|
|
@ -0,0 +1,13 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
|
||||
<i18n:msgs xmlns:i18n="http://luci.freifunk-halle.net/2008/i18n#" xmlns="http://www.w3.org/1999/xhtml">
|
||||
|
||||
<i18n:msg xml:id="disk">Disco</i18n:msg>
|
||||
<i18n:msg xml:id="enable_debug">Habilitar debug</i18n:msg>
|
||||
<i18n:msg xml:id="hd_idle">Hd-idle</i18n:msg>
|
||||
<i18n:msg xml:id="hd_idle_desc">Hd-idle é um programa utilitário para ativar o modo "economia de energia" (spinning-down) de discos externos após um período de ociosidade.</i18n:msg>
|
||||
<i18n:msg xml:id="idle_time_interval">Tempo de ociosidade</i18n:msg>
|
||||
<i18n:msg xml:id="idle_time_unit">Unidade do tempo de ociosidade</i18n:msg>
|
||||
<i18n:msg xml:id="settings">Configurações</i18n:msg>
|
||||
|
||||
</i18n:msgs>
|
|
@ -0,0 +1,41 @@
|
|||
--[[
|
||||
|
||||
LuCI hd-idle
|
||||
(c) 2008 Yanira <forum-2008@email.de>
|
||||
|
||||
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: hd_idle.lua 3503 2008-10-03 16:49:00Z jow $
|
||||
|
||||
]]--
|
||||
|
||||
require("luci.fs")
|
||||
|
||||
m = Map("hd-idle", translate("hd_idle"), translate("hd_idle_desc"))
|
||||
|
||||
s = m:section(TypedSection, "hd-idle", translate("settings"))
|
||||
s.anonymous = true
|
||||
|
||||
s:option(Flag, "enabled", translate("enable", "Enable"))
|
||||
|
||||
disk = s:option(Value, "disk", translate("disk"))
|
||||
disk.rmempty = true
|
||||
for _, dev in ipairs(luci.fs.glob("/dev/[sh]d[a-z]")) do
|
||||
disk:value(luci.fs.basename(dev))
|
||||
end
|
||||
|
||||
s:option(Value, "idle_time_interval", translate("idle_time_interval")).default = 10
|
||||
s.rmempty = true
|
||||
unit = s:option(ListValue, "idle_time_unit", translate("idle_time_unit"))
|
||||
unit.default = "minutes"
|
||||
unit:value("minutes", "min")
|
||||
unit:value("hours", "h")
|
||||
unit.rmempty = true
|
||||
|
||||
s:option(Flag, "enable_debug", translate("enable_debug"))
|
||||
|
||||
return m
|
|
@ -0,0 +1,7 @@
|
|||
#!/bin/sh
|
||||
|
||||
uci batch <<-EOF
|
||||
add ucitrack hd-idle
|
||||
set ucitrack.@hd-idle[-1].init=hd-idle
|
||||
commit ucitrack
|
||||
EOF
|
|
@ -0,0 +1,2 @@
|
|||
include ../../build/config.mk
|
||||
include ../../build/module.mk
|
|
@ -0,0 +1,29 @@
|
|||
--[[
|
||||
LuCI - Lua Configuration Interface
|
||||
|
||||
Copyright 2008 Steven Barth <steven@midlink.org>
|
||||
Copyright 2008 Jo-Philipp Wich <xm@leipzig.freifunk.net>
|
||||
|
||||
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: init.lua 3987 2009-01-02 21:35:25Z Cyrus $
|
||||
]]--
|
||||
module("luci.controller.init", package.seeall)
|
||||
|
||||
function index()
|
||||
if not luci.fs.access("/etc/rc.common") then
|
||||
return
|
||||
end
|
||||
|
||||
require("luci.i18n")
|
||||
luci.i18n.loadc("initmgr")
|
||||
|
||||
entry(
|
||||
{"admin", "system", "init"}, form("init/init"),
|
||||
luci.i18n.translate("initmgr", "Init Scripts")
|
||||
).i18n = "initmgr"
|
||||
end
|
|
@ -0,0 +1,5 @@
|
|||
initmgr = 'Startscripte'
|
||||
initmgr_desc = 'Hier können installierte Startscripte aktiviert oder deaktiviert werden. Änderungen werden erst mit einem Geräteneustart angewendet.<br /><strong>Warnung: Wenn essentialle Startscripte wie "network" deaktiviert werden könnte das Gerät unerreichbar werden!</strong>'
|
||||
initmgr_index = 'Startpriorität'
|
||||
initmgr_name = 'Startscript'
|
||||
initmgr_enabled = 'Aktivieren/Deaktivieren'
|
|
@ -0,0 +1,11 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
|
||||
<i18n:msgs xmlns:i18n="http://luci.freifunk-halle.net/2008/i18n#" xmlns="http://www.w3.org/1999/xhtml">
|
||||
|
||||
<i18n:msg xml:id="initmgr">Startscripte</i18n:msg>
|
||||
<i18n:msg xml:id="initmgr_desc">Hier können installierte Startscripte aktiviert oder deaktiviert werden. Änderungen werden erst mit einem Geräteneustart angewendet.<br /><strong>Warnung: Wenn essentialle Startscripte wie "network" deaktiviert werden könnte das Gerät unerreichbar werden!</strong></i18n:msg>
|
||||
<i18n:msg xml:id="initmgr_index">Startpriorität</i18n:msg>
|
||||
<i18n:msg xml:id="initmgr_name">Startscript</i18n:msg>
|
||||
<i18n:msg xml:id="initmgr_enabled">Aktivieren/Deaktivieren</i18n:msg>
|
||||
|
||||
</i18n:msgs>
|
|
@ -0,0 +1,5 @@
|
|||
initmgr = 'Initscripts'
|
||||
initmgr_desc = 'You can enable or disable installed init scripts here. Changes will applied after a device reboot.<br /><strong>Warning: If you disable essential init scripts like "network", your device might become inaccesable!</strong>'
|
||||
initmgr_index = 'Start priority'
|
||||
initmgr_name = 'Initscript'
|
||||
initmgr_enabled = 'Enable/Disable'
|
|
@ -0,0 +1,11 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
|
||||
<i18n:msgs xmlns:i18n="http://luci.freifunk-halle.net/2008/i18n#" xmlns="http://www.w3.org/1999/xhtml">
|
||||
|
||||
<i18n:msg xml:id="initmgr">Initscripts</i18n:msg>
|
||||
<i18n:msg xml:id="initmgr_desc">You can enable or disable installed init scripts here. Changes will applied after a device reboot.<br /><strong>Warning: If you disable essential init scripts like "network", your device might become inaccesable!</strong></i18n:msg>
|
||||
<i18n:msg xml:id="initmgr_index">Start priority</i18n:msg>
|
||||
<i18n:msg xml:id="initmgr_name">Initscript</i18n:msg>
|
||||
<i18n:msg xml:id="initmgr_enabled">Enable/Disable</i18n:msg>
|
||||
|
||||
</i18n:msgs>
|
|
@ -0,0 +1,5 @@
|
|||
initmgr = 'Scripts de Inicialização'
|
||||
initmgr_desc = 'Você pode ativar ou desativar os scripts de inicialização instalados aqui. As mudanças serão aplicadas após a reinicialização do equipamento.<br /><strong>Aviso: Se você desativar algum script de inicialização essencial como por exemplo "rede/network", o dispositivo poderá tornar-se inacessível!</strong>'
|
||||
initmgr_index = 'Prioridade de inicialização'
|
||||
initmgr_name = 'Script de inicialização'
|
||||
initmgr_enabled = 'Ativar/Desativar'
|
|
@ -0,0 +1,11 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
|
||||
<i18n:msgs xmlns:i18n="http://luci.freifunk-halle.net/2008/i18n#" xmlns="http://www.w3.org/1999/xhtml">
|
||||
|
||||
<i18n:msg xml:id="initmgr">Scripts de Inicialização</i18n:msg>
|
||||
<i18n:msg xml:id="initmgr_desc">Você pode ativar ou desativar os scripts de inicialização instalados aqui. As mudanças serão aplicadas após a reinicialização do equipamento.<br /><strong>Aviso: Se você desativar algum script de inicialização essencial como por exemplo "rede/network", o dispositivo poderá tornar-se inacessível!</strong></i18n:msg>
|
||||
<i18n:msg xml:id="initmgr_index">Prioridade de inicialização</i18n:msg>
|
||||
<i18n:msg xml:id="initmgr_name">Script de inicialização</i18n:msg>
|
||||
<i18n:msg xml:id="initmgr_enabled">Ativar/Desativar</i18n:msg>
|
||||
|
||||
</i18n:msgs>
|
|
@ -0,0 +1,58 @@
|
|||
--[[
|
||||
LuCI - Lua Configuration Interface
|
||||
|
||||
Copyright 2008 Steven Barth <steven@midlink.org>
|
||||
Copyright 2008 Jo-Philipp Wich <xm@leipzig.freifunk.net>
|
||||
|
||||
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: init.lua 3528 2008-10-06 20:09:06Z jow $
|
||||
]]--
|
||||
|
||||
require("luci.sys")
|
||||
require("luci.util")
|
||||
|
||||
local inits = { }
|
||||
|
||||
for _, name in ipairs(luci.sys.init.names()) do
|
||||
local index = luci.sys.init.index(name)
|
||||
local enabled = luci.sys.init.enabled(name)
|
||||
|
||||
inits["%02i.%s" % { index, name }] = {
|
||||
name = name,
|
||||
index = tostring(index),
|
||||
enabled = enabled
|
||||
}
|
||||
end
|
||||
|
||||
|
||||
m = SimpleForm("initmgr", translate("initmgr"), translate("initmgr_desc"))
|
||||
m.reset = false
|
||||
|
||||
s = m:section(Table, inits)
|
||||
|
||||
i = s:option(DummyValue, "index", translate("initmgr_index"))
|
||||
n = s:option(DummyValue, "name", translate("initmgr_name"))
|
||||
|
||||
e = s:option(Flag, "enabled", translate("initmgr_enabled"))
|
||||
|
||||
e.cfgvalue = function(self, section)
|
||||
return inits[section].enabled and "1" or "0"
|
||||
end
|
||||
|
||||
e.write = function(self, section, value)
|
||||
if value == "1" and not inits[section].enabled then
|
||||
inits[section].enabled = true
|
||||
return luci.sys.init.enable(inits[section].name)
|
||||
elseif value == "0" and inits[section].enabled then
|
||||
inits[section].enabled = false
|
||||
return luci.sys.init.disable(inits[section].name)
|
||||
end
|
||||
return true
|
||||
end
|
||||
|
||||
return m
|
|
@ -0,0 +1,2 @@
|
|||
include ../../build/config.mk
|
||||
include ../../build/module.mk
|
|
@ -0,0 +1,19 @@
|
|||
if(!window.CanvasRenderingContext2D){(function(){var I=Math,i=I.round,L=I.sin,M=I.cos,m=10,A=m/2,Q={init:function(a){var b=a||document;if(/MSIE/.test(navigator.userAgent)&&!window.opera){var c=this;b.attachEvent("onreadystatechange",function(){c.r(b)})}},r:function(a){if(a.readyState=="complete"){if(!a.namespaces["s"]){a.namespaces.add("g_vml_","urn:schemas-microsoft-com:vml")}var b=a.createStyleSheet();b.cssText="canvas{display:inline-block;overflow:hidden;text-align:left;width:300px;height:150px}g_vml_\\:*{behavior:url(#default#VML)}";
|
||||
var c=a.getElementsByTagName("canvas");for(var d=0;d<c.length;d++){if(!c[d].getContext){this.initElement(c[d])}}}},q:function(a){var b=a.outerHTML,c=a.ownerDocument.createElement(b);if(b.slice(-2)!="/>"){var d="/"+a.tagName,e;while((e=a.nextSibling)&&e.tagName!=d){e.removeNode()}if(e){e.removeNode()}}a.parentNode.replaceChild(c,a);return c},initElement:function(a){a=this.q(a);a.getContext=function(){if(this.l){return this.l}return this.l=new K(this)};a.attachEvent("onpropertychange",V);a.attachEvent("onresize",
|
||||
W);var b=a.attributes;if(b.width&&b.width.specified){a.style.width=b.width.nodeValue+"px"}else{a.width=a.clientWidth}if(b.height&&b.height.specified){a.style.height=b.height.nodeValue+"px"}else{a.height=a.clientHeight}return a}};function V(a){var b=a.srcElement;switch(a.propertyName){case "width":b.style.width=b.attributes.width.nodeValue+"px";b.getContext().clearRect();break;case "height":b.style.height=b.attributes.height.nodeValue+"px";b.getContext().clearRect();break}}function W(a){var b=a.srcElement;
|
||||
if(b.firstChild){b.firstChild.style.width=b.clientWidth+"px";b.firstChild.style.height=b.clientHeight+"px"}}Q.init();var R=[];for(var E=0;E<16;E++){for(var F=0;F<16;F++){R[E*16+F]=E.toString(16)+F.toString(16)}}function J(){return[[1,0,0],[0,1,0],[0,0,1]]}function G(a,b){var c=J();for(var d=0;d<3;d++){for(var e=0;e<3;e++){var g=0;for(var h=0;h<3;h++){g+=a[d][h]*b[h][e]}c[d][e]=g}}return c}function N(a,b){b.fillStyle=a.fillStyle;b.lineCap=a.lineCap;b.lineJoin=a.lineJoin;b.lineWidth=a.lineWidth;b.miterLimit=
|
||||
a.miterLimit;b.shadowBlur=a.shadowBlur;b.shadowColor=a.shadowColor;b.shadowOffsetX=a.shadowOffsetX;b.shadowOffsetY=a.shadowOffsetY;b.strokeStyle=a.strokeStyle;b.d=a.d;b.e=a.e}function O(a){var b,c=1;a=String(a);if(a.substring(0,3)=="rgb"){var d=a.indexOf("(",3),e=a.indexOf(")",d+1),g=a.substring(d+1,e).split(",");b="#";for(var h=0;h<3;h++){b+=R[Number(g[h])]}if(g.length==4&&a.substr(3,1)=="a"){c=g[3]}}else{b=a}return[b,c]}function S(a){switch(a){case "butt":return"flat";case "round":return"round";
|
||||
case "square":default:return"square"}}function K(a){this.a=J();this.m=[];this.k=[];this.c=[];this.strokeStyle="#000";this.fillStyle="#000";this.lineWidth=1;this.lineJoin="miter";this.lineCap="butt";this.miterLimit=m*1;this.globalAlpha=1;this.canvas=a;var b=a.ownerDocument.createElement("div");b.style.width=a.clientWidth+"px";b.style.height=a.clientHeight+"px";b.style.overflow="hidden";b.style.position="absolute";a.appendChild(b);this.j=b;this.d=1;this.e=1}var j=K.prototype;j.clearRect=function(){this.j.innerHTML=
|
||||
"";this.c=[]};j.beginPath=function(){this.c=[]};j.moveTo=function(a,b){this.c.push({type:"moveTo",x:a,y:b});this.f=a;this.g=b};j.lineTo=function(a,b){this.c.push({type:"lineTo",x:a,y:b});this.f=a;this.g=b};j.bezierCurveTo=function(a,b,c,d,e,g){this.c.push({type:"bezierCurveTo",cp1x:a,cp1y:b,cp2x:c,cp2y:d,x:e,y:g});this.f=e;this.g=g};j.quadraticCurveTo=function(a,b,c,d){var e=this.f+0.6666666666666666*(a-this.f),g=this.g+0.6666666666666666*(b-this.g),h=e+(c-this.f)/3,l=g+(d-this.g)/3;this.bezierCurveTo(e,
|
||||
g,h,l,c,d)};j.arc=function(a,b,c,d,e,g){c*=m;var h=g?"at":"wa",l=a+M(d)*c-A,n=b+L(d)*c-A,o=a+M(e)*c-A,f=b+L(e)*c-A;if(l==o&&!g){l+=0.125}this.c.push({type:h,x:a,y:b,radius:c,xStart:l,yStart:n,xEnd:o,yEnd:f})};j.rect=function(a,b,c,d){this.moveTo(a,b);this.lineTo(a+c,b);this.lineTo(a+c,b+d);this.lineTo(a,b+d);this.closePath()};j.strokeRect=function(a,b,c,d){this.beginPath();this.moveTo(a,b);this.lineTo(a+c,b);this.lineTo(a+c,b+d);this.lineTo(a,b+d);this.closePath();this.stroke()};j.fillRect=function(a,
|
||||
b,c,d){this.beginPath();this.moveTo(a,b);this.lineTo(a+c,b);this.lineTo(a+c,b+d);this.lineTo(a,b+d);this.closePath();this.fill()};j.createLinearGradient=function(a,b,c,d){var e=new H("gradient");return e};j.createRadialGradient=function(a,b,c,d,e,g){var h=new H("gradientradial");h.n=c;h.o=g;h.i.x=a;h.i.y=b;return h};j.drawImage=function(a,b){var c,d,e,g,h,l,n,o,f=a.runtimeStyle.width,k=a.runtimeStyle.height;a.runtimeStyle.width="auto";a.runtimeStyle.height="auto";var q=a.width,r=a.height;a.runtimeStyle.width=
|
||||
f;a.runtimeStyle.height=k;if(arguments.length==3){c=arguments[1];d=arguments[2];h=(l=0);n=(e=q);o=(g=r)}else if(arguments.length==5){c=arguments[1];d=arguments[2];e=arguments[3];g=arguments[4];h=(l=0);n=q;o=r}else if(arguments.length==9){h=arguments[1];l=arguments[2];n=arguments[3];o=arguments[4];c=arguments[5];d=arguments[6];e=arguments[7];g=arguments[8]}else{throw"Invalid number of arguments";}var s=this.b(c,d),t=[],v=10,w=10;t.push(" <g_vml_:group",' coordsize="',m*v,",",m*w,'"',' coordorigin="0,0"',
|
||||
' style="width:',v,";height:",w,";position:absolute;");if(this.a[0][0]!=1||this.a[0][1]){var x=[];x.push("M11='",this.a[0][0],"',","M12='",this.a[1][0],"',","M21='",this.a[0][1],"',","M22='",this.a[1][1],"',","Dx='",i(s.x/m),"',","Dy='",i(s.y/m),"'");var p=s,y=this.b(c+e,d),z=this.b(c,d+g),B=this.b(c+e,d+g);p.x=Math.max(p.x,y.x,z.x,B.x);p.y=Math.max(p.y,y.y,z.y,B.y);t.push("padding:0 ",i(p.x/m),"px ",i(p.y/m),"px 0;filter:progid:DXImageTransform.Microsoft.Matrix(",x.join(""),", sizingmethod='clip');")}else{t.push("top:",
|
||||
i(s.y/m),"px;left:",i(s.x/m),"px;")}t.push(' ">','<g_vml_:image src="',a.src,'"',' style="width:',m*e,";"," height:",m*g,';"',' cropleft="',h/q,'"',' croptop="',l/r,'"',' cropright="',(q-h-n)/q,'"',' cropbottom="',(r-l-o)/r,'"'," />","</g_vml_:group>");this.j.insertAdjacentHTML("BeforeEnd",t.join(""))};j.stroke=function(a){var b=[],c=O(a?this.fillStyle:this.strokeStyle),d=c[0],e=c[1]*this.globalAlpha,g=10,h=10;b.push("<g_vml_:shape",' fillcolor="',d,'"',' filled="',Boolean(a),'"',' style="position:absolute;width:',
|
||||
g,";height:",h,';"',' coordorigin="0 0" coordsize="',m*g," ",m*h,'"',' stroked="',!a,'"',' strokeweight="',this.lineWidth,'"',' strokecolor="',d,'"',' path="');var l={x:null,y:null},n={x:null,y:null};for(var o=0;o<this.c.length;o++){var f=this.c[o];if(f.type=="moveTo"){b.push(" m ");var k=this.b(f.x,f.y);b.push(i(k.x),",",i(k.y))}else if(f.type=="lineTo"){b.push(" l ");var k=this.b(f.x,f.y);b.push(i(k.x),",",i(k.y))}else if(f.type=="close"){b.push(" x ")}else if(f.type=="bezierCurveTo"){b.push(" c ");
|
||||
var k=this.b(f.x,f.y),q=this.b(f.cp1x,f.cp1y),r=this.b(f.cp2x,f.cp2y);b.push(i(q.x),",",i(q.y),",",i(r.x),",",i(r.y),",",i(k.x),",",i(k.y))}else if(f.type=="at"||f.type=="wa"){b.push(" ",f.type," ");var k=this.b(f.x,f.y),s=this.b(f.xStart,f.yStart),t=this.b(f.xEnd,f.yEnd);b.push(i(k.x-this.d*f.radius),",",i(k.y-this.e*f.radius)," ",i(k.x+this.d*f.radius),",",i(k.y+this.e*f.radius)," ",i(s.x),",",i(s.y)," ",i(t.x),",",i(t.y))}if(k){if(l.x==null||k.x<l.x){l.x=k.x}if(n.x==null||k.x>n.x){n.x=k.x}if(l.y==
|
||||
null||k.y<l.y){l.y=k.y}if(n.y==null||k.y>n.y){n.y=k.y}}}b.push(' ">');if(typeof this.fillStyle=="object"){var v={x:"50%",y:"50%"},w=n.x-l.x,x=n.y-l.y,p=w>x?w:x;v.x=i(this.fillStyle.i.x/w*100+50)+"%";v.y=i(this.fillStyle.i.y/x*100+50)+"%";var y=[];if(this.fillStyle.p=="gradientradial"){var z=this.fillStyle.n/p*100,B=this.fillStyle.o/p*100-z}else{var z=0,B=100}var C={offset:null,color:null},D={offset:null,color:null};this.fillStyle.h.sort(function(T,U){return T.offset-U.offset});for(var o=0;o<this.fillStyle.h.length;o++){var u=
|
||||
this.fillStyle.h[o];y.push(u.offset*B+z,"% ",u.color,",");if(u.offset>C.offset||C.offset==null){C.offset=u.offset;C.color=u.color}if(u.offset<D.offset||D.offset==null){D.offset=u.offset;D.color=u.color}}y.pop();b.push("<g_vml_:fill",' color="',D.color,'"',' color2="',C.color,'"',' type="',this.fillStyle.p,'"',' focusposition="',v.x,", ",v.y,'"',' colors="',y.join(""),'"',' opacity="',e,'" />')}else if(a){b.push('<g_vml_:fill color="',d,'" opacity="',e,'" />')}else{b.push("<g_vml_:stroke",' opacity="',
|
||||
e,'"',' joinstyle="',this.lineJoin,'"',' miterlimit="',this.miterLimit,'"',' endcap="',S(this.lineCap),'"',' weight="',this.lineWidth,'px"',' color="',d,'" />')}b.push("</g_vml_:shape>");this.j.insertAdjacentHTML("beforeEnd",b.join(""));this.c=[]};j.fill=function(){this.stroke(true)};j.closePath=function(){this.c.push({type:"close"})};j.b=function(a,b){return{x:m*(a*this.a[0][0]+b*this.a[1][0]+this.a[2][0])-A,y:m*(a*this.a[0][1]+b*this.a[1][1]+this.a[2][1])-A}};j.save=function(){var a={};N(this,a);
|
||||
this.k.push(a);this.m.push(this.a);this.a=G(J(),this.a)};j.restore=function(){N(this.k.pop(),this);this.a=this.m.pop()};j.translate=function(a,b){var c=[[1,0,0],[0,1,0],[a,b,1]];this.a=G(c,this.a)};j.rotate=function(a){var b=M(a),c=L(a),d=[[b,c,0],[-c,b,0],[0,0,1]];this.a=G(d,this.a)};j.scale=function(a,b){this.d*=a;this.e*=b;var c=[[a,0,0],[0,b,0],[0,0,1]];this.a=G(c,this.a)};j.clip=function(){};j.arcTo=function(){};j.createPattern=function(){return new P};function H(a){this.p=a;this.n=0;this.o=
|
||||
0;this.h=[];this.i={x:0,y:0}}H.prototype.addColorStop=function(a,b){b=O(b);this.h.push({offset:1-a,color:b})};function P(){}G_vmlCanvasManager=Q;CanvasRenderingContext2D=K;CanvasGradient=H;CanvasPattern=P})()};
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue