openwrt: remove the host directory within the LuCI package

This commit is contained in:
Bart Van Der Meerssche 2010-09-20 00:53:06 +02:00
parent 13424b5800
commit e00f6a91ec
601 changed files with 0 additions and 60051 deletions

View File

@ -1,121 +0,0 @@
#!/usr/bin/env lua
-------------------------------------------------------------------------------
-- LuaDoc launcher.
-- @release $Id: luadoc.lua.in,v 1.1 2008/02/17 06:42:51 jasonsantos Exp $
-------------------------------------------------------------------------------
require "luadoc"
-------------------------------------------------------------------------------
-- Print version number.
local function print_version ()
print (string.format("%s\n%s\n%s",
luadoc._VERSION,
luadoc._DESCRIPTION,
luadoc._COPYRIGHT))
end
-------------------------------------------------------------------------------
-- Print usage message.
local function print_help ()
print ("Usage: "..arg[0]..[[ [options|files]
Generate documentation from files. Available options are:
-d path output directory path
-t path template directory path
-h, --help print this help and exit
--noindexpage do not generate global index page
--nofiles do not generate documentation for files
--nomodules do not generate documentation for modules
--doclet doclet_module doclet module to generate output
--taglet taglet_module taglet module to parse input code
-q, --quiet suppress all normal output
-v, --version print version information]])
end
local function off_messages (arg, i, options)
options.verbose = nil
end
-------------------------------------------------------------------------------
-- Process options. TODO: use getopts.
-- @class table
-- @name OPTIONS
local OPTIONS = {
d = function (arg, i, options)
local dir = arg[i+1]
if string.sub (dir, -2) ~= "/" then
dir = dir..'/'
end
options.output_dir = dir
return 1
end,
t = function (arg, i, options)
local dir = arg[i+1]
if string.sub (dir, -2) ~= "/" then
dir = dir..'/'
end
options.template_dir = dir
return 1
end,
h = print_help,
help = print_help,
q = off_messages,
quiet = off_messages,
v = print_version,
version = print_version,
doclet = function (arg, i, options)
options.doclet = arg[i+1]
return 1
end,
taglet = function (arg, i, options)
options.taglet = arg[i+1]
return 1
end,
}
-------------------------------------------------------------------------------
local function process_options (arg)
local files = {}
local options = require "luadoc.config"
local i = 1
while i <= #arg do
local argi = arg[i]
if string.sub (argi, 1, 1) ~= '-' then
table.insert (files, argi)
else
local opt = string.sub (argi, 2)
if string.sub (opt, 1, 1) == '-' then
opt = string.gsub (opt, "%-", "")
end
if OPTIONS[opt] then
if OPTIONS[opt] (arg, i, options) then
i = i + 1
end
else
options[opt] = 1
end
end
i = i+1
end
return files, options
end
-------------------------------------------------------------------------------
-- Main function. Process command-line parameters and call luadoc processor.
function main (arg)
-- Process options
local argc = #arg
if argc < 1 then
print_help ()
return
end
local files, options = process_options (arg)
return luadoc.main(files, options)
end
main(arg)

View File

@ -1,2 +0,0 @@
#!/bin/sh
$(dirname $0)/../usr/bin/uci -c $(dirname $0)/../etc/config "$@"

View File

@ -1,7 +0,0 @@
#!/bin/sh
for i in $(find $(dirname $0)/../etc/uci-defaults -type f -not -name "$2")
do
[ -f $i ] && {
bash $i; rm $i
}
done

View File

@ -1,17 +0,0 @@
Port 80
ErrorLog /dev/stderr
AccessLog /dev/stderr
DocumentRoot /www
DirectoryMaker /usr/lib/boa/boa_indexer
KeepAliveMax 1000
KeepAliveTimeout 10
MimeTypes /etc/mime.types
DefaultType text/plain
ServerName localhost
CGIPath /bin:/usr/bin
AddType application/x-httpd-cgi cgi
AddType application/x-httpd-cgi sh
ScriptAlias /cgi-bin/ /www/cgi-bin
PluginRoot /usr/lib/boa

View File

@ -1,10 +0,0 @@
config batmand general
option interface ath0
option announce
option gateway_class
option originator_interval
option preferred_gateway
option routing_class
option visualisation_srv
option policy_routing_script

View File

@ -1,85 +0,0 @@
#################################################################
# In order to enable dynamic dns you need at least one section,
# and in that seciton the "enabled" option must be set to one
#
# Each section represents an update to a different service
#
# You specify your domain name, your username and your password
# with the optins "domain", "username" and "password" respectively
#
# Next you need to specify the name of the service you are
# connecting to "eg. dyndns.org". The format of the update
# urls for several different dynamic dns services is specified
# in the /usr/lib/ddns/services file. This list is hardly complete
# as there are many, many different dynamic dns services. If your
# service is on the list you can merely specify it with the
# "service_name" option. Otherwise you will need to determine
# the format of the url to update with. You can either add an
# entry to the /usr/lib/ddns/services file or specify this with
# the "update_url" option.
#
# We also need to specify the source of the ip address to associate with
# your domain. The "ip_source" option can be "network", "interface"
# or "web", with "network" as the default.
#
# If "ip_source" is "network" you specify a network section in your
# /etc/network config file (e.g. "wan", which is the default) with
# the "ip_network" option. If you specify "wan", you will update
# with whatever the ip for your wan is.
#
# If "ip_source" is "interface" you specify a hardware interface
# (e.g. "eth1") and whatever the current ip of this interface is
# will be associated with the domain when an update is performed.
#
# The last possibility is that "ip_source" is "web", which means
# that in order to obtain our ip address we will connect to a
# website, and the first valid ip address listed on that page
# will be assumed to be ours. If you are behind another firewall
# this is the best option since none of the local networks or
# interfaces will have the external ip. The website to connect
# to is specified by the "ip_url" option. You may specify multiple
# urls in the option, separated by whitespace.
#
# Finally we need to specify how often to check whether we need
# to check whether the ip address has changed (and if so update
# it) and how often we need to force an update ( many services
# will expire your domain if you don't connect and do an update
# every so often). Use the "check_interval" to specify how
# often to check whether an update is necessary, and the
# "force_interval" option to specify how often to force an
# update. Specify the units for these values with the "check_unit"
# and the "force_unit" options. Units can be "days", "hours",
# "minutes" or "seconds". The default force_unit is hours and the
# default check_unit is seconds. The default check_interval is
# 600 seconds, or ten minutes. The default force_interval is
# 72 hours or 3 days.
#
#
#########################################################
config service "myddns"
option enabled "0"
option service_name "dyndns.org"
option domain "mypersonaldomain.dyndns.org"
option username "myusername"
option password "mypassword"
option ip_source "network"
option ip_network "wan"
option force_interval "72"
option force_unit "hours"
option check_interval "10"
option check_unit "minutes"
#option ip_source "interface"
#option ip_interface "eth0.1"
#option ip_source "web"
#option ip_url "http://www.whatismyip.com/automation/n09230945.asp"
#option update_url "http://[USERNAME]:[PASSWORD]@members.dyndns.org/nic/update?hostname=[DOMAIN]&myip=[IP]"

View File

@ -1,23 +0,0 @@
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 'lan'
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

View File

@ -1,3 +0,0 @@
config dropbear
option PasswordAuth 'on'
option Port '22'

View File

@ -1,80 +0,0 @@
config defaults
option syn_flood 1
option input DROP
option output ACCEPT
option forward DROP
config zone
option name lan
option input ACCEPT
option output ACCEPT
option forward DROP
config zone
option name wan
option input DROP
option output ACCEPT
option forward DROP
option masq 1
config forwarding
option src lan
option dest wan
### 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 protocol 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_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

View File

@ -1,126 +0,0 @@
config settings wizard
config public contact
option nickname ''
option name ''
option mail ''
option phone ''
option location ''
option note ''
config public community
option name 'Freifunk'
option homepage 'http://freifunk.net'
config fw_rule icmp
option src freifunk
option target ACCEPT
option proto icmp
config fw_rule http
option src freifunk
option target ACCEPT
option proto tcp
option dest_port 80
config fw_rule https
option src freifunk
option target ACCEPT
option proto tcp
option dest_port 443
config fw_rule ssh
option src freifunk
option target ACCEPT
option proto tcp
option dest_port 22
config fw_rule olsr
option src freifunk
option target ACCEPT
option proto udp
option dest_port 698
config fw_forwarding lan
option src lan
option dest freifunk
config fw_forwarding fffwd
option src freifunk
option dest freifunk
config defaults wifi_device
option channel 1
option diversity 1
option disabled 0
option txpower 10
config defaults wifi_iface
option mode adhoc
option bssid 02:CA:FF:EE:BA:BE
option sw_merge 1
config defaults interface
option netmask 255.0.0.0
option dns "88.198.178.18 141.54.1.1 212.204.49.83 208.67.220.220 208.67.222.222"
config defaults alias
option netmask 255.255.255.0
config defaults dhcp
option leasetime 30m
config defaults olsr_interface
option HelloInterval 6.0
option HelloValidityTime 108.0
option TcInterval 4.0
option TcValidityTime 324.0
option MidInterval 18.0
option MidValidityTime 324.0
option HnaInterval 18.0
option HnaValidityTime 108.0
config community leipzig
option name "Freifunk Leipzig"
option homepage http://leipzig.freifunk.net
option ssid "leipzig.freifunk.net"
option prefix "104.61"
config community halle
option name "Freifunk Halle"
option homepage http://halle.freifunk.net
option ssid "halle.freifunk.net"
option prefix "104.62"
config community l59
option name "Freifunk L59"
option homepage http://freifunk.net
option ssid "start.freifunk.net"
option prefix "104.59"
config community berlin
option name "Freifunk Berlin"
option homepage http://berlin.freifunk.net
option ssid "olsr.freifunk.net"
option prefix "104"
option external freifunk_berlin
config community hannover
option name "Freifunk Hannover"
option homepage http://hannover.freifunk.net
option ssid "hannover.freifunk.net"
option prefix "10.2"
option external freifunk_hannover
config community augsburg
option name "Freifunk Augsburg"
option homepage http://augsburg.freifunk.net
option ssid "augsburg.freifunk.net"
option prefix "191.161"
option external freifunk_augsburg

View File

@ -1,2 +0,0 @@
config defaults interface
option netmask 255.255.0.0

View File

@ -1,2 +0,0 @@
config defaults wifi_device
option channel 10

View File

@ -1,5 +0,0 @@
config defaults wifi_iface
option bssid CA:FF:EE:CA:FF:EE
config defaults interface
option netmask 255.255.0.0

View File

@ -1,10 +0,0 @@
config mount
option target /home
option device /dev/sda1
option fstype ext3
option options rw,sync
option enabled 0
config swap
option device /dev/sda2
option enabled 0

View File

@ -1,5 +0,0 @@
config 'httpd'
option 'port' '80'
option 'home' '/www'

View File

@ -1,43 +0,0 @@
config 'core' 'main'
option 'lang' 'auto'
option 'mediaurlbase' '/luci-static/openwrt.org'
option 'resourcebase' '/luci-static/resources'
config 'extern' 'flash_keep'
option 'uci' '/etc/config/'
option 'dropbear' '/etc/dropbear/'
option 'openvpn' '/etc/openvpn/'
option 'passwd' '/etc/passwd'
option 'opkg' '/etc/opkg.conf'
option 'firewall' '/etc/firewall.user'
option 'uploads' '/lib/uci/upload/'
config 'internal' 'languages'
option 'ru' 'Russian'
option 'it' 'Italian'
option 'en' 'English'
option 'de' 'Deutsch'
option 'fr' 'Francais'
option 'pt_br' 'Portuguese (Brazilian)'
config 'internal' 'sauth'
option 'sessionpath' '/tmp/luci-sessions'
option 'sessiontime' '3600'
config 'internal' 'ccache'
option 'enable' '1'
config 'internal' 'template'
option 'compiler_mode' 'file'
option 'compiledir' '/tmp/luci-templatecache'
config 'internal' 'themes'
option 'OpenWrt_Light' '/luci-static/openwrt-light'
option 'Fledermaus' '/luci-static/fledermaus'
option 'Oxygen' '/luci-static/oxygen'
option 'OpenWrtOxygen' '/luci-static/openwrt.org-oxygen'
option 'OpenWrt' '/luci-static/openwrt.org'
option 'Freifunk' '/luci-static/freifunk'
option 'Freifunk_BNO' '/luci-static/freifunk-bno'

View File

@ -1,2 +0,0 @@
config core general
option leasetime 1

View File

@ -1,132 +0,0 @@
config 'statistics' 'rrdtool'
option 'default_timespan' '1hour'
option 'image_width' '400'
option 'image_path' '/tmp/rrdimg'
config 'statistics' 'collectd'
option 'BaseDir' '/var/run/collectd'
option 'Include' '/etc/collectd/conf.d'
option 'PIDFile' '/var/run/collectd.pid'
option 'PluginDir' '/usr/lib/collectd'
option 'TypesDB' '/usr/lib/collectd/types.db'
option 'Interval' '30'
option 'ReadThreads' '2'
config 'statistics' 'collectd_ping'
option 'enable' '0'
option 'TTL' '127'
option 'Hosts' '127.0.0.1'
config 'statistics' 'collectd_csv'
option 'enable' '0'
option 'StoreRates' '0'
option 'DataDir' '/tmp'
config 'statistics' 'collectd_df'
option 'enable' '0'
option 'Devices' '/dev/mtdblock/4'
option 'MountPoints' '/jffs'
option 'FSTypes' 'tmpfs'
option 'IgnoreSelected' '0'
config 'statistics' 'collectd_disk'
option 'enable' '0'
option 'Disks' 'hda1 hdb'
option 'IgnoreSelected' '0'
config 'statistics' 'collectd_dns'
option 'enable' '0'
option 'Interfaces' 'ffdhcp ff br-lan'
option 'IgnoreSources' '127.0.0.1'
config 'statistics' 'collectd_email'
option 'enable' '0'
option 'SocketFile' '/var/run/collectd/email.sock'
option 'SocketGroup' 'nogroup'
config 'statistics' 'collectd_exec'
option 'enable' '1'
config 'collectd_exec_input'
option 'cmdline' '/usr/bin/stat-input-olsr'
config 'collectd_exec_notify'
option 'cmdline' '/usr/bin/stat-output-syslog'
config 'statistics' 'collectd_interface'
option 'enable' '1'
option 'Interfaces' 'br-lan br-ff'
option 'IgnoreSelected' '0'
config 'statistics' 'collectd_iptables'
option 'enable' '1'
config 'collectd_iptables_match'
option 'table' 'nat'
option 'chain' 'luci_fw_postrouting'
option 'target' 'MASQUERADE'
option 'source' '192.168.1.0/24'
option 'outputif' 'br-ff'
option 'name' 'Verkehr LAN-Clients'
config 'collectd_iptables_match'
option 'chain' 'luci_fw_postrouting'
option 'table' 'nat'
option 'target' 'MASQUERADE'
option 'source' '10.61.230.0/24'
option 'outputif' 'br-ff'
option 'name' 'Verkehr WLAN-Clients'
config 'statistics' 'collectd_irq'
option 'enable' '0'
option 'Irqs' '2 3 4 7'
config 'statistics' 'collectd_load'
option 'enable' '1'
config 'statistics' 'collectd_logfile'
option 'enable' '0'
option 'LogLevel' 'notice'
option 'File' '/var/log/collectd.log'
option 'Timestamp' '1'
config 'statistics' 'collectd_netlink'
option 'enable' '0'
option 'IgnoreSelected' '0'
option 'VerboseInterfaces' 'br-lan br-ff'
option 'QDiscs' 'br-lan br-ff'
config 'statistics' 'collectd_network'
option 'enable' '0'
config 'collectd_network_listen'
option 'host' '0.0.0.0'
config 'collectd_network_server'
option 'host' '0.0.0.0'
config 'statistics' 'collectd_processes'
option 'enable' '1'
config 'statistics' 'collectd_tcpconns'
option 'enable' '1'
option 'ListeningPorts' '0'
option 'LocalPorts' '22 80'
config 'statistics' 'collectd_unixsock'
option 'enable' '0'
option 'SocketFile' '/var/run/collectd/query.sock'
option 'SocketGroup' 'nogroup'
config 'statistics' 'collectd_wireless'
option 'enable' '1'
config 'statistics' 'collectd_cpu'
option 'enable' '1'
config 'statistics' 'collectd_rrdtool'
option 'enable' '1'
option 'DataDir' '/tmp'
option 'RRARows' '100'
option 'RRASingle' '1'
option 'RRATimespans' '10min 1hour 1day 1week 1month 1year'

View File

@ -1,6 +0,0 @@
config lucittpd lucittpd
option port 80
option timeout 90
option keepalive 0
option path /usr/lib/lucittpd/plugins/
option root /www

View File

@ -1,27 +0,0 @@
#### VLAN configuration
config switch eth0
option vlan0 "0 1 2 3 5*"
option vlan1 "4 5"
#### Loopback configuration
config interface loopback
option ifname "lo"
option proto static
option ipaddr 127.0.0.1
option netmask 255.0.0.0
#### LAN configuration
config interface lan
option type bridge
option ifname "eth0"
option proto static
option ipaddr 192.168.1.1
option netmask 255.255.255.0
#### WAN configuration
config interface wan
option ifname "wlan0"
option proto dhcp

View File

@ -1,22 +0,0 @@
config ntpserver
option hostname '0.openwrt.pool.ntp.org'
option port '123'
config ntpserver
option hostname '1.openwrt.pool.ntp.org'
option port '123'
config ntpserver
option hostname '2.openwrt.pool.ntp.org'
option port '123'
config ntpserver
option hostname '3.openwrt.pool.ntp.org'
option port '123'
config ntpdrift
option freq '0'
config ntpclient
option interval 60
#option count 10

View File

@ -1,89 +0,0 @@
# QoS configuration for OpenWrt
# INTERFACES:
config interface wan
option classgroup "Default"
option enabled 1
option overhead 1
option upload 128
option download 1024
# RULES:
config classify
option target "Bulk"
option ipp2p "all"
config classify
option target "Bulk"
option layer7 "edonkey"
config classify
option target "Bulk"
option layer7 "bittorrent"
config classify
option target "Priority"
option ports "22,53"
config classify
option target "Normal"
option proto "tcp"
option ports "20,21,25,80,110,443,993,995"
config classify
option target "Express"
option ports "5190"
config default
option target "Express"
option proto "udp"
option pktsize "-500"
config reclassify
option target "Priority"
option proto "icmp"
config default
option target "Bulk"
option portrange "1024-65535"
config reclassify
option target "Priority"
option proto "tcp"
option pktsize "-128"
option mark "!Bulk"
option tcpflags "SYN"
config reclassify
option target "Priority"
option proto "tcp"
option pktsize "-128"
option mark "!Bulk"
option tcpflags "ACK"
# Don't change the stuff below unless you
# really know what it means :)
config classgroup "Default"
option classes "Priority Express Normal Bulk"
option default "Normal"
config class "Priority"
option packetsize 400
option maxsize 400
option avgrate 10
option priority 20
config class "Priority_down"
option packetsize 1000
option avgrate 10
config class "Express"
option packetsize 1000
option maxsize 800
option avgrate 50
option priority 10
config class "Normal"
option packetsize 1500
option packetdelay 100
option avgrate 10
option priority 5
config class "Normal_down"
option avgrate 20
config class "Bulk"
option avgrate 1
option packetdelay 200

View File

@ -1,10 +0,0 @@
config siit ipv6
option ula_prefix "fd00::"
option ula_global "00ca:ffee:babe::"
option ula_subnet "0000:0000:0000:dada::"
option siit_prefix "::ffff:0000:0000"
config siit wifi
option essid "6mesh.freifunk.net"
option bssid "02:ca:ff:ee:ba:be"
option channel "1"

View File

@ -1,3 +0,0 @@
config system
option hostname OpenWrt
option timezone UTC

View File

@ -1,81 +0,0 @@
config 'network'
option 'init' 'network'
list 'affects' 'dhcp'
config 'wireless'
list 'affects' 'network'
config 'firewall'
option 'init' 'firewall'
list 'affects' 'luci-splash'
list 'affects' 'qos'
config 'olsr'
option 'init' 'olsrd'
config 'dhcp'
option 'init' 'dnsmasq'
config 'dropbear'
option 'init' 'dropbear'
config 'httpd'
option 'init' 'httpd'
config 'fstab'
option 'init' 'fstab'
config 'qos'
option 'init' 'qos'
config 'system'
option 'init' 'led'
config 'luci_hosts'
option 'init' 'luci_hosts'
list 'affects' 'dhcp'
config 'luci_ethers'
option 'init' 'luci_ethers'
list 'affects' 'dhcp'
config 'luci_splash'
option 'init' 'luci_splash'
config 'upnpd'
option 'init' 'miniupnpd'
config 'ntpclient'
option 'init' 'ntpclient'
config 'samba'
option 'init' 'samba'
config 'tinyproxy'
option 'init' 'tinyproxy'
config 'polipo'
option 'init' 'polipo'
config 'ushare'
option 'init' 'ushare'
config 'hd-idle'
option 'init' 'hd-idle'
config 'olsrd'
option 'init' 'olsrd'
config 'mmc_over_gpio'
option 'init' 'mmc_over_gpio'
config 'p910nd'
option 'init' 'p910nd'
config 'uvc-streamer'
option 'init' 'uvc-streamer'
config 'luci_statistics'
option 'init' 'luci_statistics'

View File

@ -1,4 +0,0 @@
config upnpd config
option log_output 0
option download 1024
option upload 512

View File

@ -1,13 +0,0 @@
config wifi-device wifi0
option type atheros
option channel auto
# REMOVE THIS LINE TO ENABLE WIFI:
option disabled 1
config wifi-iface
option device wifi0
option network lan
option mode ap
option ssid OpenWrt
option encryption none

View File

@ -1,2 +0,0 @@
#!/bin/sh
[ "$(date +%M | cut -c2)" == "5" ] && luci-splash sync

View File

@ -1,53 +0,0 @@
#!/bin/sh
# Freifunk Firewall addons
# $Id: firewall.freifunk 4140 2009-01-25 19:38:41Z jow $
#
# Apply advanced settings
#
apply_advanced() {
local tcp_ecn
local tcp_window_scaling
local accept_redirects
local accept_source_route
config_get_bool tcp_ecn $1 tcp_ecn 1
config_get_bool tcp_window_scaling $1 tcp_window_scaling 1
config_get_bool accept_redirects $1 accept_redirects 0
config_get_bool accept_source_route $1 accept_source_route 0
logger -t firewall.freifunk "tcp_ecn is $tcp_ecn"
logger -t firewall.freifunk "tcp_window_scaling is $tcp_window_scaling"
logger -t firewall.freifunk "accept_redirects is $accept_redirects"
logger -t firewall.freifunk "accept_source_route is $accept_source_route"
sysctl -w net.ipv4.tcp_ecn=$tcp_ecn >/dev/null
sysctl -w net.ipv4.tcp_window_scaling=$tcp_window_scaling >/dev/null
for f in /proc/sys/net/ipv4/conf/*/accept_redirects; do
echo $accept_redirects > $f
done
for f in /proc/sys/net/ipv4/conf/*/accept_source_route; do
echo $accept_source_route > $f
done
}
config_foreach apply_advanced advanced
#
# Apply fixes for masquerading rules
#
apply_nat_fix() {
local up
local ifname
config_get up $1 up
[ -n "$up" ] || return 0
(ACTION="ifup" INTERFACE="$1" . /etc/hotplug.d/iface/22-firewall-nat-fix )
}
uci_set_state firewall core loaded 1
config_foreach fw_addif interface
config_foreach apply_nat_fix interface

View File

@ -1,61 +0,0 @@
. /lib/firewall/uci_firewall.sh
unset ZONE
config_get ifname $INTERFACE ifname
[ "$ifname" == "lo" ] && exit 0
load_zones() {
local name
local network
config_get name $1 name
config_get network $1 network
[ -z "$network" ] && network=$name
for n in $network; do
[ "$n" = "$INTERFACE" ] && ZONE="$ZONE $name"
done
}
config_foreach load_zones zone
[ -z "$ZONE" ] && exit 0
natfix_addr_add() {
local network=$1
local iface=$2
config_get parent "$1" interface
[ "$network" != "$INTERFACE" -a "$parent" != "$INTERFACE" ] && return 0
config_get ipaddr "$network" ipaddr
[ -n "$ipaddr" ] || return 0
config_get netmask "$network" netmask
[ -n "$netmask" ] || return 0
eval "$(ipcalc.sh $ipaddr $netmask)"
logger -t firewall.freifunk "adding nat rule for $iface($NETWORK/$PREFIX)"
iptables -t nat -A "natfix_$iface" -s "$NETWORK/$PREFIX" -d "$NETWORK/$PREFIX" -j ACCEPT
}
[ ifup = "$ACTION" ] && {
iptables -t nat -N "natfix_$ifname"
natfix_addr_add "$INTERFACE" "$ifname"
config_foreach natfix_addr_add alias "$ifname"
for z in $ZONE; do
local loaded
config_get loaded core loaded
[ -n "$loaded" ] && {
logger -t firewall.freifunk "applying nat rules on zone $z"
iptables -t nat -I "zone_${z}_nat" 1 -o "$ifname" -j "natfix_$ifname"
}
done
}
[ ifdown = "$ACTION" ] && {
for z in $ZONE; do
local up
config_get up $z up
iptables -t nat -D "zone_${z}_nat" -o "$ifname" -j "natfix_$ifname" 2>/dev/null
done
iptables -t nat -F "natfix_$ifname" 2>/dev/null
iptables -t nat -X "natfix_$ifname" 2>/dev/null
}

View File

@ -1,57 +0,0 @@
#!/bin/sh /etc/rc.common
#
# Written by Miquel van Smoorenburg <miquels@cistron.nl>.
# Modified for Debian GNU/Linux
# by Ian Murdock <imurdock@gnu.ai.mit.edu>.
# Modified for boa by Bill Allombert <ballombe@debian.org>.
# Modified for OpenWrt by Steven Barth <steven@midlink.org>.
### BEGIN INIT INFO
# Provides: boa
# Required-Start: $local_fs $remote_fs $network
# Required-Stop: $local_fs $remote_fs $network
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: Boa: lightweight and high performance web server
### END INIT INFO
PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin
DAEMON=/usr/bin/boa
NAME=boa
DESC="HTTP server"
START=49
test -x $DAEMON || exit 0
set -e
start() {
echo -n "Starting $DESC: $NAME"
start-stop-daemon -S -q -x $DAEMON
echo "."
}
stop() {
echo -n "Stopping $DESC: $NAME"
start-stop-daemon -K -q -x $DAEMON
echo "."
}
restart() {
echo -n "Restarting $DESC: $NAME... "
start-stop-daemon -K -s HUP -q -x $DAEMON
echo "done."
}
reload() {
#
# If the daemon can reload its config files on the fly
# for example by sending it SIGHUP, do it here.
#
# If the daemon responds to changes in its config file
# directly anyway, make this a do-nothing entry.
#
echo -n "Reloading $DESC configuration... "
start-stop-daemon -K -s 1 -q -x $DAEMON
echo "done."
}

View File

@ -1,24 +0,0 @@
#!/bin/sh /etc/rc.common
# Freifunk Init
# $Id: freifunk 4214 2009-01-31 17:32:35Z jow $
START=99
boot() {
grep -q 'killall -HUP dnsmasq' /etc/crontabs/root || {
echo "*/5 * * * * killall -HUP dnsmasq" >> /etc/crontabs/root
}
grep -q '/usr/sbin/ff_olsr_test_gw' /etc/crontabs/root || {
echo "* * * * * /usr/sbin/ff_olsr_test_gw" >> /etc/crontabs/root
}
[ -f /etc/rc.local ] && . /etc/rc.local
[ -d /etc/rc.local.d ] && {
for file in /etc/rc.local.d/*; do
test -f "$file" && . "$file"
done
}
killall -HUP crond 2>/dev/null || /etc/init.d/cron start
}

View File

@ -1,37 +0,0 @@
#!/bin/sh /etc/rc.common
START=59
apply_lease() {
local cfg="$1"
config_get macaddr "$cfg" macaddr
config_get ipaddr "$cfg" ipaddr
[ -n "$macaddr" -a -n "$ipaddr" ] || return 0
echo "$macaddr $ipaddr" >> /var/etc/ethers
}
start() {
if [ ! -L /etc/ethers ]; then
test -f /etc/ethers && mv /etc/ethers /etc/ethers.local
ln -s /var/etc/ethers /etc/ethers
fi
test -d /var/etc || mkdir -p /var/etc
echo "# This file is autogenerated, use /etc/ethers.local instead" > /var/etc/ethers
config_load luci_ethers
config_foreach apply_lease static_lease
test -f /etc/ethers.local && cat /etc/ethers.local >> /var/etc/ethers
return 0
}
stop() {
test -f /var/etc/ethers && rm -f /var/etc/ethers
return 0
}

View File

@ -1,36 +0,0 @@
#!/bin/sh /etc/rc.common
START=59
apply_host() {
local cfg="$1"
config_get hostname "$cfg" hostname
config_get ipaddr "$cfg" ipaddr
[ -n "$hostname" -a -n "$ipaddr" ] || return 0
echo "$ipaddr $hostname" >> /var/etc/hosts
}
start() {
if [ ! -L /etc/hosts ]; then
test -f /etc/hosts && mv /etc/hosts /etc/hosts.local
ln -s /var/etc/hosts /etc/hosts
fi
echo "# This file is autogenerated, use /etc/hosts.local instead" > /var/etc/hosts
test -d /var/etc || mkdir -p /var/etc
test -f /etc/hosts.local && cat /etc/hosts.local >> /var/etc/hosts
config_load luci_hosts
config_foreach apply_host host
return 0
}
stop() {
test -f /var/etc/hosts && rm -f /var/etc/hosts
return 0
}

View File

@ -1,87 +0,0 @@
#!/bin/sh /etc/rc.common
START=70
iface_add() {
local cfg="$1"
config_get zone "$cfg" zone
[ -n "$zone" ] || return 0
config_get net "$cfg" network
[ -n "$net" ] || return 0
config_get ipaddr "$net" ipaddr
[ -n "$ipaddr" ] || return 0
config_get netmask "$net" netmask
[ -n "$netmask" ] || return 0
eval "$(ipcalc.sh $ipaddr $netmask)"
iptables -t nat -A zone_${zone}_prerouting -s "$NETWORK/$PREFIX" -p ! tcp -j luci_splash_portal
iptables -t nat -A zone_${zone}_prerouting -s "$NETWORK/$PREFIX" -d ! "$ipaddr" -j luci_splash_portal
iptables -t nat -A zone_${zone}_prerouting -s "$NETWORK/$PREFIX" -d "$ipaddr" -p tcp -m multiport ! --dport 22,80,443 -j luci_splash_portal
}
blacklist_add() {
local cfg="$1"
config_get mac "$cfg" mac
[ -n "$mac" ] && iptables -t nat -A luci_splash_portal -m mac --mac-source "$mac" -j DROP
}
whitelist_add() {
local cfg="$1"
config_get mac "$cfg" mac
[ -n "$mac" ] && iptables -t nat -A luci_splash_portal -m mac --mac-source "$mac" -j RETURN
}
start() {
### Read chains from config
include /lib/network
scan_interfaces
config_load luci_splash
### Create subchains
iptables -t nat -N luci_splash
iptables -t nat -N luci_splash_portal
iptables -t nat -N luci_splash_leases
### Build the main and portal rule
config_foreach blacklist_add blacklist
config_foreach whitelist_add whitelist
config_foreach iface_add iface
### Build the portal rule
iptables -t nat -A luci_splash_portal -p udp --dport 53 -j RETURN
iptables -t nat -A luci_splash_portal -j luci_splash_leases
### Build the leases rule
iptables -t nat -A luci_splash_leases -p tcp --dport 80 -j REDIRECT --to-ports 8082
iptables -t nat -A luci_splash_leases -j DROP
### Add crontab entry
grep luci-splash /var/spool/cron/crontabs/root >/dev/null 2>&1 || {
echo '*/5 * * * * /usr/sbin/luci-splash sync' >> /var/spool/cron/crontabs/root
}
### Start the splash httpd
start-stop-daemon -S -b -q -x /usr/bin/luci-splashd
}
stop() {
### Clear subchains
iptables -t nat -F luci_splash_leases
iptables -t nat -F luci_splash_portal
iptables -t nat -F luci_splash
### Delete subchains
iptables -t nat -X luci_splash_leases
iptables -t nat -X luci_splash_portal
iptables -t nat -X luci_splash
### Stop the splash httpd
start-stop-daemon -K -q -x /usr/bin/luci-splashd
}

View File

@ -1,31 +0,0 @@
#!/bin/sh /etc/rc.common
START=79
start() {
### replace shipped config with symlink
if [ ! -L /etc/collectd.conf ]; then
test -f /etc/collectd.conf && mv /etc/collectd.conf /etc/collectd.conf.bak
ln -s /var/etc/collectd.conf /etc/collectd.conf
fi
### create config
mkdir -p /var/etc
/usr/bin/stat-genconfig > /var/etc/collectd.conf
### prepare rrdimg directory
if [ ! -L /www/rrdimg ]; then
imagepath="$(uci get luci_statistics.rrdtool.image_path)"
ln -s ${imagepath:-/tmp/rrdimg}/ /www/rrdimg
fi
### flush LuCI index cache
test -f /var/luci-indexcache && rm /var/luci-indexcache
}
restart() {
### regenerate config / prepare environment
start
### restart collectd
/etc/init.d/collectd restart
}

View File

@ -1,44 +0,0 @@
#!/bin/sh /etc/rc.common
PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin
DAEMON=/usr/bin/lucittpd
NAME=lucittpd
DESC="HTTP server"
START=49
test -x $DAEMON || exit 0
set -e
start() {
echo -n "Starting $DESC: $NAME"
start-stop-daemon -b -S -q -x $DAEMON
echo "."
}
stop() {
echo -n "Stopping $DESC: $NAME"
start-stop-daemon -K -q -x $DAEMON
echo "."
}
restart() {
# echo -n "Restarting $DESC: $NAME... "
# start-stop-daemon -K -s HUP -q -x $DAEMON
# echo "done."
stop
sleep 3
start
}
reload() {
#
# If the daemon can reload its config files on the fly
# for example by sending it SIGHUP, do it here.
#
# If the daemon responds to changes in its config file
# directly anyway, make this a do-nothing entry.
#
# echo -n "Reloading $DESC configuration... "
# start-stop-daemon -K -s 1 -q -x $DAEMON
# echo "done."
restart
}

View File

@ -1 +0,0 @@
backend.model = "ipkg"

View File

@ -1,748 +0,0 @@
###############################################################################
#
# MIME-TYPES and the extensions that represent them
#
# This file is part of the "mime-support" package. Please send email (not a
# bug report) to mime-support@packages.debian.org if you would like new types
# and/or extensions to be added.
#
# The reason that all types are managed by the mime-support package instead
# allowing individual packages to install types in much the same way as they
# add entries in to the mailcap file is so these types can be referenced by
# other programs (such as a web server) even if the specific support package
# for that type is not installed.
#
# Users can add their own types if they wish by creating a ".mime.types"
# file in their home directory. Definitions included there will take
# precedence over those listed here.
#
# Note: Compression schemes like "gzip", "bzip", and "compress" are not
# actually "mime-types". They are "encodings" and hence must _not_ have
# entries in this file to map their extensions. The "mime-type" of an
# encoded file refers to the type of data that has been encoded, not the
# type of encoding.
#
###############################################################################
application/activemessage
application/andrew-inset ez
application/applefile
application/atom atom
application/atomcat+xml atomcat
application/atomserv+xml atomsrv
application/atomicmail
application/batch-SMTP
application/beep+xml
application/cals-1840
application/cap cap pcap
application/commonground
application/cu-seeme cu
application/cybercash
application/dca-rft
application/dec-dx
application/docbook+xml
application/dsptype tsp
application/dvcs
application/edi-consent
application/edi-x12
application/edifact
application/eshop
application/font-tdpfr
application/futuresplash spl
application/ghostview
application/hta hta
application/http
application/hyperstudio
application/iges
application/index
application/index.cmd
application/index.obj
application/index.response
application/index.vnd
application/iotp
application/ipp
application/isup
application/java-archive jar
application/java-serialized-object ser
application/java-vm class
application/mac-binhex40 hqx
application/mac-compactpro cpt
application/macwriteii
application/marc
application/mathematica nb
application/mathematica-old
application/ms-tnef
application/msaccess mdb
application/msword doc dot
application/news-message-id
application/news-transmission
application/ocsp-request
application/ocsp-response
application/octet-stream bin
application/oda oda
application/ogg ogg
application/parityfec
application/pdf pdf
application/pgp-encrypted
application/pgp-keys key
application/pgp-signature pgp
application/pics-rules prf
application/pkcs10
application/pkcs7-mime
application/pkcs7-signature
application/pkix-cert
application/pkix-crl
application/pkixcmp
application/postscript ps ai eps
application/prs.alvestrand.titrax-sheet
application/prs.cww
application/prs.nprend
application/qsig
application/rar rar
application/rdf+xml rdf
application/remote-printing
application/riscos
application/rss+xml rss
application/rtf rtf
application/sdp
application/set-payment
application/set-payment-initiation
application/set-registration
application/set-registration-initiation
application/sgml
application/sgml-open-catalog
application/sieve
application/slate
application/smil smi smil
application/timestamp-query
application/timestamp-reply
application/vemmi
application/whoispp-query
application/whoispp-response
application/wita
application/wordperfect wpd
application/wordperfect5.1 wp5
application/x400-bp
application/xhtml+xml xhtml xht
application/xml xml xsl
application/xml-dtd
application/xml-external-parsed-entity
application/zip zip
application/vnd.3M.Post-it-Notes
application/vnd.accpac.simply.aso
application/vnd.accpac.simply.imp
application/vnd.acucobol
application/vnd.aether.imp
application/vnd.anser-web-certificate-issue-initiation
application/vnd.anser-web-funds-transfer-initiation
application/vnd.audiograph
application/vnd.bmi
application/vnd.businessobjects
application/vnd.canon-cpdl
application/vnd.canon-lips
application/vnd.cinderella cdy
application/vnd.claymore
application/vnd.commerce-battelle
application/vnd.commonspace
application/vnd.comsocaller
application/vnd.contact.cmsg
application/vnd.cosmocaller
application/vnd.ctc-posml
application/vnd.cups-postscript
application/vnd.cups-raster
application/vnd.cups-raw
application/vnd.cybank
application/vnd.dna
application/vnd.dpgraph
application/vnd.dxr
application/vnd.ecdis-update
application/vnd.ecowin.chart
application/vnd.ecowin.filerequest
application/vnd.ecowin.fileupdate
application/vnd.ecowin.series
application/vnd.ecowin.seriesrequest
application/vnd.ecowin.seriesupdate
application/vnd.enliven
application/vnd.epson.esf
application/vnd.epson.msf
application/vnd.epson.quickanime
application/vnd.epson.salt
application/vnd.epson.ssf
application/vnd.ericsson.quickcall
application/vnd.eudora.data
application/vnd.fdf
application/vnd.ffsns
application/vnd.flographit
application/vnd.framemaker
application/vnd.fsc.weblaunch
application/vnd.fujitsu.oasys
application/vnd.fujitsu.oasys2
application/vnd.fujitsu.oasys3
application/vnd.fujitsu.oasysgp
application/vnd.fujitsu.oasysprs
application/vnd.fujixerox.ddd
application/vnd.fujixerox.docuworks
application/vnd.fujixerox.docuworks.binder
application/vnd.fut-misnet
application/vnd.google-earth.kml+xml kml
application/vnd.google-earth.kmz kmz
application/vnd.grafeq
application/vnd.groove-account
application/vnd.groove-identity-message
application/vnd.groove-injector
application/vnd.groove-tool-message
application/vnd.groove-tool-template
application/vnd.groove-vcard
application/vnd.hhe.lesson-player
application/vnd.hp-HPGL
application/vnd.hp-PCL
application/vnd.hp-PCLXL
application/vnd.hp-hpid
application/vnd.hp-hps
application/vnd.httphone
application/vnd.hzn-3d-crossword
application/vnd.ibm.MiniPay
application/vnd.ibm.afplinedata
application/vnd.ibm.modcap
application/vnd.informix-visionary
application/vnd.intercon.formnet
application/vnd.intertrust.digibox
application/vnd.intertrust.nncp
application/vnd.intu.qbo
application/vnd.intu.qfx
application/vnd.irepository.package+xml
application/vnd.is-xpr
application/vnd.japannet-directory-service
application/vnd.japannet-jpnstore-wakeup
application/vnd.japannet-payment-wakeup
application/vnd.japannet-registration
application/vnd.japannet-registration-wakeup
application/vnd.japannet-setstore-wakeup
application/vnd.japannet-verification
application/vnd.japannet-verification-wakeup
application/vnd.koan
application/vnd.lotus-1-2-3
application/vnd.lotus-approach
application/vnd.lotus-freelance
application/vnd.lotus-notes
application/vnd.lotus-organizer
application/vnd.lotus-screencam
application/vnd.lotus-wordpro
application/vnd.mcd
application/vnd.mediastation.cdkey
application/vnd.meridian-slingshot
application/vnd.mif
application/vnd.minisoft-hp3000-save
application/vnd.mitsubishi.misty-guard.trustweb
application/vnd.mobius.daf
application/vnd.mobius.dis
application/vnd.mobius.msl
application/vnd.mobius.plc
application/vnd.mobius.txf
application/vnd.motorola.flexsuite
application/vnd.motorola.flexsuite.adsi
application/vnd.motorola.flexsuite.fis
application/vnd.motorola.flexsuite.gotap
application/vnd.motorola.flexsuite.kmr
application/vnd.motorola.flexsuite.ttc
application/vnd.motorola.flexsuite.wem
application/vnd.mozilla.xul+xml xul
application/vnd.ms-artgalry
application/vnd.ms-asf
application/vnd.ms-excel xls xlb xlt
application/vnd.ms-lrm
application/vnd.ms-pki.seccat cat
application/vnd.ms-pki.stl stl
application/vnd.ms-powerpoint ppt pps
application/vnd.ms-project
application/vnd.ms-tnef
application/vnd.ms-works
application/vnd.mseq
application/vnd.msign
application/vnd.music-niff
application/vnd.musician
application/vnd.netfpx
application/vnd.noblenet-directory
application/vnd.noblenet-sealer
application/vnd.noblenet-web
application/vnd.novadigm.EDM
application/vnd.novadigm.EDX
application/vnd.novadigm.EXT
application/vnd.oasis.opendocument.chart odc
application/vnd.oasis.opendocument.database odb
application/vnd.oasis.opendocument.formula odf
application/vnd.oasis.opendocument.graphics odg
application/vnd.oasis.opendocument.graphics-template otg
application/vnd.oasis.opendocument.image odi
application/vnd.oasis.opendocument.presentation odp
application/vnd.oasis.opendocument.presentation-template otp
application/vnd.oasis.opendocument.spreadsheet ods
application/vnd.oasis.opendocument.spreadsheet-template ots
application/vnd.oasis.opendocument.text odt
application/vnd.oasis.opendocument.text-master odm
application/vnd.oasis.opendocument.text-template ott
application/vnd.oasis.opendocument.text-web oth
application/vnd.osa.netdeploy
application/vnd.palm
application/vnd.pg.format
application/vnd.pg.osasli
application/vnd.powerbuilder6
application/vnd.powerbuilder6-s
application/vnd.powerbuilder7
application/vnd.powerbuilder7-s
application/vnd.powerbuilder75
application/vnd.powerbuilder75-s
application/vnd.previewsystems.box
application/vnd.publishare-delta-tree
application/vnd.pvi.ptid1
application/vnd.pwg-xhtml-print+xml
application/vnd.rapid
application/vnd.rim.cod cod
application/vnd.s3sms
application/vnd.seemail
application/vnd.shana.informed.formdata
application/vnd.shana.informed.formtemplate
application/vnd.shana.informed.interchange
application/vnd.shana.informed.package
application/vnd.smaf mmf
application/vnd.sss-cod
application/vnd.sss-dtf
application/vnd.sss-ntf
application/vnd.stardivision.calc sdc
application/vnd.stardivision.chart sds
application/vnd.stardivision.draw sda
application/vnd.stardivision.impress sdd
application/vnd.stardivision.math sdf
application/vnd.stardivision.writer sdw
application/vnd.stardivision.writer-global sgl
application/vnd.street-stream
application/vnd.sun.xml.calc sxc
application/vnd.sun.xml.calc.template stc
application/vnd.sun.xml.draw sxd
application/vnd.sun.xml.draw.template std
application/vnd.sun.xml.impress sxi
application/vnd.sun.xml.impress.template sti
application/vnd.sun.xml.math sxm
application/vnd.sun.xml.writer sxw
application/vnd.sun.xml.writer.global sxg
application/vnd.sun.xml.writer.template stw
application/vnd.svd
application/vnd.swiftview-ics
application/vnd.symbian.install sis
application/vnd.triscape.mxs
application/vnd.trueapp
application/vnd.truedoc
application/vnd.tve-trigger
application/vnd.ufdl
application/vnd.uplanet.alert
application/vnd.uplanet.alert-wbxml
application/vnd.uplanet.bearer-choice
application/vnd.uplanet.bearer-choice-wbxml
application/vnd.uplanet.cacheop
application/vnd.uplanet.cacheop-wbxml
application/vnd.uplanet.channel
application/vnd.uplanet.channel-wbxml
application/vnd.uplanet.list
application/vnd.uplanet.list-wbxml
application/vnd.uplanet.listcmd
application/vnd.uplanet.listcmd-wbxml
application/vnd.uplanet.signal
application/vnd.vcx
application/vnd.vectorworks
application/vnd.vidsoft.vidconference
application/vnd.visio vsd
application/vnd.vividence.scriptfile
application/vnd.wap.sic
application/vnd.wap.slc
application/vnd.wap.wbxml wbxml
application/vnd.wap.wmlc wmlc
application/vnd.wap.wmlscriptc wmlsc
application/vnd.webturbo
application/vnd.wrq-hp3000-labelled
application/vnd.wt.stf
application/vnd.xara
application/vnd.xfdl
application/vnd.yellowriver-custom-menu
application/x-123 wk
application/x-7z-compressed 7z
application/x-abiword abw
application/x-apple-diskimage dmg
application/x-bcpio bcpio
application/x-bittorrent torrent
application/x-cab cab
application/x-cbr cbr
application/x-cbz cbz
application/x-cdf cdf
application/x-cdlink vcd
application/x-chess-pgn pgn
application/x-core
application/x-cpio cpio
application/x-csh csh
application/x-debian-package deb udeb
application/x-director dcr dir dxr
application/x-dms dms
application/x-doom wad
application/x-dvi dvi
application/x-httpd-eruby rhtml
application/x-executable
application/x-flac flac
application/x-font pfa pfb gsf pcf pcf.Z
application/x-freemind mm
application/x-futuresplash spl
application/x-gnumeric gnumeric
application/x-go-sgf sgf
application/x-graphing-calculator gcf
application/x-gtar gtar tgz taz
application/x-hdf hdf
application/x-httpd-php phtml pht php
application/x-httpd-php-source phps
application/x-httpd-php3 php3
application/x-httpd-php3-preprocessed php3p
application/x-httpd-php4 php4
application/x-ica ica
application/x-internet-signup ins isp
application/x-iphone iii
application/x-iso9660-image iso
application/x-java-applet
application/x-java-bean
application/x-java-jnlp-file jnlp
application/x-javascript js
application/x-jmol jmz
application/x-kchart chrt
application/x-kdelnk
application/x-killustrator kil
application/x-koan skp skd skt skm
application/x-kpresenter kpr kpt
application/x-kspread ksp
application/x-kword kwd kwt
application/x-latex latex
application/x-lha lha
application/x-lyx lyx
application/x-lzh lzh
application/x-lzx lzx
application/x-maker frm maker frame fm fb book fbdoc
application/x-mif mif
application/x-ms-wmd wmd
application/x-ms-wmz wmz
application/x-msdos-program com exe bat dll
application/x-msi msi
application/x-netcdf nc
application/x-ns-proxy-autoconfig pac
application/x-nwc nwc
application/x-object o
application/x-oz-application oza
application/x-pkcs7-certreqresp p7r
application/x-pkcs7-crl crl
application/x-python-code pyc pyo
application/x-quicktimeplayer qtl
application/x-redhat-package-manager rpm
application/x-rx
application/x-sh sh
application/x-shar shar
application/x-shellscript
application/x-shockwave-flash swf swfl
application/x-stuffit sit sitx
application/x-sv4cpio sv4cpio
application/x-sv4crc sv4crc
application/x-tar tar
application/x-tcl tcl
application/x-tex-gf gf
application/x-tex-pk pk
application/x-texinfo texinfo texi
application/x-trash ~ % bak old sik
application/x-troff t tr roff
application/x-troff-man man
application/x-troff-me me
application/x-troff-ms ms
application/x-ustar ustar
application/x-videolan
application/x-wais-source src
application/x-wingz wz
application/x-x509-ca-cert crt
application/x-xcf xcf
application/x-xfig fig
application/x-xpinstall xpi
audio/32kadpcm
audio/3gpp
audio/basic au snd
audio/g.722.1
audio/l16
audio/midi mid midi kar
audio/mp4a-latm
audio/mpa-robust
audio/mpeg mpga mpega mp2 mp3 m4a
audio/mpegurl m3u
audio/parityfec
audio/prs.sid sid
audio/telephone-event
audio/tone
audio/vnd.cisco.nse
audio/vnd.cns.anp1
audio/vnd.cns.inf1
audio/vnd.digital-winds
audio/vnd.everad.plj
audio/vnd.lucent.voice
audio/vnd.nortel.vbk
audio/vnd.nuera.ecelp4800
audio/vnd.nuera.ecelp7470
audio/vnd.nuera.ecelp9600
audio/vnd.octel.sbc
audio/vnd.qcelp
audio/vnd.rhetorex.32kadpcm
audio/vnd.vmx.cvsd
audio/x-aiff aif aiff aifc
audio/x-gsm gsm
audio/x-mpegurl m3u
audio/x-ms-wma wma
audio/x-ms-wax wax
audio/x-pn-realaudio-plugin
audio/x-pn-realaudio ra rm ram
audio/x-realaudio ra
audio/x-scpls pls
audio/x-sd2 sd2
audio/x-wav wav
chemical/x-alchemy alc
chemical/x-cache cac cache
chemical/x-cache-csf csf
chemical/x-cactvs-binary cbin cascii ctab
chemical/x-cdx cdx
chemical/x-cerius cer
chemical/x-chem3d c3d
chemical/x-chemdraw chm
chemical/x-cif cif
chemical/x-cmdf cmdf
chemical/x-cml cml
chemical/x-compass cpa
chemical/x-crossfire bsd
chemical/x-csml csml csm
chemical/x-ctx ctx
chemical/x-cxf cxf cef
#chemical/x-daylight-smiles smi
chemical/x-embl-dl-nucleotide emb embl
chemical/x-galactic-spc spc
chemical/x-gamess-input inp gam gamin
chemical/x-gaussian-checkpoint fch fchk
chemical/x-gaussian-cube cub
chemical/x-gaussian-input gau gjc gjf
chemical/x-gaussian-log gal
chemical/x-gcg8-sequence gcg
chemical/x-genbank gen
chemical/x-hin hin
chemical/x-isostar istr ist
chemical/x-jcamp-dx jdx dx
chemical/x-kinemage kin
chemical/x-macmolecule mcm
chemical/x-macromodel-input mmd mmod
chemical/x-mdl-molfile mol
chemical/x-mdl-rdfile rd
chemical/x-mdl-rxnfile rxn
chemical/x-mdl-sdfile sd sdf
chemical/x-mdl-tgf tgf
#chemical/x-mif mif
chemical/x-mmcif mcif
chemical/x-mol2 mol2
chemical/x-molconn-Z b
chemical/x-mopac-graph gpt
chemical/x-mopac-input mop mopcrt mpc dat zmt
chemical/x-mopac-out moo
chemical/x-mopac-vib mvb
chemical/x-ncbi-asn1 asn
chemical/x-ncbi-asn1-ascii prt ent
chemical/x-ncbi-asn1-binary val aso
chemical/x-ncbi-asn1-spec asn
chemical/x-pdb pdb ent
chemical/x-rosdal ros
chemical/x-swissprot sw
chemical/x-vamas-iso14976 vms
chemical/x-vmd vmd
chemical/x-xtel xtel
chemical/x-xyz xyz
image/cgm
image/g3fax
image/gif gif
image/ief ief
image/jpeg jpeg jpg jpe
image/naplps
image/pcx pcx
image/png png
image/prs.btif
image/prs.pti
image/svg+xml svg svgz
image/tiff tiff tif
image/vnd.cns.inf2
image/vnd.djvu djvu djv
image/vnd.dwg
image/vnd.dxf
image/vnd.fastbidsheet
image/vnd.fpx
image/vnd.fst
image/vnd.fujixerox.edmics-mmr
image/vnd.fujixerox.edmics-rlc
image/vnd.mix
image/vnd.net-fpx
image/vnd.svf
image/vnd.wap.wbmp wbmp
image/vnd.xiff
image/x-cmu-raster ras
image/x-coreldraw cdr
image/x-coreldrawpattern pat
image/x-coreldrawtemplate cdt
image/x-corelphotopaint cpt
image/x-icon ico
image/x-jg art
image/x-jng jng
image/x-ms-bmp bmp
image/x-photoshop psd
image/x-portable-anymap pnm
image/x-portable-bitmap pbm
image/x-portable-graymap pgm
image/x-portable-pixmap ppm
image/x-rgb rgb
image/x-xbitmap xbm
image/x-xpixmap xpm
image/x-xwindowdump xwd
inode/chardevice
inode/blockdevice
inode/directory-locked
inode/directory
inode/fifo
inode/socket
message/delivery-status
message/disposition-notification
message/external-body
message/http
message/s-http
message/news
message/partial
message/rfc822 eml
model/iges igs iges
model/mesh msh mesh silo
model/vnd.dwf
model/vnd.flatland.3dml
model/vnd.gdl
model/vnd.gs-gdl
model/vnd.gtw
model/vnd.mts
model/vnd.vtu
model/vrml wrl vrml
multipart/alternative
multipart/appledouble
multipart/byteranges
multipart/digest
multipart/encrypted
multipart/form-data
multipart/header-set
multipart/mixed
multipart/parallel
multipart/related
multipart/report
multipart/signed
multipart/voice-message
text/calendar ics icz
text/css css
text/csv csv
text/directory
text/english
text/enriched
text/h323 323
text/html html htm shtml
text/iuls uls
text/mathml mml
text/parityfec
text/plain asc txt text pot
text/prs.lines.tag
text/rfc822-headers
text/richtext rtx
text/rtf
text/scriptlet sct wsc
text/t140
text/texmacs tm ts
text/tab-separated-values tsv
text/uri-list
text/vnd.abc
text/vnd.curl
text/vnd.DMClientScript
text/vnd.flatland.3dml
text/vnd.fly
text/vnd.fmi.flexstor
text/vnd.in3d.3dml
text/vnd.in3d.spot
text/vnd.IPTC.NewsML
text/vnd.IPTC.NITF
text/vnd.latex-z
text/vnd.motorola.reflex
text/vnd.ms-mediapackage
text/vnd.sun.j2me.app-descriptor jad
text/vnd.wap.si
text/vnd.wap.sl
text/vnd.wap.wml wml
text/vnd.wap.wmlscript wmls
text/x-bibtex bib
text/x-boo boo
text/x-c++hdr h++ hpp hxx hh
text/x-c++src c++ cpp cxx cc
text/x-chdr h
text/x-component htc
text/x-crontab
text/x-csh csh
text/x-csrc c
text/x-dsrc d
text/x-diff diff patch
text/x-haskell hs
text/x-java java
text/x-literate-haskell lhs
text/x-makefile
text/x-moc moc
text/x-pascal p pas
text/x-pcs-gcd gcd
text/x-perl pl pm
text/x-python py
text/x-server-parsed-html
text/x-setext etx
text/x-sh sh
text/x-tcl tcl tk
text/x-tex tex ltx sty cls
text/x-vcalendar vcs
text/x-vcard vcf
video/3gpp 3gp
video/dl dl
video/dv dif dv
video/fli fli
video/gl gl
video/mpeg mpeg mpg mpe
video/mp4 mp4
video/quicktime qt mov
video/mp4v-es
video/parityfec
video/pointer
video/vnd.fvt
video/vnd.motorola.video
video/vnd.motorola.videop
video/vnd.mpegurl mxu
video/vnd.mts
video/vnd.nokia.interleaved-multimedia
video/vnd.vivo
video/x-la-asf lsf lsx
video/x-mng mng
video/x-ms-asf asf asx
video/x-ms-wm wm
video/x-ms-wmv wmv
video/x-ms-wmx wmx
video/x-ms-wvx wvx
video/x-msvideo avi
video/x-sgi-movie movie
x-conference/x-cooltalk ice
x-epoc/x-sisx-app sisx
x-world/x-vrml vrm vrml wrl

View File

@ -1,2 +0,0 @@
# /etc/rc.local
# Only executed on boot, put your custom startup commands here

View File

@ -1,147 +0,0 @@
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'

View File

@ -1,240 +0,0 @@
package dhcp
config package
option title 'Dnsmasq DHCPd configuration'
config section
option name 'dnsmasq'
option package 'dhcp'
option title 'General Settings'
option unique true
option required true
option dynamic true
config variable
option name 'domainneeded'
option section 'dhcp.dnsmasq'
option title 'Domain required'
option description "Don't forward DNS-Requests without DNS-Name"
option datatype boolean
config variable
option name 'authoritative'
option section 'dhcp.dnsmasq'
option title 'Authoritative'
option description 'This is the only DHCP in the local network'
option datatype boolean
config variable
option name 'boguspriv'
option section 'dhcp.dnsmasq'
option title 'Filter private'
option description "Don't forward reverse lookups for local networks"
option datatype boolean
config variable
option name 'filterwin2k'
option section 'dhcp.dnsmasq'
option title 'Filter useless'
option description 'Filter useless DNS-queries of Windows-systems'
option datatype boolean
config variable
option name 'localise_queries'
option section 'dhcp.dnsmasq'
option title 'Localise queries'
option description 'Localises the hostname depending on its subnet'
option datatype boolean
config variable
option name 'local'
option section 'dhcp.dnsmasq'
option title 'Local Server'
config variable
option name 'domain'
option section 'dhcp.dnsmasq'
option title 'Local Domain'
config variable
option name 'expandhosts'
option section 'dhcp.dnsmasq'
option title 'Expand Hosts'
option description 'adds domain names to hostentries in the resolv file'
option datatype boolean
config variable
option name 'nonegcache'
option section 'dhcp.dnsmasq'
option title "don't cache unknown"
option description 'prevents caching of negative DNS-replies'
option datatype boolean
config variable
option name 'readethers'
option section 'dhcp.dnsmasq'
option title 'Use /etc/ethers'
option description 'Read /etc/ethers to configure the DHCP-Server'
option datatype boolean
config variable
option name 'leasefile'
option section 'dhcp.dnsmasq'
option title 'Leasefile'
option description 'file where given DHCP-leases will be stored'
config variable
option name 'resolvfile'
option section 'dhcp.dnsmasq'
option title 'Resolvfile'
option description 'local DNS file'
config variable
option name 'nohosts'
option section 'dhcp.dnsmasq'
option title 'Ignore /etc/hosts '
option datatype boolean
config variable
option name 'strictorder'
option section 'dhcp.dnsmasq'
option title 'Strict order'
option description 'DNS-Server will be queried in the order of the resolvfile'
option datatype boolean
config variable
option name 'logqueries'
option section 'dhcp.dnsmasq'
option title 'Log queries'
option datatype boolean
config variable
option name 'noresolv'
option section 'dhcp.dnsmasq'
option title 'Ignore resolve file'
option datatype boolean
config variable
option name 'dnsforwardmax'
option section 'dhcp.dnsmasq'
option title 'concurrent queries'
option datatype uint
config variable
option name 'port'
option section 'dhcp.dnsmasq'
option title 'DNS-Port'
option datatype port
config variable
option name 'ednspacket_max'
option section 'dhcp.dnsmasq'
option title 'ednspacket_max'
option datatype uint
config variable
option name 'dhcpleasemax'
option section 'dhcp.dnsmasq'
option title 'max. DHCP -Leases'
option datatype uint
config variable
option name 'addnhosts'
option section 'dhcp.dnsmasq'
option title 'additional hostfile'
option datatype file
config variable
option name 'queryport'
option section 'dhcp.dnsmasq'
option title 'query port'
option datatype port
config variable
option name 'enable_tftp'
option section 'dhcp.dnsmasq'
option title 'Enable builtin TFTP-Server'
option datatype boolean
config variable
option name 'tftp_root'
option section 'dhcp.dnsmasq'
option title 'TFTP-Server root directory'
option datatype directory
config variable
option name 'dhcp_boot'
option section 'dhcp.dnsmasq'
option title 'DHCP Boot image'
config section
option name 'dhcp'
option package 'dhcp'
option title 'DHCP interface configuration'
option dynamic true
config variable
option name 'interface'
option section 'dhcp.dhcp'
option title 'Interface'
option required true
option type reference
list valueof network.interface
list valueof network.alias
config variable
option name 'start'
option section 'dhcp.dhcp'
option title 'Start'
option description 'first address (last octet)'
option datatype uint
config variable
option name 'limit'
option section 'dhcp.dhcp'
option title 'Limit'
option description 'number of leased addresses -1'
option datatype uint
config variable
option name 'leasetime'
option section 'dhcp.dhcp'
option title 'Leasetime'
config variable
option name 'dynamicdhcp'
option section 'dhcp.dhcp'
option title 'Dynamic DHCP '
option datatype boolean
config variable
option name 'name'
option section 'dhcp.dhcp'
option title 'Name'
config variable
option name 'ignore'
option section 'dhcp.dhcp'
option title 'Ignore interface'
option description 'disable DHCP for this interface'
option datatype boolean
config variable
option name 'netmask'
option section 'dhcp.dhcp'
option title 'IPv4-Netmask'
option datatype ip4addr
config variable
option name 'force'
option section 'dhcp.dhcp'
option title 'Force'
option datatype boolean
config variable
option name 'dhcp_option'
option section 'dhcp.dhcp'
option title 'DHCP-Options'
option description 'See "dnsmasq --help dhcp" for a list of available options.'
option type lazylist

View File

@ -1,24 +0,0 @@
package dropbear
config package
option title 'Dropbear SSHd configuration'
config section
option name 'dropbear'
option title 'General SSH daemon settings'
option package 'dropbear'
option required true
option unique true
config variable
option name 'PasswordAuth'
option title 'Permit password authentication'
option section 'dropbear.dropbear'
option datatype 'boolean'
config variable
option name 'Port'
option title 'Listening port'
option section 'dropbear.dropbear'
option datatype 'integer'
option required true

View File

@ -1,255 +0,0 @@
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'

View File

@ -1,54 +0,0 @@
package fstab
config package
option title 'Filesystem configuration'
config section
option name 'mount'
option title 'Filesystem entry'
option package 'fstab'
config variable
option name 'device'
option title 'Device node'
option section 'fstab.mount'
config variable
option name 'enabled'
option title 'Enable this mount point'
option section 'fstab.mount'
option datatype 'boolean'
option required 'true'
config variable
option name 'fstype'
option title 'Filesystem type'
option section 'fstab.mount'
config variable
option name 'options'
option title 'Mount options'
option section 'fstab.mount'
config variable
option name 'target'
option title 'Mount point'
option section 'fstab.mount'
option datatype 'directory'
config section
option name 'swap'
option title 'Swap entry'
option package 'fstab'
config variable
option name 'device'
option title 'Swap file or Partition'
option section 'fstab.swap'
config variable
option name 'enabled'
option title 'Enable this swap'
option section 'fstab.swap'
option datatype 'boolean'

View File

@ -1,37 +0,0 @@
package httpd
config package
option title 'Busybox HTTPd configuration'
config section
option name 'httpd'
option title 'General httpd settings'
option package 'httpd'
option required true
config variable
option name 'home'
option title 'Document root'
option section 'httpd.httpd'
option datatype 'directory'
option required true
config variable
option name 'port'
option title 'Listening port'
option section 'httpd.httpd'
option datatype 'integer'
option required true
config variable
option name 'c_file'
option title 'Configuration file'
option section 'httpd.httpd'
option datatype 'file'
config variable
option name 'realm'
option title 'Authentication Realm'
option description 'Realm shown on login prompt'
option section 'httpd.httpd'

View File

@ -1,21 +0,0 @@
package luci_hosts
config section
option name 'host'
option title 'Host entry definition'
option package 'luci_hosts'
config variable
option name 'hostname'
option title 'Hostname'
option section 'luci_hosts.host'
option datatype 'hostname'
option required true
config variable
option name 'ipaddr'
option title 'IP address'
option section 'luci_hosts.host'
option datatype 'ipaddr'
option required true

View File

@ -1,14 +0,0 @@
package luci_splash
config section
option name 'core'
option title 'Common DHCP splash settings'
option package 'luci_splash'
option unique true
option required true
config variable
option name 'leasetime'
option title 'Lease time in hours'
option section 'luci_splash.core'
option datatype 'float'

View File

@ -1,495 +0,0 @@
package network
config package
option title 'Network configuration'
config section
option name 'interface'
option title 'Network interface'
option package 'network'
list depends 'proto=static, ipaddr, netmask'
list depends 'proto=static, ip6addr'
list depends 'proto=pppoe, username, password'
list depends 'proto=pppoa, username, password, encaps, vpi, vci'
list depends 'proto=ppp, device'
list depends 'proto=3g, device'
list depends 'proto=pptp, username, password, server'
list depends 'proto=dhcp'
list depends 'proto=none'
option named 'true'
option required 'true'
config variable
option name 'ifname'
option title 'Physical interface'
option section 'network.interface'
config variable
option name 'macaddr'
option title 'Interface MAC address'
option section 'network.interface'
option datatype 'macaddr'
config variable
option name 'mtu'
option title 'MTU'
option section 'network.interface'
option datatype 'uint'
config variable
option name 'ipaddr'
option title 'IPv4 host address'
option section 'network.interface'
option datatype 'ip4addr'
config variable
option name 'netmask'
option title 'IPv4 network mask'
option section 'network.interface'
option datatype 'ip4addr'
config variable
option name 'gateway'
option title 'IPv4 gateway'
option section 'network.interface'
option datatype 'ip4addr'
config variable
option name 'bcast'
option title 'IPv4 broadcast address'
option section 'network.interface'
option datatype 'ip4addr'
config variable
option name 'ip6addr'
option title 'IPv6 address (CIDR)'
option section 'network.interface'
option datatype 'ip6addr'
config variable
option name 'ip6gw'
option title 'IPv6 gateway'
option section 'network.interface'
option datatype 'ip6addr'
config variable
option name 'dns'
option title 'DNS server (IPv4 or IPv6)'
option section 'network.interface'
option datatype 'ipaddr'
option multival 'true'
config variable
option name 'keepalive'
option title 'keep-alive'
option description 'Number of connection failures before reconnect'
option section 'network.interface'
option datatype 'string'
list depends 'proto=pppoe'
list depends 'proto=pptp'
list depends 'proto=ppp'
list depends 'proto=3g'
list depends 'proto=pppoa'
config variable
option name 'demand'
option title 'Dial on-demand'
option description 'Number of seconds to wait before closing the connection due to inactivity'
option section 'network.interface'
option datatype 'uint'
list depends 'proto=pppoe'
list depends 'proto=pppoa'
list depends 'proto=pptp'
list depends 'proto=ppp'
list depends 'proto=3g'
config variable
option name 'username'
option title 'Username'
option section 'network.interface'
option datatype 'string'
list depends 'proto=pppoa'
list depends 'proto=pppoe'
list depends 'proto=pptp'
list depends 'proto=ppp'
list depends 'proto=3g'
config variable
option name 'password'
option title 'Password'
option section 'network.interface'
option datatype 'string'
list depends 'proto=pppoe'
list depends 'proto=pppoa'
list depends 'proto=pptp'
list depends 'proto=ppp'
list depends 'proto=3g'
config variable
option name 'encaps'
option title 'PPPoA encapsulation mode'
option section 'network.interface'
option type 'enum'
list depends 'proto=pppoa'
config enum
option variable 'network.interface.encaps'
option value 'vc'
option title 'VC'
config enum
option variable 'network.interface.encaps'
option value 'llc'
option title 'LLC'
config variable
option name 'vpi'
option title 'PPPoA VPI'
option section 'network.interface'
option datatype 'uint'
list depends 'proto=pppoa'
config variable
option name 'vci'
option title 'PPPoA VCI'
option section 'network.interface'
option datatype 'uint'
list depends 'proto=pppoa'
config variable
option name 'server'
option title 'PPTP server'
option section 'network.interface'
option datatype 'host'
list depends 'proto=pptp'
config variable
option name 'device'
option title 'Modem device'
option section 'network.interface'
option datatype 'device'
list depends 'proto=ppp'
list depends 'proto=3g'
config variable
option name 'defaultroute'
option title 'Replace default route'
option section 'network.interface'
option datatype 'boolean'
list depends 'proto=ppp'
list depends 'proto=pppoa'
list depends 'proto=pppoe'
list depends 'proto=pptp'
list depends 'proto=3g'
config variable
option name 'peerdns'
option title 'Use peer DNS'
option section 'network.interface'
option datatype 'boolean'
list depends 'proto=ppp'
list depends 'proto=pppoe'
list depends 'proto=pppoa'
list depends 'proto=pptp'
list depends 'proto=3g'
config variable
option name 'ipv6'
option title 'Enable IPv6 on PPP link'
option section 'network.interface'
option datatype 'boolean'
list depends 'proto=ppp'
list depends 'proto=pppoe'
list depends 'proto=pppoa'
list depends 'proto=pptp'
list depends 'proto=3g'
config variable
option name 'connect'
option title 'PPP connect script'
option section 'network.interface'
option datatype 'file'
list depends 'proto=ppp'
list depends 'proto=pppoe'
list depends 'proto=pppoa'
list depends 'proto=pptp'
list depends 'proto=3g'
config variable
option name 'disconnect'
option title 'PPP disconnect script'
option section 'network.interface'
option datatype 'file'
list depends 'proto=ppp'
list depends 'proto=pppoe'
list depends 'proto=pppoa'
list depends 'proto=pptp'
list depends 'proto=3g'
config variable
option name 'pppd_options'
option title 'Additional PPP daemon options'
option section 'network.interface'
option datatype 'string'
list depends 'proto=ppp'
list depends 'proto=pppoe'
list depends 'proto=pppoa'
list depends 'proto=pptp'
list depends 'proto=3g'
config variable
option name 'maxwait'
option title 'Setup wait time'
option description 'Number of seconds to wait for the device to become ready'
option section 'network.interface'
option datatype 'uint'
list depends 'proto=3g'
config variable
option name 'apn'
option title 'Access point (APN)'
option section 'network.interface'
option datatype 'string'
list depends 'proto=3g'
config variable
option name 'pincode'
option title 'PIN code'
option section 'network.interface'
option datatype 'uint'
list depends 'proto=3g'
config variable
option name 'service'
option title 'Service type'
option section 'network.interface'
option type 'enum'
list depends 'proto=3g'
config enum
option variable 'network.interface.service'
option value 'umts'
option title 'UMTS/GPRS'
config enum
option variable 'network.interface.service'
option value 'cdma'
option title 'CDMA'
config enum
option variable 'network.interface.service'
option value 'evdo'
option title 'EV-DO'
config variable
option name 'proto'
option title 'Protocol'
option section 'network.interface'
option type 'enum'
option required 'true'
config enum
option variable 'network.interface.proto'
option value 'none'
option title 'Disabled'
config enum
option variable 'network.interface.proto'
option value 'dhcp'
option title 'Retrieve IP address via DHCP'
option default 'true'
config enum
option variable 'network.interface.proto'
option value 'pptp'
option title 'Interface is a PPTP tunnel endpoint'
config enum
option variable 'network.interface.proto'
option value 'static'
option title 'Interface has static network configuration'
config enum
option variable 'network.interface.proto'
option value 'pppoe'
option title 'Interface is a PPPoE connection'
config enum
option variable 'network.interface.proto'
option value 'pppoa'
option title 'Interface is a PPPoA connection'
config enum
option variable 'network.interface.proto'
option value 'ppp'
option title 'Interface is a PPP connection'
config enum
option variable 'network.interface.proto'
option value '3g'
option title '3G UMTS/GPRS connection'
config variable
option name 'type'
option title 'Option type'
option section 'network.interface'
option type 'enum'
config enum
option variable 'network.interface.type'
option value 'bridge'
option title 'This is a bridge interface'
config section
option name 'alias'
option title 'Alias interface definition'
option package 'network'
list depends 'proto=static, ipaddr, netmask'
list depends 'proto=static, ip6addr'
option named 'true'
config variable
option name 'interface'
option title 'Parent interface'
option section 'network.alias'
option valueof 'network.interface'
option required 'true'
config variable
option name 'ipaddr'
option title 'IPv4 host address'
option section 'network.alias'
option datatype 'ip4addr'
config variable
option name 'netmask'
option title 'IPv4 network mask'
option section 'network.alias'
option datatype 'ip4addr'
config variable
option name 'gateway'
option title 'IPv4 gateway'
option section 'network.alias'
option datatype 'ip4addr'
config variable
option name 'bcast'
option title 'IPv4 broadcast address'
option section 'network.alias'
option datatype 'ip4addr'
config variable
option name 'ip6addr'
option title 'IPv6 address (CIDR)'
option section 'network.alias'
option datatype 'ip6addr'
config variable
option name 'ip6gw'
option title 'IPv6 gateway'
option section 'network.alias'
option datatype 'ip6addr'
config variable
option name 'dns'
option title 'DNS server (IPv4 or IPv6)'
option section 'network.alias'
option datatype 'ipaddr'
config variable
option name 'proto'
option title 'Protocol'
option section 'network.alias'
option type 'enum'
option required 'true'
config enum
option variable 'network.alias.proto'
option value 'static'
option title 'Interface has static network configuration'
config section
option name 'route'
option title 'Static route definition'
option package 'network'
config variable
option name 'interface'
option title 'Interface'
option section 'network.route'
option valueof 'network.interface'
option required 'true'
config variable
option name 'target'
option title 'Target IPv4 host or network'
option section 'network.route'
option datatype 'ip4addr'
option required 'true'
config variable
option name 'netmask'
option title 'Target IPv4 netmask'
option section 'network.route'
option datatype 'ip4addr'
config variable
option name 'gateway'
option title 'IPv4 gateway'
option section 'network.route'
option datatype 'ip4addr'
config variable
option name 'metric'
option title 'Metric'
option section 'network.route6'
option datatype 'uint'
config section
option name 'route6'
option title 'Static IPv6 route definition'
option package 'network'
config variable
option name 'interface'
option title 'Interface'
option section 'network.route6'
option valueof 'network.interface'
option required 'true'
config variable
option name 'target'
option title 'Target IPv6 host or network (CIDR)'
option section 'network.route6'
option datatype 'ip6addr'
option required 'true'
config variable
option name 'gateway'
option title 'IPv6 gateway'
option section 'network.route6'
option datatype 'ip6addr'
option required 'false'
config variable
option name 'metric'
option title 'Metric'
option section 'network.route6'
option datatype 'uint'
config section
option name 'switch'
option title 'Section switch'
option package 'network'
option named 'true'
option dynamic 'true'
option required 'true'

View File

@ -1,53 +0,0 @@
package ntpclient
config package
option title 'Time Synchronisation'
config section
option name 'ntpclient'
option package 'ntpclient'
option title 'General'
option unique true
option required true
config variable
option name 'interval'
option section 'ntpclient.ntpclient'
option title 'Update Interval (in s)'
option datatype uint
config variable
option name 'count'
option section 'ntpclient.ntpclient'
option title 'Count of Time Measurements'
option datatype uint
config section
option name 'ntpdrift'
option package 'ntpclient'
option title 'Clock Adjustment'
option unique true
config variable
option name 'freq'
option section 'ntpclient.ntpdrift'
option title 'Offset Frequency'
option datatype float
config section
option name 'ntpserver'
option package 'ntpclient'
option title 'Time Server'
config variable
option name 'hostname'
option section 'ntpclient.ntpserver'
option title 'Hostname'
option required true
option datatype host
config variable
option name 'port'
option section 'ntpclient.ntpserver'
option title 'Port'
option datatype port

View File

@ -1,200 +0,0 @@
package qos
config package
option title 'Network quality of service'
config section
option name 'interface'
option title 'QoS interface section'
option package 'qos'
option named true
option required true
config variable
option name 'enabled'
option title 'Enable QoS on this interface'
option section 'qos.interface'
config variable
option name 'overhead'
option title 'Calculate overhead bandwidth'
option section 'qos.interface'
option datatype 'boolean'
config variable
option name 'classgroup'
option title 'QoS classification'
option section 'qos.interface'
option valueof 'qos.classgroup'
config variable
option name 'download'
option title 'Maximum download speed in kBits/s'
option section 'qos.interface'
option datatype 'integer'
config variable
option name 'upload'
option title 'Maximum upload speed in kBits/s'
option section 'qos.interface'
option datatype 'integer'
config section
option name 'class'
option title 'QoS traffic class definition'
option package 'qos'
option named true
option required true
config variable
option name 'avgrate'
option title 'Average rate'
option section 'qos.class'
option datatype 'integer'
config variable
option name 'maxsize'
option title 'Maximum size'
option section 'qos.class'
option datatype 'integer'
config variable
option name 'packetdelay'
option title 'Packet delay'
option section 'qos.class'
option datatype 'integer'
config variable
option name 'packetsize'
option title 'Packet size'
option section 'qos.class'
option datatype 'integer'
config variable
option name 'priority'
option title 'QoS priority'
option section 'qos.class'
option datatype 'integer'
config section
option name 'classgroup'
option title 'QoS classification group'
option package 'qos'
option named true
config variable
option name 'classes'
option title 'Defined QoS classes in group'
option section 'qos.classgroup'
config variable
option name 'default'
option title 'Default QoS class in group'
option section 'qos.classgroup'
option valueof 'qos.class'
config section
option name 'default'
option title 'QoS default classification'
option package 'qos'
list depends 'target, pktsize'
list depends 'target, portrange'
list depends 'target, proto'
config variable
option name 'pktsize'
option title 'Match by packet size'
option section 'qos.default'
option datatype 'integer'
config variable
option name 'portrange'
option title 'Match by port range'
option section 'qos.default'
config variable
option name 'proto'
option title 'Match by layer 3 protocol'
option section 'qos.default'
config variable
option name 'target'
option title 'Option target'
option section 'qos.default'
option valueof 'qos.class'
option required true
config section
option name 'classify'
option title 'QoS classification rule'
option package 'qos'
config variable
option name 'ipp2p'
option title 'Match by ipp2p'
option section 'qos.classify'
config variable
option name 'layer7'
option title 'Match by layer 7 protocol'
option section 'qos.classify'
config variable
option name 'ports'
option title 'Match by ports'
option section 'qos.classify'
config variable
option name 'proto'
option title 'Match by layer 3 protocol'
option section 'qos.classify'
config variable
option name 'tcpflags'
option title 'Match by TCP flags'
option section 'qos.classify'
config variable
option name 'target'
option title 'QoS target class'
option section 'qos.classify'
option valueof 'qos.class'
option required true
config section
option name 'reclassify'
option title 'QoS reclassification rule'
option package 'qos'
config variable
option name 'mark'
option title 'Match by classification mark'
option section 'qos.reclassify'
config variable
option name 'pktsize'
option title 'Match by packet size'
option section 'qos.reclassify'
option datatype 'integer'
config variable
option name 'proto'
option title 'Match by layer 3 protocol'
option section 'qos.reclassify'
config variable
option name 'tcpflags'
option title 'Match by TCP flags'
option section 'qos.reclassify'
config variable
option name 'target'
option title 'QoS classification target'
option section 'qos.reclassify'
option valueof 'qos.class'
option required true

View File

@ -1,76 +0,0 @@
package samba
config package
option title 'Samba CIFS/SMB Daemon'
config section
option name 'samba'
option package 'samba'
option title 'General Settings'
option unique true
option required true
config variable
option name 'name'
option section 'samba.samba'
option title 'Hostname'
option datatype host
option required true
config variable
option name 'description'
option section 'samba.samba'
option title 'Description'
config variable
option name 'workgroup'
option section 'samba.samba'
option title 'Workgroup'
option required true
config variable
option name 'homes'
option section 'samba.samba'
option title 'Share home-directories'
option description 'System users can reach their home directories via network shares.'
option datatype boolean
config section
option name 'sambashare'
option package 'samba'
option title 'Shared Directories'
config variable
option name 'name'
option section 'samba.sambashare'
option title 'Name'
option required true
config variable
option name 'users'
option section 'samba.sambashare'
option title 'Allowed Users'
config variable
option name 'read_only'
option section 'samba.sambashare'
option title 'Read Only'
option datatype boolean
config variable
option name 'guest_ok'
option section 'samba.sambashare'
option title 'Allow Guests'
option datatype boolean
config variable
option name 'create_mask'
option section 'samba.sambashare'
option title 'Create Mask'
option description 'Mask for new files'
config variable
option name 'dir_mask'
option section 'samba.sambashare'
option title 'Directory Mask'
option description 'Mask for new directories'

View File

@ -1,103 +0,0 @@
package system
config package
option title 'System configuration'
config section
option name 'system'
option title 'General system configuration'
option package 'system'
option unique true
option required true
config variable
option name 'hostname'
option title 'Local hostname'
option section 'system.system'
option datatype 'hostname'
option required true
config variable
option name 'zonename'
option title 'Option zonename'
option section 'system.system'
config variable
option name 'timezone'
option title 'Option timezone'
option section 'system.system'
option required true
config variable
option name 'log_size'
option section 'system.system'
option title 'System log buffer size (kiB)'
option datatype uint
config variable
option name 'log_ip'
option section 'system.system'
option title 'External system log server'
option datatype ipaddr
config variable
option name 'conloglevel'
option section 'system.system'
option title 'Log output level'
option description 'Level of log messages on the console'
option datatype integer
config section
option name 'led'
option package 'system'
option title 'LED Configuration'
config variable
option name 'name'
option section 'system.led'
option title 'LED Name'
option required true
config variable
option name 'sysfs'
option section 'system.led'
option title 'LED Device'
option required true
config variable
option name 'default'
option section 'system.led'
option title 'Default state'
option datatype boolean
config variable
option name 'trigger'
option section 'system.led'
option title 'Trigger'
option required true
config variable
option name 'delayon'
option section 'system.led'
option title 'On-State Delay'
option description 'Time (in ms) the LED is on'
list depends 'trigger=timer'
config variable
option name 'delayoff'
option section 'system.led'
option title 'Off-State Delay'
option description 'Time (in ms) the LED is off'
list depends 'trigger=timer'
config variable
option name 'dev'
option section 'system.led'
option title 'Device'
list depends 'trigger=netdev'
config variable
option name 'mode'
option section 'system.led'
option title 'Trigger Mode'
list depends 'trigger=netdev'

View File

@ -1,28 +0,0 @@
package upnpd
config package
option title 'Miniupnpd UPNP daemon'
config section
option name 'upnpd'
option title 'Settings'
option package 'upnpd'
option unique true
config variable
option name 'download'
option title 'Download bandwidth in kBit/s'
option section 'upnpd.upnpd'
option datatype 'integer'
config variable
option name 'upload'
option title 'Upload bandwidth in kBit/s'
option section 'upnpd.upnpd'
option datatype 'integer'
config variable
option name 'log_output'
option title 'Enable log messages'
option section 'upnpd.upnpd'
option datatype 'boolean'

View File

@ -1,41 +0,0 @@
#package uvc-streamer
config package
option title 'UVC-Streamer webcam streaming configuration'
config section
option name 'uvc-streamer'
option package 'uvc-streamer'
option title 'Settings'
option unique true
option required true
config variable
option name 'enabled'
option section 'uvc-streamer.uvc-streamer'
option title 'Enable'
option required true
option datatype boolean
config variable
option name 'device'
option section 'uvc-streamer.uvc-streamer'
option title 'Device'
config variable
option name 'resolution'
option section 'uvc-streamer.uvc-streamer'
option title 'Resolution'
option required true
config variable
option name 'framespersecond'
option section 'uvc-streamer.uvc-streamer'
option title 'Frames per second'
option datatype uint
config variable
option name 'port'
option section 'uvc-streamer.uvc-streamer'
option title 'Port'
option datatype port

View File

@ -1,523 +0,0 @@
package wireless
config package
option title 'Wireless LAN'
config section
option name 'wifi-device'
option package 'wireless'
option title 'Devices'
option named true
config variable
option name 'disabled'
option section 'wireless.wifi-device'
option title 'disabled'
option datatype boolean
config variable
option name 'type'
option section 'wireless.wifi-device'
option title 'Type'
option required true
config variable
option name 'channel'
option section 'wireless.wifi-device'
option title 'Channel'
config variable
option name 'hwmode'
option section 'wireless.wifi-device'
option title 'Mode (atheros)'
option type enum
list depends type=atheros
config enum
option variable 'wireless.wifi-device.hwmode'
option value ''
option title 'auto'
config enum
option variable 'wireless.wifi-device.hwmode'
option value '11b'
option title '802.11b'
config enum
option variable 'wireless.wifi-device.hwmode'
option value '11g'
option title '802.11g'
config enum
option variable 'wireless.wifi-device.hwmode'
option value '11a'
option title '802.11a'
config enum
option variable 'wireless.wifi-device.hwmode'
option value '11bg'
option title '802.11b+g'
config enum
option variable 'wireless.wifi-device.hwmode'
option value '11gdt'
option title '802.11adt'
config enum
option variable 'wireless.wifi-device.hwmode'
option value '11adt'
option title '802.11adt'
config enum
option variable 'wireless.wifi-device.hwmode'
option value 'fh'
option title 'Frequency Hopping'
config variable
option name 'diversity'
option section 'wireless.wifi-device'
option title 'Diversity (atheros)'
option datatype boolean
list depends type=atheros
config variable
option name 'txpower'
option section 'wireless.wifi-device'
option title 'Transmit Power'
option description 'dbm'
option datatype uint
config variable
option name 'txantenna'
option section 'wireless.wifi-device'
option title 'Transmitter Antenna'
option datatype uint
list depends type=atheros
list depends type=broadcom
config variable
option name 'rxantenna'
option section 'wireless.wifi-device'
option title 'Receiver Antenna'
option datatype uint
list depends type=atheros
list depends type=broadcom
config variable
option name 'distance'
option section 'wireless.wifi-device'
option title 'Distance Optimization (atheros, broadcom)'
option description 'Distance to farthest network member in meters.'
option datatype uint
list depends type=atheros
list depends type=broadcom
config variable
option name 'macfilter'
option section 'wireless.wifi-device'
option title 'MAC-Address Filter (broadcom)'
option type enum
list depends type=broadcom
config enum
option variable 'wireless.wifi-device.macfilter'
option value 'deny'
option title 'Allow listed only'
config enum
option variable 'wireless.wifi-device.macfilter'
option value 'allow'
option title 'Allow all except listed'
config variable
option name 'maclist'
option section 'wireless.wifi-device'
option title 'MAC-List (broadcom)'
list depends 'type=broadcom, macfilter=allow'
list depends 'type=broadcom, macfilter=deny'
option type lazylist
option datatype macaddr
config variable
option name 'frameburst'
option section 'wireless.wifi-device'
option title 'Frame Bursting (broadcom)'
option datatype boolean
list depends 'type=broadcom'
config variable
option name 'country'
option section 'wireless.wifi-device'
option title 'Country Code (broadcom)'
list depends 'type=broadcom'
config variable
option name 'maxassoc'
option section 'wireless.wifi-device'
option title 'Connection Limit (broadcom)'
option datatype uint
list depends 'type=broadcom'
config section
option name 'wifi-iface'
option package 'wireless'
option title 'Interfaces'
config variable
option name 'device'
option section 'wireless.wifi-iface'
option title 'Wifi Device'
option valueof 'wireless.wifi-device'
config variable
option name 'ssid'
option section 'wireless.wifi-iface'
option title 'ESSID'
config variable
option name 'network'
option section 'wireless.wifi-iface'
option title 'Network'
option description 'Add the Wifi network to physical network'
option type reference
list valueof network.interface
config variable
option name 'mode'
option section 'wireless.wifi-iface'
option title 'Mode'
option required true
option type enum
config enum
option variable 'wireless.wifi-iface.mode'
option value 'ap'
option title 'Access Point'
config enum
option variable 'wireless.wifi-iface.mode'
option value 'adhoc'
option title 'Ad-Hoc'
config enum
option variable 'wireless.wifi-iface.mode'
option value 'sta'
option title 'Client'
config enum
option variable 'wireless.wifi-iface.mode'
option value 'monitor'
option title 'Monitor'
config enum
option variable 'wireless.wifi-iface.mode'
option value 'ahdemo'
option title 'Pseudo Ad-Hoc (ahdemo)'
config enum
option variable 'wireless.wifi-iface.mode'
option value 'wds'
option title 'WDS'
config variable
option name 'bssid'
option section 'wireless.wifi-iface'
option title 'BSSID'
config variable
option name 'txpower'
option section 'wireless.wifi-iface'
option title 'Transmit Power'
option description 'dbm'
option datatype uint
config variable
option name 'frag'
option section 'wireless.wifi-iface'
option title 'Fragmentation Threshold (mac80211, atheros)'
option datatype uint
config variable
option name 'rts'
option section 'wireless.wifi-iface'
option title 'RTS/CTS Threshold (mac80211, atheros)'
option datatype uint
config variable
option name 'wds'
option section 'wireless.wifi-iface'
option title 'WDS (atheros)'
option datatype boolean
list depends 'mode=ap'
list depends 'mode=sta'
config variable
option name 'wdssep'
option section 'wireless.wifi-iface'
option title 'Separate WDS (atheros)'
option datatype boolean
list depends 'wds=1,mode=ap'
config variable
option name 'doth'
option section 'wireless.wifi-iface'
option title '802.11h (atheros)'
option datatype boolean
config variable
option name 'hidden'
option section 'wireless.wifi-iface'
option title 'Hide ESSID (atheros, broadcom)'
option datatype boolean
list depends 'mode=ap'
list depends 'mode=adhoc'
list depends 'mode=wds'
config variable
option name 'isolate'
option section 'wireless.wifi-iface'
option title 'isolate (atheros, broadcom)'
option datatype boolean
list depends 'mode=ap'
config variable
option name 'bgscan'
option section 'wireless.wifi-iface'
option title 'Background Scan (atheros)'
option datatype boolean
config variable
option name 'sw_merge'
option section 'wireless.wifi-iface'
option title 'Disable Ad-Hoc HW beacon timer (atheros)'
option datatype boolean
config variable
option name 'nosbeacon'
option section 'wireless.wifi-iface'
option title 'Disable station HW beacon timer (atheros)'
option datatype boolean
config variable
option name 'probereq'
option section 'wireless.wifi-iface'
option title 'Disable probe responses (atheros)'
option datatype boolean
config variable
option name 'macpolicy'
option section 'wireless.wifi-iface'
option title 'MAC-Address Filter (atheros)'
option type enum
config enum
option variable 'wireless.wifi-iface.macpolicy'
option value 'deny'
option title 'Allow listed only'
config enum
option variable 'wireless.wifi-iface.macpolicy'
option value 'allow'
option title 'Allow all except listed'
config variable
option name 'maclist'
option section 'wireless.wifi-iface'
option title 'MAC-List (atheros)'
list depends 'macpolicy=allow'
list depends 'macpolicy=deny'
option type lazylist
option datatype macaddr
config variable
option name 'rate'
option section 'wireless.wifi-iface'
option title 'Transmission Rate (atheros)'
config variable
option name 'mcast_rate'
option section 'wireless.wifi-iface'
option title 'Multicast Rate (atheros)'
config variable
option name 'minrate'
option section 'wireless.wifi-iface'
option title 'Minimum Rate (atheros)'
config variable
option name 'maxrate'
option section 'wireless.wifi-iface'
option title 'Maximum Rate (atheros)'
config variable
option name 'compression'
option section 'wireless.wifi-iface'
option title 'Compression (atheros)'
option datatype boolean
config variable
option name 'bursting'
option section 'wireless.wifi-iface'
option title 'Frame Bursting (atheros)'
option datatype boolean
config variable
option name 'turbo'
option section 'wireless.wifi-iface'
option title 'Turbo Mode (atheros)'
option datatype boolean
config variable
option name 'ff'
option section 'wireless.wifi-iface'
option title 'Fast Frames (atheros)'
config variable
option name 'wmm'
option section 'wireless.wifi-iface'
option title 'WMM Mode (atheros)'
option datatype boolean
config variable
option name 'xr'
option section 'wireless.wifi-iface'
option title 'XR Support (atheros)'
option datatype boolean
config variable
option name 'ar'
option section 'wireless.wifi-iface'
option title 'AR Support (atheros)'
option datatype boolean
config variable
option name 'encryption'
option section 'wireless.wifi-iface'
option title 'Encryption'
option description 'WPA-Encryption requires wpa_supplicant (for client mode) or hostapd (for AP and ad-hoc mode) to be installed.'
option type enum
config enum
option variable 'wireless.wifi-iface.encryption'
option value 'none'
option title 'No Encryption'
config enum
option variable 'wireless.wifi-iface.encryption'
option value 'wep'
option title 'WEP'
config enum
option variable 'wireless.wifi-iface.encryption'
option value 'psk'
option title 'WPA-PSK'
config enum
option variable 'wireless.wifi-iface.encryption'
option value 'psk2'
option title 'WPA2-PSK'
config enum
option variable 'wireless.wifi-iface.encryption'
option value 'wpa'
option title 'WPA-EAP'
config enum
option variable 'wireless.wifi-iface.encryption'
option value 'wpa2i'
option title 'WPA2-EAP'
config variable
option name 'server'
option section 'wireless.wifi-iface'
option title 'RadiusServer'
list depends 'encryption=wpa,mode=ap'
list depends 'encryption=wpa2i,mode=ap'
option datatype host
config variable
option name 'port'
option section 'wireless.wifi-iface'
option title 'Radius-Port'
list depends 'encryption=wpa,mode=ap'
list depends 'encryption=wpa2i,mode=ap'
option datatype port
config variable
option name 'key'
option section 'wireless.wifi-iface'
option title 'Key'
list depends 'encryption=wep'
list depends 'encryption=psk'
list depends 'encryption=wpa,mode=ap'
list depends 'encryption=psk2'
list depends 'encryption=wpa2i,mode=ap'
config variable
option name 'nasid'
option section 'wireless.wifi-iface'
option title 'NAS ID'
list depends 'encryption=wpa,mode=ap'
list depends 'encryption=wpa2i,mode=ap'
config variable
option name 'eap_type'
option section 'wireless.wifi-iface'
option title 'EAP-Method'
option type enum
list depends 'encryption=wpa,mode=sta'
list depends 'encryption=wpa2i,mode=sta'
config enum
option variable 'wireless.wifi-iface.eap_type'
option value 'TLS'
config enum
option variable 'wireless.wifi-iface.eap_type'
option value 'PEAP'
config variable
option name 'ca_cert'
option section 'wireless.wifi-iface'
option title 'Path to CA-Certificate'
list depends 'encryption=wpa,mode=sta'
list depends 'encryption=wpa2i,mode=sta'
option datatype file
config variable
option name 'priv_key'
option section 'wireless.wifi-iface'
option title 'Path to Private Key'
list depends 'mode=sta,encryption=wpa2i,eap_type=TLS'
list depends 'mode=sta,encryption=wpa,eap_type=TLS'
option datatype file
config variable
option name 'priv_key_pwd'
option section 'wireless.wifi-iface'
option title 'Password of Private Key'
list depends 'mode=sta,encryption=wpa2i,eap_type=TLS'
list depends 'mode=sta,encryption=wpa,eap_type=TLS'
config variable
option name 'auth'
option section 'wireless.wifi-iface'
option title 'PEAP-Authentication'
list depends 'mode=sta,encryption=wpa2i,eap_type=PEAP'
list depends 'mode=sta,encryption=wpa,eap_type=PEAP'
config variable
option name 'identity'
option section 'wireless.wifi-iface'
option title 'PEAP-Identity'
list depends 'mode=sta,encryption=wpa2i,eap_type=PEAP'
list depends 'mode=sta,encryption=wpa,eap_type=PEAP'
config variable
option name 'password'
option section 'wireless.wifi-iface'
option title 'PEAP-Password'
list depends 'mode=sta,encryption=wpa2i,eap_type=PEAP'
list depends 'mode=sta,encryption=wpa,eap_type=PEAP'

View File

@ -1,403 +0,0 @@
# UVL - Reference-Spec
# This is a meta scheme defining the format of uci schemes.
# $Id: schema 3709 2008-11-04 21:28:07Z jow $
package schema
#-------------------------------------------------------------------------------
# Central package definition
#
# config package
# option ...
#-------------------------------------------------------------------------------
# Section definition (schema.@package)
config section
option name 'package'
option title 'Definition of uci package'
option package 'schema'
option required false
option named false
option unique true
option dynamic false
# Section title (schema.@package.title)
config variable
option name 'title'
option title 'Title of the defined package'
option section 'schema.package'
option type 'variable'
option datatype 'string'
option required false
# Section description (schema.@package.description)
config variable
option name 'description'
option title 'Description of the defined package'
option section 'schema.package'
option type 'lazylist'
option datatype 'string'
option required false
#-------------------------------------------------------------------------------
# Central section definition
#
# config section
# option ...
#-------------------------------------------------------------------------------
# Section definition (schema.@section)
config section
option name 'section'
option title 'Definition of uci section'
option package 'schema'
option required false
option named false
option unique false
option dynamic false
# Section name (schema.@section.name)
config variable
option name 'name'
option title 'Name of the defined section'
option section 'schema.section'
option type 'variable'
option datatype 'string'
option required true
# Section package (schema.@section.package)
config variable
option name 'package'
option title 'Parent package of the defined section'
option section 'schema.section'
option type 'variable'
option datatype 'string'
option required true
# Section title (schema.@section.title)
config variable
option name 'title'
option title 'Title of the defined section'
option section 'schema.section'
option type 'variable'
option datatype 'string'
option required false
# Section description (schema.@section.description)
config variable
option name 'description'
option title 'Description of the defined section'
option section 'schema.section'
option type 'lazylist'
option datatype 'string'
option required false
# Section dependencies (schema.@section.depends)
config variable
option name 'depends'
option title 'List of dependencies within and between defined sections'
option section 'schema.section'
option type 'lazylist'
option datatype 'string'
option required false
# Section required flag (schema.@section.required)
config variable
option name 'required'
option title 'Specify whether at least one instance of this section type must be defined in config'
option section 'schema.section'
option type 'variable'
option datatype 'boolean'
option required false
# Section unique flag (schema.@section.unique)
config variable
option name 'unique'
option title 'Specify whether only one instance of this section type is allowed in config'
option section 'schema.section'
option type 'variable'
option datatype 'boolean'
option required false
# Section named flag (schema.@section.named)
config variable
option name 'named'
option title 'Specify whether sections of this type must have a name set (are not anonymous)'
option section 'schema.section'
option type 'variable'
option datatype 'boolean'
option required false
# Section dynamic flag (schema.@section.dynamic)
config variable
option name 'dynamic'
option title 'Specify whether sections of this type may contain arbitary, not specified options'
option section 'schema.section'
option type 'variable'
option datatype 'boolean'
option required false
#-------------------------------------------------------------------------------
# Central variable definition
#
# config variable
# option ...
#-------------------------------------------------------------------------------
# Variable definition (schema.@variable)
config section
option name 'variable'
option title 'Definition of uci variable'
option package 'schema'
option required false
option named false
option unique false
option dynamic false
# Variable name (schema.@variable.name)
config variable
option name 'name'
option title 'Name of the defined variable'
option section 'schema.variable'
option type 'variable'
option datatype 'string'
option required true
# Variable section (schema.@variable.section)
config variable
option name 'section'
option title 'Parent section of the defined variable'
option section 'schema.variable'
option type 'variable'
option datatype 'string'
option required true
# Variable title (schema.@variable.title)
config variable
option name 'title'
option title 'Title of the defined variable'
option section 'schema.variable'
option type 'variable'
option datatype 'string'
option required false
# Variable description (schema.@variable.description)
config variable
option name 'description'
option title 'Description of the defined variable'
option section 'schema.variable'
option type 'lazylist'
option datatype 'string'
option required false
# Variable dependencies (schema.@variable.depends)
config variable
option name 'depends'
option title 'List of dependencies between defined variables'
option section 'schema.variable'
option type 'lazylist'
option datatype 'string'
option required false
# Variable required flag (schema.@variable.required)
config variable
option name 'required'
option title 'Specify whether this variable must be set in config'
option section 'schema.variable'
option type 'variable'
option datatype 'boolean'
option required false
# Variable multiple values flag (schema.@variable.multival)
config variable
option name 'multival'
option title 'Specify whether this variable may contain multiple values separated by space'
option section 'schema.variable'
option type 'variable'
option datatype 'boolean'
option required false
# Variable type (schema.@variable.type)
config variable
option name 'type'
option title 'Type of this variable'
option section 'schema.variable'
option type 'enum'
option datatype 'string'
option required false
# Plain variable type (schema.@variable.type=variable)
config enum
option value 'variable'
option title 'This is a plain variable'
option variable 'schema.variable.type'
# Enum variable type (schema.@variable.type=enum)
config enum
option value 'enum'
option title 'This is a enum variable'
option variable 'schema.variable.type'
# List variable type (schema.@variable.type=list)
config enum
option value 'list'
option title 'This is a list variable'
option variable 'schema.variable.type'
# List-or-Option variable type (schema.@variable.type=lazylist)
config enum
option value 'lazylist'
option title 'This is a list or option variable'
option variable 'schema.variable.type'
# Reference variable type (schema.@variable.type=reference)
config enum
option value 'reference'
option title 'This is a reference (valueof) variable'
option variable 'schema.variable.type'
# Variable datatype (schema.@variable.datatype)
config variable
option name 'datatype'
option title 'Datatype of this variable'
option section 'schema.variable'
option type 'variable'
option datatype 'string'
option required false
# Variable default value (schema.@variable.default)
config variable
option name 'default'
option title 'Default value of this variable'
option section 'schema.variable'
option type 'variable'
option datatype 'string'
option required false
# Variable minimum length (schema.@variable.minlength)
config variable
option name 'minlength'
option title 'Minimum length of this variable'
option section 'schema.variable'
option type 'variable'
option datatype 'uint'
option required false
# Variable maximum length (schema.@variable.minlength)
config variable
option name 'maxlength'
option title 'Maximum length of this variable'
option section 'schema.variable'
option type 'variable'
option datatype 'uint'
option required false
# Variable minimum value (schema.@variable.minlength)
config variable
option name 'minimum'
option title 'Minimum value of this variable'
option section 'schema.variable'
option type 'variable'
option datatype 'integer'
option required false
# Variable maximum value (schema.@variable.minlength)
config variable
option name 'maximum'
option title 'Maximum value of this variable'
option section 'schema.variable'
option type 'variable'
option datatype 'integer'
option required false
# Variable validators (schema.@variable.validator)
config variable
option name 'validator'
option title 'Datatype of this variable'
option section 'schema.variable'
option type 'lazylist'
option datatype 'string'
option required false
# Variable value references (schema.@variable.valueof)
config variable
option name 'valueof'
option title 'Reference to section or option to read values from'
option section 'schema.variable'
option type 'lazylist'
option datatype 'string'
option required false
#-------------------------------------------------------------------------------
# Central enum definition
#
# config enum
# option ...
#-------------------------------------------------------------------------------
# Enum definition (schema.@enum)
config section
option name 'enum'
option title 'Definition of uci enum value'
option package 'schema'
option required false
option named false
option unique false
option dynamic false
# Enum value (schema.@enum.value)
config variable
option name 'value'
option title 'Value of the defined enum value'
option section 'schema.enum'
option type 'variable'
option datatype 'string'
option required true
# Enum variable (schema.@enum.variable)
config variable
option name 'variable'
option title 'Parent variable of the defined enum value'
option section 'schema.enum'
option type 'variable'
option datatype 'string'
option required true
# Enum value title (schema.@enum.title)
config variable
option name 'title'
option title 'Title of the defined enum value'
option section 'schema.enum'
option type 'variable'
option datatype 'string'
option required false
# Enum value description (schema.@enum.description)
config variable
option name 'description'
option title 'Description of the defined enum value'
option section 'schema.enum'
option type 'lazylist'
option datatype 'string'
option required false
# Enum value dependencies (schema.@enum.depends)
config variable
option name 'depends'
option title 'List of dependencies on defined variables'
option section 'schema.enum'
option type 'lazylist'
option datatype 'string'
option required false
# Enum value default flag (schema.@enum.default)
config variable
option name 'default'
option title 'Specify whether this value is the default value of the parent enum'
option section 'schema.enum'
option type 'variable'
option datatype 'boolean'
option required false

View File

@ -1 +0,0 @@
./usr/lib/lua/luci

View File

@ -1,89 +0,0 @@
#!/bin/sh
. /etc/functions.sh
# initialize defaults
RAMFS_COPY_BIN="/usr/bin/awk" # extra programs for temporary ramfs root
RAMFS_COPY_DATA="" # extra data files
export KEEP_PATTERN=""
export VERBOSE=0
# parse options
while [ -n "$1" ]; do
case "$1" in
-k)
shift
export SAVE_CONFIG=1
export KEEP_PATTERN="$1"
;;
-*)
echo "Invalid option: $1"
exit 1
;;
*) break;;
esac
shift;
done
export CONFFILES=/tmp/sysupgrade.conffiles
export CONF_TAR=/tmp/sysupgrade.tgz
[ -f $CONFFILES ] && rm $CONFFILES
[ -f $CONF_TAR ] && rm $CONF_TAR
export ARGV="$*"
export ARGC="$#"
[ -z "$ARGV" ] && {
cat <<EOF
Usage: $0 [options] <image file or URL>
Options:
-k <"file 1, file 2, ..."> Files to be kept
EOF
exit 1
}
add_pattern_conffiles() {
local file="$1"
find $KEEP_PATTERN >> "$file" 2>/dev/null
return 0
}
# hooks
sysupgrade_image_check="platform_check_image"
sysupgrade_init_conffiles=""
[ -n "$KEEP_PATTERN" ] && append sysupgrade_init_conffiles "add_pattern_conffiles"
include /lib/upgrade
do_save_conffiles() {
[ -z "$(rootfs_type)" ] && {
echo "Cannot save config while running from ramdisk."
exit 3
return 0
}
run_hooks "$CONFFILES" $sysupgrade_init_conffiles
v "Saving config files..."
[ "$VERBOSE" -gt 1 ] && TAR_V="v" || TAR_V=""
tar c${TAR_V}zf "$CONF_TAR" -T "$CONFFILES" 2>/dev/null
}
type platform_check_image >/dev/null 2>/dev/null || {
echo "Firmware upgrade is not implemented for this platform."
exit 1
}
for check in $sysupgrade_image_check; do
( eval "$check \"\$ARGV\"" ) || {
echo "Image check '$check' failed."
exit 2
}
done
[ -n "$sysupgrade_init_conffiles" ] && do_save_conffiles
run_hooks "" $sysupgrade_pre_upgrade
v "Switching to ramdisk..."
run_ramfs '. /etc/functions.sh; include /lib/upgrade; do_upgrade'

View File

@ -1,34 +0,0 @@
#!/bin/sh
. /etc/functions.sh
apply_config() {
config_get init "$1" init
config_get exec "$1" exec
config_get test "$1" test
[ -n "$init" ] && reload_init "$2" "$init" "$test"
[ -n "$exec" ] && reload_exec "$2" "$exec" "$test"
}
reload_exec() {
[ -x $2 ] && {
echo "Reloading $1... "
$2 >/dev/null 2>&1
[ -n "$3" -a "$?" != "$3" ] && echo '!!! Failed to reload' $1 '!!!'
}
}
reload_init() {
[ -x /etc/init.d/$2 ] && /etc/init.d/$2 enabled && {
echo "Reloading $1... "
/etc/init.d/$2 reload >/dev/null 2>&1
[ -n "$3" -a "$?" != "$3" ] && echo '!!! Failed to reload' $1 '!!!'
}
}
config_load ucitrack
for i in $*
do
config_foreach apply_config $i $i
done

View File

@ -1,2 +0,0 @@
#!/usr/bin/lua
require("luci.lpk")

View File

@ -1,38 +0,0 @@
#!/usr/bin/lua
require("socket")
require("luci.ip")
require("luci.model.uci")
local uci = luci.model.uci.cursor_state()
uci:load("network")
local server = socket.bind("0.0.0.0", arg[1] or 8082)
server:settimeout(0, "t")
while true do
local client = server:accept()
if client then
client:settimeout(1)
local srv
local ip = luci.ip.IPv4(client:getpeername())
uci:foreach("network", "interface",
function (section)
if section.ipaddr then
local net = luci.ip.IPv4(section.ipaddr, section.netmask)
if ip and net and net:contains(ip) then
srv = section.ipaddr
return
end
end
end)
client:receive()
client:send("HTTP/1.0 302 Found\r\nLocation: http://" .. srv ..
(arg[2] or "/luci/splash") .. "\r\n\r\n")
client:close()
else
socket.sleep(0.1)
end
end

View File

@ -1,381 +0,0 @@
#!/usr/bin/lua
--[[
Luci statistics - collectd configuration generator
(c) 2008 Freifunk Leipzig / 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: stat-genconfig 3642 2008-10-29 05:08:03Z jow $
]]--
require("luci.model.uci")
require("luci.sys.iptparser")
require("luci.util")
local ipt = luci.sys.iptparser.IptParser()
local uci = luci.model.uci.cursor()
local sections = uci:get_all( "luci_statistics" )
function section( plugin )
local config = sections[ "collectd_" .. plugin ] or sections["collectd"]
if type(config) == "table" and ( plugin == "collectd" or config.enable == "1" ) then
local params = ""
if type( plugins[plugin] ) == "function" then
params = plugins[plugin]( config )
else
params = config_generic( config, plugins[plugin][1], plugins[plugin][2], plugins[plugin][3], plugin == "collectd" )
end
if plugin ~= "collectd" then
print( "LoadPlugin " .. plugin )
if params:len() > 0 then
print( "<Plugin " .. plugin .. ">\n" .. params .. "</Plugin>\n" )
else
print( "" )
end
else
print( params .. "\n" )
end
end
end
function config_generic( c, singles, bools, lists, nopad )
local str = ""
if type(c) == "table" then
if type(singles) == "table" then
for i, key in ipairs( singles ) do
if preprocess[key] then
c[key] = preprocess[key](c[key])
end
str = str .. _string( c[key], key, nopad )
end
end
if type(bools) == "table" then
for i, key in ipairs( bools ) do
if preprocess[key] then
c[key] = preprocess[key](c[key])
end
str = str .. _bool( c[key], key, nopad )
end
end
if type(lists) == "table" then
str = str .. _list_expand( c, lists, nopad )
end
end
return str
end
function config_exec( c )
local str = ""
for s in pairs(sections) do
for key, type in pairs({ Exec="collectd_exec_input", NotificationExec="collectd_exec_notify" }) do
if sections[s][".type"] == type then
cmd = sections[s].cmdline
if cmd then
cmd = cmd:gsub("^%s+", ""):gsub("%s+$", "")
user = sections[s].cmduser or "nobody"
group = sections[s].cmdgroup
str = str .. "\t" .. key .. ' "' ..
user .. ( group and ":" .. group or "" ) .. '" "' ..
cmd:gsub('%s+', '" "') .. '"\n'
end
end
end
end
return str
end
function config_iptables( c )
local str = ""
for s in pairs(sections) do
if sections[s][".type"] == "collectd_iptables_match" then
search = { }
for i, k in ipairs( {
"table", "chain", "target", "protocol", "source", "destination",
"inputif", "outputif", "options"
} ) do
v = sections[s][k]
if type(v) == "string" then
if k == "options" then v = luci.util.split( v, "%s+", nil, true ) end
search[k] = v
end
end
for i, rule in ipairs( ipt:find( search ) ) do
name = sections[s].name:gsub( "%s+", "_" )
if i > 1 then name = name .. "_(" .. i .. ")" end
str = str .. "\tChain " .. rule.table .. " " .. rule.chain .. " " .. rule.index .. ' "' .. name .. "\"\n"
end
end
end
return str
end
function config_network( c )
local str = ""
for s in pairs(sections) do
for key, type in pairs({ Listen="collectd_network_listen", Server="collectd_network_server" }) do
if sections[s][".type"] == type then
host = sections[s].host
port = sections[s].port
if host then
if port then
str = str .. "\t" .. key .. " " .. host .. " " .. port .. "\n"
else
str = str .. "\t" .. key .. " " .. host .. "\n"
end
end
end
end
end
return str .. _string( c["TimeToLive"], "TimeToLive" )
.. _string( c["CacheFlush"], "CacheFlush" )
.. _bool( c["Forward"], "Forward" )
end
function _list_expand( c, l, nopad )
local str = ""
for i, n in ipairs(l) do
if c[n] then
if preprocess[n] then
c[n] = preprocess[n](c[n])
end
if n:find("(%w+)ses") then
k = n:gsub("(%w+)ses", "%1s")
else
k = n:gsub("(%w+)s", "%1")
end
str = str .. _expand( c[n], k, nopad )
end
end
return str
end
function _expand( s, n, nopad )
if type(s) == "string" then
local str = ""
for i, v in ipairs( luci.util.split( s, "%s+", nil, true ) ) do
str = str .. _string( v, n, nopad )
end
return str
end
end
function _bool( s, n, nopad )
local str = ""
local pad = ""
if not nopad then pad = "\t" end
if s and s == "1" then
str = pad .. n .. " true"
else
str = pad .. n .. " false"
end
return str .. "\n"
end
function _string( s, n, nopad )
local str = ""
local pad = ""
if not nopad then pad = "\t" end
if s then
if s:find("[^%d]") then
if not s:find("[^%w]") then
str = pad .. n .. " " .. luci.util.trim(s)
else
str = pad .. n .. ' "' .. luci.util.trim(s) .. '"'
end
else
str = pad .. n .. " " .. luci.util.trim(s)
end
str = str .. "\n"
end
return str
end
plugins = {
collectd = {
{ "BaseDir", "Include", "PIDFile", "PluginDir", "TypesDB", "Interval", "ReadThreads", "Hostname" },
{ },
{ }
},
cpu = {
{ },
{ },
{ }
},
csv = {
{ "DataDir" },
{ "StoreRates" },
{ }
},
df = {
{ },
{ "IgnoreSelected" },
{ "Devices", "MountPoints", "FSTypes" }
},
disk = {
{ },
{ "IgnoreSelected" },
{ "Disks" }
},
dns = {
{ },
{ },
{ "Interfaces", "IgnoreSources" }
},
email = {
{ "SocketFile", "SocketGroup", "SocketPerms", "MaxConns" },
{ },
{ }
},
exec = config_exec,
interface = {
{ },
{ "IgnoreSelected" },
{ "Interfaces" }
},
iptables = config_iptables,
irq = {
{ },
{ "IgnoreSelected" },
{ "Irqs" }
},
load = {
{ },
{ },
{ }
},
logfile = {
{ "LogLevel", "File" },
{ "Timestamp" },
{ }
},
netlink = {
{ },
{ "IgnoreSelected" },
{ "Interfaces", "VerboseInterfaces", "QDiscs", "Classes", "Filters" }
},
network = config_network,
ping = {
{ "TTL" },
{ },
{ "Hosts" }
},
processes = {
{ },
{ },
{ "Processes" }
},
rrdtool = {
{ "DataDir", "StepSize", "HeartBeat", "RRARows", "XFF", "CacheFlush", "CacheTimeout" },
{ "RRASingle" },
{ "RRATimespans" }
},
tcpconns = {
{ },
{ "ListeningPorts" },
{ "LocalPorts", "RemotePorts" }
},
unixsock = {
{ "SocketFile", "SocketGroup", "SocketPerms" },
{ },
{ }
},
wireless = {
{ },
{ },
{ }
},
}
preprocess = {
RRATimespans = function(val)
local rv = { }
for time in val:gmatch("[^%s]+") do
table.insert( rv, luci.util.parse_units(time) )
end
return table.concat(rv, " ")
end
}
section("collectd")
for plugin in pairs(plugins) do
if plugin ~= "collectd" then
section( plugin )
end
end

View File

@ -1,241 +0,0 @@
#!/usr/bin/lua
--[[
UCI Validation Layer - Command Line Utility
(c) 2008 Jo-Philipp Wich <xm@leipzig.freifunk.net>
(c) 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: uvl 4085 2009-01-17 23:51:28Z jow $
]]--
require("luci.uvl")
require("luci.util")
function getopt( arg, options )
options = options or ""
local tab = {}
local args = {}
for k, v in ipairs(arg) do
if v:sub(1, 2) == "--" then
local x = v:find( "=", 1, true )
if x then
tab[ v:sub( 3, x-1 ) ] = v:sub( x+1 )
else
tab[ v:sub( 3 ) ] = true
end
elseif v:sub( 1, 1 ) == "-" then
local y = 2
local l = #v
local jopt
while ( y <= l ) do
jopt = v:sub( y, y )
if options:find( jopt, 1, true ) then
if y < l then
tab[ jopt ] = v:sub( y+1 )
y = l
else
tab[ jopt ] = arg[ k + 1 ]
arg[ k + 1 ] = ""
end
else
tab[ jopt ] = true
end
y = y + 1
end
elseif #v > 0 then
table.insert(args, v)
end
end
return tab, args
end
function genspec(conf)
require("luci.model.uci")
require("luci.uvl.datatypes")
local uci = luci.model.uci.cursor()
local ok, err = uci:load(conf)
if not ok then
print("Can not load config:", err)
os.exit(1)
else
local function _guess_datatype(v)
if type(v) == "table" then v = v[1] end
for _, type in ipairs({
"boolean", "integer", "float", "ip4addr", "ip6addr",
"macaddr", "directory", "file"
}) do
if luci.uvl.datatypes[type](v) then
return type
end
end
return "string"
end
local co = uci:get_all(conf)
local ct = { }
local ca = { }
local so = { }
local to = { }
-- count section types
for _, section in pairs(co) do
ct[section['.type']] = ( ct[section['.type']] or 0 ) + 1
ca[section['.type']] = section['.anonymous']
so[section['.type']] = so[section['.type']] or { }
to[section['.type']] = to[section['.type']] or { }
for option, value in pairs(section) do
if option:sub(1,1) ~= "." then
so[section['.type']][option] = _guess_datatype(value)
to[section['.type']][option] = ( type(value) == "table" and "list" or "variable" )
end
end
end
-- package name
print( "package %s" % conf )
-- write section schemes
for type, count in luci.util.kspairs(ct) do
print( "\nconfig section" )
print( "\toption name '%s'" % type )
print( "\toption title 'Section %s'" % type )
print( "\toption package '%s'"% conf )
print( "\toption named %s" % ( ca[type] and 'false' or 'true' ) )
print( "\toption unique %s" % ( ct[type] > 1 and 'false' or ( ca[type] and 'false' or 'true' ) ) )
print( "\toption dynamic false" )
print( "\toption required false" )
-- write option schemes
for opt, val in luci.util.kspairs(so[type]) do
print( "\nconfig variable" )
print( "\toption name '%s'" % opt )
print( "\toption title 'Option %s'" % opt )
print( "\toption section '%s.%s'" %{ conf, type } )
print( "\toption datatype '%s'" % so[type][opt] )
if to[type][opt] ~= "variable" then
print( "\toption type '%s'" % to[type][opt] )
end
end
print("")
end
end
end
local options, arguments = getopt( arg )
if #arguments ~= 2 or options.help then
print([=[
uvl - UCI Validation Layer
$Id: uvl 4085 2009-01-17 23:51:28Z jow $
(c) 2008 Jo-Philipp Wich, Steven Barth
Usage:
uvl --help
uvl [--silent] [--schemedir=DIR] [--configdir=DIR] [--no-strict-sections] \
[--no-strict-options] [--no-strict-validators] [--no-strict-lists] \
{verify|verify-scheme|genspec} config[.section[.option]]
Options:
--help
Display this help message.
--silent
Don't produce any output.
--schemedir=DIR
Use DIR as scheme directory.
--configdir=DIR
Use DIR as config directory.
--no-strict-sections
Don't treat sections found in config but not in scheme as error.
--no-strict-options
Don't treat options found in config but not in scheme as error.
--no-strict-validators
Don't invalidate config if an external validator fails.
--no-strict-lists
Don't invalidate lists that are stored options.
Actions:
verify
Validate given configuration, section or option.
verify-scheme
Validate given scheme against the reference meta scheme.
genspec
Generate a scheme skeleton from given configuration.
]=])
os.exit(255)
elseif arguments[1] == "verify" or arguments[1] == "verify-scheme" then
luci.uvl.STRICT_UNKNOWN_SECTIONS =
( not options['no-strict-sections'] and true or false )
luci.uvl.STRICT_UNKNOWN_OPTIONS =
( not options['no-strict-options'] and true or false )
luci.uvl.STRICT_EXTERNAL_VALIDATORS =
( not options['no-strict-validators'] and true or false )
luci.uvl.STRICT_LIST_TYPE =
( not options['no-strict-lists'] and true or false )
local uvl = luci.uvl.UVL(
type(options.schemedir) == "string" and options.schemedir,
type(options.configdir) == "string" and options.configdir
)
local cso = luci.util.split( arguments[2], "." )
local ok, err
if arguments[1] == "verify-scheme" then
uvl:read_scheme( 'schema', cso[1] )
local uci = uvl.uci.cursor(
type(options.configdir) == "string"
and options.configdir or uvl.schemedir .. '/default'
)
ok, err = uvl:validate_config( cso[1], uci:get_all(cso[1]) )
if err then err.code = luci.uvl.errors.ERR_SCHEME end
else
ok, err = uvl:validate( unpack(cso) )
end
if ok then
if not options.silent then
print( string.format(
'%s "%s" validates fine!',
( arguments[1] == "verify-scheme" and "Scheme" or
( #cso == 1 and "Config" or
( #cso == 2 and "Section" or "Option" ) ) ),
table.concat(cso, ".")
) )
end
os.exit( 0 )
else
if not options.silent then print( err and err:string() or "Unknown error" ) end
os.exit( 1 )
end
else
genspec( arguments[2] )
end

View File

@ -1,22 +0,0 @@
#!/usr/bin/lua
if arg[1] then
require("luci.util")
require("luci.uvl")
require("luci.fs")
local uvl = luci.uvl.UVL()
local scheme, err = uvl:get_scheme( arg[1] )
if scheme then
luci.fs.writefile(
"%s/bytecode/%s.lua" %{ uvl.schemedir, arg[1] },
luci.util.get_bytecode(scheme)
)
else
print("Error:", err:string())
end
else
print( "Usage: uvlc <scheme>" )
end

View File

@ -1,545 +0,0 @@
/*
* libuci - Library for the Unified Configuration Interface
* Copyright (C) 2008 Felix Fietkau <nbd@openwrt.org>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License version 2.1
* as published by the Free Software Foundation
*
* 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.
*/
#ifndef __LIBUCI_H
#define __LIBUCI_H
#include "uci_config.h"
/*
* you can use these defines to enable debugging behavior for
* apps compiled against libuci:
*
* #define UCI_DEBUG_TYPECAST:
* enable uci_element typecast checking at run time
*
*/
#include <stdbool.h>
#include <setjmp.h>
#include <stdio.h>
#define UCI_CONFDIR "/etc/config"
#define UCI_SAVEDIR "/tmp/.uci"
#define UCI_DIRMODE 0700
#define UCI_FILEMODE 0600
enum
{
UCI_OK = 0,
UCI_ERR_MEM,
UCI_ERR_INVAL,
UCI_ERR_NOTFOUND,
UCI_ERR_IO,
UCI_ERR_PARSE,
UCI_ERR_DUPLICATE,
UCI_ERR_UNKNOWN,
UCI_ERR_LAST
};
struct uci_list;
struct uci_list
{
struct uci_list *next;
struct uci_list *prev;
};
struct uci_ptr;
struct uci_element;
struct uci_package;
struct uci_section;
struct uci_option;
struct uci_history;
struct uci_context;
struct uci_backend;
struct uci_parse_context;
/**
* uci_alloc_context: Allocate a new uci context
*/
extern struct uci_context *uci_alloc_context(void);
/**
* uci_free_context: Free the uci context including all of its data
*/
extern void uci_free_context(struct uci_context *ctx);
/**
* uci_perror: Print the last uci error that occured
* @ctx: uci context
* @str: string to print before the error message
*/
extern void uci_perror(struct uci_context *ctx, const char *str);
/**
* uci_geterror: Get an error string for the last uci error
* @ctx: uci context
* @dest: target pointer for the string
* @str: prefix for the error message
*
* Note: string must be freed by the caller
*/
extern void uci_get_errorstr(struct uci_context *ctx, char **dest, const char *str);
/**
* uci_import: Import uci config data from a stream
* @ctx: uci context
* @stream: file stream to import from
* @name: (optional) assume the config has the given name
* @package: (optional) store the last parsed config package in this variable
* @single: ignore the 'package' keyword and parse everything into a single package
*
* the name parameter is for config files that don't explicitly use the 'package <...>' keyword
* if 'package' points to a non-null struct pointer, enable history tracking and merge
*/
extern int uci_import(struct uci_context *ctx, FILE *stream, const char *name, struct uci_package **package, bool single);
/**
* uci_export: Export one or all uci config packages
* @ctx: uci context
* @stream: output stream
* @package: (optional) uci config package to export
* @header: include the package header
*/
extern int uci_export(struct uci_context *ctx, FILE *stream, struct uci_package *package, bool header);
/**
* uci_load: Parse an uci config file and store it in the uci context
*
* @ctx: uci context
* @name: name of the config file (relative to the config directory)
* @package: store the loaded config package in this variable
*/
extern int uci_load(struct uci_context *ctx, const char *name, struct uci_package **package);
/**
* uci_unload: Unload a config file from the uci context
*
* @ctx: uci context
* @package: pointer to the uci_package struct
*/
extern int uci_unload(struct uci_context *ctx, struct uci_package *p);
/**
* uci_lookup_ptr: Split an uci tuple string and look up an element tree
* @ctx: uci context
* @ptr: lookup result struct
* @str: uci tuple string to look up
* @extended: allow extended syntax lookup
*
* if extended is set to true, uci_lookup_ptr supports the following
* extended syntax:
*
* Examples:
* network.@interface[0].ifname ('ifname' option of the first interface section)
* network.@interface[-1] (last interface section)
* Note: uci_lookup_ext will automatically load a config package if necessary
*/
extern int uci_lookup_ptr(struct uci_context *ctx, struct uci_ptr *ptr, char *str, bool extended);
/**
* uci_add_section: Add an unnamed section
* @ctx: uci context
* @p: package to add the section to
* @type: section type
* @res: pointer to store a reference to the new section in
*/
extern int uci_add_section(struct uci_context *ctx, struct uci_package *p, const char *type, struct uci_section **res);
/**
* uci_set: Set an element's value; create the element if necessary
* @ctx: uci context
* @ptr: uci pointer
*
* The updated/created element is stored in ptr->last
*/
extern int uci_set(struct uci_context *ctx, struct uci_ptr *ptr);
/**
* uci_add_list: Append a string to an element list
* @ctx: uci context
* @ptr: uci pointer (with value)
*
* Note: if the given option already contains a string value,
* it will be converted to an 1-element-list before appending the next element
*/
extern int uci_add_list(struct uci_context *ctx, struct uci_ptr *ptr);
/**
* uci_rename: Rename an element
* @ctx: uci context
* @ptr: uci pointer (with value)
*/
extern int uci_rename(struct uci_context *ctx, struct uci_ptr *ptr);
/**
* uci_delete: Delete a section or option
* @ctx: uci context
* @ptr: uci pointer
*/
extern int uci_delete(struct uci_context *ctx, struct uci_ptr *ptr);
/**
* uci_save: save change history for a package
* @ctx: uci context
* @p: uci_package struct
*/
extern int uci_save(struct uci_context *ctx, struct uci_package *p);
/**
* uci_commit: commit changes to a package
* @ctx: uci context
* @p: uci_package struct pointer
* @overwrite: overwrite existing config data and flush history
*
* committing may reload the whole uci_package data,
* the supplied pointer is updated accordingly
*/
extern int uci_commit(struct uci_context *ctx, struct uci_package **p, bool overwrite);
/**
* uci_list_configs: List available uci config files
* @ctx: uci context
*
* caller is responsible for freeing the allocated memory behind list
*/
extern int uci_list_configs(struct uci_context *ctx, char ***list);
/**
* uci_set_savedir: override the default history save directory
* @ctx: uci context
* @dir: directory name
*/
extern int uci_set_savedir(struct uci_context *ctx, const char *dir);
/**
* uci_set_savedir: override the default config storage directory
* @ctx: uci context
* @dir: directory name
*/
extern int uci_set_confdir(struct uci_context *ctx, const char *dir);
/**
* uci_add_history_path: add a directory to the search path for change history files
* @ctx: uci context
* @dir: directory name
*
* This function allows you to add directories, which contain 'overlays'
* for the active config, that will never be committed.
*/
extern int uci_add_history_path(struct uci_context *ctx, const char *dir);
/**
* uci_revert: revert all changes to a config item
* @ctx: uci context
* @ptr: uci pointer
*/
extern int uci_revert(struct uci_context *ctx, struct uci_ptr *ptr);
/**
* uci_parse_argument: parse a shell-style argument, with an arbitrary quoting style
* @ctx: uci context
* @stream: input stream
* @str: pointer to the current line (use NULL for parsing the next line)
* @result: pointer for the result
*/
extern int uci_parse_argument(struct uci_context *ctx, FILE *stream, char **str, char **result);
/**
* uci_set_backend: change the default backend
* @ctx: uci context
* @name: name of the backend
*
* The default backend is "file", which uses /etc/config for config storage
*/
extern int uci_set_backend(struct uci_context *ctx, const char *name);
/**
* uci_validate_text: validate a value string for uci options
* @str: value
*
* this function checks whether a given string is acceptable as value
* for uci options
*/
extern bool uci_validate_text(const char *str);
/* UCI data structures */
enum uci_type {
UCI_TYPE_UNSPEC = 0,
UCI_TYPE_HISTORY = 1,
UCI_TYPE_PACKAGE = 2,
UCI_TYPE_SECTION = 3,
UCI_TYPE_OPTION = 4,
UCI_TYPE_PATH = 5,
UCI_TYPE_BACKEND = 6,
UCI_TYPE_ITEM = 7,
};
enum uci_option_type {
UCI_TYPE_STRING = 0,
UCI_TYPE_LIST = 1,
};
enum uci_flags {
UCI_FLAG_STRICT = (1 << 0), /* strict mode for the parser */
UCI_FLAG_PERROR = (1 << 1), /* print parser error messages */
UCI_FLAG_EXPORT_NAME = (1 << 2), /* when exporting, name unnamed sections */
UCI_FLAG_SAVED_HISTORY = (1 << 3), /* store the saved history in memory as well */
};
struct uci_element
{
struct uci_list list;
enum uci_type type;
char *name;
};
struct uci_backend
{
struct uci_element e;
char **(*list_configs)(struct uci_context *ctx);
struct uci_package *(*load)(struct uci_context *ctx, const char *name);
void (*commit)(struct uci_context *ctx, struct uci_package **p, bool overwrite);
/* private: */
const void *ptr;
void *priv;
};
struct uci_context
{
/* list of config packages */
struct uci_list root;
/* parser context, use for error handling only */
struct uci_parse_context *pctx;
/* backend for import and export */
struct uci_backend *backend;
struct uci_list backends;
/* uci runtime flags */
enum uci_flags flags;
char *confdir;
char *savedir;
/* search path for history files */
struct uci_list history_path;
/* private: */
int err;
const char *func;
jmp_buf trap;
bool internal, nested;
char *buf;
int bufsz;
};
struct uci_package
{
struct uci_element e;
struct uci_list sections;
struct uci_context *ctx;
bool has_history;
char *path;
/* private: */
struct uci_backend *backend;
void *priv;
int n_section;
struct uci_list history;
struct uci_list saved_history;
};
struct uci_section
{
struct uci_element e;
struct uci_list options;
struct uci_package *package;
bool anonymous;
char *type;
};
struct uci_option
{
struct uci_element e;
struct uci_section *section;
enum uci_option_type type;
union {
struct uci_list list;
char *string;
} v;
};
enum uci_command {
UCI_CMD_ADD,
UCI_CMD_REMOVE,
UCI_CMD_CHANGE,
UCI_CMD_RENAME,
UCI_CMD_LIST_ADD,
};
struct uci_history
{
struct uci_element e;
enum uci_command cmd;
char *section;
char *value;
};
struct uci_ptr
{
enum uci_type target;
enum {
UCI_LOOKUP_DONE = (1 << 0),
UCI_LOOKUP_COMPLETE = (1 << 1),
UCI_LOOKUP_EXTENDED = (1 << 2),
} flags;
struct uci_package *p;
struct uci_section *s;
struct uci_option *o;
struct uci_element *last;
const char *package;
const char *section;
const char *option;
const char *value;
};
/* linked list handling */
#ifndef offsetof
#define offsetof(TYPE, MEMBER) ((size_t) &((TYPE *)0)->MEMBER)
#endif
/**
* container_of - cast a member of a structure out to the containing structure
* @ptr: the pointer to the member.
* @type: the type of the container struct this is embedded in.
* @member: the name of the member within the struct.
*/
#ifndef container_of
#define container_of(ptr, type, member) \
((type *) ((char *)ptr - offsetof(type,member)))
#endif
/**
* uci_list_entry: casts an uci_list pointer to the containing struct.
* @_type: config, section or option
* @_ptr: pointer to the uci_list struct
*/
#define list_to_element(ptr) \
container_of(ptr, struct uci_element, list)
/**
* uci_foreach_entry: loop through a list of uci elements
* @_list: pointer to the uci_list struct
* @_ptr: iteration variable, struct uci_element
*
* use like a for loop, e.g:
* uci_foreach(&list, p) {
* ...
* }
*/
#define uci_foreach_element(_list, _ptr) \
for(_ptr = list_to_element((_list)->next); \
&_ptr->list != (_list); \
_ptr = list_to_element(_ptr->list.next))
/**
* uci_foreach_entry_safe: like uci_foreach_safe, but safe for deletion
* @_list: pointer to the uci_list struct
* @_tmp: temporary variable, struct uci_element *
* @_ptr: iteration variable, struct uci_element *
*
* use like a for loop, e.g:
* uci_foreach(&list, p) {
* ...
* }
*/
#define uci_foreach_element_safe(_list, _tmp, _ptr) \
for(_ptr = list_to_element((_list)->next), \
_tmp = list_to_element(_ptr->list.next); \
&_ptr->list != (_list); \
_ptr = _tmp, _tmp = list_to_element(_ptr->list.next))
/**
* uci_list_empty: returns true if a list is empty
* @list: list head
*/
#define uci_list_empty(list) ((list)->next == (list))
/* wrappers for dynamic type handling */
#define uci_type_backend UCI_TYPE_BACKEND
#define uci_type_history UCI_TYPE_HISTORY
#define uci_type_package UCI_TYPE_PACKAGE
#define uci_type_section UCI_TYPE_SECTION
#define uci_type_option UCI_TYPE_OPTION
/* element typecasting */
#ifdef UCI_DEBUG_TYPECAST
static const char *uci_typestr[] = {
[uci_type_backend] = "backend",
[uci_type_history] = "history",
[uci_type_package] = "package",
[uci_type_section] = "section",
[uci_type_option] = "option",
};
static void uci_typecast_error(int from, int to)
{
fprintf(stderr, "Invalid typecast from '%s' to '%s'\n", uci_typestr[from], uci_typestr[to]);
}
#define BUILD_CAST(_type) \
static inline struct uci_ ## _type *uci_to_ ## _type (struct uci_element *e) \
{ \
if (e->type != uci_type_ ## _type) { \
uci_typecast_error(e->type, uci_type_ ## _type); \
} \
return (struct uci_ ## _type *) e; \
}
BUILD_CAST(backend)
BUILD_CAST(history)
BUILD_CAST(package)
BUILD_CAST(section)
BUILD_CAST(option)
#else
#define uci_to_backend(ptr) container_of(ptr, struct uci_backend, e)
#define uci_to_history(ptr) container_of(ptr, struct uci_history, e)
#define uci_to_package(ptr) container_of(ptr, struct uci_package, e)
#define uci_to_section(ptr) container_of(ptr, struct uci_section, e)
#define uci_to_option(ptr) container_of(ptr, struct uci_option, e)
#endif
/**
* uci_alloc_element: allocate a generic uci_element, reserve a buffer and typecast
* @ctx: uci context
* @type: {package,section,option}
* @name: string containing the name of the element
* @datasize: additional buffer size to reserve at the end of the struct
*/
#define uci_alloc_element(ctx, type, name, datasize) \
uci_to_ ## type (uci_alloc_generic(ctx, uci_type_ ## type, name, sizeof(struct uci_ ## type) + datasize))
#define uci_dataptr(ptr) \
(((char *) ptr) + sizeof(*ptr))
#endif

View File

@ -1,3 +0,0 @@
#define UCI_PLUGIN_SUPPORT 1
#undef UCI_DEBUG
#undef UCI_DEBUG_TYPECAST

View File

@ -1,601 +0,0 @@
#ifndef _LINUX_LIST_H
#define _LINUX_LIST_H
#include <stddef.h>
/**
* container_of - cast a member of a structure out to the containing structure
* @ptr: the pointer to the member.
* @type: the type of the container struct this is embedded in.
* @member: the name of the member within the struct.
*
*/
#ifndef container_of
#define container_of(ptr, type, member) ( \
(type *)( (char *)ptr - offsetof(type,member) ))
#endif
/*
* Simple doubly linked list implementation.
*
* Some of the internal functions ("__xxx") are useful when
* manipulating whole lists rather than single entries, as
* sometimes we already know the next/prev entries and we can
* generate better code by using them directly rather than
* using the generic single-entry routines.
*/
struct list_head {
struct list_head *next, *prev;
};
#define LIST_HEAD_INIT(name) { &(name), &(name) }
#define LIST_HEAD(name) \
struct list_head name = LIST_HEAD_INIT(name)
static inline void INIT_LIST_HEAD(struct list_head *list)
{
list->next = list;
list->prev = list;
}
/*
* Insert a new entry between two known consecutive entries.
*
* This is only for internal list manipulation where we know
* the prev/next entries already!
*/
static inline void __list_add(struct list_head *new,
struct list_head *prev,
struct list_head *next)
{
next->prev = new;
new->next = next;
new->prev = prev;
prev->next = new;
}
/**
* list_add - add a new entry
* @new: new entry to be added
* @head: list head to add it after
*
* Insert a new entry after the specified head.
* This is good for implementing stacks.
*/
static inline void list_add(struct list_head *new, struct list_head *head)
{
__list_add(new, head, head->next);
}
/**
* list_add_tail - add a new entry
* @new: new entry to be added
* @head: list head to add it before
*
* Insert a new entry before the specified head.
* This is useful for implementing queues.
*/
static inline void list_add_tail(struct list_head *new, struct list_head *head)
{
__list_add(new, head->prev, head);
}
/*
* Delete a list entry by making the prev/next entries
* point to each other.
*
* This is only for internal list manipulation where we know
* the prev/next entries already!
*/
static inline void __list_del(struct list_head * prev, struct list_head * next)
{
next->prev = prev;
prev->next = next;
}
/**
* list_del - deletes entry from list.
* @entry: the element to delete from the list.
* Note: list_empty() on entry does not return true after this, the entry is
* in an undefined state.
*/
static inline void list_del(struct list_head *entry)
{
__list_del(entry->prev, entry->next);
entry->next = NULL;
entry->prev = NULL;
}
/**
* list_replace - replace old entry by new one
* @old : the element to be replaced
* @new : the new element to insert
*
* If @old was empty, it will be overwritten.
*/
static inline void list_replace(struct list_head *old,
struct list_head *new)
{
new->next = old->next;
new->next->prev = new;
new->prev = old->prev;
new->prev->next = new;
}
static inline void list_replace_init(struct list_head *old,
struct list_head *new)
{
list_replace(old, new);
INIT_LIST_HEAD(old);
}
/**
* list_del_init - deletes entry from list and reinitialize it.
* @entry: the element to delete from the list.
*/
static inline void list_del_init(struct list_head *entry)
{
__list_del(entry->prev, entry->next);
INIT_LIST_HEAD(entry);
}
/**
* list_move - delete from one list and add as another's head
* @list: the entry to move
* @head: the head that will precede our entry
*/
static inline void list_move(struct list_head *list, struct list_head *head)
{
__list_del(list->prev, list->next);
list_add(list, head);
}
/**
* list_move_tail - delete from one list and add as another's tail
* @list: the entry to move
* @head: the head that will follow our entry
*/
static inline void list_move_tail(struct list_head *list,
struct list_head *head)
{
__list_del(list->prev, list->next);
list_add_tail(list, head);
}
/**
* list_is_last - tests whether @list is the last entry in list @head
* @list: the entry to test
* @head: the head of the list
*/
static inline int list_is_last(const struct list_head *list,
const struct list_head *head)
{
return list->next == head;
}
/**
* list_empty - tests whether a list is empty
* @head: the list to test.
*/
static inline int list_empty(const struct list_head *head)
{
return head->next == head;
}
/**
* list_empty_careful - tests whether a list is empty and not being modified
* @head: the list to test
*
* Description:
* tests whether a list is empty _and_ checks that no other CPU might be
* in the process of modifying either member (next or prev)
*
* NOTE: using list_empty_careful() without synchronization
* can only be safe if the only activity that can happen
* to the list entry is list_del_init(). Eg. it cannot be used
* if another CPU could re-list_add() it.
*/
static inline int list_empty_careful(const struct list_head *head)
{
struct list_head *next = head->next;
return (next == head) && (next == head->prev);
}
static inline void __list_splice(struct list_head *list,
struct list_head *head)
{
struct list_head *first = list->next;
struct list_head *last = list->prev;
struct list_head *at = head->next;
first->prev = head;
head->next = first;
last->next = at;
at->prev = last;
}
/**
* list_splice - join two lists
* @list: the new list to add.
* @head: the place to add it in the first list.
*/
static inline void list_splice(struct list_head *list, struct list_head *head)
{
if (!list_empty(list))
__list_splice(list, head);
}
/**
* list_splice_init - join two lists and reinitialise the emptied list.
* @list: the new list to add.
* @head: the place to add it in the first list.
*
* The list at @list is reinitialised
*/
static inline void list_splice_init(struct list_head *list,
struct list_head *head)
{
if (!list_empty(list)) {
__list_splice(list, head);
INIT_LIST_HEAD(list);
}
}
/**
* list_entry - get the struct for this entry
* @ptr: the &struct list_head pointer.
* @type: the type of the struct this is embedded in.
* @member: the name of the list_struct within the struct.
*/
#define list_entry(ptr, type, member) \
container_of(ptr, type, member)
/**
* list_first_entry - get the first element from a list
* @ptr: the list head to take the element from.
* @type: the type of the struct this is embedded in.
* @member: the name of the list_struct within the struct.
*
* Note, that list is expected to be not empty.
*/
#define list_first_entry(ptr, type, member) \
list_entry((ptr)->next, type, member)
/**
* list_for_each - iterate over a list
* @pos: the &struct list_head to use as a loop cursor.
* @head: the head for your list.
*/
#define list_for_each(pos, head) \
for (pos = (head)->next; pos != (head); \
pos = pos->next)
/**
* __list_for_each - iterate over a list
* @pos: the &struct list_head to use as a loop cursor.
* @head: the head for your list.
*
* This variant differs from list_for_each() in that it's the
* simplest possible list iteration code, no prefetching is done.
* Use this for code that knows the list to be very short (empty
* or 1 entry) most of the time.
*/
#define __list_for_each(pos, head) \
for (pos = (head)->next; pos != (head); pos = pos->next)
/**
* list_for_each_prev - iterate over a list backwards
* @pos: the &struct list_head to use as a loop cursor.
* @head: the head for your list.
*/
#define list_for_each_prev(pos, head) \
for (pos = (head)->prev; pos != (head); \
pos = pos->prev)
/**
* list_for_each_safe - iterate over a list safe against removal of list entry
* @pos: the &struct list_head to use as a loop cursor.
* @n: another &struct list_head to use as temporary storage
* @head: the head for your list.
*/
#define list_for_each_safe(pos, n, head) \
for (pos = (head)->next, n = pos->next; pos != (head); \
pos = n, n = pos->next)
/**
* list_for_each_prev_safe - iterate over a list backwards safe against removal of list entry
* @pos: the &struct list_head to use as a loop cursor.
* @n: another &struct list_head to use as temporary storage
* @head: the head for your list.
*/
#define list_for_each_prev_safe(pos, n, head) \
for (pos = (head)->prev, n = pos->prev; \
pos != (head); \
pos = n, n = pos->prev)
/**
* list_for_each_entry - iterate over list of given type
* @pos: the type * to use as a loop cursor.
* @head: the head for your list.
* @member: the name of the list_struct within the struct.
*/
#define list_for_each_entry(pos, head, member) \
for (pos = list_entry((head)->next, typeof(*pos), member); \
&pos->member != (head); \
pos = list_entry(pos->member.next, typeof(*pos), member))
/**
* list_for_each_entry_reverse - iterate backwards over list of given type.
* @pos: the type * to use as a loop cursor.
* @head: the head for your list.
* @member: the name of the list_struct within the struct.
*/
#define list_for_each_entry_reverse(pos, head, member) \
for (pos = list_entry((head)->prev, typeof(*pos), member); \
&pos->member != (head); \
pos = list_entry(pos->member.prev, typeof(*pos), member))
/**
* list_prepare_entry - prepare a pos entry for use in list_for_each_entry_continue()
* @pos: the type * to use as a start point
* @head: the head of the list
* @member: the name of the list_struct within the struct.
*
* Prepares a pos entry for use as a start point in list_for_each_entry_continue().
*/
#define list_prepare_entry(pos, head, member) \
((pos) ? : list_entry(head, typeof(*pos), member))
/**
* list_for_each_entry_continue - continue iteration over list of given type
* @pos: the type * to use as a loop cursor.
* @head: the head for your list.
* @member: the name of the list_struct within the struct.
*
* Continue to iterate over list of given type, continuing after
* the current position.
*/
#define list_for_each_entry_continue(pos, head, member) \
for (pos = list_entry(pos->member.next, typeof(*pos), member); \
&pos->member != (head); \
pos = list_entry(pos->member.next, typeof(*pos), member))
/**
* list_for_each_entry_continue_reverse - iterate backwards from the given point
* @pos: the type * to use as a loop cursor.
* @head: the head for your list.
* @member: the name of the list_struct within the struct.
*
* Start to iterate over list of given type backwards, continuing after
* the current position.
*/
#define list_for_each_entry_continue_reverse(pos, head, member) \
for (pos = list_entry(pos->member.prev, typeof(*pos), member); \
&pos->member != (head); \
pos = list_entry(pos->member.prev, typeof(*pos), member))
/**
* list_for_each_entry_from - iterate over list of given type from the current point
* @pos: the type * to use as a loop cursor.
* @head: the head for your list.
* @member: the name of the list_struct within the struct.
*
* Iterate over list of given type, continuing from current position.
*/
#define list_for_each_entry_from(pos, head, member) \
for (; &pos->member != (head); \
pos = list_entry(pos->member.next, typeof(*pos), member))
/**
* list_for_each_entry_safe - iterate over list of given type safe against removal of list entry
* @pos: the type * to use as a loop cursor.
* @n: another type * to use as temporary storage
* @head: the head for your list.
* @member: the name of the list_struct within the struct.
*/
#define list_for_each_entry_safe(pos, n, head, member) \
for (pos = list_entry((head)->next, typeof(*pos), member), \
n = list_entry(pos->member.next, typeof(*pos), member); \
&pos->member != (head); \
pos = n, n = list_entry(n->member.next, typeof(*n), member))
/**
* list_for_each_entry_safe_continue
* @pos: the type * to use as a loop cursor.
* @n: another type * to use as temporary storage
* @head: the head for your list.
* @member: the name of the list_struct within the struct.
*
* Iterate over list of given type, continuing after current point,
* safe against removal of list entry.
*/
#define list_for_each_entry_safe_continue(pos, n, head, member) \
for (pos = list_entry(pos->member.next, typeof(*pos), member), \
n = list_entry(pos->member.next, typeof(*pos), member); \
&pos->member != (head); \
pos = n, n = list_entry(n->member.next, typeof(*n), member))
/**
* list_for_each_entry_safe_from
* @pos: the type * to use as a loop cursor.
* @n: another type * to use as temporary storage
* @head: the head for your list.
* @member: the name of the list_struct within the struct.
*
* Iterate over list of given type from current point, safe against
* removal of list entry.
*/
#define list_for_each_entry_safe_from(pos, n, head, member) \
for (n = list_entry(pos->member.next, typeof(*pos), member); \
&pos->member != (head); \
pos = n, n = list_entry(n->member.next, typeof(*n), member))
/**
* list_for_each_entry_safe_reverse
* @pos: the type * to use as a loop cursor.
* @n: another type * to use as temporary storage
* @head: the head for your list.
* @member: the name of the list_struct within the struct.
*
* Iterate backwards over list of given type, safe against removal
* of list entry.
*/
#define list_for_each_entry_safe_reverse(pos, n, head, member) \
for (pos = list_entry((head)->prev, typeof(*pos), member), \
n = list_entry(pos->member.prev, typeof(*pos), member); \
&pos->member != (head); \
pos = n, n = list_entry(n->member.prev, typeof(*n), member))
/*
* Double linked lists with a single pointer list head.
* Mostly useful for hash tables where the two pointer list head is
* too wasteful.
* You lose the ability to access the tail in O(1).
*/
struct hlist_head {
struct hlist_node *first;
};
struct hlist_node {
struct hlist_node *next, **pprev;
};
#define HLIST_HEAD_INIT { .first = NULL }
#define HLIST_HEAD(name) struct hlist_head name = { .first = NULL }
#define INIT_HLIST_HEAD(ptr) ((ptr)->first = NULL)
static inline void INIT_HLIST_NODE(struct hlist_node *h)
{
h->next = NULL;
h->pprev = NULL;
}
static inline int hlist_unhashed(const struct hlist_node *h)
{
return !h->pprev;
}
static inline int hlist_empty(const struct hlist_head *h)
{
return !h->first;
}
static inline void __hlist_del(struct hlist_node *n)
{
struct hlist_node *next = n->next;
struct hlist_node **pprev = n->pprev;
*pprev = next;
if (next)
next->pprev = pprev;
}
static inline void hlist_del(struct hlist_node *n)
{
__hlist_del(n);
n->next = NULL;
n->pprev = NULL;
}
static inline void hlist_del_init(struct hlist_node *n)
{
if (!hlist_unhashed(n)) {
__hlist_del(n);
INIT_HLIST_NODE(n);
}
}
static inline void hlist_add_head(struct hlist_node *n, struct hlist_head *h)
{
struct hlist_node *first = h->first;
n->next = first;
if (first)
first->pprev = &n->next;
h->first = n;
n->pprev = &h->first;
}
/* next must be != NULL */
static inline void hlist_add_before(struct hlist_node *n,
struct hlist_node *next)
{
n->pprev = next->pprev;
n->next = next;
next->pprev = &n->next;
*(n->pprev) = n;
}
static inline void hlist_add_after(struct hlist_node *n,
struct hlist_node *next)
{
next->next = n->next;
n->next = next;
next->pprev = &n->next;
if(next->next)
next->next->pprev = &next->next;
}
#define hlist_entry(ptr, type, member) container_of(ptr,type,member)
#define hlist_for_each(pos, head) \
for (pos = (head)->first; pos; pos = pos->next)
#define hlist_for_each_safe(pos, n, head) \
for (pos = (head)->first; pos; pos = n)
/**
* hlist_for_each_entry - iterate over list of given type
* @tpos: the type * to use as a loop cursor.
* @pos: the &struct hlist_node to use as a loop cursor.
* @head: the head for your list.
* @member: the name of the hlist_node within the struct.
*/
#define hlist_for_each_entry(tpos, pos, head, member) \
for (pos = (head)->first; pos && \
({ tpos = hlist_entry(pos, typeof(*tpos), member); 1;}); \
pos = pos->next)
/**
* hlist_for_each_entry_continue - iterate over a hlist continuing after current point
* @tpos: the type * to use as a loop cursor.
* @pos: the &struct hlist_node to use as a loop cursor.
* @member: the name of the hlist_node within the struct.
*/
#define hlist_for_each_entry_continue(tpos, pos, member) \
for (pos = (pos)->next; pos && \
({ tpos = hlist_entry(pos, typeof(*tpos), member); 1;}); \
pos = pos->next)
/**
* hlist_for_each_entry_from - iterate over a hlist continuing from current point
* @tpos: the type * to use as a loop cursor.
* @pos: the &struct hlist_node to use as a loop cursor.
* @member: the name of the hlist_node within the struct.
*/
#define hlist_for_each_entry_from(tpos, pos, member) \
for (; pos && \
({ tpos = hlist_entry(pos, typeof(*tpos), member); 1;}); \
pos = pos->next)
/**
* hlist_for_each_entry_safe - iterate over list of given type safe against removal of list entry
* @tpos: the type * to use as a loop cursor.
* @pos: the &struct hlist_node to use as a loop cursor.
* @n: another &struct hlist_node to use as temporary storage
* @head: the head for your list.
* @member: the name of the hlist_node within the struct.
*/
#define hlist_for_each_entry_safe(tpos, pos, n, head, member) \
for (pos = (head)->first; \
pos && ({ n = pos->next; 1; }) && \
({ tpos = hlist_entry(pos, typeof(*tpos), member); 1;}); \
pos = n)
#endif

View File

@ -1,125 +0,0 @@
/*
* ucimap - library for mapping uci sections into data structures
* Copyright (C) 2008 Felix Fietkau <nbd@openwrt.org>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2
* as published by the Free Software Foundation
*
* 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.
*/
#include <stdbool.h>
#include "uci_list.h"
#include "uci.h"
#ifndef ARRAY_SIZE
#define ARRAY_SIZE(x) (sizeof(x) / sizeof((x)[0]))
#endif
#define BITFIELD_SIZE(_fields) (((_fields) / 8) + 1)
#define CLR_BIT(_name, _bit) do { \
_name[(_bit) / 8] &= ~(1 << ((_bit) % 8)); \
} while (0)
#define SET_BIT(_name, _bit) do { \
_name[(_bit) / 8] |= (1 << ((_bit) % 8)); \
} while (0)
#define TEST_BIT(_name, _bit) \
(_name[(_bit) / 8] & (1 << ((_bit) % 8)))
#define OPTMAP_OPTION(_maptype, _type, _field, ...) \
{ \
.type = _maptype, \
.name = #_field, \
.offset = offsetof(_type, _field), \
__VA_ARGS__ \
}
struct uci_sectmap;
struct uci_optmap;
struct uci_map {
struct uci_sectmap **sections;
unsigned int n_sections;
struct list_head sdata;
struct list_head fixup;
void *priv; /* user data */
};
enum ucimap_type {
/* types */
UCIMAP_SIMPLE = 0x00,
UCIMAP_LIST = 0x10,
UCIMAP_TYPE = 0xf0, /* type mask */
/* subtypes */
UCIMAP_STRING = 0x0,
UCIMAP_BOOL = 0x1,
UCIMAP_INT = 0x2,
UCIMAP_SECTION = 0x3,
UCIMAP_SUBTYPE = 0xf, /* subtype mask */
};
union uci_datamap {
int i;
bool b;
const char *s;
void *section;
struct list_head list;
};
struct uci_listmap {
struct list_head list;
union uci_datamap data;
};
struct uci_sectmap {
/* type string for the uci section */
const char *type;
/* length of the struct to map into */
unsigned int alloc_len;
/* give the caller time to initialize the preallocated struct */
int (*init_section)(struct uci_map *map, void *section, struct uci_section *s);
/* pass the fully processed struct to the callback after the section end */
int (*add_section)(struct uci_map *map, void *section);
/* let the callback clean up its own stuff in the section */
int (*free_section)(struct uci_map *map, void *section);
/* list of option mappings for this section */
struct uci_optmap *options;
unsigned int n_options;
};
struct uci_optmap {
unsigned int offset;
const char *name;
enum ucimap_type type;
union {
struct {
int base;
int min;
int max;
} i;
struct {
int maxlen;
} s;
struct uci_sectmap *sm;
} data;
};
extern int ucimap_init(struct uci_map *map);
extern void ucimap_cleanup(struct uci_map *map);
extern void ucimap_set_changed(void *section, void *field);
extern int ucimap_store_section(struct uci_map *map, struct uci_package *p, void *section);
extern void ucimap_parse(struct uci_map *map, struct uci_package *pkg);

View File

@ -1,66 +0,0 @@
module("luci-plugin", package.seeall)
function normalize(path)
local newpath
while newpath ~= path do
if (newpath) then
path = newpath
end
newpath = string.gsub(path, "/[^/]+/../", "/")
end
return newpath
end
function init(path)
-- NB: path points to ROOT/usr/lib/boa, change it to /usr/lib/lua
root = normalize(path .. '/../../../')
path = normalize(path .. '/../lua/')
package.cpath = path..'?.so;'..package.cpath
package.path = path..'?.lua;'..package.path
require("luci.dispatcher")
require("luci.sgi.webuci")
require("luci.model.uci")
if (root ~= '/') then
-- Entering dummy mode
luci.model.uci.cursor = function(config, ...)
return uci.cursor(config or root .. "/etc/config", ...)
end
luci.sys.hostname = function() return "" end
luci.sys.loadavg = function() return 0,0,0,0,0 end
luci.sys.reboot = function() return end
luci.sys.sysinfo = function() return "","","" end
luci.sys.syslog = function() return "" end
luci.sys.net.arptable = function() return {} end
luci.sys.net.devices = function() return {} end
luci.sys.net.routes = function() return {} end
luci.sys.wifi.getiwconfig = function() return {} end
luci.sys.wifi.iwscan = function() return {} end
luci.sys.user.checkpasswd = function() return true end
end
end
function prepare_req(uri)
luci.dispatcher.createindex()
env = {}
env.REQUEST_URI = uri
-- TODO: setting luci-plugin.reload = true allows this function to trigger a context reload
end
function handle_req(context)
env.SERVER_PROTOCOL = context.server_proto
env.REMOTE_ADDR = context.remote_addr
env.REQUEST_METHOD = context.request_method
env.PATH_INFO = context.uri
env.REMOTE_PORT = context.remote_port
env.SERVER_ADDR = context.server_addr
env.HTTP_COOKIE = context.cookie
env.HTTP_ACCEPT = context.http_accept
env.SCRIPT_NAME = env.REQUEST_URI:sub(1, #env.REQUEST_URI - #env.PATH_INFO)
luci.sgi.webuci.run(env, vars)
end

View File

@ -1,292 +0,0 @@
-----------------------------------------------------------------------------
-- LTN12 - Filters, sources, sinks and pumps.
-- LuaSocket toolkit.
-- Author: Diego Nehab
-- RCS ID: $Id: ltn12.lua,v 1.31 2006/04/03 04:45:42 diego Exp $
-----------------------------------------------------------------------------
-----------------------------------------------------------------------------
-- Declare module
-----------------------------------------------------------------------------
local string = require("string")
local table = require("table")
local base = _G
module("ltn12")
filter = {}
source = {}
sink = {}
pump = {}
-- 2048 seems to be better in windows...
BLOCKSIZE = 2048
_VERSION = "LTN12 1.0.1"
-----------------------------------------------------------------------------
-- Filter stuff
-----------------------------------------------------------------------------
-- returns a high level filter that cycles a low-level filter
function filter.cycle(low, ctx, extra)
base.assert(low)
return function(chunk)
local ret
ret, ctx = low(ctx, chunk, extra)
return ret
end
end
-- chains a bunch of filters together
-- (thanks to Wim Couwenberg)
function filter.chain(...)
local n = table.getn(arg)
local top, index = 1, 1
local retry = ""
return function(chunk)
retry = chunk and retry
while true do
if index == top then
chunk = arg[index](chunk)
if chunk == "" or top == n then return chunk
elseif chunk then index = index + 1
else
top = top+1
index = top
end
else
chunk = arg[index](chunk or "")
if chunk == "" then
index = index - 1
chunk = retry
elseif chunk then
if index == n then return chunk
else index = index + 1 end
else base.error("filter returned inappropriate nil") end
end
end
end
end
-----------------------------------------------------------------------------
-- Source stuff
-----------------------------------------------------------------------------
-- create an empty source
local function empty()
return nil
end
function source.empty()
return empty
end
-- returns a source that just outputs an error
function source.error(err)
return function()
return nil, err
end
end
-- creates a file source
function source.file(handle, io_err)
if handle then
return function()
local chunk = handle:read(BLOCKSIZE)
if not chunk then handle:close() end
return chunk
end
else return source.error(io_err or "unable to open file") end
end
-- turns a fancy source into a simple source
function source.simplify(src)
base.assert(src)
return function()
local chunk, err_or_new = src()
src = err_or_new or src
if not chunk then return nil, err_or_new
else return chunk end
end
end
-- creates string source
function source.string(s)
if s then
local i = 1
return function()
local chunk = string.sub(s, i, i+BLOCKSIZE-1)
i = i + BLOCKSIZE
if chunk ~= "" then return chunk
else return nil end
end
else return source.empty() end
end
-- creates rewindable source
function source.rewind(src)
base.assert(src)
local t = {}
return function(chunk)
if not chunk then
chunk = table.remove(t)
if not chunk then return src()
else return chunk end
else
table.insert(t, chunk)
end
end
end
function source.chain(src, f)
base.assert(src and f)
local last_in, last_out = "", ""
local state = "feeding"
local err
return function()
if not last_out then
base.error('source is empty!', 2)
end
while true do
if state == "feeding" then
last_in, err = src()
if err then return nil, err end
last_out = f(last_in)
if not last_out then
if last_in then
base.error('filter returned inappropriate nil')
else
return nil
end
elseif last_out ~= "" then
state = "eating"
if last_in then last_in = "" end
return last_out
end
else
last_out = f(last_in)
if last_out == "" then
if last_in == "" then
state = "feeding"
else
base.error('filter returned ""')
end
elseif not last_out then
if last_in then
base.error('filter returned inappropriate nil')
else
return nil
end
else
return last_out
end
end
end
end
end
-- creates a source that produces contents of several sources, one after the
-- other, as if they were concatenated
-- (thanks to Wim Couwenberg)
function source.cat(...)
local src = table.remove(arg, 1)
return function()
while src do
local chunk, err = src()
if chunk then return chunk end
if err then return nil, err end
src = table.remove(arg, 1)
end
end
end
-----------------------------------------------------------------------------
-- Sink stuff
-----------------------------------------------------------------------------
-- creates a sink that stores into a table
function sink.table(t)
t = t or {}
local f = function(chunk, err)
if chunk then table.insert(t, chunk) end
return 1
end
return f, t
end
-- turns a fancy sink into a simple sink
function sink.simplify(snk)
base.assert(snk)
return function(chunk, err)
local ret, err_or_new = snk(chunk, err)
if not ret then return nil, err_or_new end
snk = err_or_new or snk
return 1
end
end
-- creates a file sink
function sink.file(handle, io_err)
if handle then
return function(chunk, err)
if not chunk then
handle:close()
return 1
else return handle:write(chunk) end
end
else return sink.error(io_err or "unable to open file") end
end
-- creates a sink that discards data
local function null()
return 1
end
function sink.null()
return null
end
-- creates a sink that just returns an error
function sink.error(err)
return function()
return nil, err
end
end
-- chains a sink with a filter
function sink.chain(f, snk)
base.assert(f and snk)
return function(chunk, err)
if chunk ~= "" then
local filtered = f(chunk)
local done = chunk and ""
while true do
local ret, snkerr = snk(filtered, err)
if not ret then return nil, snkerr end
if filtered == done then return 1 end
filtered = f(done)
end
else return 1 end
end
end
-----------------------------------------------------------------------------
-- Pump stuff
-----------------------------------------------------------------------------
-- pumps one chunk from the source to the sink
function pump.step(src, snk)
local chunk, src_err = src()
local ret, snk_err = snk(chunk, src_err)
if chunk and ret then return 1
else return nil, src_err or snk_err end
end
-- pumps all data from a source to a sink, using a step function
function pump.all(src, snk, step)
base.assert(src and snk)
step = step or pump.step
while true do
local ret, err = step(src, snk)
if not ret then
if err then return nil, err
else return 1 end
end
end
end

View File

@ -1,34 +0,0 @@
-------------------------------------------------------------------------------
-- LuaDoc configuration file. This file contains the default options for
-- luadoc operation. These options can be overriden by the command line tool
-- @see luadoc.print_help
-- @release $Id: config.lua 3941 2008-12-23 21:39:38Z jow $
-------------------------------------------------------------------------------
module "luadoc.config"
-------------------------------------------------------------------------------
-- Default options
-- @class table
-- @name default_options
-- @field output_dir default output directory for generated documentation, used
-- by several doclets
-- @field taglet parser used to analyze source code input
-- @field doclet documentation generator
-- @field template_dir directory with documentation templates, used by the html
-- doclet
-- @field verbose command line tool configuration to output processing
-- information
local default_options = {
output_dir = "",
taglet = "luadoc.taglet.standard",
doclet = "luadoc.doclet.html",
-- TODO: find a way to define doclet specific options
template_dir = "luadoc/doclet/html/",
nomodules = false,
nofiles = false,
verbose = true,
}
return default_options

View File

@ -1,46 +0,0 @@
-----------------------------------------------------------------
-- LuaDoc debugging facilities.
-- @release $Id: debug.lua 3941 2008-12-23 21:39:38Z jow $
-----------------------------------------------------------------
module "luadoc.doclet.debug"
function printline()
print(string.rep('-', 79))
end
-----------------------------------------------------------------
-- Print debug information about document
-- @param doc Table with the structured documentation.
function start (doc)
print("Files:")
for _, filepath in ipairs(doc.files) do
print('\t', filepath)
end
printline()
print("Modules:")
for _, modulename in ipairs(doc.modules) do
print('\t', modulename)
end
printline()
for i, v in pairs(doc.files) do
print('\t', i, v)
end
printline()
for i, v in pairs(doc.files[doc.files[1]]) do
print(i, v)
end
printline()
for i, v in pairs(doc.files[doc.files[1]].doc[1]) do
print(i, v)
end
printline()
print("Params")
for i, v in pairs(doc.files[doc.files[1]].doc[1].param) do
print(i, v)
end
end

View File

@ -1,84 +0,0 @@
-------------------------------------------------------------------------------
-- Doclet to format source code according to LuaDoc standard tags. This doclet
-- (re)write .lua files adding missing standard tags. Texts are formatted to
-- 80 columns and function parameters are added based on code analysis.
--
-- @release $Id: formatter.lua 3941 2008-12-23 21:39:38Z jow $
-------------------------------------------------------------------------------
local util = require "luadoc.util"
local assert, ipairs, pairs, type = assert, ipairs, pairs, type
local string = require"string"
local table = require"table"
module "luadoc.doclet.formatter"
options = {
output_dir = "./",
}
-------------------------------------------------------------------------------
-- Assembly the output filename for an input file.
-- TODO: change the name of this function
function out_file (filename)
local h = filename
h = options.output_dir..h
return h
end
-------------------------------------------------------------------------------
-- Generate a new lua file for each input lua file. If the user does not
-- specify a different output directory input files will be rewritten.
-- @param doc documentation table
function start (doc)
local todo = "<TODO>"
-- Process files
for i, file_doc in ipairs(doc.files) do
-- assembly the filename
local filename = out_file(file_doc.name)
luadoc.logger:info(string.format("generating file `%s'", filename))
-- TODO: confirm file overwrite
local f = posix.open(filename, "w")
assert(f, string.format("could not open `%s' for writing", filename))
for _, block in ipairs(file_doc.doc) do
-- write reorganized comments
f:write(string.rep("-", 80).."\n")
-- description
f:write(util.comment(util.wrap(block.description, 77)))
f:write("\n")
if block.class == "function" then
-- parameters
table.foreachi(block.param, function (_, param_name)
f:write(util.comment(util.wrap(string.format("@param %s %s", param_name, block.param[param_name] or todo), 77)))
f:write("\n")
end)
-- return
if type(block.ret) == "table" then
table.foreachi(block.ret, function (_, ret)
f:write(util.comment(util.wrap(string.format("@return %s", ret), 77)).."\n")
end)
else
f:write(util.comment(util.wrap(string.format("@return %s", block.ret or todo), 77)).."\n")
end
end
-- TODO: usage
-- TODO: see
-- write code
for _, line in ipairs(block.code) do
f:write(line.."\n")
end
end
f:close()
end
end

View File

@ -1,275 +0,0 @@
-------------------------------------------------------------------------------
-- Doclet that generates HTML output. This doclet generates a set of html files
-- based on a group of templates. The main templates are:
-- <ul>
-- <li>index.lp: index of modules and files;</li>
-- <li>file.lp: documentation for a lua file;</li>
-- <li>module.lp: documentation for a lua module;</li>
-- <li>function.lp: documentation for a lua function. This is a
-- sub-template used by the others.</li>
-- </ul>
--
-- @release $Id: html.lua 3941 2008-12-23 21:39:38Z jow $
-------------------------------------------------------------------------------
local assert, getfenv, ipairs, loadstring, pairs, setfenv, tostring, tonumber, type = assert, getfenv, ipairs, loadstring, pairs, setfenv, tostring, tonumber, type
local io = require"io"
local posix = require "posix"
local lp = require "luadoc.lp"
local luadoc = require"luadoc"
local package = package
local string = require"string"
local table = require"table"
module "luadoc.doclet.html"
-------------------------------------------------------------------------------
-- Looks for a file `name' in given path. Removed from compat-5.1
-- @param path String with the path.
-- @param name String with the name to look for.
-- @return String with the complete path of the file found
-- or nil in case the file is not found.
local function search (path, name)
for c in string.gfind(path, "[^;]+") do
c = string.gsub(c, "%?", name)
local f = io.open(c)
if f then -- file exist?
f:close()
return c
end
end
return nil -- file not found
end
-------------------------------------------------------------------------------
-- Include the result of a lp template into the current stream.
function include (template, env)
-- template_dir is relative to package.path
local templatepath = options.template_dir .. template
-- search using package.path (modified to search .lp instead of .lua
local search_path = string.gsub(package.path, "%.lua", "")
local templatepath = search(search_path, templatepath)
assert(templatepath, string.format("template `%s' not found", template))
env = env or {}
env.table = table
env.io = io
env.lp = lp
env.ipairs = ipairs
env.tonumber = tonumber
env.tostring = tostring
env.type = type
env.luadoc = luadoc
env.options = options
return lp.include(templatepath, env)
end
-------------------------------------------------------------------------------
-- Returns a link to a html file, appending "../" to the link to make it right.
-- @param html Name of the html file to link to
-- @return link to the html file
function link (html, from)
local h = html
from = from or ""
string.gsub(from, "/", function () h = "../" .. h end)
return h
end
-------------------------------------------------------------------------------
-- Returns the name of the html file to be generated from a module.
-- Files with "lua" or "luadoc" extensions are replaced by "html" extension.
-- @param modulename Name of the module to be processed, may be a .lua file or
-- a .luadoc file.
-- @return name of the generated html file for the module
function module_link (modulename, doc, from)
-- TODO: replace "." by "/" to create directories?
-- TODO: how to deal with module names with "/"?
assert(modulename)
assert(doc)
from = from or ""
if doc.modules[modulename] == nil then
-- logger:error(string.format("unresolved reference to module `%s'", modulename))
return
end
local href = "modules/" .. modulename .. ".html"
string.gsub(from, "/", function () href = "../" .. href end)
return href
end
-------------------------------------------------------------------------------
-- Returns the name of the html file to be generated from a lua(doc) file.
-- Files with "lua" or "luadoc" extensions are replaced by "html" extension.
-- @param to Name of the file to be processed, may be a .lua file or
-- a .luadoc file.
-- @param from path of where am I, based on this we append ..'s to the
-- beginning of path
-- @return name of the generated html file
function file_link (to, from)
assert(to)
from = from or ""
local href = to
href = string.gsub(href, "lua$", "html")
href = string.gsub(href, "luadoc$", "html")
href = "files/" .. href
string.gsub(from, "/", function () href = "../" .. href end)
return href
end
-------------------------------------------------------------------------------
-- Returns a link to a function or to a table
-- @param fname name of the function or table to link to.
-- @param doc documentation table
-- @param kind String specying the kinf of element to link ("functions" or "tables").
function link_to (fname, doc, module_doc, file_doc, from, kind)
assert(fname)
assert(doc)
from = from or ""
kind = kind or "functions"
if file_doc then
for _, func_name in pairs(file_doc[kind]) do
if func_name == fname then
return file_link(file_doc.name, from) .. "#" .. fname
end
end
end
if module_doc and module_doc[kind] then
for func_name, tbl in pairs(module_doc[kind]) do
if func_name == fname then
return "#" .. fname
end
end
end
local _, _, modulename, fname = string.find(fname, "^(.-)[%.%:]?([^%.%:]*)$")
assert(fname)
-- if fname does not specify a module, use the module_doc
if string.len(modulename) == 0 and module_doc then
modulename = module_doc.name
end
local module_doc = doc.modules[modulename]
if not module_doc then
-- logger:error(string.format("unresolved reference to function `%s': module `%s' not found", fname, modulename))
return
end
for _, func_name in pairs(module_doc[kind]) do
if func_name == fname then
return module_link(modulename, doc, from) .. "#" .. fname
end
end
-- logger:error(string.format("unresolved reference to function `%s' of module `%s'", fname, modulename))
end
-------------------------------------------------------------------------------
-- Make a link to a file, module or function
function symbol_link (symbol, doc, module_doc, file_doc, from)
assert(symbol)
assert(doc)
local href =
-- file_link(symbol, from) or
module_link(symbol, doc, from) or
link_to(symbol, doc, module_doc, file_doc, from, "functions") or
link_to(symbol, doc, module_doc, file_doc, from, "tables")
if not href then
logger:error(string.format("unresolved reference to symbol `%s'", symbol))
end
return href or ""
end
-------------------------------------------------------------------------------
-- Assembly the output filename for an input file.
-- TODO: change the name of this function
function out_file (filename)
local h = filename
h = string.gsub(h, "lua$", "html")
h = string.gsub(h, "luadoc$", "html")
h = "files/" .. h
-- h = options.output_dir .. string.gsub (h, "^.-([%w_]+%.html)$", "%1")
h = options.output_dir .. h
return h
end
-------------------------------------------------------------------------------
-- Assembly the output filename for a module.
-- TODO: change the name of this function
function out_module (modulename)
local h = modulename .. ".html"
h = "modules/" .. h
h = options.output_dir .. h
return h
end
-----------------------------------------------------------------
-- Generate the output.
-- @param doc Table with the structured documentation.
function start (doc)
-- Generate index file
if (#doc.files > 0 or #doc.modules > 0) and (not options.noindexpage) then
local filename = options.output_dir.."index.html"
logger:info(string.format("generating file `%s'", filename))
local f = posix.open(filename, "w")
assert(f, string.format("could not open `%s' for writing", filename))
io.output(f)
include("index.lp", { doc = doc })
f:close()
end
-- Process modules
if not options.nomodules then
for _, modulename in ipairs(doc.modules) do
local module_doc = doc.modules[modulename]
-- assembly the filename
local filename = out_module(modulename)
logger:info(string.format("generating file `%s'", filename))
local f = posix.open(filename, "w")
assert(f, string.format("could not open `%s' for writing", filename))
io.output(f)
include("module.lp", { doc = doc, module_doc = module_doc })
f:close()
end
end
-- Process files
if not options.nofiles then
for _, filepath in ipairs(doc.files) do
local file_doc = doc.files[filepath]
-- assembly the filename
local filename = out_file(file_doc.name)
logger:info(string.format("generating file `%s'", filename))
local f = posix.open(filename, "w")
assert(f, string.format("could not open `%s' for writing", filename))
io.output(f)
include("file.lp", { doc = doc, file_doc = file_doc} )
f:close()
end
end
-- copy extra files
local f = posix.open(options.output_dir.."luadoc.css", "w")
io.output(f)
include("luadoc.css")
f:close()
end

View File

@ -1,28 +0,0 @@
<%
if module_doc then
from = "modules/"..module_doc.name
elseif file_doc then
from = "files/.."..file_doc.name
else
from = ""
end
%>
<dt><%=const.private and "local " or ""%><a name="<%=const.name%>"></a><strong><%=const.name:gsub(".+%.","")%></strong></dt>
<dd>
<%=const.description or ""%>
<%if type(const.see) == "string" then %>
<h3>See also:</h3>
<a href="<%=const.see%>"><%=const.see%></a>
<%elseif type(const.see) == "table" and #const.see > 0 then %>
<h3>See also:</h3>
<ul>
<%for i = 1, #const.see do%>
<li><a href="<%=luadoc.doclet.html.symbol_link(const.see[i], doc, module_doc, file_doc, from)%>">
<%=const.see[i]:gsub(".+%.","")%>
</a>
<%end%>
</ul
<%end%>
</dd>

View File

@ -1,112 +0,0 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html>
<head>
<title>Reference</title>
<link rel="stylesheet" href="<%=luadoc.doclet.html.link('luadoc.css', 'files/'..file_doc.name)%>" type="text/css" />
<!--meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/-->
</head>
<body>
<div id="container">
<div id="product">
<div id="product_logo"></div>
<div id="product_name"><big><b></b></big></div>
<div id="product_description"></div>
</div> <!-- id="product" -->
<div id="main">
<div id="navigation">
<%=luadoc.doclet.html.include("menu.lp", { doc=doc, file_doc=file_doc })%>
</div> <!-- id="navigation" -->
<div id="content">
<h1>File <code><%=file_doc.name%></code></h1>
<%if file_doc.description then%>
<p><%=file_doc.description%></p>
<%end%>
<%if file_doc.author then%>
<p><b><%= #file_doc.author>1 and "Authors" or "Author" %>:</b>
<table class="authors_list">
<%for _, author in ipairs(file_doc.author) do%>
<tr><td class="name"><%= author %></td></tr>
<%end%>
</table>
</p>
<%end%>
<%if file_doc.copyright then%>
<p>Copyright &copy;<%=file_doc.copyright%></p>
<%end%>
<%if file_doc.release then%>
<p><small><b>Release:</b> <%=file_doc.release%></small></p>
<%end%>
<%if #file_doc.functions > 0 then%>
<h2>Functions</h2>
<table class="function_list">
<%for _, func_name in ipairs(file_doc.functions) do
local func_data = file_doc.functions[func_name]%>
<tr>
<td class="name" nowrap><%=func_data.private and "local " or ""%><a href="#<%=func_name%>"><%=func_name%></a>&nbsp;(<%=table.concat(func_data.param, ", ")%>)</td>
<td class="summary"><%=func_data.summary%></td>
</tr>
<%end%>
</table>
<%end%>
<%if #file_doc.tables > 0 then%>
<h2>Tables</h2>
<table class="table_list">
<%for _, tab_name in ipairs(file_doc.tables) do%>
<tr>
<td class="name" nowrap><a href="#<%=tab_name%>"><%=tab_name%></a></td>
<td class="summary"><%=file_doc.tables[tab_name].summary%></td>
</tr>
<%end%>
</table>
<%end%>
<br/>
<br/>
<%if #file_doc.functions > 0 then%>
<h2><a name="functions"></a>Functions</h2>
<dl class="function">
<%for _, func_name in ipairs(file_doc.functions) do%>
<%=luadoc.doclet.html.include("function.lp", { doc=doc, file_doc=file_doc, func=file_doc.functions[func_name] })%>
<%end%>
</dl>
<%end%>
<%if #file_doc.tables > 0 then%>
<h2><a name="tables"></a>Tables</h2>
<dl class="table">
<%for _, tab_name in ipairs(file_doc.tables) do%>
<%=luadoc.doclet.html.include("table.lp", { doc=doc, file_doc=file_doc, tab=file_doc.tables[tab_name] })%>
<%end%>
</dl>
<%end%>
</div> <!-- id="content" -->
</div> <!-- id="main" -->
<div id="about">
<p><a href="http://validator.w3.org/check?uri=referer"><img src="http://www.w3.org/Icons/valid-xhtml10" alt="Valid XHTML 1.0!" height="31" width="88" /></a></p>
</div> <!-- id="about" -->
</div> <!-- id="container" -->
</body>
</html>

View File

@ -1,64 +0,0 @@
<%
if module_doc then
from = "modules/"..module_doc.name
elseif file_doc then
from = "files/.."..file_doc.name
else
from = ""
end
%>
<dt><%=func.private and "local " or ""%><a name="<%=func.name%>"></a><strong><%=(oop and func.name:gsub("%.",":") or func.name:gsub(".+%.",""))%></strong>&nbsp;(<%=table.concat(func.param or {}, ", ")%>)</dt>
<dd>
<%=func.description or ""%>
<%if type(func.param) == "table" and #func.param > 0 then%>
<h3>Parameters</h3>
<ul>
<%for p = 1, #func.param do%>
<li>
<%=func.param[p]%>: <%=func.param[func.param[p]] or ""%>
</li>
<%end%>
</ul>
<%end%>
<%if type(func.usage) == "string" then%>
<h3>Usage:</h3>
<%=func.usage%>
<%elseif type(func.usage) == "table" then%>
<h3>Usage</h3>
<ul>
<%for _, usage in ipairs(func.usage) do%>
<li><%= usage %>
<%end%>
</ul>
<%end%>
<%if type(func.ret) == "string" then%>
<h3>Return value:</h3>
<%=func.ret%>
<%elseif type(func.ret) == "table" then%>
<h3>Return values:</h3>
<ol>
<%for _, ret in ipairs(func.ret) do%>
<li><%= ret %>
<%end%>
</ol>
<%end%>
<%if type(func.see) == "string" then %>
<h3>See also:</h3>
<a href="<%=func.see%>"><%=func.see%></a>
<%elseif type(func.see) == "table" and #func.see > 0 then %>
<h3>See also:</h3>
<ul>
<%for i = 1, #func.see do%>
<li><a href="<%=luadoc.doclet.html.symbol_link(func.see[i], doc, module_doc, file_doc, from)%>">
<%=(oop and func.see[i]:gsub("%.",":") or func.see[i]:gsub(".+%.",""))%>
</a>
<%end%>
</ul
<%end%>
</dd>

View File

@ -1,67 +0,0 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html>
<head>
<title>Reference</title>
<link rel="stylesheet" href="<%=luadoc.doclet.html.link("luadoc.css")%>" type="text/css" />
<!--meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/-->
</head>
<body>
<div id="container">
<div id="product">
<div id="product_logo"></div>
<div id="product_name"><big><b></b></big></div>
<div id="product_description"></div>
</div> <!-- id="product" -->
<div id="main">
<div id="navigation">
<%=luadoc.doclet.html.include("menu.lp", { doc=doc })%>
</div> <!-- id="navigation" -->
<div id="content">
<%if not options.nomodules and #doc.modules > 0 then%>
<h2>Modules</h2>
<table class="module_list">
<!--<tr><td colspan="2">Modules</td></tr>-->
<%for _, modulename in ipairs(doc.modules) do%>
<tr>
<td class="name"><a href="<%=luadoc.doclet.html.module_link(modulename, doc)%>"><%=modulename%></a></td>
<td class="summary"><%=doc.modules[modulename].summary%></td>
</tr>
<%end%>
</table>
<%end%>
<%if not options.nofiles and #doc.files > 0 then%>
<h2>Files</h2>
<table class="file_list">
<!--<tr><td colspan="2">Files</td></tr>-->
<%for _, filepath in ipairs(doc.files) do%>
<tr>
<td class="name"><a href="<%=luadoc.doclet.html.file_link(filepath)%>"><%=filepath%></a></td>
<td class="summary"></td>
</tr>
<%end%>
</table>
<%end%>
</div> <!-- id="content" -->
</div> <!-- id="main" -->
<div id="about">
<p><a href="http://validator.w3.org/check?uri=referer"><img src="http://www.w3.org/Icons/valid-xhtml10" alt="Valid XHTML 1.0!" height="31" width="88" /></a></p>
</div> <!-- id="about" -->
</div> <!-- id="container" -->
</body>
</html>

View File

@ -1,286 +0,0 @@
body {
margin-left: 1em;
margin-right: 1em;
font-family: arial, helvetica, geneva, sans-serif;
background-color:#ffffff; margin:0px;
}
code {
font-family: "Andale Mono", monospace;
}
tt {
font-family: "Andale Mono", monospace;
}
body, td, th { font-size: 11pt; }
h1, h2, h3, h4 { margin-left: 0em; }
textarea, pre, tt { font-size:10pt; }
body, td, th { color:#000000; }
small { font-size:0.85em; }
h1 { font-size:1.5em; }
h2 { font-size:1.25em; }
h3 { font-size:1.15em; }
h4 { font-size:1.06em; }
a:link { font-weight:bold; color: #004080; text-decoration: none; }
a:visited { font-weight:bold; color: #006699; text-decoration: none; }
a:link:hover { text-decoration:underline; }
hr { color:#cccccc }
img { border-width: 0px; }
h3 { padding-top: 1em; }
p { margin-left: 1em; }
p.name {
font-family: "Andale Mono", monospace;
padding-top: 1em;
margin-left: 0em;
}
blockquote { margin-left: 3em; }
pre.example {
background-color: rgb(245, 245, 245);
border-top-width: 1px;
border-right-width: 1px;
border-bottom-width: 1px;
border-left-width: 1px;
border-top-style: solid;
border-right-style: solid;
border-bottom-style: solid;
border-left-style: solid;
border-top-color: silver;
border-right-color: silver;
border-bottom-color: silver;
border-left-color: silver;
padding: 1em;
margin-left: 1em;
margin-right: 1em;
font-family: "Andale Mono", monospace;
font-size: smaller;
}
hr {
margin-left: 0em;
background: #00007f;
border: 0px;
height: 1px;
}
ul { list-style-type: disc; }
table.index { border: 1px #00007f; }
table.index td { text-align: left; vertical-align: top; }
table.index ul { padding-top: 0em; margin-top: 0em; }
table {
border: 1px solid black;
border-collapse: collapse;
margin-left: auto;
margin-right: auto;
}
th {
border: 1px solid black;
padding: 0.5em;
}
td {
border: 1px solid black;
padding: 0.5em;
}
div.header, div.footer { margin-left: 0em; }
#container
{
margin-left: 1em;
margin-right: 1em;
background-color: #f0f0f0;
}
#product
{
text-align: center;
border-bottom: 1px solid #cccccc;
background-color: #ffffff;
}
#product big {
font-size: 2em;
}
#product_logo
{
}
#product_name
{
}
#product_description
{
}
#main
{
background-color: #f0f0f0;
border-left: 2px solid #cccccc;
}
#navigation
{
float: left;
width: 18em;
margin: 0;
vertical-align: top;
background-color: #f0f0f0;
overflow:visible;
}
#navigation h1 {
background-color:#e7e7e7;
font-size:1.1em;
color:#000000;
text-align:left;
margin:0px;
padding:0.2em;
border-top:1px solid #dddddd;
border-bottom:1px solid #dddddd;
}
#navigation ul
{
font-size:1em;
list-style-type: none;
padding: 0;
margin: 1px;
}
#navigation li
{
text-indent: -1em;
margin: 0em 0em 0em 0.5em;
display: block;
padding: 3px 0px 0px 12px;
}
#navigation li li a
{
padding: 0px 3px 0px -1em;
}
#content
{
margin-left: 18em;
padding: 1em;
border-left: 2px solid #cccccc;
border-right: 2px solid #cccccc;
background-color: #ffffff;
}
#about
{
clear: both;
margin: 0;
padding: 5px;
border-top: 2px solid #cccccc;
background-color: #ffffff;
}
@media print {
body {
font: 12pt "Times New Roman", "TimeNR", Times, serif;
}
a { font-weight:bold; color: #004080; text-decoration: underline; }
#main { background-color: #ffffff; border-left: 0px; }
#container { margin-left: 2%; margin-right: 2%; background-color: #ffffff; }
#content { margin-left: 0px; padding: 1em; border-left: 0px; border-right: 0px; background-color: #ffffff; }
#navigation { display: none;
}
pre.example {
font-family: "Andale Mono", monospace;
font-size: 10pt;
page-break-inside: avoid;
}
}
table.module_list td
{
border-width: 1px;
padding: 3px;
border-style: solid;
border-color: #cccccc;
}
table.module_list td.name { background-color: #f0f0f0; }
table.module_list td.summary { width: 100%; }
table.file_list
{
border-width: 1px;
border-style: solid;
border-color: #cccccc;
border-collapse: collapse;
}
table.file_list td
{
border-width: 1px;
padding: 3px;
border-style: solid;
border-color: #cccccc;
}
table.file_list td.name { background-color: #f0f0f0; }
table.file_list td.summary { width: 100%; }
table.function_list
{
border-width: 1px;
border-style: solid;
border-color: #cccccc;
border-collapse: collapse;
}
table.function_list td
{
border-width: 1px;
padding: 3px;
border-style: solid;
border-color: #cccccc;
}
table.function_list td.name { background-color: #f0f0f0; }
table.function_list td.summary { width: 100%; }
table.table_list
{
border-width: 1px;
border-style: solid;
border-color: #cccccc;
border-collapse: collapse;
}
table.table_list td
{
border-width: 1px;
padding: 3px;
border-style: solid;
border-color: #cccccc;
}
table.table_list td.name { background-color: #f0f0f0; }
table.table_list td.summary { width: 100%; }
dl.function dt {border-top: 1px solid #ccc; padding-top: 1em;}
dl.function dd {padding-bottom: 1em;}
dl.function h3 {padding: 0; margin: 0; font-size: medium;}
dl.table dt {border-top: 1px solid #ccc; padding-top: 1em;}
dl.table dd {padding-bottom: 1em;}
dl.table h3 {padding: 0; margin: 0; font-size: medium;}
#TODO: make module_list, file_list, function_list, table_list inherit from a list

View File

@ -1,55 +0,0 @@
<%
if module_doc then
from = "modules/"..module_doc.name
elseif file_doc then
from = "files/.."..file_doc.name
else
from = ""
end
%>
<h1>LuaDoc</h1>
<ul>
<%if not module_doc and not file_doc then%>
<li><strong>Index</strong></li>
<%else%>
<li><a href="<%=luadoc.doclet.html.link("index.html", from)%>">Index</a></li>
<%end%>
</ul>
<!-- Module list -->
<%if not options.nomodules and #doc.modules > 0 then%>
<h1>Modules</h1>
<ul>
<%for _, modulename in ipairs(doc.modules) do
if module_doc and module_doc.name == modulename then%>
<li><strong><%=modulename%></strong></li>
<%else%>
<li>
<a href="<%=luadoc.doclet.html.module_link(modulename, doc, from)%>"><%=modulename%></a>
</li>
<% end
end%>
</ul>
<%end%>
<!-- File list -->
<%if not options.nofiles and #doc.files > 0 then%>
<h1>Files</h1>
<ul>
<%for _, filepath in ipairs(doc.files) do
if file_doc and file_doc.name == filepath then%>
<li><strong><%=filepath%></strong></li>
<%else%>
<li>
<a href="<%=luadoc.doclet.html.file_link(filepath, from)%>"><%=filepath%></a>
</li>
<% end
end%>
</ul>
<%end%>

View File

@ -1,120 +0,0 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html>
<head>
<title>Reference</title>
<link rel="stylesheet" href="<%=luadoc.doclet.html.link('luadoc.css', 'modules/'..module_doc.name)%>" type="text/css" />
<!--meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/-->
</head>
<body>
<div id="container">
<div id="product">
<div id="product_logo"></div>
<div id="product_name"><big><b></b></big></div>
<div id="product_description"></div>
</div> <!-- id="product" -->
<div id="main">
<div id="navigation">
<%=luadoc.doclet.html.include("menu.lp", { doc=doc, module_doc=module_doc })%>
<% oop = ( module_doc.doc[1].cstyle == "instance" ) and true or false %>
</div><!-- id="navigation" -->
<div id="content">
<h1><%=( oop and "Object Instance" or "Class" )%> <code><%=module_doc.name%></code></h1>
<p><%=module_doc.description%></p>
<%if module_doc.author then%>
<p><b><%= #module_doc.author>1 and "Authors" or "Author" %>:</b>
<table class="authors_list">
<%for _, author in ipairs(module_doc.author) do%>
<tr><td class="name"><%= author %></td></tr>
<%end%>
</table>
</p>
<%end%>
<%if module_doc.copyright then%>
<p>Copyright&copy; <%=module_doc.copyright%></p>
<%end%>
<%if module_doc.release then%>
<p><small><b>Release:</b> <%=module_doc.release%></small></p>
<%end%>
<%if #module_doc.constants > 0 then %>
<h2>Constants</h2>
<table class="function_list">
<%for _, const_name in ipairs(module_doc.constants) do
local const_data = module_doc.constants[const_name]%>
<tr>
<td class="name" nowrap><code><%=const_data.private and "local " or ""%><%=(const_name:gsub(".+%.",""))%></code></td>
<td class="summary"><%=const_data.summary%></td>
</tr>
<%end%>
</table>
<%end%>
<%if #module_doc.functions > 0 then %>
<h2>Functions</h2>
<table class="function_list">
<%for _, func_name in ipairs(module_doc.functions) do
local func_data = module_doc.functions[func_name]%>
<tr>
<td class="name" nowrap><%=func_data.private and "local " or ""%><a href="#<%=func_name%>"><%=(oop and func_name:gsub("%.",":") or func_name:gsub(".+%.",""))%></a>&nbsp;(<%=table.concat(module_doc.functions[func_name].param or {}, ", ")%>)</td>
<td class="summary"><%=module_doc.functions[func_name].summary%></td>
</tr>
<%end%>
</table>
<%end%>
<%if #module_doc.tables > 0 then%>
<h2>Tables</h2>
<table class="table_list">
<%for _, tab_name in ipairs(module_doc.tables) do%>
<tr>
<td class="name" nowrap><a href="#<%=tab_name%>"><%=tab_name%></a></td>
<td class="summary"><%=module_doc.tables[tab_name].summary%></td>
</tr>
<%end%>
</table>
<%end%>
<br/>
<br/>
<%if #module_doc.functions > 0 then%>
<h2><a name="functions"></a>Functions</h2>
<dl class="function">
<%for _, func_name in ipairs(module_doc.functions) do%>
<%=luadoc.doclet.html.include("function.lp", { doc=doc, module_doc=module_doc, func=module_doc.functions[func_name], oop=oop })%>
<%end%>
</dl>
<%end%>
<%if #module_doc.tables > 0 then%>
<h2><a name="tables"></a>Tables</h2>
<dl class="table">
<%for _, tab_name in ipairs(module_doc.tables) do%>
<%=luadoc.doclet.html.include("table.lp", { doc=doc, module_doc=module_doc, tab=module_doc.tables[tab_name] })%>
<%end%>
</dl>
<%end%>
</div> <!-- id="content" -->
</div> <!-- id="main" -->
<div id="about">
<p><a href="http://validator.w3.org/check?uri=referer"><img src="http://www.w3.org/Icons/valid-xhtml10" alt="Valid XHTML 1.0!" height="31" width="88" /></a></p>
</div> <!-- id="about" -->
</div> <!-- id="container" -->
</body>
</html>

View File

@ -1,15 +0,0 @@
<dt><a name="<%=tab.name%>"></a><strong><%=tab.name%></strong></dt>
<dd><%=tab.description%>
<%if type(tab.field) == "table" and #tab.field > 0 then%>
<em>Fields</em>
<ul>
<%for p = 1, #tab.field do%>
<li>
<%=tab.field[p]%>: <%=tab.field[tab.field[p]] or ""%>
</li>
<%end%>
</ul>
<%end%>
</dd>

View File

@ -1,12 +0,0 @@
-----------------------------------------------------------------
-- @release $Id: raw.lua 3941 2008-12-23 21:39:38Z jow $
-----------------------------------------------------------------
module "luadoc.doclet.raw"
-----------------------------------------------------------------
-- Generate the output.
-- @param doc Table with the structured documentation.
function start (doc)
end

View File

@ -1,50 +0,0 @@
-------------------------------------------------------------------------------
-- LuaDoc main function.
-- @release $Id: init.lua 3941 2008-12-23 21:39:38Z jow $
-------------------------------------------------------------------------------
local require = require
local util = require "luadoc.util"
logger = {}
module ("luadoc")
-------------------------------------------------------------------------------
-- LuaDoc version number.
_COPYRIGHT = "Copyright (c) 2003-2007 The Kepler Project"
_DESCRIPTION = "Documentation Generator Tool for the Lua language"
_VERSION = "LuaDoc 3.0.1"
-------------------------------------------------------------------------------
-- Main function
-- @see luadoc.doclet.html, luadoc.doclet.formatter, luadoc.doclet.raw
-- @see luadoc.taglet.standard
function main (files, options)
logger = util.loadlogengine(options)
-- load config file
if options.config ~= nil then
-- load specified config file
dofile(options.config)
else
-- load default config file
require("luadoc.config")
end
local taglet = require(options.taglet)
local doclet = require(options.doclet)
-- analyze input
taglet.options = options
taglet.logger = logger
local doc = taglet.start(files)
-- generate output
doclet.options = options
doclet.logger = logger
doclet.start(doc)
end

View File

@ -1,130 +0,0 @@
----------------------------------------------------------------------------
-- Lua Pages Template Preprocessor.
--
-- @release $Id: lp.lua 3941 2008-12-23 21:39:38Z jow $
----------------------------------------------------------------------------
local assert, error, getfenv, loadstring, setfenv = assert, error, getfenv, loadstring, setfenv
local find, format, gsub, strsub = string.find, string.format, string.gsub, string.sub
local concat, tinsert = table.concat, table.insert
local open = io.open
module (...)
----------------------------------------------------------------------------
-- function to do output
local outfunc = "io.write"
-- accepts the old expression field: `$| <Lua expression> |$'
local compatmode = true
--
-- Builds a piece of Lua code which outputs the (part of the) given string.
-- @param s String.
-- @param i Number with the initial position in the string.
-- @param f Number with the final position in the string (default == -1).
-- @return String with the correspondent Lua code which outputs the part of the string.
--
local function out (s, i, f)
s = strsub(s, i, f or -1)
if s == "" then return s end
-- we could use `%q' here, but this way we have better control
s = gsub(s, "([\\\n\'])", "\\%1")
-- substitute '\r' by '\'+'r' and let `loadstring' reconstruct it
s = gsub(s, "\r", "\\r")
return format(" %s('%s'); ", outfunc, s)
end
----------------------------------------------------------------------------
-- Translate the template to Lua code.
-- @param s String to translate.
-- @return String with translated code.
----------------------------------------------------------------------------
function translate (s)
if compatmode then
s = gsub(s, "$|(.-)|%$", "<?lua = %1 ?>")
s = gsub(s, "<!%-%-$$(.-)$$%-%->", "<?lua %1 ?>")
end
s = gsub(s, "<%%(.-)%%>", "<?lua %1 ?>")
local res = {}
local start = 1 -- start of untranslated part in `s'
while true do
local ip, fp, target, exp, code = find(s, "<%?(%w*)[ \t]*(=?)(.-)%?>", start)
if not ip then break end
tinsert(res, out(s, start, ip-1))
if target ~= "" and target ~= "lua" then
-- not for Lua; pass whole instruction to the output
tinsert(res, out(s, ip, fp))
else
if exp == "=" then -- expression?
tinsert(res, format(" %s(%s);", outfunc, code))
else -- command
tinsert(res, format(" %s ", code))
end
end
start = fp + 1
end
tinsert(res, out(s, start))
return concat(res)
end
----------------------------------------------------------------------------
-- Defines the name of the output function.
-- @param f String with the name of the function which produces output.
function setoutfunc (f)
outfunc = f
end
----------------------------------------------------------------------------
-- Turns on or off the compatibility with old CGILua 3.X behavior.
-- @param c Boolean indicating if the compatibility mode should be used.
function setcompatmode (c)
compatmode = c
end
----------------------------------------------------------------------------
-- Internal compilation cache.
local cache = {}
----------------------------------------------------------------------------
-- Translates a template into a Lua function.
-- Does NOT execute the resulting function.
-- Uses a cache of templates.
-- @param string String with the template to be translated.
-- @param chunkname String with the name of the chunk, for debugging purposes.
-- @return Function with the resulting translation.
function compile (string, chunkname)
local f, err = cache[string]
if f then return f end
f, err = loadstring (translate (string), chunkname)
if not f then error (err, 3) end
cache[string] = f
return f
end
----------------------------------------------------------------------------
-- Translates and executes a template in a given file.
-- The translation creates a Lua function which will be executed in an
-- optionally given environment.
-- @param filename String with the name of the file containing the template.
-- @param env Table with the environment to run the resulting function.
function include (filename, env)
-- read the whole contents of the file
local fh = assert (open (filename))
local src = fh:read("*a")
fh:close()
-- translates the file into a function
local prog = compile (src, '@'..filename)
local _env
if env then
_env = getfenv (prog)
setfenv (prog, env)
end
prog ()
end

View File

@ -1,565 +0,0 @@
-------------------------------------------------------------------------------
-- @release $Id: standard.lua 3941 2008-12-23 21:39:38Z jow $
-------------------------------------------------------------------------------
local assert, pairs, tostring, type = assert, pairs, tostring, type
local io = require "io"
local posix = require "posix"
local luadoc = require "luadoc"
local util = require "luadoc.util"
local tags = require "luadoc.taglet.standard.tags"
local string = require "string"
local table = require "table"
module 'luadoc.taglet.standard'
-------------------------------------------------------------------------------
-- Creates an iterator for an array base on a class type.
-- @param t array to iterate over
-- @param class name of the class to iterate over
function class_iterator (t, class)
return function ()
local i = 1
return function ()
while t[i] and t[i].class ~= class do
i = i + 1
end
local v = t[i]
i = i + 1
return v
end
end
end
-- Patterns for function recognition
local identifiers_list_pattern = "%s*(.-)%s*"
local identifier_pattern = "[^%(%s]+"
local function_patterns = {
"^()%s*function%s*("..identifier_pattern..")%s*%("..identifiers_list_pattern.."%)",
"^%s*(local%s)%s*function%s*("..identifier_pattern..")%s*%("..identifiers_list_pattern.."%)",
"^()%s*("..identifier_pattern..")%s*%=%s*function%s*%("..identifiers_list_pattern.."%)",
}
-------------------------------------------------------------------------------
-- Checks if the line contains a function definition
-- @param line string with line text
-- @return function information or nil if no function definition found
local function check_function (line)
line = util.trim(line)
local info = table.foreachi(function_patterns, function (_, pattern)
local r, _, l, id, param = string.find(line, pattern)
if r ~= nil then
return {
name = id,
private = (l == "local"),
param = { } --util.split("%s*,%s*", param),
}
end
end)
-- TODO: remove these assert's?
if info ~= nil then
assert(info.name, "function name undefined")
assert(info.param, string.format("undefined parameter list for function `%s'", info.name))
end
return info
end
-------------------------------------------------------------------------------
-- Checks if the line contains a module definition.
-- @param line string with line text
-- @param currentmodule module already found, if any
-- @return the name of the defined module, or nil if there is no module
-- definition
local function check_module (line, currentmodule)
line = util.trim(line)
-- module"x.y"
-- module'x.y'
-- module[[x.y]]
-- module("x.y")
-- module('x.y')
-- module([[x.y]])
-- module(...)
local r, _, modulename = string.find(line, "^module%s*[%s\"'(%[]+([^,\"')%]]+)")
if r then
-- found module definition
logger:debug(string.format("found module `%s'", modulename))
return modulename
end
return currentmodule
end
-- Patterns for constant recognition
local constant_patterns = {
"^()%s*([A-Z][A-Z0-9_]*)%s*=",
"^%s*(local%s)%s*([A-Z][A-Z0-9_]*)%s*=",
}
-------------------------------------------------------------------------------
-- Checks if the line contains a constant definition
-- @param line string with line text
-- @return constant information or nil if no constant definition found
local function check_constant (line)
line = util.trim(line)
local info = table.foreachi(constant_patterns, function (_, pattern)
local r, _, l, id = string.find(line, pattern)
if r ~= nil then
return {
name = id,
private = (l == "local"),
}
end
end)
-- TODO: remove these assert's?
if info ~= nil then
assert(info.name, "constant name undefined")
end
return info
end
-------------------------------------------------------------------------------
-- Extracts summary information from a description. The first sentence of each
-- doc comment should be a summary sentence, containing a concise but complete
-- description of the item. It is important to write crisp and informative
-- initial sentences that can stand on their own
-- @param description text with item description
-- @return summary string or nil if description is nil
local function parse_summary (description)
-- summary is never nil...
description = description or ""
-- append an " " at the end to make the pattern work in all cases
description = description.." "
-- read until the first period followed by a space or tab
local summary = string.match(description, "(.-%.)[%s\t]")
-- if pattern did not find the first sentence, summary is the whole description
summary = summary or description
return summary
end
-------------------------------------------------------------------------------
-- @param f file handle
-- @param line current line being parsed
-- @param modulename module already found, if any
-- @return current line
-- @return code block
-- @return modulename if found
local function parse_code (f, line, modulename)
local code = {}
while line ~= nil do
if string.find(line, "^[\t ]*%-%-%-") then
-- reached another luadoc block, end this parsing
return line, code, modulename
else
-- look for a module definition
modulename = check_module(line, modulename)
table.insert(code, line)
line = f:read()
end
end
-- reached end of file
return line, code, modulename
end
-------------------------------------------------------------------------------
-- Parses the information inside a block comment
-- @param block block with comment field
-- @return block parameter
local function parse_comment (block, first_line, modulename)
-- get the first non-empty line of code
local code = table.foreachi(block.code, function(_, line)
if not util.line_empty(line) then
-- `local' declarations are ignored in two cases:
-- when the `nolocals' option is turned on; and
-- when the first block of a file is parsed (this is
-- necessary to avoid confusion between the top
-- local declarations and the `module' definition.
if (options.nolocals or first_line) and line:find"^%s*local" then
return
end
return line
end
end)
-- parse first line of code
if code ~= nil then
local func_info = check_function(code)
local module_name = check_module(code)
local const_info = check_constant(code)
if func_info then
block.class = "function"
block.name = func_info.name
block.param = func_info.param
block.private = func_info.private
elseif const_info then
block.class = "constant"
block.name = const_info.name
block.private = const_info.private
elseif module_name then
block.class = "module"
block.name = module_name
block.param = {}
else
block.param = {}
end
else
-- TODO: comment without any code. Does this means we are dealing
-- with a file comment?
end
-- parse @ tags
local currenttag = "description"
local currenttext
table.foreachi(block.comment, function (_, line)
line = util.trim_comment(line)
local r, _, tag, text = string.find(line, "@([_%w%.]+)%s+(.*)")
if r ~= nil then
-- found new tag, add previous one, and start a new one
-- TODO: what to do with invalid tags? issue an error? or log a warning?
tags.handle(currenttag, block, currenttext)
currenttag = tag
currenttext = text
else
currenttext = util.concat(currenttext, line)
assert(string.sub(currenttext, 1, 1) ~= " ", string.format("`%s', `%s'", currenttext, line))
end
end)
tags.handle(currenttag, block, currenttext)
-- extracts summary information from the description
block.summary = parse_summary(block.description)
assert(string.sub(block.description, 1, 1) ~= " ", string.format("`%s'", block.description))
if block.name and block.class == "module" then
modulename = block.name
end
return block, modulename
end
-------------------------------------------------------------------------------
-- Parses a block of comment, started with ---. Read until the next block of
-- comment.
-- @param f file handle
-- @param line being parsed
-- @param modulename module already found, if any
-- @return line
-- @return block parsed
-- @return modulename if found
local function parse_block (f, line, modulename, first)
local block = {
comment = {},
code = {},
}
while line ~= nil do
if string.find(line, "^[\t ]*%-%-") == nil then
-- reached end of comment, read the code below it
-- TODO: allow empty lines
line, block.code, modulename = parse_code(f, line, modulename)
-- parse information in block comment
block, modulename = parse_comment(block, first, modulename)
return line, block, modulename
else
table.insert(block.comment, line)
line = f:read()
end
end
-- reached end of file
-- parse information in block comment
block, modulename = parse_comment(block, first, modulename)
return line, block, modulename
end
-------------------------------------------------------------------------------
-- Parses a file documented following luadoc format.
-- @param filepath full path of file to parse
-- @param doc table with documentation
-- @return table with documentation
function parse_file (filepath, doc, handle, prev_line, prev_block, prev_modname)
local blocks = { prev_block }
local modulename = prev_modname
-- read each line
local f = handle or io.open(filepath, "r")
local i = 1
local line = prev_line or f:read()
local first = true
while line ~= nil do
if string.find(line, "^[\t ]*%-%-%-") then
-- reached a luadoc block
local block, newmodname
line, block, newmodname = parse_block(f, line, modulename, first)
if modulename and newmodname and newmodname ~= modulename then
doc = parse_file( nil, doc, f, line, block, newmodname )
else
table.insert(blocks, block)
modulename = newmodname
end
else
-- look for a module definition
local newmodname = check_module(line, modulename)
if modulename and newmodname and newmodname ~= modulename then
parse_file( nil, doc, f )
else
modulename = newmodname
end
-- TODO: keep beginning of file somewhere
line = f:read()
end
first = false
i = i + 1
end
if not handle then
f:close()
end
if filepath then
-- store blocks in file hierarchy
assert(doc.files[filepath] == nil, string.format("doc for file `%s' already defined", filepath))
table.insert(doc.files, filepath)
doc.files[filepath] = {
type = "file",
name = filepath,
doc = blocks,
-- functions = class_iterator(blocks, "function"),
-- tables = class_iterator(blocks, "table"),
}
--
local first = doc.files[filepath].doc[1]
if first and modulename then
doc.files[filepath].author = first.author
doc.files[filepath].copyright = first.copyright
doc.files[filepath].description = first.description
doc.files[filepath].release = first.release
doc.files[filepath].summary = first.summary
end
end
-- if module definition is found, store in module hierarchy
if modulename ~= nil then
if modulename == "..." then
assert( filepath, "Can't determine name for virtual module from filepatch" )
modulename = string.gsub (filepath, "%.lua$", "")
modulename = string.gsub (modulename, "/", ".")
end
if doc.modules[modulename] ~= nil then
-- module is already defined, just add the blocks
table.foreachi(blocks, function (_, v)
table.insert(doc.modules[modulename].doc, v)
end)
else
-- TODO: put this in a different module
table.insert(doc.modules, modulename)
doc.modules[modulename] = {
type = "module",
name = modulename,
doc = blocks,
-- functions = class_iterator(blocks, "function"),
-- tables = class_iterator(blocks, "table"),
author = first and first.author,
copyright = first and first.copyright,
description = "",
release = first and first.release,
summary = "",
}
-- find module description
for m in class_iterator(blocks, "module")() do
doc.modules[modulename].description = util.concat(
doc.modules[modulename].description,
m.description)
doc.modules[modulename].summary = util.concat(
doc.modules[modulename].summary,
m.summary)
if m.author then
doc.modules[modulename].author = m.author
end
if m.copyright then
doc.modules[modulename].copyright = m.copyright
end
if m.release then
doc.modules[modulename].release = m.release
end
if m.name then
doc.modules[modulename].name = m.name
end
end
doc.modules[modulename].description = doc.modules[modulename].description or (first and first.description) or ""
doc.modules[modulename].summary = doc.modules[modulename].summary or (first and first.summary) or ""
end
-- make functions table
doc.modules[modulename].functions = {}
for f in class_iterator(blocks, "function")() do
if f and f.name then
table.insert(doc.modules[modulename].functions, f.name)
doc.modules[modulename].functions[f.name] = f
end
end
-- make tables table
doc.modules[modulename].tables = {}
for t in class_iterator(blocks, "table")() do
if t and t.name then
table.insert(doc.modules[modulename].tables, t.name)
doc.modules[modulename].tables[t.name] = t
end
end
-- make constants table
doc.modules[modulename].constants = {}
for c in class_iterator(blocks, "constant")() do
if c and c.name then
table.insert(doc.modules[modulename].constants, c.name)
doc.modules[modulename].constants[c.name] = c
end
end
end
if filepath then
-- make functions table
doc.files[filepath].functions = {}
for f in class_iterator(blocks, "function")() do
if f and f.name then
table.insert(doc.files[filepath].functions, f.name)
doc.files[filepath].functions[f.name] = f
end
end
-- make tables table
doc.files[filepath].tables = {}
for t in class_iterator(blocks, "table")() do
if t and t.name then
table.insert(doc.files[filepath].tables, t.name)
doc.files[filepath].tables[t.name] = t
end
end
end
return doc
end
-------------------------------------------------------------------------------
-- Checks if the file is terminated by ".lua" or ".luadoc" and calls the
-- function that does the actual parsing
-- @param filepath full path of the file to parse
-- @param doc table with documentation
-- @return table with documentation
-- @see parse_file
function file (filepath, doc)
local patterns = { "%.lua$", "%.luadoc$" }
local valid = table.foreachi(patterns, function (_, pattern)
if string.find(filepath, pattern) ~= nil then
return true
end
end)
if valid then
logger:info(string.format("processing file `%s'", filepath))
doc = parse_file(filepath, doc)
end
return doc
end
-------------------------------------------------------------------------------
-- Recursively iterates through a directory, parsing each file
-- @param path directory to search
-- @param doc table with documentation
-- @return table with documentation
function directory (path, doc)
for f in posix.files(path) do
local fullpath = path .. "/" .. f
local attr = posix.stat(fullpath)
assert(attr, string.format("error stating file `%s'", fullpath))
if attr.type == "regular" then
doc = file(fullpath, doc)
elseif attr.type == "directory" and f ~= "." and f ~= ".." then
doc = directory(fullpath, doc)
end
end
return doc
end
-- Recursively sorts the documentation table
local function recsort (tab)
table.sort (tab)
-- sort list of functions by name alphabetically
for f, doc in pairs(tab) do
if doc.functions then
table.sort(doc.functions)
end
if doc.tables then
table.sort(doc.tables)
end
end
end
-------------------------------------------------------------------------------
function start (files, doc)
assert(files, "file list not specified")
-- Create an empty document, or use the given one
doc = doc or {
files = {},
modules = {},
}
assert(doc.files, "undefined `files' field")
assert(doc.modules, "undefined `modules' field")
table.foreachi(files, function (_, path)
local attr = posix.stat(path)
assert(attr, string.format("error stating path `%s'", path))
if attr.type == "regular" then
doc = file(path, doc)
elseif attr.type == "directory" then
doc = directory(path, doc)
end
end)
-- order arrays alphabetically
recsort(doc.files)
recsort(doc.modules)
return doc
end

View File

@ -1,178 +0,0 @@
-------------------------------------------------------------------------------
-- Handlers for several tags
-- @release $Id: tags.lua 3941 2008-12-23 21:39:38Z jow $
-------------------------------------------------------------------------------
local luadoc = require "luadoc"
local util = require "luadoc.util"
local string = require "string"
local table = require "table"
local assert, type, tostring = assert, type, tostring
module "luadoc.taglet.standard.tags"
-------------------------------------------------------------------------------
local function author (tag, block, text)
block[tag] = block[tag] or {}
if not text then
luadoc.logger:warn("author `name' not defined [["..text.."]]: skipping")
return
end
table.insert (block[tag], text)
end
-------------------------------------------------------------------------------
-- Set the class of a comment block. Classes can be "module", "function",
-- "table". The first two classes are automatic, extracted from the source code
local function class (tag, block, text)
block[tag] = text
end
-------------------------------------------------------------------------------
local function cstyle (tag, block, text)
block[tag] = text
end
-------------------------------------------------------------------------------
local function copyright (tag, block, text)
block[tag] = text
end
-------------------------------------------------------------------------------
local function description (tag, block, text)
block[tag] = text
end
-------------------------------------------------------------------------------
local function field (tag, block, text)
if block["class"] ~= "table" then
luadoc.logger:warn("documenting `field' for block that is not a `table'")
end
block[tag] = block[tag] or {}
local _, _, name, desc = string.find(text, "^([_%w%.]+)%s+(.*)")
assert(name, "field name not defined")
table.insert(block[tag], name)
block[tag][name] = desc
end
-------------------------------------------------------------------------------
-- Set the name of the comment block. If the block already has a name, issue
-- an error and do not change the previous value
local function name (tag, block, text)
if block[tag] and block[tag] ~= text then
luadoc.logger:error(string.format("block name conflict: `%s' -> `%s'", block[tag], text))
end
block[tag] = text
end
-------------------------------------------------------------------------------
-- Processes a parameter documentation.
-- @param tag String with the name of the tag (it must be "param" always).
-- @param block Table with previous information about the block.
-- @param text String with the current line beeing processed.
local function param (tag, block, text)
block[tag] = block[tag] or {}
-- TODO: make this pattern more flexible, accepting empty descriptions
local _, _, name, desc = string.find(text, "^([_%w%.]+)%s+(.*)")
if not name then
luadoc.logger:warn("parameter `name' not defined [["..text.."]]: skipping")
return
end
local i = table.foreachi(block[tag], function (i, v)
if v == name then
return i
end
end)
if i == nil then
luadoc.logger:warn(string.format("documenting undefined parameter `%s'", name))
table.insert(block[tag], name)
end
block[tag][name] = desc
end
-------------------------------------------------------------------------------
local function release (tag, block, text)
block[tag] = text
end
-------------------------------------------------------------------------------
local function ret (tag, block, text)
tag = "ret"
if type(block[tag]) == "string" then
block[tag] = { block[tag], text }
elseif type(block[tag]) == "table" then
table.insert(block[tag], text)
else
block[tag] = text
end
end
-------------------------------------------------------------------------------
-- @see ret
local function see (tag, block, text)
-- see is always an array
block[tag] = block[tag] or {}
-- remove trailing "."
text = string.gsub(text, "(.*)%.$", "%1")
local s = util.split("%s*,%s*", text)
table.foreachi(s, function (_, v)
table.insert(block[tag], v)
end)
end
-------------------------------------------------------------------------------
-- @see ret
local function usage (tag, block, text)
if type(block[tag]) == "string" then
block[tag] = { block[tag], text }
elseif type(block[tag]) == "table" then
table.insert(block[tag], text)
else
block[tag] = text
end
end
-------------------------------------------------------------------------------
local handlers = {}
handlers["author"] = author
handlers["class"] = class
handlers["cstyle"] = cstyle
handlers["copyright"] = copyright
handlers["description"] = description
handlers["field"] = field
handlers["name"] = name
handlers["param"] = param
handlers["release"] = release
handlers["return"] = ret
handlers["see"] = see
handlers["usage"] = usage
-------------------------------------------------------------------------------
function handle (tag, block, text)
if not handlers[tag] then
luadoc.logger:error(string.format("undefined handler for tag `%s'", tag))
return
end
-- assert(handlers[tag], string.format("undefined handler for tag `%s'", tag))
return handlers[tag](tag, block, text)
end

View File

@ -1,201 +0,0 @@
-------------------------------------------------------------------------------
-- General utilities.
-- @release $Id: util.lua 3941 2008-12-23 21:39:38Z jow $
-------------------------------------------------------------------------------
local posix = require "posix"
local type, table, string, io, assert, tostring, setmetatable, pcall = type, table, string, io, assert, tostring, setmetatable, pcall
-------------------------------------------------------------------------------
-- Module with several utilities that could not fit in a specific module
module "luadoc.util"
-------------------------------------------------------------------------------
-- Removes spaces from the begining and end of a given string
-- @param s string to be trimmed
-- @return trimmed string
function trim (s)
return (string.gsub(s, "^%s*(.-)%s*$", "%1"))
end
-------------------------------------------------------------------------------
-- Removes spaces from the begining and end of a given string, considering the
-- string is inside a lua comment.
-- @param s string to be trimmed
-- @return trimmed string
-- @see trim
-- @see string.gsub
function trim_comment (s)
s = string.gsub(s, "%-%-+(.*)$", "%1")
return trim(s)
end
-------------------------------------------------------------------------------
-- Checks if a given line is empty
-- @param line string with a line
-- @return true if line is empty, false otherwise
function line_empty (line)
return (string.len(trim(line)) == 0)
end
-------------------------------------------------------------------------------
-- Appends two string, but if the first one is nil, use to second one
-- @param str1 first string, can be nil
-- @param str2 second string
-- @return str1 .. " " .. str2, or str2 if str1 is nil
function concat (str1, str2)
if str1 == nil or string.len(str1) == 0 then
return str2
else
return str1 .. " " .. str2
end
end
-------------------------------------------------------------------------------
-- Split text into a list consisting of the strings in text,
-- separated by strings matching delim (which may be a pattern).
-- @param delim if delim is "" then action is the same as %s+ except that
-- field 1 may be preceeded by leading whitespace
-- @usage split(",%s*", "Anna, Bob, Charlie,Dolores")
-- @usage split(""," x y") gives {"x","y"}
-- @usage split("%s+"," x y") gives {"", "x","y"}
-- @return array with strings
-- @see table.concat
function split(delim, text)
local list = {}
if string.len(text) > 0 then
delim = delim or ""
local pos = 1
-- if delim matches empty string then it would give an endless loop
if string.find("", delim, 1) and delim ~= "" then
error("delim matches empty string!")
end
local first, last
while 1 do
if delim ~= "" then
first, last = string.find(text, delim, pos)
else
first, last = string.find(text, "%s+", pos)
if first == 1 then
pos = last+1
first, last = string.find(text, "%s+", pos)
end
end
if first then -- found?
table.insert(list, string.sub(text, pos, first-1))
pos = last+1
else
table.insert(list, string.sub(text, pos))
break
end
end
end
return list
end
-------------------------------------------------------------------------------
-- Comments a paragraph.
-- @param text text to comment with "--", may contain several lines
-- @return commented text
function comment (text)
text = string.gsub(text, "\n", "\n-- ")
return "-- " .. text
end
-------------------------------------------------------------------------------
-- Wrap a string into a paragraph.
-- @param s string to wrap
-- @param w width to wrap to [80]
-- @param i1 indent of first line [0]
-- @param i2 indent of subsequent lines [0]
-- @return wrapped paragraph
function wrap(s, w, i1, i2)
w = w or 80
i1 = i1 or 0
i2 = i2 or 0
assert(i1 < w and i2 < w, "the indents must be less than the line width")
s = string.rep(" ", i1) .. s
local lstart, len = 1, string.len(s)
while len - lstart > w do
local i = lstart + w
while i > lstart and string.sub(s, i, i) ~= " " do i = i - 1 end
local j = i
while j > lstart and string.sub(s, j, j) == " " do j = j - 1 end
s = string.sub(s, 1, j) .. "\n" .. string.rep(" ", i2) ..
string.sub(s, i + 1, -1)
local change = i2 + 1 - (i - j)
lstart = j + change
len = len + change
end
return s
end
-------------------------------------------------------------------------------
-- Opens a file, creating the directories if necessary
-- @param filename full path of the file to open (or create)
-- @param mode mode of opening
-- @return file handle
function posix.open (filename, mode)
local f = io.open(filename, mode)
if f == nil then
filename = string.gsub(filename, "\\", "/")
local dir = ""
for d in string.gfind(filename, ".-/") do
dir = dir .. d
posix.mkdir(dir)
end
f = io.open(filename, mode)
end
return f
end
----------------------------------------------------------------------------------
-- Creates a Logger with LuaLogging, if present. Otherwise, creates a mock logger.
-- @param options a table with options for the logging mechanism
-- @return logger object that will implement log methods
function loadlogengine(options)
local logenabled = pcall(function()
require "logging"
require "logging.console"
end)
local logging = logenabled and logging
if logenabled then
if options.filelog then
logger = logging.file("luadoc.log") -- use this to get a file log
else
logger = logging.console("[%level] %message\n")
end
if options.verbose then
logger:setLevel(logging.INFO)
else
logger:setLevel(logging.WARN)
end
else
noop = {__index=function(...)
return function(...)
-- noop
end
end}
logger = {}
setmetatable(logger, noop)
end
return logger
end

View File

@ -1,23 +0,0 @@
--[[
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: cacheloader.lua 3941 2008-12-23 21:39:38Z jow $
]]--
local config = require "luci.config"
local ccache = require "luci.ccache"
module "luci.cacheloader"
if config.ccache and config.ccache.enable == "1" then
ccache.cache_ondemand()
end

File diff suppressed because it is too large Load Diff

View File

@ -1,86 +0,0 @@
--[[
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: ccache.lua 3941 2008-12-23 21:39:38Z jow $
]]--
local io = require "io"
local util = require "luci.util"
local posix = require "posix"
local debug = require "debug"
local string = require "string"
local package = require "package"
local type, loadfile = type, loadfile
module "luci.ccache"
function cache_ondemand(...)
if debug.getinfo(1, 'S').source ~= "=?" then
cache_enable(...)
end
end
function cache_enable(cachepath, mode)
cachepath = cachepath or "/tmp/luci-modulecache"
mode = mode or "r--r--r--"
local loader = package.loaders[2]
local uid = posix.getpid("uid")
if not posix.stat(cachepath) then
posix.mkdir(cachepath)
end
local function _encode_filename(name)
local encoded = ""
for i=1, #name do
encoded = encoded .. ("%2X" % string.byte(name, i))
end
return encoded
end
local function _load_sane(file)
local stat = posix.stat(file)
if stat and stat.uid == uid and stat.mode == mode then
return loadfile(file)
end
end
local function _write_sane(file, func)
if posix.getpid("uid") == uid then
local fp = io.open(file, "w")
if fp then
fp:write(util.get_bytecode(func))
fp:close()
posix.chmod(file, mode)
end
end
end
package.loaders[2] = function(mod)
local encoded = cachepath .. "/" .. _encode_filename(mod)
local modcons = _load_sane(encoded)
if modcons then
return modcons
end
-- No cachefile
modcons = loader(mod)
if type(modcons) == "function" then
_write_sane(encoded, modcons)
end
return modcons
end
end

View File

@ -1,42 +0,0 @@
--[[
LuCI - Configuration
Description:
Some LuCI configuration values read from uci file "luci"
FileId:
$Id: config.lua 3857 2008-12-05 15:37:39Z Cyrus $
License:
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
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.
]]--
local util = require "luci.util"
module("luci.config",
function(m)
if pcall(require, "luci.model.uci") then
local config = util.threadlocal()
setmetatable(m, {
__index = function(tbl, key)
if not config[key] then
config[key] = luci.model.uci.cursor():get_all("luci", key)
end
return config[key]
end
})
end
end)

Some files were not shown because too many files have changed in this diff Show More