Merge pull request #1508 from jow-/check-foritfy-source-compat
authorSteven Barth <steven@midlink.org>
Thu, 16 Jul 2015 15:52:02 +0000 (17:52 +0200)
committerSteven Barth <steven@midlink.org>
Thu, 16 Jul 2015 15:52:02 +0000 (17:52 +0200)
check: fix fortify source compatibility

203 files changed:
README.md
admin/monit/Makefile
admin/sudo/Makefile
admin/zabbix/Makefile
admin/zabbix/files/zabbix_agentd.init [changed mode: 0644->0755]
admin/zabbix/patches/010-change-agentd-config.patch
admin/zabbix/patches/015-daemon-foreground.patch [new file with mode: 0644]
devel/diffutils/Makefile
ipv6/aiccu/Makefile
ipv6/aiccu/patches/300-resolver-uclibc.patch
ipv6/aiccu/patches/400-musl-compat.patch
lang/micropython-lib/Makefile
lang/micropython/Makefile
lang/perl-cgi/Makefile [new file with mode: 0644]
lang/perl-compress-bzip2/Makefile
lang/perl-dbi/Makefile
lang/perl-device-serialport/Makefile
lang/perl-encode-locale/Makefile [new file with mode: 0644]
lang/perl-file-listing/Makefile [new file with mode: 0644]
lang/perl-html-form/Makefile [new file with mode: 0644]
lang/perl-html-parser/Makefile
lang/perl-html-tagset/Makefile
lang/perl-html-tree/Makefile
lang/perl-http-cookies/Makefile [new file with mode: 0644]
lang/perl-http-daemon/Makefile [new file with mode: 0644]
lang/perl-http-date/Makefile [new file with mode: 0644]
lang/perl-http-message/Makefile [new file with mode: 0644]
lang/perl-http-negotiate/Makefile [new file with mode: 0644]
lang/perl-http-server-simple/Makefile [new file with mode: 0644]
lang/perl-io-html/Makefile [new file with mode: 0644]
lang/perl-lockfile-simple/Makefile
lang/perl-lwp-mediatypes/Makefile [new file with mode: 0644]
lang/perl-net-http/Makefile [new file with mode: 0644]
lang/perl-net-telnet/Makefile
lang/perl-sub-uplevel/Makefile [new file with mode: 0644]
lang/perl-test-harness/Makefile
lang/perl-test-warn/Makefile [new file with mode: 0644]
lang/perl-uri/Makefile
lang/perl-www-curl/Makefile
lang/perl-www-mechanize/Makefile
lang/perl-www-robotrules/Makefile [new file with mode: 0644]
lang/perl-www/Makefile
lang/perl-www/patches/010-lwp-https-call-verify-hostname-when-avail.patch [deleted file]
lang/perl-www/patches/020-lwp-https-verify-hostnames-by-default.patch [deleted file]
lang/python-pyserial/Makefile [new file with mode: 0644]
lang/python/Makefile
lang/python/patches/006-remove-debian-multiarch-support.patch
lang/python3/Makefile
lang/python3/patches/012-disable-wcsftime-detection.patch [new file with mode: 0644]
libs/alsa-lib/patches/005-fix_include_file_redirect_warnings.patch [new file with mode: 0644]
libs/boost/Makefile
libs/gnutls/Makefile
libs/libevdev/Makefile
libs/libidn/Makefile
libs/libinput/Makefile
libs/libnet-1.2.x/Makefile
libs/libnet-1.2.x/patches/100-musl-compat.patch
libs/libssh2/Makefile
libs/libunistring/Makefile
libs/mxml/Makefile
libs/openldap/Makefile
libs/pthsem/Makefile
libs/zmq/Makefile
libs/zmq/patches/010-disable_pedantic_on_linux_with_ulibc++.patch [new file with mode: 0644]
libs/zmq/patches/020-map_with_const_string_with_ublic++.patch [new file with mode: 0644]
libs/zmq/patches/030-streamoff_missing_with_ulibc++.patch [new file with mode: 0644]
libs/zmq/patches/100-fix-cxx-include-order.patch [new file with mode: 0644]
libs/zmq/patches/disable_pedantic_on_linux_with_ulibc++.patch [deleted file]
libs/zmq/patches/map_with_const_string_with_ublic++.patch [deleted file]
libs/zmq/patches/streamoff_missing_with_ulibc++.patch [deleted file]
multimedia/tvheadend/Config.in [new file with mode: 0644]
multimedia/tvheadend/Makefile [new file with mode: 0644]
multimedia/tvheadend/files/tvheadend.config [new file with mode: 0644]
multimedia/tvheadend/files/tvheadend.init [new file with mode: 0644]
net/ctorrent-svn/Makefile
net/ctorrent-svn/patches/400-musl-compat.patch [new file with mode: 0644]
net/ctorrent/Makefile
net/ctorrent/patches/200-musl-compat.patch [new file with mode: 0644]
net/davfs2/Makefile
net/davfs2/patches/100-musl-compat.patch [new file with mode: 0644]
net/dnscrypt-proxy/Makefile
net/dnscrypt-proxy/files/dnscrypt-proxy.config
net/dnscrypt-proxy/files/dnscrypt-proxy.init
net/esniper/Makefile [new file with mode: 0644]
net/gnunet/Makefile
net/gnunet/files/gnunet.init
net/gnurl/Makefile
net/gnurl/patches/010-backport-gtls-add-support-for-CURLOPT_CAPATH.patch [new file with mode: 0644]
net/haproxy/Makefile
net/iotivity/Makefile [new file with mode: 0644]
net/iotivity/patches/001-no_unit_test.patch [new file with mode: 0644]
net/iotivity/patches/002-do-not-chck-for-boost.patch [new file with mode: 0644]
net/iotivity/patches/004-use-env.patch [new file with mode: 0644]
net/iotivity/patches/010-libcoap-fix-big-endian-problems.patch [new file with mode: 0644]
net/iotivity/patches/011-cdsk-fix-big-endian-problem.patch [new file with mode: 0644]
net/iotivity/patches/020-Do-not-set-architecture-specific-flags.patch [new file with mode: 0644]
net/iotivity/patches/021-add-some-more-architectures.patch [new file with mode: 0644]
net/iotivity/patches/030-fix-missing-lib.patch [new file with mode: 0644]
net/iotivity/patches/040-fix-things-manager.patch [new file with mode: 0644]
net/iotivity/patches/050-fix-OICMidle.patch [new file with mode: 0644]
net/ipsec-tools/Makefile
net/ipsec-tools/files/functions.sh [new file with mode: 0644]
net/ipsec-tools/files/p1client-down [new file with mode: 0644]
net/ipsec-tools/files/p1client-up [new file with mode: 0644]
net/ipsec-tools/files/racoon [new file with mode: 0644]
net/ipsec-tools/files/racoon.conf [deleted file]
net/ipsec-tools/files/racoon.init
net/ipsec-tools/files/vpnctl [new file with mode: 0644]
net/knot/Makefile
net/knxd/Makefile
net/knxd/patches/0100-musl-compat [new file with mode: 0644]
net/lighttpd/Makefile
net/linknx/Makefile
net/linknx/patches/010-musl-compat [new file with mode: 0644]
net/linknx/patches/012-fix-linknx.cpp [new file with mode: 0644]
net/luci-app-sqm/Makefile
net/luci-app-sqm/files/sqm-cbi.lua
net/mtr/Makefile
net/mtr/patches/100-disabled-ipv6-fix.patch [new file with mode: 0644]
net/mwan3-luci/Makefile
net/mwan3-luci/files/etc/hotplug.d/iface/16-mwancustombak
net/mwan3-luci/files/usr/lib/lua/luci/controller/mwan3.lua
net/mwan3-luci/files/usr/lib/lua/luci/model/cbi/mwan/interface.lua
net/mwan3-luci/files/usr/lib/lua/luci/model/cbi/mwan/interfaceconfig.lua
net/mwan3-luci/files/usr/lib/lua/luci/model/cbi/mwan/rule.lua
net/mwan3-luci/files/usr/lib/lua/luci/model/cbi/mwan/ruleconfig.lua
net/net-snmp/Makefile
net/netperf/Makefile [new file with mode: 0644]
net/netperf/files/netserver.init [new file with mode: 0644]
net/netperf/patches/001-musl-fix.patch [new file with mode: 0644]
net/ngircd/Makefile [new file with mode: 0644]
net/ngircd/files/ngircd.init [new file with mode: 0644]
net/ntpd/Makefile
net/ntripcaster/Makefile
net/ntripclient/Makefile
net/ntripclient/patches/100-musl-compat.patch [new file with mode: 0644]
net/ntripserver/Makefile
net/ocserv/Makefile
net/ocserv/README
net/ola/Makefile
net/ola/files/olad.init
net/ola/patches/001-include-endian_h.patch [new file with mode: 0644]
net/openconnect/Makefile
net/openconnect/files/openconnect.sh
net/pptpd/files/pptpd.init
net/shadowsocks-client/patches/100-fortify-source-compat.patch [new file with mode: 0644]
net/shadowsocks-libev/Makefile [new file with mode: 0644]
net/shadowsocks-libev/files/firewall.include [new file with mode: 0644]
net/shadowsocks-libev/files/shadowsocks-libev.config [new file with mode: 0644]
net/shadowsocks-libev/files/shadowsocks-libev.init [new file with mode: 0644]
net/shadowsocks-libev/files/ss-rules [new file with mode: 0644]
net/sqm-scripts/Makefile
net/sqm-scripts/files/etc/config/sqm
net/sqm-scripts/files/usr/lib/sqm/functions.sh
net/sqm-scripts/files/usr/lib/sqm/simple.qos
net/sqm-scripts/files/usr/lib/sqm/simplest.qos
net/squid/Makefile
net/squid/patches/001-cross_compile.patch
net/squid/patches/200-musl-compat.patch [deleted file]
net/sslh/Makefile
net/sslh/patches/002-no_regex_probes.patch [new file with mode: 0644]
net/tinc/Makefile
net/tinc/patches/100-musl-compat.patch [deleted file]
net/unbound/Makefile
net/vpnc/Makefile
net/vpnc/files/vpnc.sh
net/vsftpd/Makefile
net/vsftpd/patches/007-CVE-2015-1419.patch [new file with mode: 0644]
net/znc/Makefile
net/znc/files/znc.init
sound/forked-daapd/patches/010-include_pregen.patch
utils/banhosts/Makefile [new file with mode: 0644]
utils/banhosts/files/updatebanhost [new file with mode: 0644]
utils/gammu/Makefile
utils/hfsprogs/patches/0015-sysctl-only-on-glibc.patch [new file with mode: 0644]
utils/joe/Makefile
utils/joe/files/joerc
utils/joe/patches/001-mathaway.patch [deleted file]
utils/lcd4linux/Config.in [new file with mode: 0644]
utils/lcd4linux/Makefile [new file with mode: 0644]
utils/lcd4linux/files/lcd4linux.init [new file with mode: 0644]
utils/lcd4linux/patches/100-drv_RouterBoard.patch [new file with mode: 0644]
utils/lcd4linux/patches/110-uclibc-logarithm-fix.patch [new file with mode: 0644]
utils/lcd4linux/patches/120-remove-as-needed-linker-option.patch [new file with mode: 0644]
utils/lcd4linux/patches/140-no_repnop_T6963.patch [new file with mode: 0644]
utils/lcd4linux/patches/150-addlibmpdclient.patch [new file with mode: 0644]
utils/lcd4linux/patches/160-uinput_defs.patch [new file with mode: 0644]
utils/lcd4linux/patches/170-add-generic-spidev-driver.patch [new file with mode: 0644]
utils/lcd4linux/patches/171-allow-to-specify-drv_generic_graphic_real_clear.patch [new file with mode: 0644]
utils/lcd4linux/patches/172-add-TEW673GRU-driver.patch [new file with mode: 0644]
utils/lvm2/Makefile
utils/lvm2/patches/002-const-stdio.patch
utils/mysql/Makefile
utils/mysql/files/mysqld.init
utils/nano/Makefile
utils/open-plc-utils/Makefile
utils/rtl-ais/Makefile [new file with mode: 0644]
utils/screen/Makefile
utils/screen/patches/100-cross_compile_fix.patch
utils/screen/patches/200-musl-compat.patch
utils/shadow/Makefile
utils/shadow/patches/004-fix-su-controoling-term.patch [new file with mode: 0644]
utils/tcsh/Makefile

index 930b6f0dd0e70ff82042b66747e6998b4aeb9780..d908a86abb121e7ad338c357b9f0283a028d48ae 100644 (file)
--- a/README.md
+++ b/README.md
@@ -4,7 +4,7 @@
 
 This is the OpenWrt "packages"-feed containing community-maintained build scripts, options and patches for applications, modules and libraries used within OpenWrt.
 
-Installation of pre-built packages is handled directly by the **opkg** utility within your running OpenWrt system or by using the [OpenWrt SDK](http://doc/howto/obtain.firmware.sdk) on a build system.
+Installation of pre-built packages is handled directly by the **opkg** utility within your running OpenWrt system or by using the [OpenWrt SDK](http://wiki.openwrt.org/doc/howto/obtain.firmware.sdk) on a build system.
 
 ## Usage
 
index ba1b64c564e44855944b0c71c8924c5a1178f3eb..b172de4aa78672bc2131a068783c62f89b608f44 100644 (file)
@@ -8,12 +8,12 @@
 include $(TOPDIR)/rules.mk
 
 PKG_NAME:=monit
-PKG_VERSION:=5.13
+PKG_VERSION:=5.14
 PKG_RELEASE:=1
 
 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
 PKG_SOURCE_URL:=http://mmonit.com/monit/dist
-PKG_MD5SUM:=7902ff45eaa1303ac25f6366eff251ef
+PKG_MD5SUM:=1b3ae1eb08a0914402a8764e5689c1c5
 
 PKG_LICENSE:=AGPL-3.0
 PKG_LICENSE_FILES:=COPYING
index 69ace6060f200287767875138eca627fb2753daa..282db1a10982de9b285cb3ea40f235a26eb3155b 100644 (file)
@@ -9,7 +9,7 @@ include $(TOPDIR)/rules.mk
 
 PKG_NAME:=sudo
 PKG_VERSION:=1.8.13
-PKG_RELEASE:=1
+PKG_RELEASE:=2
 PKG_LICENSE:=ISC
 PKG_LICENSE_FILES:=doc/LICENSE
 
@@ -40,6 +40,7 @@ endef
 
 define Package/sudo/conffiles
 /etc/sudoers
+/etc/sudoers.d/
 endef
 
 CONFIGURE_ARGS+= \
index e764b7701addc21fb3fd974a130248e7e6ae427d..02e142164f8d0f32b9a78aad534f6fa6975b7a5c 100644 (file)
@@ -9,7 +9,7 @@ include $(TOPDIR)/rules.mk
 
 PKG_NAME:=zabbix
 PKG_VERSION:=2.4.5
-PKG_RELEASE:=2
+PKG_RELEASE:=3
 
 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
 PKG_SOURCE_URL:=@SF/zabbix
old mode 100644 (file)
new mode 100755 (executable)
index c806a9f..86f1ced
@@ -3,29 +3,19 @@
 
 START=60
 
+USE_PROCD=1
 PROG=/usr/sbin/zabbix_agentd
 CONFIG=/etc/zabbix_agentd.conf
-SERVICE_PID_FILE=/var/run/zabbix_agentd.pid
 
-start() {
+start_service() {
        # Sometimes the agentd config was installed in /etc/zabbix/zabbix_agentd.conf
        [ -f /etc/zabbix/zabbix_agentd.conf ] && mv /etc/zabbix/zabbix_agentd.conf ${CONFIG}
 
        [ -f ${CONFIG} ] || return 1
 
-       grep -q "^PidFile=${SERVICE_PID_FILE}" ${CONFIG} || {
-               logger -s -t ${CONFIG} -p daemon.error "Only \"PidFile=${SERVICE_PID_FILE}\" supported"
-               return 1
-       }
-
-       grep -q "^AllowRoot=1" ${CONFIG} || {
-               touch ${SERVICE_PID_FILE}
-               chown zabbix:zabbix ${SERVICE_PID_FILE}
-       }
-
-       service_start ${PROG} -c ${CONFIG}
+       procd_open_instance
+       procd_set_param command ${PROG} -c ${CONFIG} -f
+       procd_set_param respawn
+       procd_close_instance
 }
 
-stop() {
-       service_stop ${PROG}
-}
index ccc36d1b40cc5ba8583f796e811d7dd575e02919..e4812f6ef97de80bdc6292509f44e5ca3fa28c84 100644 (file)
@@ -10,8 +10,8 @@
 -# Mandatory: no
 -# Default:
 -# PidFile=/tmp/zabbix_agentd.pid
-+# Only /var/run/zabbix_agentd.pid supported
-+PidFile=/var/run/zabbix_agentd.pid
++# We do not need PidFile with procd
++PidFile=/var/run/zabbix_agentd.pid
  
  ### Option: LogFile
  #     Name of log file.
diff --git a/admin/zabbix/patches/015-daemon-foreground.patch b/admin/zabbix/patches/015-daemon-foreground.patch
new file mode 100644 (file)
index 0000000..20e1306
--- /dev/null
@@ -0,0 +1,243 @@
+--- a/include/common.h
++++ b/include/common.h
+@@ -1081,4 +1081,7 @@ int      parse_serveractive_element(char *str
+ #define ZBX_SESSION_ACTIVE    0
+ #define ZBX_SESSION_PASSIVE   1
++#define ZBX_RUN_BACKGROUND      0
++#define ZBX_RUN_FOREGROUND      1
++
+ #endif
+--- a/include/daemon.h
++++ b/include/daemon.h
+@@ -28,7 +28,7 @@ extern char  *CONFIG_PID_FILE;
+ #include "threads.h"
+-int   daemon_start(int allow_root, const char *user);
++int   daemon_start(int allow_root, const char *user, int run_foreground);
+ void  daemon_stop();
+ int   zbx_sigusr_send(int flags);
+@@ -36,6 +36,6 @@ int  zbx_sigusr_send(int flags);
+ #define ZBX_IS_RUNNING()      1
+ #define ZBX_DO_EXIT()
+-#define START_MAIN_ZABBIX_ENTRY(a, u) daemon_start(a, u)
++#define START_MAIN_ZABBIX_ENTRY(a, u, f)      daemon_start(a, u, f)
+ #endif        /* ZABBIX_DAEMON_H */
+--- a/src/libs/zbxnix/daemon.c
++++ b/src/libs/zbxnix/daemon.c
+@@ -272,16 +272,17 @@ static void      set_daemon_signal_handlers()
+  *                                                                            *
+  * Purpose: init process as daemon                                            *
+  *                                                                            *
+- * Parameters: allow_root - allow root permission for application             *
+- *             user       - user on the system to which to drop the           *
+- *                          privileges                                        *
++ * Parameters: allow_root     - allow root permission for application         *
++ *             user           - user on the system to which to drop the       *
++ *                              privileges                                    *
++ *             run_foreground - should it close its controling tty            *
+  *                                                                            *
+  * Author: Alexei Vladishev                                                   *
+  *                                                                            *
+  * Comments: it doesn't allow running under 'root' if allow_root is zero      *
+  *                                                                            *
+  ******************************************************************************/
+-int   daemon_start(int allow_root, const char *user)
++int   daemon_start(int allow_root, const char *user, int run_foreground)
+ {
+       pid_t           pid;
+       struct passwd   *pwd;
+@@ -336,15 +337,22 @@ int      daemon_start(int allow_root, const c
+ #endif
+       }
+-      if (0 != (pid = zbx_fork()))
+-              exit(EXIT_SUCCESS);
++      if ( ZBX_RUN_FOREGROUND != run_foreground)
++              if (0 != (pid = zbx_fork()))
++                      exit(EXIT_SUCCESS);
+       setsid();
+       signal(SIGHUP, SIG_IGN);
+-      if (0 != (pid = zbx_fork()))
+-              exit(EXIT_SUCCESS);
++      if ( ZBX_RUN_FOREGROUND == run_foreground) {
++              zabbix_log(LOG_LEVEL_INFORMATION, "Running in foreground...");
++      } else {
++              if (0 != (pid = zbx_fork()))
++                      exit(EXIT_SUCCESS);
++      }
++
++
+       if (-1 == chdir("/"))   /* this is to eliminate warning: ignoring return value of chdir */
+               assert(0);
+--- a/src/zabbix_agent/zabbix_agentd.c
++++ b/src/zabbix_agent/zabbix_agentd.c
+@@ -62,6 +62,8 @@ const char   *progname = NULL;
+       static char     DEFAULT_CONFIG_FILE[]   = SYSCONFDIR "/zabbix_agentd.conf";
+ #endif
++int CONFIG_FOREGROUND = ZBX_RUN_BACKGROUND;
++
+ /* application TITLE */
+ const char    title_message[] = APPLICATION_NAME
+ #if defined(_WIN64)
+@@ -93,6 +95,7 @@ const char   usage_message[] =
+ const char    *help_message[] = {
+       "Options:",
+       "  -c --config <config-file>       Absolute path to the configuration file",
++      "  -f --foreground                 Run in foreground don't fork",
+       "  -p --print                      Print known items and exit",
+       "  -t --test <item key>            Test specified item and exit",
+       "  -h --help                       Display help information",
+@@ -127,6 +130,7 @@ const char *help_message[] = {
+ /* COMMAND LINE OPTIONS */
+ static struct zbx_option      longopts[] =
+ {
++      {"foreground",          0,      NULL,   'f'},
+       {"config",              1,      NULL,   'c'},
+       {"help",                0,      NULL,   'h'},
+       {"version",             0,      NULL,   'V'},
+@@ -147,7 +151,7 @@ static struct zbx_option   longopts[] =
+ };
+ static char   shortopts[] =
+-      "c:hVpt:"
++      "c:hfVpt:"
+ #ifndef _WINDOWS
+       "R:"
+ #else
+@@ -241,6 +245,9 @@ static void        parse_commandline(int argc,
+       {
+               switch (ch)
+               {
++                      case 'f':
++                              CONFIG_FOREGROUND = ZBX_RUN_FOREGROUND;
++                              break;
+                       case 'c':
+                               CONFIG_FILE = strdup(zbx_optarg);
+                               break;
+@@ -944,7 +951,7 @@ int        main(int argc, char **argv)
+                       break;
+       }
+-      START_MAIN_ZABBIX_ENTRY(CONFIG_ALLOW_ROOT, CONFIG_USER);
++      START_MAIN_ZABBIX_ENTRY(CONFIG_ALLOW_ROOT, CONFIG_USER, CONFIG_FOREGROUND);
+       exit(EXIT_SUCCESS);
+ }
+--- a/src/zabbix_proxy/proxy.c
++++ b/src/zabbix_proxy/proxy.c
+@@ -60,6 +60,7 @@ const char   usage_message[] = "[-hV] [-c
+ const char    *help_message[] = {
+       "Options:",
++      "  -f --foreground                 Run in foreground don't fork",
+       "  -c --config <file>              Absolute path to the configuration file",
+       "  -R --runtime-control <option>   Perform administrative functions",
+       "",
+@@ -84,6 +85,7 @@ const char   *help_message[] = {
+ /* long options */
+ static struct zbx_option      longopts[] =
+ {
++      {"foreground",          0,      NULL,   'f'},
+       {"config",              1,      NULL,   'c'},
+       {"runtime-control",     1,      NULL,   'R'},
+       {"help",                0,      NULL,   'h'},
+@@ -92,7 +94,7 @@ static struct zbx_option     longopts[] =
+ };
+ /* short options */
+-static char   shortopts[] = "c:n:hVR:";
++static char   shortopts[] = "c:n:fhVR:";
+ /* end of COMMAND LINE OPTIONS */
+@@ -202,6 +204,7 @@ char       *CONFIG_LOAD_MODULE_PATH        = NULL;
+ char  **CONFIG_LOAD_MODULE            = NULL;
+ char  *CONFIG_USER                    = NULL;
++int   CONFIG_FOREGROUND               = ZBX_RUN_BACKGROUND;
+ /* web monitoring */
+ #ifdef HAVE_LIBCURL
+@@ -666,6 +669,9 @@ int        main(int argc, char **argv)
+       {
+               switch (ch)
+               {
++                      case 'f':
++                              CONFIG_FOREGROUND = ZBX_RUN_FOREGROUND;
++                              break;
+                       case 'c':
+                               CONFIG_FILE = zbx_strdup(CONFIG_FILE, zbx_optarg);
+                               break;
+@@ -705,7 +711,7 @@ int        main(int argc, char **argv)
+       init_ipmi_handler();
+ #endif
+-      return daemon_start(CONFIG_ALLOW_ROOT, CONFIG_USER);
++      return daemon_start(CONFIG_ALLOW_ROOT, CONFIG_USER, CONFIG_FOREGROUND);
+ }
+ int   MAIN_ZABBIX_ENTRY()
+--- a/src/zabbix_server/server.c
++++ b/src/zabbix_server/server.c
+@@ -64,6 +64,7 @@ const char   usage_message[] = "[-hV] [-c
+ const char    *help_message[] = {
+       "Options:",
++      "  -f --foreground                 Run in foreground don't fork",
+       "  -c --config <file>              Absolute path to the configuration file",
+       "  -R --runtime-control <option>   Perform administrative functions",
+       "",
+@@ -88,6 +89,7 @@ const char   *help_message[] = {
+ /* long options */
+ static struct zbx_option      longopts[] =
+ {
++      {"foreground",          0,      NULL,   'f'},
+       {"config",              1,      NULL,   'c'},
+       {"runtime-control",     1,      NULL,   'R'},
+       {"help",                0,      NULL,   'h'},
+@@ -96,7 +98,7 @@ static struct zbx_option     longopts[] =
+ };
+ /* short options */
+-static char   shortopts[] = "c:n:hVR:";
++static char   shortopts[] = "c:n:fhVR:";
+ /* end of COMMAND LINE OPTIONS */
+@@ -197,6 +199,7 @@ char       *CONFIG_LOAD_MODULE_PATH        = NULL;
+ char  **CONFIG_LOAD_MODULE            = NULL;
+ char  *CONFIG_USER                    = NULL;
++int   CONFIG_FOREGROUND               = ZBX_RUN_BACKGROUND;
+ /* web monitoring */
+ #ifdef HAVE_LIBCURL
+@@ -631,6 +634,9 @@ int        main(int argc, char **argv)
+       {
+               switch (ch)
+               {
++                      case 'f':
++                              CONFIG_FOREGROUND = ZBX_RUN_FOREGROUND;
++                              break;
+                       case 'c':
+                               CONFIG_FILE = zbx_strdup(CONFIG_FILE, zbx_optarg);
+                               break;
+@@ -670,7 +676,7 @@ int        main(int argc, char **argv)
+       init_ipmi_handler();
+ #endif
+-      return daemon_start(CONFIG_ALLOW_ROOT, CONFIG_USER);
++      return daemon_start(CONFIG_ALLOW_ROOT, CONFIG_USER, CONFIG_FOREGROUND);
+ }
+ int   MAIN_ZABBIX_ENTRY()
index b313dafa420e2260c9411a43d47437a3c70e9e22..fb00a42d8df1ed9d659a4e205838643c5fb13c93 100644 (file)
@@ -1,5 +1,5 @@
 #
-# Copyright (C) 2008-2012 OpenWrt.org
+# Copyright (C) 2008-2015 OpenWrt.org
 #
 # This is free software, licensed under the GNU General Public License v2.
 # See /LICENSE for more information.
@@ -9,7 +9,7 @@ include $(TOPDIR)/rules.mk
 
 PKG_NAME:=diffutils
 PKG_VERSION:=3.3
-PKG_RELEASE:=1
+PKG_RELEASE:=2
 
 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.xz
 PKG_SOURCE_URL:=@GNU/diffutils
@@ -36,7 +36,7 @@ endef
 
 CONFIGURE_VARS += \
        ac_cv_func_mempcpy=n
-TARGET_CFLAGS += --std=c99
+TARGET_CFLAGS += --std=gnu99
 
 define Package/diffutils/install
        $(INSTALL_DIR) $(1)/usr/bin
index 0034c0b7091eeb1263ac628dee6f78b13a296d73..dae693839d27ac30acb6fae95b366f52e6eb5500 100644 (file)
@@ -9,7 +9,7 @@ include $(TOPDIR)/rules.mk
 
 PKG_NAME:=aiccu
 PKG_VERSION:=20070115
-PKG_RELEASE:=13
+PKG_RELEASE:=14
 
 PKG_SOURCE:=$(PKG_NAME)_$(PKG_VERSION).tar.gz
 PKG_SOURCE_URL:=http://www.sixxs.net/archive/sixxs/aiccu/unix
index 1a5f11626e057779aaef6afe115c65b42e721879..b88ef5c1a357f1fa09823e201effb15b125c2da1 100644 (file)
@@ -5,7 +5,7 @@
  int getrrs(const char *label, int rrtype, void gotrec(unsigned int num, int type, const char *record))
  {
 -#ifdef _LINUX
-+#if defined(_LINUX) && defined(__GLIBC__)
++#if defined(_LINUX) && defined(__GLIBC__) && !defined(__UCLIBC__)
        struct __res_state      res;
  #endif
        unsigned char           answer[8192];
@@ -14,7 +14,7 @@
        uint32_t                ttl = 0;
  
 -#ifdef _LINUX
-+#if defined(_LINUX) && defined(__GLIBC__)
++#if defined(_LINUX) && defined(__GLIBC__) && !defined(__UCLIBC__)
        memset(&res, 0, sizeof(res));
        res.options = RES_DEBUG;
        res_ninit(&res);
  
        memset(answer, 0, sizeof(answer));
 -#ifdef _LINUX
-+#if defined(_LINUX) && defined(__GLIBC__)
++#if defined(_LINUX) && defined(__GLIBC__) && !defined(__UCLIBC__)
        ret = res_nquery(&res, label, C_IN, rrtype, answer, sizeof(answer));
  #else
        ret = res_query(label, C_IN, rrtype, answer, sizeof(answer));
---- a/common/dn_skipname.c
-+++ b/common/dn_skipname.c
-@@ -9,7 +9,7 @@
-  * return:
-  *      0 on success, -1 (with errno set) on failure.
-  */
--int ns_name_skip(const u_char **ptrptr, const u_char *eom)
-+static int ns_name_skip(const u_char **ptrptr, const u_char *eom)
- {
-       const u_char *cp;
-       u_int n;
index 2e732d8a2ed8f14bc4a40c94ad69f14e14583e15..b6e0c3236e8442ddfd8b29fa4a25559eaef3de13 100644 (file)
        #include <linux/if_tun.h>
 --- a/common/dn_skipname.c
 +++ b/common/dn_skipname.c
-@@ -1,5 +1,6 @@
+@@ -1,6 +1,8 @@
  #include <errno.h>
  #include <resolv.h>
-+#include <sys/types.h>
  
++#include <sys/types.h>
++
  /* Ripped from glibc 2.4 sources. */
  
+ /*
index c8162dc54b9357349e09f9d83e264f5620de6f40..ee190bfec820a5be341a0940ab03c90ce83e12b2 100644 (file)
@@ -1,5 +1,5 @@
 #
-# Copyright (C) 2008-2010 OpenWrt.org
+# Copyright (C) 2008-2015 OpenWrt.org
 #
 # This is free software, licensed under the GNU General Public License v2.
 # See /LICENSE for more information.
@@ -8,7 +8,7 @@
 include $(TOPDIR)/rules.mk
 
 PKG_NAME:=micropython-lib
-PKG_VERSION=0.1-20150601-$(PKG_SOURCE_VERSION)
+PKG_VERSION=0.5-20150702-$(PKG_SOURCE_VERSION)
 PKG_RELEASE:=1
 
 PKG_MAINTAINER:=Roger D <rogerdammit@gmail.com>
@@ -17,7 +17,7 @@ PKG_LICENSE_FILES:=LICENSE
 
 PKG_SOURCE_PROTO:=git
 PKG_SOURCE_URL:=https://github.com/micropython/micropython-lib.git
-PKG_SOURCE_VERSION:=b8092c1838f4942a0fab62c1eb6d08b542cc9e9b
+PKG_SOURCE_VERSION:=863538b44f268ae39aa583f9cd124ed79ad7ba25
 
 PKG_SOURCE_SUBDIR:=$(PKG_NAME)-$(PKG_VERSION)-$(PKG_SOURCE_VERSION)
 PKG_SOURCE:=$(PKG_SOURCE_SUBDIR).tar.gz
index d5c66ada6ab2c800ab764f2eca6feaa28e0d7612..e5317d160541fce1121cfc71dbbf866478472de2 100644 (file)
@@ -1,5 +1,5 @@
 #
-# Copyright (C) 2008-2010 OpenWrt.org
+# Copyright (C) 2008-2015 OpenWrt.org
 #
 # This is free software, licensed under the GNU General Public License v2.
 # See /LICENSE for more information.
@@ -8,7 +8,7 @@
 include $(TOPDIR)/rules.mk
 
 PKG_NAME:=micropython
-PKG_VERSION=1.4.3-20150601-$(PKG_SOURCE_VERSION)
+PKG_VERSION=1.4.4-20150702-$(PKG_SOURCE_VERSION)
 PKG_RELEASE:=1
 
 PKG_MAINTAINER:=Roger D <rogerdammit@gmail.com>
@@ -17,7 +17,7 @@ PKG_LICENSE_FILES:=LICENSE
 
 PKG_SOURCE_PROTO:=git
 PKG_SOURCE_URL:=https://github.com/micropython/micropython.git
-PKG_SOURCE_VERSION:=3ac2d06bd13f1cedb8242eaacc6c608ac08c3520
+PKG_SOURCE_VERSION:=9220dc466a8d098ed669a33a617edd1118a3e35d
 
 PKG_SOURCE_SUBDIR:=$(PKG_NAME)-$(PKG_VERSION)
 PKG_SOURCE:=$(PKG_SOURCE_SUBDIR).tar.gz
diff --git a/lang/perl-cgi/Makefile b/lang/perl-cgi/Makefile
new file mode 100644 (file)
index 0000000..b23c783
--- /dev/null
@@ -0,0 +1,48 @@
+#
+# Copyright (C) 2015 OpenWrt.org
+#
+# This is free software, licensed under the GNU General Public License v2.
+# See /LICENSE for more information.
+#
+
+include $(TOPDIR)/rules.mk
+
+PKG_NAME:=perl-cgi
+PKG_VERSION:=4.21
+PKG_RELEASE:=1
+
+PKG_SOURCE_URL:=http://www.cpan.org/authors/id/L/LE/LEEJO
+PKG_SOURCE:=CGI-$(PKG_VERSION).tar.gz
+PKG_MD5SUM:=78b427bfee2dd21b2e612b5bfe5f038c
+
+PKG_LICENSE:=GPL Artistic-2.0
+PKG_MAINTAINER:=Marcel Denia <naoir@gmx.net>
+
+PKG_BUILD_DIR:=$(BUILD_DIR)/perl/CGI-$(PKG_VERSION)
+
+include $(INCLUDE_DIR)/package.mk
+include ../perl/perlmod.mk
+
+define Package/perl-cgi
+  SUBMENU:=Perl
+  SECTION:=lang
+  CATEGORY:=Languages
+  TITLE:=Handle Common Gateway Interface requests and responses
+  URL:=http://search.cpan.org/dist/CGI/
+  DEPENDS:=perl +perl-html-parser +perlbase-base +perlbase-config +perlbase-encode +perlbase-essential +perlbase-file +perlbase-if +perlbase-utf8
+endef
+
+define Build/Configure
+        $(call perlmod/Configure,,)
+endef
+
+define Build/Compile
+        $(call perlmod/Compile,,)
+endef
+
+define Package/perl-cgi/install
+        $(call perlmod/Install,$(1),CGI auto/CGI)
+endef
+
+
+$(eval $(call BuildPackage,perl-cgi))
index fbb388f181f9d59576395ad9949f4ed834a0c75f..e6c7c8fd6aef04d30df93c55553e81bec6e37b6d 100644 (file)
@@ -9,7 +9,7 @@ include $(TOPDIR)/rules.mk
 
 PKG_NAME:=perl-compress-bzip2
 PKG_VERSION:=2.22
-PKG_RELEASE:=3
+PKG_RELEASE:=4
 
 PKG_SOURCE_URL:=http://www.cpan.org/authors/id/R/RU/RURBAN/
 PKG_SOURCE:=Compress-Bzip2-$(PKG_VERSION).tar.gz
@@ -29,7 +29,7 @@ define Package/perl-compress-bzip2
   CATEGORY:=Languages
   TITLE:=Perl interface to bzip2 compression library
   URL:=http://search.cpan.org/dist/Compress-Bzip2/
-  DEPENDS:=perl +libbz2
+  DEPENDS:=perl +libbz2 +perlbase-autoloader +perlbase-config +perlbase-essential +perlbase-fcntl +perlbase-file +perlbase-getopt +perlbase-test +perlbase-xsloader
 endef
 
 define Build/Configure
index c752e96029fa48d33d915251e318a3706a0eb58d..b13c3a673eb6e0818067e9cb5277da1307ac498e 100644 (file)
@@ -9,7 +9,7 @@ include $(TOPDIR)/rules.mk
 
 PKG_NAME:=perl-dbi
 PKG_VERSION:=1.633
-PKG_RELEASE:=3
+PKG_RELEASE:=4
 
 PKG_SOURCE_URL:=http://www.cpan.org/authors/id/T/TI/TIMB/
 PKG_SOURCE:=DBI-$(PKG_VERSION).tar.gz
@@ -31,7 +31,7 @@ define Package/perl-dbi
   CATEGORY:=Languages
   TITLE:=Database independent interface for Perl
   URL:=http://search.cpan.org/dist/DBI/
-  DEPENDS:=perl +perlbase-essential
+  DEPENDS:=perl +perlbase-base +perlbase-config +perlbase-cwd +perlbase-data +perlbase-dynaloader +perlbase-errno +perlbase-essential +perlbase-fcntl +perlbase-file +perlbase-io +perlbase-ipc +perlbase-scalar +perlbase-storable +perlbase-symbol +perlbase-tie +perlbase-universal +perlbase-utf8
 endef
 
 define Build/Configure
index 22297ae9b578f2b8b5740d7521249794d8e89769..2069bed96f9cda2cc13ce4cc3a07b3efa4c59376 100644 (file)
@@ -9,7 +9,7 @@ include $(TOPDIR)/rules.mk
 
 PKG_NAME:=perl-device-serialport
 PKG_VERSION:=1.04
-PKG_RELEASE:=2
+PKG_RELEASE:=3
 
 PKG_SOURCE_URL:=http://www.cpan.org/authors/id/C/CO/COOK/
 PKG_SOURCE:=Device-SerialPort-$(PKG_VERSION).tar.gz
@@ -29,7 +29,7 @@ define Package/perl-device-serialport
   CATEGORY:=Languages
   TITLE:=A POSIX-based version of the Win32::SerialPort module
   URL:=http://search.cpan.org/dist/Device-SerialPort/
-  DEPENDS:=perl +perlbase-essential
+  DEPENDS:=perl +perlbase-essential +perlbase-io +perlbase-posix +perlbase-test +perlbase-xsloader
 endef
 
 define Package/perl-device-serialport/description
diff --git a/lang/perl-encode-locale/Makefile b/lang/perl-encode-locale/Makefile
new file mode 100644 (file)
index 0000000..54071dc
--- /dev/null
@@ -0,0 +1,48 @@
+#
+# Copyright (C) 2015 OpenWrt.org
+#
+# This is free software, licensed under the GNU General Public License v2.
+# See /LICENSE for more information.
+#
+
+include $(TOPDIR)/rules.mk
+
+PKG_NAME:=perl-encode-locale
+PKG_VERSION:=1.05
+PKG_RELEASE:=1
+
+PKG_SOURCE_URL:=http://www.cpan.org/authors/id/G/GA/GAAS
+PKG_SOURCE:=Encode-Locale-$(PKG_VERSION).tar.gz
+PKG_MD5SUM:=fcfdb8e4ee34bcf62aed429b4a23db27
+
+PKG_LICENSE:=GPL-1.0+ Artistic-1.0-Perl
+PKG_MAINTAINER:=Marcel Denia <naoir@gmx.net>
+
+PKG_BUILD_DIR:=$(BUILD_DIR)/perl/Encode-Locale-$(PKG_VERSION)
+
+include $(INCLUDE_DIR)/package.mk
+include ../perl/perlmod.mk
+
+define Package/perl-encode-locale
+  SUBMENU:=Perl
+  SECTION:=lang
+  CATEGORY:=Languages
+  TITLE:=Determine the locale encoding
+  URL:=http://search.cpan.org/dist/Encode-Locale/
+  DEPENDS:=perl +perlbase-base +perlbase-encode +perlbase-essential
+endef
+
+define Build/Configure
+        $(call perlmod/Configure,,)
+endef
+
+define Build/Compile
+        $(call perlmod/Compile,,)
+endef
+
+define Package/perl-encode-locale/install
+        $(call perlmod/Install,$(1),Encode auto/Encode)
+endef
+
+
+$(eval $(call BuildPackage,perl-encode-locale))
diff --git a/lang/perl-file-listing/Makefile b/lang/perl-file-listing/Makefile
new file mode 100644 (file)
index 0000000..19a6938
--- /dev/null
@@ -0,0 +1,48 @@
+#
+# Copyright (C) 2015 OpenWrt.org
+#
+# This is free software, licensed under the GNU General Public License v2.
+# See /LICENSE for more information.
+#
+
+include $(TOPDIR)/rules.mk
+
+PKG_NAME:=perl-file-listing
+PKG_VERSION:=6.04
+PKG_RELEASE:=1
+
+PKG_SOURCE_URL:=http://www.cpan.org/authors/id/G/GA/GAAS
+PKG_SOURCE:=File-Listing-$(PKG_VERSION).tar.gz
+PKG_MD5SUM:=83f636b477741f3a014585bb9cc079a6
+
+PKG_LICENSE:=GPL-1.0+ Artistic-1.0-Perl
+PKG_MAINTAINER:=Marcel Denia <naoir@gmx.net>
+
+PKG_BUILD_DIR:=$(BUILD_DIR)/perl/File-Listing-$(PKG_VERSION)
+
+include $(INCLUDE_DIR)/package.mk
+include ../perl/perlmod.mk
+
+define Package/perl-file-listing
+  SUBMENU:=Perl
+  SECTION:=lang
+  CATEGORY:=Languages
+  TITLE:=Parse directory listing
+  URL:=http://search.cpan.org/dist/File-Listing/
+  DEPENDS:=perl +perl-http-date +perlbase-essential
+endef
+
+define Build/Configure
+        $(call perlmod/Configure,,)
+endef
+
+define Build/Compile
+        $(call perlmod/Compile,,)
+endef
+
+define Package/perl-file-listing/install
+        $(call perlmod/Install,$(1),File auto/File)
+endef
+
+
+$(eval $(call BuildPackage,perl-file-listing))
diff --git a/lang/perl-html-form/Makefile b/lang/perl-html-form/Makefile
new file mode 100644 (file)
index 0000000..d412a1f
--- /dev/null
@@ -0,0 +1,48 @@
+#
+# Copyright (C) 2015 OpenWrt.org
+#
+# This is free software, licensed under the GNU General Public License v2.
+# See /LICENSE for more information.
+#
+
+include $(TOPDIR)/rules.mk
+
+PKG_NAME:=perl-html-form
+PKG_VERSION:=6.03
+PKG_RELEASE:=1
+
+PKG_SOURCE_URL:=http://www.cpan.org/authors/id/G/GA/GAAS
+PKG_SOURCE:=HTML-Form-$(PKG_VERSION).tar.gz
+PKG_MD5SUM:=fa6c2680207ed4fef5ea2ef09c210614
+
+PKG_LICENSE:=GPL-1.0+ Artistic-1.0-Perl
+PKG_MAINTAINER:=Marcel Denia <naoir@gmx.net>
+
+PKG_BUILD_DIR:=$(BUILD_DIR)/perl/HTML-Form-$(PKG_VERSION)
+
+include $(INCLUDE_DIR)/package.mk
+include ../perl/perlmod.mk
+
+define Package/perl-html-form
+  SUBMENU:=Perl
+  SECTION:=lang
+  CATEGORY:=Languages
+  TITLE:=Class that represents an HTML form element
+  URL:=http://search.cpan.org/dist/HTML-Form/
+  DEPENDS:=perl +perl-html-parser +perl-http-message +perl-uri +perlbase-encode +perlbase-essential
+endef
+
+define Build/Configure
+        $(call perlmod/Configure,,)
+endef
+
+define Build/Compile
+        $(call perlmod/Compile,,)
+endef
+
+define Package/perl-html-form/install
+        $(call perlmod/Install,$(1),HTML auto/HTML)
+endef
+
+
+$(eval $(call BuildPackage,perl-html-form))
index d1c86af6183da03249bac92885db05d7b44be638..c248a615c1ce23aef50660abb93920710f082a3d 100644 (file)
@@ -9,7 +9,7 @@ include $(TOPDIR)/rules.mk
 
 PKG_NAME:=perl-html-parser
 PKG_VERSION:=3.71
-PKG_RELEASE:=3
+PKG_RELEASE:=4
 
 PKG_SOURCE_URL:=http://www.cpan.org/authors/id/G/GA/GAAS/
 PKG_SOURCE:=HTML-Parser-$(PKG_VERSION).tar.gz
@@ -29,7 +29,7 @@ define Package/perl-html-parser
   CATEGORY:=Languages
   TITLE:=A collection of modules that parse HTML text documents
   URL:=http://search.cpan.org/dist/HTML-Parser/
-  DEPENDS:=perl +perl-html-tagset +perl-uri
+  DEPENDS:=perl +perl-html-tagset +perlbase-essential +perlbase-xsloader
 endef
 
 define Build/Configure
index d7b0b0c83b861c304b0b4cb54e6353873d03c63e..4bcd10c714d9ac0c467927bcea4cf3afed4640b5 100644 (file)
@@ -9,7 +9,7 @@ include $(TOPDIR)/rules.mk
 
 PKG_NAME:=perl-html-tagset
 PKG_VERSION:=3.20
-PKG_RELEASE:=2
+PKG_RELEASE:=3
 
 PKG_SOURCE_URL:=http://www.cpan.org/authors/id/P/PE/PETDANCE/
 PKG_SOURCE:=HTML-Tagset-$(PKG_VERSION).tar.gz
@@ -29,7 +29,7 @@ define Package/perl-html-tagset
   CATEGORY:=Languages
   TITLE:=Data tables pertaining to HTML
   URL:=http://search.cpan.org/dist/HTML-Tagset/
-  DEPENDS:=perl
+  DEPENDS:=perl +perlbase-essential
 endef
 
 define Build/Configure
index 942e3bf224012ace93b3b5a705f0a9eea773b494..d1b4ac9ac4eeab2f07c2395525e5fed36cd3c168 100644 (file)
@@ -9,7 +9,7 @@ include $(TOPDIR)/rules.mk
 
 PKG_NAME:=perl-html-tree
 PKG_VERSION:=3.23
-PKG_RELEASE:=3
+PKG_RELEASE:=4
 PKG_MD5SUM:=6352f50be402301f79b580dd235d7762
 
 PKG_SOURCE_URL:=http://www.cpan.org/authors/id/P/PE/PETEK/
@@ -28,9 +28,9 @@ define Package/perl-html-tree
   SUBMENU:=Perl
   SECTION:=lang
   CATEGORY:=Languages
-  TITLE:=represent and create HTML syntax trees
+  TITLE:=Represent and create HTML syntax trees
   URL:=http://search.cpan.org/dist/HTML-Tree/
-  DEPENDS:=perl +perl-html-parser +perl-html-tagset
+  DEPENDS:=perl +perl-html-parser +perl-html-tagset +perlbase-essential +perlbase-integer
 endef
 
 define Build/Configure
diff --git a/lang/perl-http-cookies/Makefile b/lang/perl-http-cookies/Makefile
new file mode 100644 (file)
index 0000000..329767a
--- /dev/null
@@ -0,0 +1,48 @@
+#
+# Copyright (C) 2015 OpenWrt.org
+#
+# This is free software, licensed under the GNU General Public License v2.
+# See /LICENSE for more information.
+#
+
+include $(TOPDIR)/rules.mk
+
+PKG_NAME:=perl-http-cookies
+PKG_VERSION:=6.01
+PKG_RELEASE:=1
+
+PKG_SOURCE_URL:=http://www.cpan.org/authors/id/G/GA/GAAS
+PKG_SOURCE:=HTTP-Cookies-$(PKG_VERSION).tar.gz
+PKG_MD5SUM:=ecfd0eeb88512033352c2f13c9580f03
+
+PKG_LICENSE:=GPL-1.0+ Artistic-1.0-Perl
+PKG_MAINTAINER:=Marcel Denia <naoir@gmx.net>
+
+PKG_BUILD_DIR:=$(BUILD_DIR)/perl/HTTP-Cookies-$(PKG_VERSION)
+
+include $(INCLUDE_DIR)/package.mk
+include ../perl/perlmod.mk
+
+define Package/perl-http-cookies
+  SUBMENU:=Perl
+  SECTION:=lang
+  CATEGORY:=Languages
+  TITLE:=HTTP cookie jars
+  URL:=http://search.cpan.org/dist/HTTP-Cookies/
+  DEPENDS:=perl +perl-http-date +perl-http-message +perlbase-essential +perlbase-time
+endef
+
+define Build/Configure
+        $(call perlmod/Configure,,)
+endef
+
+define Build/Compile
+        $(call perlmod/Compile,,)
+endef
+
+define Package/perl-http-cookies/install
+        $(call perlmod/Install,$(1),HTTP auto/HTTP)
+endef
+
+
+$(eval $(call BuildPackage,perl-http-cookies))
diff --git a/lang/perl-http-daemon/Makefile b/lang/perl-http-daemon/Makefile
new file mode 100644 (file)
index 0000000..178573d
--- /dev/null
@@ -0,0 +1,48 @@
+#
+# Copyright (C) 2015 OpenWrt.org
+#
+# This is free software, licensed under the GNU General Public License v2.
+# See /LICENSE for more information.
+#
+
+include $(TOPDIR)/rules.mk
+
+PKG_NAME:=perl-http-daemon
+PKG_VERSION:=6.01
+PKG_RELEASE:=1
+
+PKG_SOURCE_URL:=http://www.cpan.org/authors/id/G/GA/GAAS
+PKG_SOURCE:=HTTP-Daemon-$(PKG_VERSION).tar.gz
+PKG_MD5SUM:=ed0ae02d25d7f1e89456d4d69732adc2
+
+PKG_LICENSE:=GPL-1.0+ Artistic-1.0-Perl
+PKG_MAINTAINER:=Marcel Denia <naoir@gmx.net>
+
+PKG_BUILD_DIR:=$(BUILD_DIR)/perl/HTTP-Daemon-$(PKG_VERSION)
+
+include $(INCLUDE_DIR)/package.mk
+include ../perl/perlmod.mk
+
+define Package/perl-http-daemon
+  SUBMENU:=Perl
+  SECTION:=lang
+  CATEGORY:=Languages
+  TITLE:=A simple http server class
+  URL:=http://search.cpan.org/dist/HTTP-Daemon/
+  DEPENDS:=perl +perl-http-date +perl-http-message +perl-lwp-mediatypes +perlbase-essential +perlbase-io +perlbase-sys
+endef
+
+define Build/Configure
+        $(call perlmod/Configure,,)
+endef
+
+define Build/Compile
+        $(call perlmod/Compile,,)
+endef
+
+define Package/perl-http-daemon/install
+        $(call perlmod/Install,$(1),HTTP auto/HTTP)
+endef
+
+
+$(eval $(call BuildPackage,perl-http-daemon))
diff --git a/lang/perl-http-date/Makefile b/lang/perl-http-date/Makefile
new file mode 100644 (file)
index 0000000..bf0bd40
--- /dev/null
@@ -0,0 +1,48 @@
+#
+# Copyright (C) 2015 OpenWrt.org
+#
+# This is free software, licensed under the GNU General Public License v2.
+# See /LICENSE for more information.
+#
+
+include $(TOPDIR)/rules.mk
+
+PKG_NAME:=perl-http-date
+PKG_VERSION:=6.02
+PKG_RELEASE:=1
+
+PKG_SOURCE_URL:=http://www.cpan.org/authors/id/G/GA/GAAS
+PKG_SOURCE:=HTTP-Date-$(PKG_VERSION).tar.gz
+PKG_MD5SUM:=52b7a0d5982d61be1edb217751d7daba
+
+PKG_LICENSE:=GPL-1.0+ Artistic-1.0-Perl
+PKG_MAINTAINER:=Marcel Denia <naoir@gmx.net>
+
+PKG_BUILD_DIR:=$(BUILD_DIR)/perl/HTTP-Date-$(PKG_VERSION)
+
+include $(INCLUDE_DIR)/package.mk
+include ../perl/perlmod.mk
+
+define Package/perl-http-date
+  SUBMENU:=Perl
+  SECTION:=lang
+  CATEGORY:=Languages
+  TITLE:=Date conversion routines
+  URL:=http://search.cpan.org/dist/HTTP-Date/
+  DEPENDS:=perl +perlbase-essential +perlbase-time
+endef
+
+define Build/Configure
+        $(call perlmod/Configure,,)
+endef
+
+define Build/Compile
+        $(call perlmod/Compile,,)
+endef
+
+define Package/perl-http-date/install
+        $(call perlmod/Install,$(1),HTTP auto/HTTP)
+endef
+
+
+$(eval $(call BuildPackage,perl-http-date))
diff --git a/lang/perl-http-message/Makefile b/lang/perl-http-message/Makefile
new file mode 100644 (file)
index 0000000..ecbb31f
--- /dev/null
@@ -0,0 +1,48 @@
+#
+# Copyright (C) 2015 OpenWrt.org
+#
+# This is free software, licensed under the GNU General Public License v2.
+# See /LICENSE for more information.
+#
+
+include $(TOPDIR)/rules.mk
+
+PKG_NAME:=perl-http-message
+PKG_VERSION:=6.06
+PKG_RELEASE:=1
+
+PKG_SOURCE_URL:=http://www.cpan.org/authors/id/G/GA/GAAS
+PKG_SOURCE:=HTTP-Message-$(PKG_VERSION).tar.gz
+PKG_MD5SUM:=e563ac516e28d33f65bc0f295f625f85
+
+PKG_LICENSE:=GPL-1.0+ Artistic-1.0-Perl
+PKG_MAINTAINER:=Marcel Denia <naoir@gmx.net>
+
+PKG_BUILD_DIR:=$(BUILD_DIR)/perl/HTTP-Message-$(PKG_VERSION)
+
+include $(INCLUDE_DIR)/package.mk
+include ../perl/perlmod.mk
+
+define Package/perl-http-message
+  SUBMENU:=Perl
+  SECTION:=lang
+  CATEGORY:=Languages
+  TITLE:=HTTP style messages
+  URL:=http://search.cpan.org/dist/HTTP-Message/
+  DEPENDS:=perl +perl-encode-locale +perl-http-date +perl-io-html +perl-lwp-mediatypes +perl-uri +perlbase-compress +perlbase-encode +perlbase-essential +perlbase-io +perlbase-mime
+endef
+
+define Build/Configure
+        $(call perlmod/Configure,,)
+endef
+
+define Build/Compile
+        $(call perlmod/Compile,,)
+endef
+
+define Package/perl-http-message/install
+        $(call perlmod/Install,$(1),HTTP auto/HTTP)
+endef
+
+
+$(eval $(call BuildPackage,perl-http-message))
diff --git a/lang/perl-http-negotiate/Makefile b/lang/perl-http-negotiate/Makefile
new file mode 100644 (file)
index 0000000..a72893a
--- /dev/null
@@ -0,0 +1,48 @@
+#
+# Copyright (C) 2015 OpenWrt.org
+#
+# This is free software, licensed under the GNU General Public License v2.
+# See /LICENSE for more information.
+#
+
+include $(TOPDIR)/rules.mk
+
+PKG_NAME:=perl-http-negotiate
+PKG_VERSION:=6.01
+PKG_RELEASE:=1
+
+PKG_SOURCE_URL:=http://www.cpan.org/authors/id/G/GA/GAAS
+PKG_SOURCE:=HTTP-Negotiate-$(PKG_VERSION).tar.gz
+PKG_MD5SUM:=1236195250e264d7436e7bb02031671b
+
+PKG_LICENSE:=GPL-1.0+ Artistic-1.0-Perl
+PKG_MAINTAINER:=Marcel Denia <naoir@gmx.net>
+
+PKG_BUILD_DIR:=$(BUILD_DIR)/perl/HTTP-Negotiate-$(PKG_VERSION)
+
+include $(INCLUDE_DIR)/package.mk
+include ../perl/perlmod.mk
+
+define Package/perl-http-negotiate
+  SUBMENU:=Perl
+  SECTION:=lang
+  CATEGORY:=Languages
+  TITLE:=Choose a variant to serve
+  URL:=http://search.cpan.org/dist/HTTP-Negotiate/
+  DEPENDS:=perl +perl-http-message +perlbase-essential
+endef
+
+define Build/Configure
+        $(call perlmod/Configure,,)
+endef
+
+define Build/Compile
+        $(call perlmod/Compile,,)
+endef
+
+define Package/perl-http-negotiate/install
+        $(call perlmod/Install,$(1),HTTP auto/HTTP)
+endef
+
+
+$(eval $(call BuildPackage,perl-http-negotiate))
diff --git a/lang/perl-http-server-simple/Makefile b/lang/perl-http-server-simple/Makefile
new file mode 100644 (file)
index 0000000..a967138
--- /dev/null
@@ -0,0 +1,48 @@
+#
+# Copyright (C) 2015 OpenWrt.org
+#
+# This is free software, licensed under the GNU General Public License v2.
+# See /LICENSE for more information.
+#
+
+include $(TOPDIR)/rules.mk
+
+PKG_NAME:=perl-http-server-simple
+PKG_VERSION:=0.50
+PKG_RELEASE:=1
+
+PKG_SOURCE_URL:=http://www.cpan.org/authors/id/F/FA/FALCONE
+PKG_SOURCE:=HTTP-Server-Simple-$(PKG_VERSION).tar.gz
+PKG_MD5SUM:=09704b016bc276ca78df6ad4a7d36af6
+
+PKG_LICENSE:=GPL-1.0+ Artistic-1.0-Perl
+PKG_MAINTAINER:=Marcel Denia <naoir@gmx.net>
+
+PKG_BUILD_DIR:=$(BUILD_DIR)/perl/HTTP-Server-Simple-$(PKG_VERSION)
+
+include $(INCLUDE_DIR)/package.mk
+include ../perl/perlmod.mk
+
+define Package/perl-http-server-simple
+  SUBMENU:=Perl
+  SECTION:=lang
+  CATEGORY:=Languages
+  TITLE:=Lightweight HTTP server
+  URL:=http://search.cpan.org/dist/HTTP-Server-Simple/
+  DEPENDS:=perl +perl-cgi +perlbase-base +perlbase-essential +perlbase-filehandle +perlbase-socket +perlbase-test
+endef
+
+define Build/Configure
+        $(call perlmod/Configure,,)
+endef
+
+define Build/Compile
+        $(call perlmod/Compile,,)
+endef
+
+define Package/perl-http-server-simple/install
+        $(call perlmod/Install,$(1),HTTP auto/HTTP)
+endef
+
+
+$(eval $(call BuildPackage,perl-http-server-simple))
diff --git a/lang/perl-io-html/Makefile b/lang/perl-io-html/Makefile
new file mode 100644 (file)
index 0000000..9390c36
--- /dev/null
@@ -0,0 +1,48 @@
+#
+# Copyright (C) 2015 OpenWrt.org
+#
+# This is free software, licensed under the GNU General Public License v2.
+# See /LICENSE for more information.
+#
+
+include $(TOPDIR)/rules.mk
+
+PKG_NAME:=perl-io-html
+PKG_VERSION:=1.001
+PKG_RELEASE:=1
+
+PKG_SOURCE_URL:=http://www.cpan.org/authors/id/C/CJ/CJM
+PKG_SOURCE:=IO-HTML-$(PKG_VERSION).tar.gz
+PKG_MD5SUM:=3f8958718844dc96b9f6946f21d70d22
+
+PKG_LICENSE:=GPL-1.0+ Artistic-1.0-Perl
+PKG_MAINTAINER:=Marcel Denia <naoir@gmx.net>
+
+PKG_BUILD_DIR:=$(BUILD_DIR)/perl/IO-HTML-$(PKG_VERSION)
+
+include $(INCLUDE_DIR)/package.mk
+include ../perl/perlmod.mk
+
+define Package/perl-io-html
+  SUBMENU:=Perl
+  SECTION:=lang
+  CATEGORY:=Languages
+  TITLE:=Open an HTML file with automatic charset detection
+  URL:=http://search.cpan.org/dist/IO-HTML/
+  DEPENDS:=perl +perlbase-encode +perlbase-essential
+endef
+
+define Build/Configure
+        $(call perlmod/Configure,,)
+endef
+
+define Build/Compile
+        $(call perlmod/Compile,,)
+endef
+
+define Package/perl-io-html/install
+        $(call perlmod/Install,$(1),IO auto/IO)
+endef
+
+
+$(eval $(call BuildPackage,perl-io-html))
index 97e3c568ab22e386c1157ec87023f8f664b458d2..b81e678d1dadd272d28315e1f1632a6fe19abc69 100644 (file)
@@ -9,7 +9,7 @@ include $(TOPDIR)/rules.mk
 
 PKG_NAME:=perl-lockfile-simple
 PKG_VERSION:=0.208
-PKG_RELEASE:=2
+PKG_RELEASE:=3
 
 PKG_SOURCE_URL:=http://www.cpan.org/authors/id/S/SC/SCHWIGON/lockfile-simple/
 PKG_SOURCE:=LockFile-Simple-$(PKG_VERSION).tar.gz
@@ -29,7 +29,7 @@ define Package/perl-lockfile-simple
   CATEGORY:=Languages
   TITLE:=Simple advisory file locking
   URL:=http://search.cpan.org/dist/LockFile-Simple/
-  DEPENDS:=perl
+  DEPENDS:=perl +perlbase-essential +perlbase-sys
 endef
 
 define Build/Configure
diff --git a/lang/perl-lwp-mediatypes/Makefile b/lang/perl-lwp-mediatypes/Makefile
new file mode 100644 (file)
index 0000000..6985431
--- /dev/null
@@ -0,0 +1,48 @@
+#
+# Copyright (C) 2015 OpenWrt.org
+#
+# This is free software, licensed under the GNU General Public License v2.
+# See /LICENSE for more information.
+#
+
+include $(TOPDIR)/rules.mk
+
+PKG_NAME:=perl-lwp-mediatypes
+PKG_VERSION:=6.02
+PKG_RELEASE:=1
+
+PKG_SOURCE_URL:=http://www.cpan.org/authors/id/G/GA/GAAS
+PKG_SOURCE:=LWP-MediaTypes-$(PKG_VERSION).tar.gz
+PKG_MD5SUM:=8c5f25fb64b974d22aff424476ba13c9
+
+PKG_LICENSE:=GPL-1.0+ Artistic-1.0-Perl
+PKG_MAINTAINER:=Marcel Denia <naoir@gmx.net>
+
+PKG_BUILD_DIR:=$(BUILD_DIR)/perl/LWP-MediaTypes-$(PKG_VERSION)
+
+include $(INCLUDE_DIR)/package.mk
+include ../perl/perlmod.mk
+
+define Package/perl-lwp-mediatypes
+  SUBMENU:=Perl
+  SECTION:=lang
+  CATEGORY:=Languages
+  TITLE:=Guess media type for a file or a URL
+  URL:=http://search.cpan.org/dist/LWP-MediaTypes/
+  DEPENDS:=perl +perlbase-essential
+endef
+
+define Build/Configure
+        $(call perlmod/Configure,,)
+endef
+
+define Build/Compile
+        $(call perlmod/Compile,,)
+endef
+
+define Package/perl-lwp-mediatypes/install
+        $(call perlmod/Install,$(1),LWP auto/LWP)
+endef
+
+
+$(eval $(call BuildPackage,perl-lwp-mediatypes))
diff --git a/lang/perl-net-http/Makefile b/lang/perl-net-http/Makefile
new file mode 100644 (file)
index 0000000..058ac16
--- /dev/null
@@ -0,0 +1,48 @@
+#
+# Copyright (C) 2015 OpenWrt.org
+#
+# This is free software, licensed under the GNU General Public License v2.
+# See /LICENSE for more information.
+#
+
+include $(TOPDIR)/rules.mk
+
+PKG_NAME:=perl-net-http
+PKG_VERSION:=6.09
+PKG_RELEASE:=1
+
+PKG_SOURCE_URL:=http://www.cpan.org/authors/id/E/ET/ETHER
+PKG_SOURCE:=Net-HTTP-$(PKG_VERSION).tar.gz
+PKG_MD5SUM:=3d84d17f64c7316d69e7eb7b4e292b9a
+
+PKG_LICENSE:=GPL-1.0+ Artistic-1.0-Perl
+PKG_MAINTAINER:=Marcel Denia <naoir@gmx.net>
+
+PKG_BUILD_DIR:=$(BUILD_DIR)/perl/Net-HTTP-$(PKG_VERSION)
+
+include $(INCLUDE_DIR)/package.mk
+include ../perl/perlmod.mk
+
+define Package/perl-net-http
+  SUBMENU:=Perl
+  SECTION:=lang
+  CATEGORY:=Languages
+  TITLE:=Low-level HTTP connection (client)
+  URL:=http://search.cpan.org/dist/Net-HTTP/
+  DEPENDS:=perl +perl-uri +perlbase-compress +perlbase-essential +perlbase-io
+endef
+
+define Build/Configure
+        $(call perlmod/Configure,,)
+endef
+
+define Build/Compile
+        $(call perlmod/Compile,,)
+endef
+
+define Package/perl-net-http/install
+        $(call perlmod/Install,$(1),Net auto/Net)
+endef
+
+
+$(eval $(call BuildPackage,perl-net-http))
index f1823fc92165f566c9596416dfa05e6d26dd125b..c915064997790befba05c8197908a5325d79c418 100644 (file)
@@ -9,7 +9,7 @@ include $(TOPDIR)/rules.mk
 
 PKG_NAME:=perl-net-telnet
 PKG_VERSION:=3.04
-PKG_RELEASE:=2
+PKG_RELEASE:=3
 
 PKG_SOURCE_URL:=http://www.cpan.org/authors/id/J/JR/JROGERS/
 PKG_SOURCE:=Net-Telnet-$(PKG_VERSION).tar.gz
@@ -29,7 +29,7 @@ define Package/perl-net-telnet
   CATEGORY:=Languages
   TITLE:=Telnet client
   URL:=http://search.cpan.org/dist/Net-Telnet/
-  DEPENDS:=perl
+  DEPENDS:=perl +perlbase-essential +perlbase-socket +perlbase-symbol
 endef
 
 define Build/Configure
diff --git a/lang/perl-sub-uplevel/Makefile b/lang/perl-sub-uplevel/Makefile
new file mode 100644 (file)
index 0000000..266bce4
--- /dev/null
@@ -0,0 +1,48 @@
+#
+# Copyright (C) 2015 OpenWrt.org
+#
+# This is free software, licensed under the GNU General Public License v2.
+# See /LICENSE for more information.
+#
+
+include $(TOPDIR)/rules.mk
+
+PKG_NAME:=perl-sub-uplevel
+PKG_VERSION:=0.25
+PKG_RELEASE:=1
+
+PKG_SOURCE_URL:=http://www.cpan.org/authors/id/D/DA/DAGOLDEN
+PKG_SOURCE:=Sub-Uplevel-$(PKG_VERSION).tar.gz
+PKG_MD5SUM:=5d0752dbfa94d0c91b25a264f47f5675
+
+PKG_LICENSE:=GPL-1.0+ Artistic-1.0-Perl
+PKG_MAINTAINER:=Marcel Denia <naoir@gmx.net>
+
+PKG_BUILD_DIR:=$(BUILD_DIR)/perl/Sub-Uplevel-$(PKG_VERSION)
+
+include $(INCLUDE_DIR)/package.mk
+include ../perl/perlmod.mk
+
+define Package/perl-sub-uplevel
+  SUBMENU:=Perl
+  SECTION:=lang
+  CATEGORY:=Languages
+  TITLE:=Apparently run a function in a higher stack frame
+  URL:=http://search.cpan.org/dist/Sub-Uplevel/
+  DEPENDS:=perl +perlbase-essential
+endef
+
+define Build/Configure
+        $(call perlmod/Configure,,)
+endef
+
+define Build/Compile
+        $(call perlmod/Compile,,)
+endef
+
+define Package/perl-sub-uplevel/install
+        $(call perlmod/Install,$(1),Sub auto/Sub)
+endef
+
+
+$(eval $(call BuildPackage,perl-sub-uplevel))
index aa08dec9465a51f22536df8df3e1050e4d7e98c4..fd2b4f63482d94480669db2067bc97212581a0ce 100644 (file)
@@ -9,7 +9,7 @@ include $(TOPDIR)/rules.mk
 
 PKG_NAME:=perl-test-harness
 PKG_VERSION:=3.35
-PKG_RELEASE:=2
+PKG_RELEASE:=3
 
 PKG_SOURCE_URL:=http://www.cpan.org/authors/id/L/LE/LEONT/
 PKG_SOURCE:=Test-Harness-$(PKG_VERSION).tar.gz
@@ -29,7 +29,7 @@ define Package/perl-test-harness
   CATEGORY:=Languages
   TITLE:=Perl Test Harness
   URL:=http://search.cpan.org/dist/Test-Harness/
-  DEPENDS:=perl
+  DEPENDS:=perl +perlbase-base +perlbase-benchmark +perlbase-config +perlbase-essential +perlbase-file +perlbase-getopt +perlbase-io +perlbase-posix +perlbase-text
 endef
 
 define Build/Configure
diff --git a/lang/perl-test-warn/Makefile b/lang/perl-test-warn/Makefile
new file mode 100644 (file)
index 0000000..995e1ba
--- /dev/null
@@ -0,0 +1,48 @@
+#
+# Copyright (C) 2015 OpenWrt.org
+#
+# This is free software, licensed under the GNU General Public License v2.
+# See /LICENSE for more information.
+#
+
+include $(TOPDIR)/rules.mk
+
+PKG_NAME:=perl-test-warn
+PKG_VERSION:=0.30
+PKG_RELEASE:=1
+
+PKG_SOURCE_URL:=http://www.cpan.org/authors/id/C/CH/CHORNY
+PKG_SOURCE:=Test-Warn-$(PKG_VERSION).tar.gz
+PKG_MD5SUM:=8306b998a96d2cc69266b5248d550472
+
+PKG_LICENSE:=GPL-1.0+ Artistic-1.0-Perl
+PKG_MAINTAINER:=Marcel Denia <naoir@gmx.net>
+
+PKG_BUILD_DIR:=$(BUILD_DIR)/perl/Test-Warn-$(PKG_VERSION)
+
+include $(INCLUDE_DIR)/package.mk
+include ../perl/perlmod.mk
+
+define Package/perl-test-warn
+  SUBMENU:=Perl
+  SECTION:=lang
+  CATEGORY:=Languages
+  TITLE:=Perl extension to test methods for warnings
+  URL:=http://search.cpan.org/dist/Test-Warn/
+  DEPENDS:=perl +perl-sub-uplevel +perlbase-essential +perlbase-test
+endef
+
+define Build/Configure
+        $(call perlmod/Configure,,)
+endef
+
+define Build/Compile
+        $(call perlmod/Compile,,)
+endef
+
+define Package/perl-test-warn/install
+        $(call perlmod/Install,$(1),Test auto/Test)
+endef
+
+
+$(eval $(call BuildPackage,perl-test-warn))
index df46d5292a7fa63781faa25b7f22236e75eb2604..3508d903c0b93c5c11d7ebc7d6ca10049645c5fd 100644 (file)
@@ -8,12 +8,12 @@
 include $(TOPDIR)/rules.mk
 
 PKG_NAME:=perl-uri
-PKG_VERSION:=1.67
-PKG_RELEASE:=2
+PKG_VERSION:=1.68
+PKG_RELEASE:=1
 
 PKG_SOURCE_URL:=http://www.cpan.org/authors/id/E/ET/ETHER/
 PKG_SOURCE:=URI-$(PKG_VERSION).tar.gz
-PKG_MD5SUM:=d0ef53b6c63bcc02ba55f405c30741e3
+PKG_MD5SUM:=4a954ab8d79f831616ca817ba4b26cb9
 
 PKG_LICENSE:=GPL-1.0+ Artistic-1.0-Perl
 PKG_MAINTAINER:=Marcel Denia <naoir@gmx.net>
@@ -29,7 +29,7 @@ define Package/perl-uri
   CATEGORY:=Languages
   TITLE:=Manipulates and accesses URI strings
   URL:=http://search.cpan.org/dist/URI/
-  DEPENDS:=perl
+  DEPENDS:=perl +perlbase-essential +perlbase-integer +perlbase-mime +perlbase-scalar +perlbase-utf8
 endef
 
 define Build/Configure
index 3eaa3d01ccd699858d438382f74bd268dfb674f5..1e424cbb07b05d11fec589eb39f7c3c7a3bc047d 100644 (file)
@@ -9,7 +9,7 @@ include $(TOPDIR)/rules.mk
 
 PKG_NAME:=perl-www-curl
 PKG_VERSION:=4.17
-PKG_RELEASE:=3
+PKG_RELEASE:=4
 
 PKG_SOURCE_URL:=http://www.cpan.org/authors/id/S/SZ/SZBALINT/
 PKG_SOURCE:=WWW-Curl-$(PKG_VERSION).tar.gz
@@ -30,7 +30,7 @@ define Package/perl-www-curl
   CATEGORY:=Languages
   TITLE:=Perl bindings to libcurl
   URL:=http://search.cpan.org/dist/WWW-Curl/
-  DEPENDS:=perl +libcurl
+  DEPENDS:=perl +libcurl +perlbase-essential +perlbase-xsloader
 endef
 
 define Build/Configure
index 9fb1fcb22f52792351577d4a68796ac3aee5af75..93d6be21b5bcd3388efa28b2a13082f43b429fbd 100644 (file)
@@ -8,12 +8,12 @@
 include $(TOPDIR)/rules.mk
 
 PKG_NAME:=perl-www-mechanize
-PKG_VERSION:=1.74
-PKG_RELEASE:=2
+PKG_VERSION:=1.75
+PKG_RELEASE:=1
 
 PKG_SOURCE:=WWW-Mechanize-$(PKG_VERSION).tar.gz
 PKG_SOURCE_URL:=http://www.cpan.org/authors/id/E/ET/ETHER/
-PKG_MD5SUM:=8ec615225037ac66a2d37f4e9693ef86
+PKG_MD5SUM:=9a4b9c8827f519908ef0a0d2b8ae96fa
 
 PKG_LICENSE:=GPL-1.0+ Artistic-1.0-Perl
 PKG_MAINTAINER:=Marcel Denia <naoir@gmx.net>
@@ -29,7 +29,7 @@ define Package/perl-www-mechanize
   CATEGORY:=Languages
   TITLE:=Perl WWW Mechanize
   URL:=http://search.cpan.org/dist/WWW-Mechanize/
-  DEPENDS:=perl +perl-www
+  DEPENDS:=perl +perl-cgi +perl-html-form +perl-html-parser +perl-html-tree +perl-http-daemon +perl-http-message +perl-http-server-simple +perl-test-warn +perl-uri +perl-www +perlbase-base +perlbase-essential +perlbase-file +perlbase-findbin +perlbase-getopt +perlbase-pod +perlbase-test
 endef
 
 define Build/Configure
diff --git a/lang/perl-www-robotrules/Makefile b/lang/perl-www-robotrules/Makefile
new file mode 100644 (file)
index 0000000..c28b8c2
--- /dev/null
@@ -0,0 +1,48 @@
+#
+# Copyright (C) 2015 OpenWrt.org
+#
+# This is free software, licensed under the GNU General Public License v2.
+# See /LICENSE for more information.
+#
+
+include $(TOPDIR)/rules.mk
+
+PKG_NAME:=perl-www-robotrules
+PKG_VERSION:=6.02
+PKG_RELEASE:=1
+
+PKG_SOURCE_URL:=http://www.cpan.org/authors/id/G/GA/GAAS
+PKG_SOURCE:=WWW-RobotRules-$(PKG_VERSION).tar.gz
+PKG_MD5SUM:=b7186e8b8b3701e70c22abf430742403
+
+PKG_LICENSE:=GPL-1.0+ Artistic-1.0-Perl
+PKG_MAINTAINER:=Marcel Denia <naoir@gmx.net>
+
+PKG_BUILD_DIR:=$(BUILD_DIR)/perl/WWW-RobotRules-$(PKG_VERSION)
+
+include $(INCLUDE_DIR)/package.mk
+include ../perl/perlmod.mk
+
+define Package/perl-www-robotrules
+  SUBMENU:=Perl
+  SECTION:=lang
+  CATEGORY:=Languages
+  TITLE:=database of robots.txt-derived permissions
+  URL:=http://search.cpan.org/dist/WWW-RobotRules/
+  DEPENDS:=perl +perl-uri +perlbase-anydbm-file +perlbase-essential +perlbase-fcntl
+endef
+
+define Build/Configure
+        $(call perlmod/Configure,,)
+endef
+
+define Build/Compile
+        $(call perlmod/Compile,,)
+endef
+
+define Package/perl-www-robotrules/install
+        $(call perlmod/Install,$(1),WWW auto/WWW)
+endef
+
+
+$(eval $(call BuildPackage,perl-www-robotrules))
index acd9e9b9fdf7ea9928707691b7a1c583944de49f..6bb7c653934abcff231f8e33a28eb561e12693a9 100644 (file)
@@ -1,5 +1,5 @@
 #
-# Copyright (C) 2013-2014 OpenWrt.org
+# Copyright (C) 2013-2015 OpenWrt.org
 #
 # This is free software, licensed under the GNU General Public License v2.
 # See /LICENSE for more information.
@@ -8,12 +8,12 @@
 include $(TOPDIR)/rules.mk
 
 PKG_NAME:=perl-www
-PKG_VERSION:=5.837
-PKG_RELEASE:=3
+PKG_VERSION:=6.13
+PKG_RELEASE:=1
 
-PKG_SOURCE_URL:=http://www.cpan.org/authors/id/G/GA/GAAS/
+PKG_SOURCE_URL:=http://www.cpan.org/authors/id/E/ET/ETHER/
 PKG_SOURCE:=libwww-perl-$(PKG_VERSION).tar.gz
-PKG_MD5SUM:=9bbf1bce482b0bac98bb4f04253c03d0
+PKG_MD5SUM:=85b36bcd2fd2450718ee14f894f0d3d1
 
 PKG_LICENSE:=GPL-1.0+ Artistic-1.0-Perl
 PKG_MAINTAINER:=Marcel Denia <naoir@gmx.net>
@@ -29,7 +29,7 @@ define Package/perl-www
   CATEGORY:=Languages
   TITLE:=WWW client/server library for Perl (aka LWP)
   URL:=http://search.cpan.org/dist/libwww-perl/
-  DEPENDS:=perl +perl-html-parser +perl-html-tagset +perl-uri
+  DEPENDS:=perl +perl-encode-locale +perl-file-listing +perl-html-parser +perl-http-cookies +perl-http-daemon +perl-http-date +perl-http-message +perl-http-negotiate +perl-lwp-mediatypes +perl-net-http +perl-uri +perl-www-robotrules +perlbase-base +perlbase-digest +perlbase-encode +perlbase-essential +perlbase-io +perlbase-mime +perlbase-net
 endef
 
 define Build/Configure
@@ -41,7 +41,7 @@ define Build/Compile
 endef
 
 define Package/perl-www/install
-       $(call perlmod/Install,$(1),File HTML HTTP LWP LWP.pm Net WWW)
+       $(call perlmod/Install,$(1),LWP.pm auto/LWP LWP)
 endef
 
 
diff --git a/lang/perl-www/patches/010-lwp-https-call-verify-hostname-when-avail.patch b/lang/perl-www/patches/010-lwp-https-call-verify-hostname-when-avail.patch
deleted file mode 100644 (file)
index 9166e89..0000000
+++ /dev/null
@@ -1,41 +0,0 @@
-commit 3b266f17ccd5613a9c42d1e04118e94ca6467489
-Author: Gisle Aas <gisle@aas.no>
-Date:   Sun Jan 16 12:56:30 2011 +0100
-
-    Call IO::Socket::SSL's verify_hostname when available
-
---- a/lib/LWP/Protocol/https.pm
-+++ b/lib/LWP/Protocol/https.pm
-@@ -14,6 +14,15 @@ sub socket_type
- sub _check_sock
- {
-     my($self, $req, $sock) = @_;
-+    if ($sock->can("verify_hostname")) {
-+      if (!$sock->verify_hostname($req->uri->host, "www")) {
-+          my $subject = $sock->peer_certificate("subject");
-+          die "SSL-peer fails verification [subject=$subject]\n";
-+      }
-+      else {
-+          $req->{ssl_sock_verified}++;
-+      }
-+    }
-     my $check = $req->header("If-SSL-Cert-Subject");
-     if (defined $check) {
-       my $cert = $sock->get_peer_certificate ||
-@@ -36,9 +45,14 @@ sub _get_sock_info
-       $res->header("Client-SSL-Cert-Subject" => $cert->subject_name);
-       $res->header("Client-SSL-Cert-Issuer" => $cert->issuer_name);
-     }
--    if(! eval { $sock->get_peer_verify }) {
--       $res->header("Client-SSL-Warning" => "Peer certificate not verified");
-+    if (!$res->request->{ssl_sock_verified}) {
-+      if(! eval { $sock->get_peer_verify }) {
-+          my $msg = "Peer certificate not verified";
-+          $msg .= " [$@]" if $@;
-+          $res->header("Client-SSL-Warning" => $msg);
-+      }
-     }
-+    $res->header("Client-SSL-Socket-Class" => $Net::HTTPS::SSL_SOCKET_CLASS);
- }
- #-----------------------------------------------------------
diff --git a/lang/perl-www/patches/020-lwp-https-verify-hostnames-by-default.patch b/lang/perl-www/patches/020-lwp-https-verify-hostnames-by-default.patch
deleted file mode 100644 (file)
index 465010e..0000000
+++ /dev/null
@@ -1,113 +0,0 @@
-commit 62dd58188d8f8987d24bd84951813a54a8bf5987
-Author: Gisle Aas <gisle@aas.no>
-Date:   Mon Jan 24 23:19:59 2011 +0100
-
-    Default to verifying hostnames when using SSL
-
---- a/lib/LWP/Protocol/https.pm
-+++ b/lib/LWP/Protocol/https.pm
-@@ -11,18 +11,30 @@ sub socket_type
-     return "https";
- }
--sub _check_sock
-+sub _extra_sock_opts
- {
--    my($self, $req, $sock) = @_;
--    if ($sock->can("verify_hostname")) {
--      if (!$sock->verify_hostname($req->uri->host, "www")) {
--          my $subject = $sock->peer_certificate("subject");
--          die "SSL-peer fails verification [subject=$subject]\n";
--      }
--      else {
--          $req->{ssl_sock_verified}++;
-+    my $self = shift;
-+    my %ssl_opts = %{$self->{ua}{ssl_opts} || {}};
-+    unless (exists $ssl_opts{SSL_verify_mode}) {
-+      $ssl_opts{SSL_verify_mode} = 1;
-+    }
-+    if (delete $ssl_opts{verify_hostname}) {
-+      $ssl_opts{SSL_verify_mode} ||= 1;
-+      $ssl_opts{SSL_verifycn_scheme} = 'www';
-+    }
-+    if ($ssl_opts{SSL_verify_mode}) {
-+      unless (exists $ssl_opts{SSL_ca_file} || exists $ssl_opts{SSL_ca_path}) {
-+          require Mozilla::CA;
-+          $ssl_opts{SSL_ca_file} = Mozilla::CA::SSL_ca_file();
-       }
-     }
-+    $self->{ssl_opts} = \%ssl_opts;
-+    return (%ssl_opts, $self->SUPER::_extra_sock_opts);
-+}
-+
-+sub _check_sock
-+{
-+    my($self, $req, $sock) = @_;
-     my $check = $req->header("If-SSL-Cert-Subject");
-     if (defined $check) {
-       my $cert = $sock->get_peer_certificate ||
-@@ -45,12 +57,11 @@ sub _get_sock_info
-       $res->header("Client-SSL-Cert-Subject" => $cert->subject_name);
-       $res->header("Client-SSL-Cert-Issuer" => $cert->issuer_name);
-     }
--    if (!$res->request->{ssl_sock_verified}) {
--      if(! eval { $sock->get_peer_verify }) {
--          my $msg = "Peer certificate not verified";
--          $msg .= " [$@]" if $@;
--          $res->header("Client-SSL-Warning" => $msg);
--      }
-+    if (!$self->{ssl_opts}{SSL_verify_mode}) {
-+      $res->push_header("Client-SSL-Warning" => "Peer certificate not verified");
-+    }
-+    elsif (!$self->{ssl_opts}{SSL_verifycn_scheme}) {
-+      $res->push_header("Client-SSL-Warning" => "Peer hostname match with certificate not verified");
-     }
-     $res->header("Client-SSL-Socket-Class" => $Net::HTTPS::SSL_SOCKET_CLASS);
- }
---- a/lib/LWP/UserAgent.pm
-+++ b/lib/LWP/UserAgent.pm
-@@ -41,6 +41,7 @@ sub new
-     my $timeout = delete $cnf{timeout};
-     $timeout = 3*60 unless defined $timeout;
-     my $local_address = delete $cnf{local_address};
-+    my $ssl_opts = delete $cnf{ssl_opts};
-     my $use_eval = delete $cnf{use_eval};
-     $use_eval = 1 unless defined $use_eval;
-     my $parse_head = delete $cnf{parse_head};
-@@ -83,6 +84,7 @@ sub new
-                     def_headers  => $def_headers,
-                     timeout      => $timeout,
-                     local_address => $local_address,
-+                    ssl_opts     => { $ssl_opts ? %$ssl_opts  : (verify_hostname => 1) },
-                     use_eval     => $use_eval,
-                       show_progress=> $show_progress,
-                     max_size     => $max_size,
-@@ -582,6 +584,20 @@ sub max_size     { shift->_elem('max_siz
- sub max_redirect { shift->_elem('max_redirect', @_); }
- sub show_progress{ shift->_elem('show_progress', @_); }
-+sub ssl_opts {
-+    my $self = shift;
-+    if (@_ == 1) {
-+      my $k = shift;
-+      return $self->{ssl_opts}{$k};
-+    }
-+    if (@_) {
-+      %{$self->{ssl_opts}} = (%{$self->{ssl_opts}}, @_);
-+    }
-+    else {
-+      return keys %{$self->{ssl_opts}};
-+    }
-+}
-+
- sub parse_head {
-     my $self = shift;
-     if (@_) {
-@@ -1040,6 +1056,7 @@ The following options correspond to attr
-    cookie_jar              undef
-    default_headers         HTTP::Headers->new
-    local_address           undef
-+   ssl_opts              { verify_hostname => 1 }
-    max_size                undef
-    max_redirect            7
-    parse_head              1
diff --git a/lang/python-pyserial/Makefile b/lang/python-pyserial/Makefile
new file mode 100644 (file)
index 0000000..ba28e10
--- /dev/null
@@ -0,0 +1,50 @@
+#
+# Copyright (C) 2015 OpenWrt.org
+#
+# This is free software, licensed under the GNU General Public License v2.
+# See /LICENSE for more information.
+#
+
+include $(TOPDIR)/rules.mk
+
+PKG_NAME:=python-pyserial
+PKG_VERSION:=2.7
+PKG_RELEASE:=1
+PKG_MAINTAINER:=Micke Prag <micke.prag@telldus.se>
+PKG_LICENSE:=Python-2.0
+
+PKG_SOURCE:=pyserial-$(PKG_VERSION).tar.gz
+PKG_SOURCE_URL:=http://pypi.python.org/packages/source/p/pyserial/
+PKG_MD5SUM:=794506184df83ef2290de0d18803dd11
+
+PKG_BUILD_DIR:=$(BUILD_DIR)/pyserial-$(PKG_VERSION)
+PKG_BUILD_DEPENDS:=python
+
+include $(INCLUDE_DIR)/package.mk
+$(call include_mk, python-package.mk)
+
+define Package/python-pyserial
+  SUBMENU:=Python
+  SECTION:=lang
+  CATEGORY:=Languages
+  TITLE:=python-pyserial
+  URL:=http://pyserial.sourceforge.net
+  DEPENDS:=+python-light
+endef
+
+define Package/python-pyserial/description
+       serial port python bindings
+endef
+
+define Build/Compile
+       $(call Build/Compile/PyMod,,install --prefix="$(PKG_INSTALL_DIR)/usr")
+endef
+
+define Package/python-pyserial/install
+       $(INSTALL_DIR) $(1)$(PYTHON_PKG_DIR)
+       $(CP) \
+           $(PKG_INSTALL_DIR)$(PYTHON_PKG_DIR)/* \
+           $(1)$(PYTHON_PKG_DIR)
+endef
+
+$(eval $(call BuildPackage,python-pyserial))
index 133bab0d9e5311c9a116a84c5f018d132103e5a7..0caa92ba255864d7ebe9c52b91dab71bde7e16dc 100644 (file)
@@ -12,7 +12,7 @@ include ./files/python-package.mk
 
 PKG_NAME:=python
 PKG_VERSION:=$(PYTHON_VERSION).$(PYTHON_VERSION_MICRO)
-PKG_RELEASE:=5
+PKG_RELEASE:=6
 
 PKG_SOURCE:=Python-$(PKG_VERSION).tar.xz
 PKG_SOURCE_URL:=http://www.python.org/ftp/python/$(PKG_VERSION)
index 52d52b94e88b1175d40f30211c1244d7ec4e70d7..01aa924ab76f3c0e451e27b4f91b0d4e86ae4421 100644 (file)
@@ -1,12 +1,14 @@
 diff --git a/setup.py b/setup.py
-index 7868b7b..9ae0ef2 100644
+index 1d1ae72..511aed5 100644
 --- a/setup.py
 +++ b/setup.py
-@@ -444,7 +444,6 @@ class PyBuildExt(build_ext):
+@@ -444,7 +444,8 @@ class PyBuildExt(build_ext):
              add_dir_to_list(self.compiler.include_dirs, '/usr/local/include')
          if cross_compiling:
              self.add_gcc_paths()
 -        self.add_multiarch_paths()
++        else:
++            self.add_multiarch_paths()
  
          # Add paths specified in the environment variables LDFLAGS and
          # CPPFLAGS for header and library files.
index b9d29aab229be70cd87345139268abc57f878533..e68f415fbf1480c1c932caf843af7753a28ddbcb 100644 (file)
@@ -14,7 +14,7 @@ PYTHON_VERSION:=$(PYTHON3_VERSION)
 PYTHON_VERSION_MICRO:=$(PYTHON3_VERSION_MICRO)
 
 PKG_NAME:=python3
-PKG_RELEASE:=2
+PKG_RELEASE:=3
 PKG_VERSION:=$(PYTHON_VERSION).$(PYTHON_VERSION_MICRO)
 
 PKG_SOURCE:=Python-$(PKG_VERSION).tar.xz
diff --git a/lang/python3/patches/012-disable-wcsftime-detection.patch b/lang/python3/patches/012-disable-wcsftime-detection.patch
new file mode 100644 (file)
index 0000000..55a383c
--- /dev/null
@@ -0,0 +1,13 @@
+diff --git a/configure b/configure
+index 274af7e..85bbf0e 100755
+--- a/configure
++++ b/configure
+@@ -10555,7 +10555,7 @@ for ac_func in alarm accept4 setitimer getitimer bind_textdomain_codeset chown \
+  sigtimedwait sigwait sigwaitinfo snprintf strftime strlcpy symlinkat sync \
+  sysconf tcgetpgrp tcsetpgrp tempnam timegm times tmpfile tmpnam tmpnam_r \
+  truncate uname unlinkat unsetenv utimensat utimes waitid waitpid wait3 wait4 \
+- wcscoll wcsftime wcsxfrm wmemcmp writev _getpty
++ wcscoll wcsxfrm wmemcmp writev _getpty
+ do :
+   as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh`
+ ac_fn_c_check_func "$LINENO" "$ac_func" "$as_ac_var"
diff --git a/libs/alsa-lib/patches/005-fix_include_file_redirect_warnings.patch b/libs/alsa-lib/patches/005-fix_include_file_redirect_warnings.patch
new file mode 100644 (file)
index 0000000..8230c02
--- /dev/null
@@ -0,0 +1,142 @@
+--- a/src/seq/seq.c
++++ b/src/seq/seq.c
+@@ -777,7 +777,7 @@ void event_filter(snd_seq_t *seq, snd_se
+ */
+-#include <sys/poll.h>
++#include <poll.h>
+ #include "seq_local.h"
+ /****************************************************************************
+--- a/aserver/aserver.c
++++ b/aserver/aserver.c
+@@ -20,7 +20,7 @@
+ #include <sys/shm.h>
+ #include <sys/socket.h>
+-#include <sys/poll.h>
++#include <poll.h>
+ #include <sys/un.h>
+ #include <sys/uio.h>
+ #include <stdio.h>
+--- a/include/asoundlib-head.h
++++ b/include/asoundlib-head.h
+@@ -35,6 +35,6 @@
+ #include <string.h>
+ #include <fcntl.h>
+ #include <assert.h>
+-#include <sys/poll.h>
++#include <poll.h>
+ #include <errno.h>
+ #include <stdarg.h>
+--- a/include/asoundlib.h
++++ b/include/asoundlib.h
+@@ -35,7 +35,7 @@
+ #include <string.h>
+ #include <fcntl.h>
+ #include <assert.h>
+-#include <sys/poll.h>
++#include <poll.h>
+ #include <errno.h>
+ #include <stdarg.h>
+ #include <endian.h>
+--- a/include/local.h
++++ b/include/local.h
+@@ -47,7 +47,7 @@
+ #error Header defining endianness not defined
+ #endif
+ #include <stdarg.h>
+-#include <sys/poll.h>
++#include <poll.h>
+ #include <sys/types.h>
+ #include <errno.h>
+ #include <linux/types.h>
+--- a/src/control/control.c
++++ b/src/control/control.c
+@@ -48,7 +48,7 @@ and IEC958 structure.
+ #include <string.h>
+ #include <fcntl.h>
+ #include <signal.h>
+-#include <sys/poll.h>
++#include <poll.h>
+ #include "control_local.h"
+ /**
+--- a/src/control/control_shm.c
++++ b/src/control/control_shm.c
+@@ -27,7 +27,7 @@
+ #include <fcntl.h>
+ #include <sys/shm.h>
+ #include <sys/socket.h>
+-#include <sys/poll.h>
++#include <poll.h>
+ #include <sys/un.h>
+ #include <sys/uio.h>
+ #include <sys/mman.h>
+--- a/src/pcm/pcm.c
++++ b/src/pcm/pcm.c
+@@ -634,7 +634,7 @@ playback devices.
+ #include <stdarg.h>
+ #include <signal.h>
+ #include <ctype.h>
+-#include <sys/poll.h>
++#include <poll.h>
+ #include <sys/shm.h>
+ #include <sys/mman.h>
+ #include <limits.h>
+--- a/src/pcm/pcm_direct.c
++++ b/src/pcm/pcm_direct.c
+@@ -30,7 +30,7 @@
+ #include <grp.h>
+ #include <sys/ioctl.h>
+ #include <sys/mman.h>
+-#include <sys/poll.h>
++#include <poll.h>
+ #include <sys/shm.h>
+ #include <sys/sem.h>
+ #include <sys/wait.h>
+--- a/src/pcm/pcm_mmap.c
++++ b/src/pcm/pcm_mmap.c
+@@ -21,7 +21,7 @@
+ #include <stdio.h>
+ #include <malloc.h>
+ #include <string.h>
+-#include <sys/poll.h>
++#include <poll.h>
+ #include <sys/mman.h>
+ #include <sys/shm.h>
+ #include "pcm_local.h"
+--- a/src/pcm/pcm_share.c
++++ b/src/pcm/pcm_share.c
+@@ -34,7 +34,7 @@
+ #include <signal.h>
+ #include <math.h>
+ #include <sys/socket.h>
+-#include <sys/poll.h>
++#include <poll.h>
+ #include <sys/shm.h>
+ #include <pthread.h>
+ #include "pcm_local.h"
+--- a/src/pcm/pcm_shm.c
++++ b/src/pcm/pcm_shm.c
+@@ -36,7 +36,7 @@
+ #include <sys/ioctl.h>
+ #include <sys/shm.h>
+ #include <sys/socket.h>
+-#include <sys/poll.h>
++#include <poll.h>
+ #include <sys/un.h>
+ #include <sys/mman.h>
+ #include <netinet/in.h>
+--- a/src/shmarea.c
++++ b/src/shmarea.c
+@@ -22,7 +22,7 @@
+ #include <malloc.h>
+ #include <string.h>
+ #include <errno.h>
+-#include <sys/poll.h>
++#include <poll.h>
+ #include <sys/mman.h>
+ #include <sys/shm.h>
+ #include "list.h"
index b54ea1e84ccd3cf7f839fdd40c3f374ccdfd29ed..ef0f31f0238e83c9b4ee3ca10f46e0c543141094 100644 (file)
@@ -226,16 +226,9 @@ define Build/InstallDev
                $(1)/usr/include/boost/ \
                # copies _all_ header files - independent of <--with-library>-argument above
 
-       if [ -d $(PKG_INSTALL_DIR)/lib ]; then \
-               $(INSTALL_DIR) \
-                       $(1)/usr/lib; \
-               $(CP) \
-                       $(PKG_INSTALL_DIR)/lib/*.a \
-                       $(1)/usr/lib/; \
-               $(CP) \
-                       $(PKG_INSTALL_DIR)/lib/*.so* \
-                       $(1)/usr/lib/; \
-       fi
+       $(INSTALL_DIR) $(1)/usr/lib
+       -$(CP) $(PKG_INSTALL_DIR)/lib/*.a $(1)/usr/lib/
+       -$(CP) $(PKG_INSTALL_DIR)/lib/*.so* $(1)/usr/lib/
 endef
 
 define Host/Install
index 8d716af9fa3713726d58d199374700643d00977b..472caa87413773e9b2200806dd704d4ff0102e7f 100644 (file)
@@ -8,13 +8,13 @@
 include $(TOPDIR)/rules.mk
 
 PKG_NAME:=gnutls
-PKG_VERSION:=3.4.2
+PKG_VERSION:=3.4.3
 PKG_RELEASE:=1
 PKG_USE_MIPS16:=0
 
 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.xz
 PKG_SOURCE_URL:=ftp://ftp.gnutls.org/gcrypt/gnutls/v3.4
-PKG_MD5SUM:=4fb4a6253e09aa070e6c467cbb51ba33
+PKG_MD5SUM:=8a119d7830b81a44faa721a6fde2a295
 #PKG_FIXUP:=autoreconf gettext-version
 PKG_MAINTAINER:=Nikos Mavrogiannopoulos <nmav@gnutls.org>
 PKG_LICENSE:=LGPLv2.1+
index 2fe243331f6b068dbc7594595a5656dac5a845b5..c3d2ddc2f9d113b1f3ca57e4f781d9264bdceb8e 100644 (file)
@@ -8,12 +8,12 @@
 include $(TOPDIR)/rules.mk
 
 PKG_NAME:=libevdev
-PKG_VERSION:=1.4.2
+PKG_VERSION:=1.4.3
 PKG_RELEASE:=1
 
 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.xz
 PKG_SOURCE_URL:=http://www.freedesktop.org/software/libevdev/
-PKG_MD5SUM:=debfcd5153558eba25a8e71eb2534ae8
+PKG_MD5SUM:=2fc170e2d6f543ba26e7c79f95dc1935
 
 PKG_LICENSE:=MIT
 PKG_LICENSE_FILES:=COPYING
index b92e392409626a7762c0b528a4722fab2a6fe811..99f4803cb63c9a44f6a9ed947edab4d5128450f7 100644 (file)
@@ -8,12 +8,12 @@
 include $(TOPDIR)/rules.mk
 
 PKG_NAME:=libidn
-PKG_VERSION:=1.30
+PKG_VERSION:=1.31
 PKG_RELEASE:=1
 
 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
 PKG_SOURCE_URL:=@GNU/libidn
-PKG_MD5SUM:=b17edc8551cd31cc5f14c82a9dabf58e
+PKG_MD5SUM:=83806230fc0989a24cf9dfe6685563d9
 
 PKG_LICENSE:=GPL-2.0+ GPL-3.0+ LGPL-2.1+ LGPL-3.0+ Apache-2.0
 PKG_LICENSE_FILES:=COPYING COPYINGv2 COPYINGv3 COPYING.LESSERv2 COPYING.LESSERv3 java/LICENSE-2.0.txt
index f03e1dbecc6eb646e823b8ca1d127cb15c61e78b..26da26366440a7b62b3d2bb4c43039a144b5977e 100644 (file)
@@ -8,12 +8,12 @@
 include $(TOPDIR)/rules.mk
 
 PKG_NAME:=libinput
-PKG_VERSION:=0.17.0
+PKG_VERSION:=0.18.0
 PKG_RELEASE:=1
 
 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.xz
 PKG_SOURCE_URL:=http://www.freedesktop.org/software/libinput/
-# PKG_MD5SUM:=debfcd5153558eba25a8e71eb2534ae8
+PKG_MD5SUM:=0ddbb0d53d58dec0a86de6791560011a
 
 PKG_LICENSE:=MIT
 PKG_LICENSE_FILES:=COPYING
index a9d7e750824028d844ba636e0439c3f4c00c7fcb..a7911633733d00d6338390cf6a3c9bc9568cb8b2 100644 (file)
@@ -9,7 +9,7 @@ include $(TOPDIR)/rules.mk
 
 PKG_NAME:=libnet
 PKG_VERSION:=1.2-rc3
-PKG_RELEASE:=2
+PKG_RELEASE:=3
 
 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
 PKG_SOURCE_URL:=http://sourceforge.net/projects/libnet-dev/files/
index fcb4188a01ba8a9d947f4df99909552e64459512..b95366a07cfc66e6ccb2e7dc171ddcbd6b935621 100644 (file)
@@ -1,11 +1,16 @@
 --- a/src/libnet_link_linux.c
 +++ b/src/libnet_link_linux.c
-@@ -30,7 +30,7 @@
+@@ -30,13 +30,8 @@
  #include <sys/time.h>
  
  #include <net/if.h>
 -#if (__GLIBC__)
-+#if (!__UCLIBC__)
  #include <netinet/if_ether.h>
  #include <net/if_arp.h>
- #else
+-#else
+-#include <linux/if_arp.h>
+-#include <linux/if_ether.h>
+-#endif
+ #if (HAVE_PACKET_SOCKET)
+ #ifndef SOL_PACKET
index 4497f389cf2991b8166c29abe3a7b6208cd75458..7951f63efa1f57b7859acb1e1cca47825349b00a 100644 (file)
@@ -1,5 +1,5 @@
 #
-# Copyright (C) 2014 OpenWrt.org
+# Copyright (C) 2015 OpenWrt.org
 #
 # This is free software, licensed under the GNU General Public License v2.
 # See /LICENSE for more information.
@@ -8,12 +8,12 @@
 include $(TOPDIR)/rules.mk
 
 PKG_NAME:=libssh2
-PKG_VERSION:=1.4.3
-PKG_RELEASE:=2
+PKG_VERSION:=1.6.0
+PKG_RELEASE:=1
 
 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
 PKG_SOURCE_URL:=http://www.libssh2.org/download
-PKG_MD5SUM:=071004c60c5d6f90354ad1b701013a0b
+PKG_MD5SUM:=00aabd6e714a5f42a4fb82ace20db1dd
 
 PKG_INSTALL:=1
 
index 1abd5fc778b390f77651858c8286a77af47d09ce..98ebb341dfc866a7dfd17fd125b83e68603d6f73 100644 (file)
@@ -8,9 +8,9 @@
 include $(TOPDIR)/rules.mk
 
 PKG_NAME:=libunistring
-PKG_VERSION:=0.9.5
+PKG_VERSION:=0.9.6
 PKG_RELEASE:=1
-PKG_MD5SUM:=1a705bcdcb83799d544137617b377cfd
+PKG_MD5SUM:=dfae4ff5583649ed24d8f368f1d0543b
 
 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
 PKG_SOURCE_URL:=http://ftp.gnu.org/gnu/libunistring
index 74cff413bbe6d29a5f72fc0c98053fd88998f594..9c5a4e2c71b95144a2c933655c2de315007b0628 100644 (file)
@@ -1,5 +1,5 @@
 #
-# Copyright (C) 2006-2014 OpenWrt.org
+# Copyright (C) 2006-2015 OpenWrt.org
 #
 # This is free software, licensed under the GNU General Public License v2.
 # See /LICENSE for more information.
@@ -8,9 +8,9 @@
 include $(TOPDIR)/rules.mk
 
 PKG_NAME:=mxml
-PKG_VERSION:=2.8
+PKG_VERSION:=2.9
 PKG_RELEASE:=1
-PKG_MD5SUM:=d85ee6d30de053581242c4a86e79a5d2
+PKG_MD5SUM:=e21cad0f7aacd18f942aa0568a8dee19
 
 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
 PKG_SOURCE_URL:=http://www.msweet.org/files/project3/
index dcc9d988a7a7ac3cea73e07eaf12b851625fc14b..e25fc0152f24107efa628a64ce388b23ffeafc66 100644 (file)
@@ -1,5 +1,5 @@
 #
-# Copyright (C) 2006-2012 OpenWrt.org
+# Copyright (C) 2006-2015 OpenWrt.org
 #
 # This is free software, licensed under the GNU General Public License v2.
 # See /LICENSE for more information.
@@ -8,15 +8,15 @@
 include $(TOPDIR)/rules.mk
 
 PKG_NAME:=openldap
-PKG_VERSION:=2.4.39
-PKG_RELEASE:=2
+PKG_VERSION:=2.4.41
+PKG_RELEASE:=1
 
 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tgz
 PKG_SOURCE_URL:=ftp://ftp.openldap.org/pub/OpenLDAP/openldap-release/ \
        ftp://sunsite.cnlab-switch.ch/mirror/OpenLDAP/openldap-release/ \
        ftp://ftp.nl.uu.net/pub/unix/db/openldap/openldap-release/ \
        ftp://ftp.plig.org/pub/OpenLDAP/openldap-release/
-PKG_MD5SUM:=b0d5ee4b252c841dec6b332d679cf943
+PKG_MD5SUM:=3f1a4cea52827e18feaedfdc1634b5d0
 
 PKG_FIXUP:=autoreconf
 
index 6e07e6854cc8c4b49454eb7da10a66b0db3de134..54d7737e1cce9b8d7884daf47e4bd69d8593f471 100644 (file)
@@ -9,7 +9,7 @@ include $(TOPDIR)/rules.mk
 
 PKG_NAME:=pthsem
 PKG_VERSION:=2.0.8
-PKG_RELEASE:=3
+PKG_RELEASE:=4
 
 PKG_MAINTAINER:=Othmar Truniger <github@truniger.ch>
 PKG_LICENSE:=LGPL-2.1+
@@ -21,6 +21,7 @@ PKG_MD5SUM:=9144b26dcc27e67498d63dd5456f934c
 
 PKG_FIXUP:=autoreconf
 PKG_BUILD_PARALLEL:=1
+PKG_FORTIFY_SOURCE:=0
 PKG_INSTALL:=1
 
 include $(INCLUDE_DIR)/package.mk
@@ -37,6 +38,13 @@ define Package/pthsem/description
   pthsem is an extend version, with support for semaphores added. It can be installed parallel to a normal pth.
 endef
 
+# The musl libc provides a proper implementation of sigaltstack() so
+# prevent configure from wrongly assuming a broken Linux platform
+ifeq ($(CONFIG_USE_MUSL),y)
+  CONFIGURE_VARS += \
+       ac_cv_check_sjlj=ssjlj
+endif
+
 define Build/InstallDev
        $(INSTALL_DIR) $(1)/usr/bin
        $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/pthsem-config $(1)/usr/bin/
index dd845815a2b20cc8a397be0d0694e6269e08590d..ab07dc1e1478d5b6653d79c0b7a28fafb60179d5 100644 (file)
@@ -18,9 +18,9 @@ PKG_LICENSE_FILES:=LICENCE.txt
 
 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
 PKG_SOURCE_URL:= http://download.zeromq.org
-PKG_MD5SUM:=73c39f5eb01b9d7eaf74a5d899f1d03d
+PKG_MD5SUM:=0a4b44aa085644f25c177f79dc13f253
 
-PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)-$(PKG_VERSION)
+PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)-$(BUILD_VARIANT)/$(PKG_NAME)-$(PKG_VERSION)
 PKG_BUILD_DEPENDS:=libuuid
 
 PKG_FIXUP:=autoreconf
@@ -31,26 +31,34 @@ PKG_INSTALL:=1
 include $(INCLUDE_DIR)/uclibc++.mk
 include $(INCLUDE_DIR)/package.mk
 
-define Package/libzmq
+define Package/libzmq/default
   TITLE:=ZeroMQ - Message Queue engine
   URL:=http://www.zeromq.org/
   SECTION:=libs
   CATEGORY:=Libraries
-  DEPENDS:=+libuuid +libpthread +librt +PACKAGE_libsodium:libsodium $(CXX_DEPENDS)
-  MENU:=1
+  DEPENDS:=+libuuid +libpthread +librt $(CXX_DEPENDS)
+  PROVIDES:=libzmq
 endef
 
-define Package/libzmq/config
- config LIBZMQ_CURVEZMQ
-       bool "Include support for CurveZMQ security"
-       depends on PACKAGE_libzmq
-       default y
-       select PACKAGE_libsodium
+define Package/libzmq-nc
+  $(call Package/libzmq/default)
+  VARIANT:=nc
 endef
 
-define Package/libzmq/description
+define Package/libzmq-curve
+  $(call Package/libzmq/default)
+  VARIANT:=curve
+  TITLE+= (CurveZMQ)
+  DEPENDS+=+libsodium 
+endef
+
+define Package/libzmq-nc/description
  This package contains the ZeroMQ messaging engine shared library.
- CurveZMQ security protocols are optional using libsodium.
+endef
+
+define Package/libzmq-curve/description
+ $(call Package/libzmq-nc/description)
+ Includes CurveZMQ security by libsodium.
 endef
 
 # add extra configure flags here
@@ -58,15 +66,12 @@ CONFIGURE_ARGS += \
        --enable-static \
        --enable-shared
 
-ifneq ($(CONFIG_PACKAGE_libsodium),)
+ifeq ($(BUILD_VARIANT),curve)
   CONFIGURE_ARGS+= --with-libsodium
 else
   CONFIGURE_ARGS+= --without-libsodium
 endif
 
-# add make variable overrides here
-MAKE_FLAGS +=
-
 define Build/InstallDev
        $(INSTALL_DIR) $(1)/usr/include
        $(CP) $(PKG_INSTALL_DIR)/usr/include/zmq.h $(1)/usr/include
@@ -77,9 +82,12 @@ define Build/InstallDev
        $(CP) $(PKG_INSTALL_DIR)/usr/lib/pkgconfig/libzmq.pc $(1)/usr/lib/pkgconfig/
 endef
 
-define Package/libzmq/install
+define Package/libzmq-nc/install
        $(INSTALL_DIR) $(1)/usr/lib
        $(CP) $(PKG_INSTALL_DIR)/usr/lib/libzmq.so.* $(1)/usr/lib/
 endef
 
-$(eval $(call BuildPackage,libzmq))
+Package/libzmq-curve/install=$(Package/libzmq-nc/install)
+
+$(eval $(call BuildPackage,libzmq-nc))
+$(eval $(call BuildPackage,libzmq-curve))
diff --git a/libs/zmq/patches/010-disable_pedantic_on_linux_with_ulibc++.patch b/libs/zmq/patches/010-disable_pedantic_on_linux_with_ulibc++.patch
new file mode 100644 (file)
index 0000000..74e673c
--- /dev/null
@@ -0,0 +1,14 @@
+--- a/configure.ac
++++ b/configure.ac
+@@ -147,8 +147,10 @@ case "${host_os}" in
+     *linux*)
+         # Define on Linux to enable all library features. Define if using a gnu compiler
+         if test "x$GXX" = "xyes"; then
+-            CPPFLAGS="-D_GNU_SOURCE $CPPFLAGS"
++            CPPFLAGS="-D_GNU_SOURCE $CPPFLAGS -Wno-long-long"
+         fi
++        libzmq_pedantic="no"
++        libzmq_werror="no"
+         AC_DEFINE(ZMQ_HAVE_LINUX, 1, [Have Linux OS])
+         libzmq_on_linux="yes"
diff --git a/libs/zmq/patches/020-map_with_const_string_with_ublic++.patch b/libs/zmq/patches/020-map_with_const_string_with_ublic++.patch
new file mode 100644 (file)
index 0000000..121f707
--- /dev/null
@@ -0,0 +1,41 @@
+--- a/src/metadata.hpp
++++ b/src/metadata.hpp
+@@ -31,7 +31,7 @@ namespace zmq
+     {
+         public:
+-            typedef std::map <std::string, const std::string> dict_t;
++            typedef std::map <std::string, std::string> dict_t;
+             metadata_t (const dict_t &dict);
+             virtual ~metadata_t ();
+--- a/src/socket_base.cpp
++++ b/src/socket_base.cpp
+@@ -20,6 +20,7 @@
+ #include <new>
+ #include <string>
+ #include <algorithm>
++#include <ctype.h>
+ #include "platform.hpp"
+--- a/src/stream_engine.cpp
++++ b/src/stream_engine.cpp
+@@ -198,7 +198,7 @@ void zmq::stream_engine_t::plug (io_thre
+             //  Compile metadata.
+             typedef metadata_t::dict_t properties_t;
+             properties_t properties;
+-            properties.insert(std::make_pair("Peer-Address", peer_address));
++            properties.insert(std::make_pair<std::string, std::string>("Peer-Address", peer_address));
+             zmq_assert (metadata == NULL);
+             metadata = new (std::nothrow) metadata_t (properties);
+         }
+@@ -805,7 +805,7 @@ void zmq::stream_engine_t::mechanism_rea
+     //  If we have a peer_address, add it to metadata
+     if (!peer_address.empty()) {
+-        properties.insert(std::make_pair("Peer-Address", peer_address));
++        properties.insert(std::make_pair<std::string, std::string>("Peer-Address", peer_address));
+     }
+     //  Add ZAP properties.
diff --git a/libs/zmq/patches/030-streamoff_missing_with_ulibc++.patch b/libs/zmq/patches/030-streamoff_missing_with_ulibc++.patch
new file mode 100644 (file)
index 0000000..6abd647
--- /dev/null
@@ -0,0 +1,10 @@
+--- a/src/blob.hpp
++++ b/src/blob.hpp
+@@ -21,6 +21,7 @@
+ #define __ZMQ_BLOB_HPP_INCLUDED__
+ #include <string>
++#include <ios>
+ #include <string.h>
+ // Borrowed from id3lib_strings.h:
diff --git a/libs/zmq/patches/100-fix-cxx-include-order.patch b/libs/zmq/patches/100-fix-cxx-include-order.patch
new file mode 100644 (file)
index 0000000..63a21ba
--- /dev/null
@@ -0,0 +1,84 @@
+--- a/src/mtrie.cpp
++++ b/src/mtrie.cpp
+@@ -17,11 +17,11 @@
+     along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ */
+-#include <stdlib.h>
+-
+ #include <new>
+ #include <algorithm>
++#include <stdlib.h>
++
+ #include "platform.hpp"
+ #if defined ZMQ_HAVE_WINDOWS
+ #include "windows.hpp"
+--- a/src/raw_encoder.cpp
++++ b/src/raw_encoder.cpp
+@@ -17,6 +17,11 @@
+     along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ */
++#include <basic_definitions>
++#include <exception>
++#include <cstddef>
++#include <algorithm>
++
+ #include "encoder.hpp"
+ #include "raw_encoder.hpp"
+ #include "likely.hpp"
+--- a/src/trie.cpp
++++ b/src/trie.cpp
+@@ -17,11 +17,11 @@
+     along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ */
+-#include <stdlib.h>
+-
+ #include <new>
+ #include <algorithm>
++#include <stdlib.h>
++
+ #include "platform.hpp"
+ #if defined ZMQ_HAVE_WINDOWS
+ #include "windows.hpp"
+--- a/src/encoder.hpp
++++ b/src/encoder.hpp
+@@ -29,7 +29,6 @@
+ #include <stddef.h>
+ #include <string.h>
+ #include <stdlib.h>
+-#include <algorithm>
+ #include "err.hpp"
+ #include "msg.hpp"
+--- a/src/v1_encoder.cpp
++++ b/src/v1_encoder.cpp
+@@ -17,6 +17,11 @@
+     along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ */
++#include <basic_definitions>
++#include <exception>
++#include <cstddef>
++#include <algorithm>
++
+ #include "encoder.hpp"
+ #include "v1_encoder.hpp"
+ #include "likely.hpp"
+--- a/src/v2_encoder.cpp
++++ b/src/v2_encoder.cpp
+@@ -17,6 +17,11 @@
+     along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ */
++#include <basic_definitions>
++#include <exception>
++#include <cstddef>
++#include <algorithm>
++
+ #include "v2_protocol.hpp"
+ #include "v2_encoder.hpp"
+ #include "likely.hpp"
diff --git a/libs/zmq/patches/disable_pedantic_on_linux_with_ulibc++.patch b/libs/zmq/patches/disable_pedantic_on_linux_with_ulibc++.patch
deleted file mode 100644 (file)
index 74e0091..0000000
+++ /dev/null
@@ -1,14 +0,0 @@
---- a/configure.ac     2014-06-04 10:19:35.140061796 +0800
-+++ b/configure.ac     2014-06-04 11:08:17.231997926 +0800
-@@ -127,8 +127,10 @@
-     *linux*)
-         # Define on Linux to enable all library features. Define if using a gnu compiler
-         if test "x$GXX" = "xyes"; then
--            CPPFLAGS="-D_GNU_SOURCE $CPPFLAGS"
-+            CPPFLAGS="-D_GNU_SOURCE $CPPFLAGS -Wno-long-long"
-         fi
-+        libzmq_pedantic="no"
-+        libzmq_werror="no"
-         AC_DEFINE(ZMQ_HAVE_LINUX, 1, [Have Linux OS])
-         libzmq_on_linux="yes"
diff --git a/libs/zmq/patches/map_with_const_string_with_ublic++.patch b/libs/zmq/patches/map_with_const_string_with_ublic++.patch
deleted file mode 100644 (file)
index c1a14fc..0000000
+++ /dev/null
@@ -1,41 +0,0 @@
---- a/src/metadata.hpp 2015-06-17 21:39:33.629934688 +0800
-+++ b/src/metadata.hpp 2014-10-14 22:07:36.000000000 +0800
-@@ -31,7 +31,7 @@
-     {
-         public:
--            typedef std::map <std::string, const std::string> dict_t;
-+            typedef std::map <std::string, std::string> dict_t;
-             metadata_t (const dict_t &dict);
-             virtual ~metadata_t ();
---- a/src/socket_base.cpp      2015-06-17 21:42:26.289413233 +0800
-+++ b/src/socket_base.cpp      2015-06-02 18:31:00.000000000 +0800
-@@ -20,6 +20,7 @@
- #include <new>
- #include <string>
- #include <algorithm>
-+#include <ctype.h>
- #include "platform.hpp"
---- a/src/stream_engine.cpp    2015-06-17 21:57:29.599443517 +0800
-+++ b/src/stream_engine.cpp    2015-06-02 18:31:00.000000000 +0800
-@@ -198,7 +198,7 @@
-             //  Compile metadata.
-             typedef metadata_t::dict_t properties_t;
-             properties_t properties;
--            properties.insert(std::make_pair("Peer-Address", peer_address));
-+            properties.insert(std::make_pair<std::string, std::string>("Peer-Address", peer_address));
-             zmq_assert (metadata == NULL);
-             metadata = new (std::nothrow) metadata_t (properties);
-         }
-@@ -805,7 +805,7 @@
-     //  If we have a peer_address, add it to metadata
-     if (!peer_address.empty()) {
--        properties.insert(std::make_pair("Peer-Address", peer_address));
-+        properties.insert(std::make_pair<std::string, std::string>("Peer-Address", peer_address));
-     }
-     //  Add ZAP properties.
diff --git a/libs/zmq/patches/streamoff_missing_with_ulibc++.patch b/libs/zmq/patches/streamoff_missing_with_ulibc++.patch
deleted file mode 100644 (file)
index 0d1127b..0000000
+++ /dev/null
@@ -1,10 +0,0 @@
---- a/src/blob.hpp     2014-06-04 10:19:12.680062287 +0800
-+++ b/src/blob.hpp     2014-06-04 10:30:31.168047457 +0800
-@@ -21,6 +21,7 @@
- #define __ZMQ_BLOB_HPP_INCLUDED__
- #include <string>
-+#include <ios>
- #include <string.h>
- // Borrowed from id3lib_strings.h:
diff --git a/multimedia/tvheadend/Config.in b/multimedia/tvheadend/Config.in
new file mode 100644 (file)
index 0000000..61a3774
--- /dev/null
@@ -0,0 +1,17 @@
+config TVHEADEND_CWC_SUPPORT
+       bool "NewCamd support"
+       default y
+
+config TVHEADEND_LINUXDVB_SUPPORT
+       bool "Linux DVB support"
+       default y
+
+config TVHEADEND_DVBSCAN_SUPPORT
+       bool "Fetch DVB-scan data"
+       depends on TVHEADEND_LINUXDVB_SUPPORT
+       default TVHEADEND_LINUXDVB_SUPPORT
+
+config TVHEADEND_AVAHI_SUPPORT
+       bool "Avahi client support"
+       select PACKAGE_libavahi-client
+       default n
diff --git a/multimedia/tvheadend/Makefile b/multimedia/tvheadend/Makefile
new file mode 100644 (file)
index 0000000..3495783
--- /dev/null
@@ -0,0 +1,97 @@
+#
+# Copyright (C) 2015 OpenWrt.org
+#
+# This is free software, licensed under the GNU General Public License v2.
+# See /LICENSE for more information.
+#
+
+include $(TOPDIR)/rules.mk
+
+PKG_NAME:=tvheadend
+PKG_VERSION:=4.0.5
+PKG_RELEASE:=1
+
+PKG_SOURCE_SUBDIR:=$(PKG_NAME)
+PKG_SOURCE_VERSION:=v$(PKG_VERSION)
+PKG_SOURCE:=$(PKG_NAME)-$(PKG_SOURCE_VERSION).tar.gz
+PKG_SOURCE_PROTO:=git
+PKG_SOURCE_URL:=https://github.com/tvheadend/tvheadend.git
+PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)
+
+PKG_LICENSE:=GPL-3.0
+PKG_LICENSE_FILES:=LICENSE.md
+
+PKG_FIXUP:=autoreconf
+
+PKG_USE_MIPS16:=0
+
+include $(INCLUDE_DIR)/package.mk
+include $(INCLUDE_DIR)/nls.mk
+
+define Package/tvheadend
+  SECTION:=multimedia
+  CATEGORY:=Multimedia
+  TITLE:=Tvheadend is a TV streaming server for Linux
+  DEPENDS:=+libopenssl +librt +zlib +TVHEADEND_AVAHI_SUPPORT:libavahi-client
+  URL:=https://tvheadend.org
+  MAINTAINER:=Jan ÄŒermák <jan.cermak@nic.cz>
+endef
+
+define Package/tvheadend/description
+  Tvheadend is a TV streaming server and recorder for Linux, FreeBSD and Android
+  supporting DVB-S, DVB-S2, DVB-C, DVB-T, ATSC, IPTV, SAT>IP and HDHomeRun as input sources.
+
+  Tvheadend offers the HTTP (VLC, MPlayer), HTSP (Kodi, Movian) and SAT>IP streaming.
+endef
+
+define Package/tvheadend/config
+  menu "Configuration"
+  depends on PACKAGE_tvheadend
+  source "$(SOURCE)/Config.in"
+  endmenu
+endef
+
+ifeq ($(CONFIG_TVHEADEND_CWC_SUPPORT),)
+  CONFIGURE_ARGS += --disable-cwc
+endif
+
+ifeq ($(CONFIG_TVHEADEND_LINUXDVB_SUPPORT),)
+  CONFIGURE_ARGS += --disable-linuxdvb
+endif
+
+ifeq ($(CONFIG_TVHEADEND_DVBSCAN_SUPPORT),)
+  CONFIGURE_ARGS += --disable-dvbscan
+endif
+
+ifeq ($(CONFIG_TVHEADEND_AVAHI_SUPPORT),)
+  CONFIGURE_ARGS += --disable-avahi
+else
+  CONFIGURE_ARGS += --enable-avahi
+endif
+
+CONFIGURE_ARGS += \
+       --arch=$(ARCH) \
+       --disable-dbus_1 \
+       --disable-libav \
+       --enable-bundle
+
+define Build/Prepare
+       $(call Build/Prepare/Default)
+       echo 'Tvheadend $(shell echo $(PKG_SOURCE_VERSION) | sed "s/^v//")~openwrt$(PKG_RELEASE)' \
+               > $(PKG_BUILD_DIR)/debian/changelog
+endef
+
+define Package/conffiles
+/etc/config/tvheadend
+endef
+
+define Package/tvheadend/install
+       $(INSTALL_DIR) $(1)/etc/init.d
+       $(INSTALL_BIN) ./files/tvheadend.init $(1)/etc/init.d/tvheadend
+       $(INSTALL_DIR) $(1)/etc/config
+
+       $(INSTALL_DIR) $(1)/usr/bin
+       $(INSTALL_BIN) $(PKG_BUILD_DIR)/build.linux/tvheadend $(1)/usr/bin/
+endef
+
+$(eval $(call BuildPackage,tvheadend))
diff --git a/multimedia/tvheadend/files/tvheadend.config b/multimedia/tvheadend/files/tvheadend.config
new file mode 100644 (file)
index 0000000..62c139d
--- /dev/null
@@ -0,0 +1,13 @@
+#config tvheadend service
+#       option nosyslog '0'
+#       option use_temp_epgdb '0'
+#       option config_path '/etc/tvheadend'
+
+config tvheadend server
+       option ipv6 '1'
+#       option bindaddr '0.0.0.0'
+#       option http_port '9981'
+#       option http_root '/tvheadend'
+#       option htsp_port '9982'
+#       option htsp_port2 '9983'
+#       option xspf '0'
diff --git a/multimedia/tvheadend/files/tvheadend.init b/multimedia/tvheadend/files/tvheadend.init
new file mode 100644 (file)
index 0000000..31702e1
--- /dev/null
@@ -0,0 +1,71 @@
+#!/bin/sh /etc/rc.common
+
+START=99
+STOP=00
+
+USE_PROCD=1
+PROG=/usr/bin/tvheadend
+
+TEMP_CONFIG=/tmp/tvheadend
+PERSISTENT_CONFIG=/etc/tvheadend
+
+execute_first_run() {
+       "$PROG" -c "$1" -B -C -A >/dev/null 2>&1
+}
+
+ensure_config_exists() {
+       local config_path
+
+       config_load tvheadend
+       config_get config_path service config_path
+
+       if [ -z "$config_path" ]; then
+               [ -d "$PERSISTENT_CONFIG" ] || execute_first_run "$PERSISTENT_CONFIG"
+       else
+               # if the configuration directory is empty, empty config with grant-all ACL is created
+               [ -d "$config_path" ] && [ "$(ls -A $config_path)" ] || execute_first_run "$config_path"
+       fi
+
+       # if use_temp_epgdb is enabled (default), most of the config is put to config_path
+       # (or /etc/config), except for epgdb.v2, which grows quite large and is write-heavy,
+       # so it's put into volatile tmpfs
+       # epgdb.v2 is created and symlinked to main config dir upon each start (if it doesn't exist)
+       config_get_bool use_temp_epgdb service use_temp_epgdb 1
+       if [ "$use_temp_epgdb" == "1" ]; then
+               TEMP_EPG="${TEMP_CONFIG}/epgdb.v2"
+               [ ! -f "$TEMP_EPG" ] && mkdir -p "$TEMP_CONFIG" && touch "$TEMP_EPG" && chmod 700 "$TEMP_EPG"
+               [ -z "$config_path" ] && config_path="$PERSISTENT_CONFIG"
+               ln -sf "$TEMP_EPG" "${config_path}/epgdb.v2"
+       fi
+}
+
+load_uci_config() {
+       config_load tvheadend
+       config_get config_path service config_path "$PERSISTENT_CONFIG"
+       [ -n "$config_path" ] && procd_append_param command -c "$config_path"
+       config_get_bool nosyslog service nosyslog 0
+       [ "$nosyslog" -eq 1 ] && procd_append_param command --nosyslog
+       config_get_bool ipv6 server ipv6 0
+       [ "$ipv6" -eq 1 ] && procd_append_param command --ipv6
+       config_get bindaddr server bindaddr
+       [ -n "$bindaddr" ] && procd_append_param command --bindaddr "$bindaddr"
+       config_get http_port server http_port
+       [ -n "$http_port" ] && procd_append_param command --http_port "$http_port"
+       config_get http_root server http_root
+       [ -n "$http_root" ] && procd_append_param command --http_root "$http_root"
+       config_get htsp_port server htsp_port
+       [ -n "$htsp_port" ] && procd_append_param command --htsp_port "$htsp_port"
+       config_get htsp_port2 server htsp_port2
+       [ -n "$htsp_port2" ] && procd_append_param command --htsp_port "$htsp_port2"
+       config_get xspf server xspf 0
+       [ "$xspf" -eq 1 ] && procd_append_param command --xspf
+}
+
+start_service() {
+       ensure_config_exists
+       procd_open_instance
+       procd_set_param file /etc/config/tvheadend
+       procd_set_param command "$PROG" -B
+       load_uci_config
+       procd_close_instance
+}
index 609206324ddb1cb470306565e6f38fe7216ccf56..0725f5934cf9705af24aceda10ed21b44f0974b2 100644 (file)
@@ -1,5 +1,5 @@
 #
-# Copyright (C) 2006-2008 OpenWrt.org
+# Copyright (C) 2006-2015 OpenWrt.org
 #
 # This is free software, licensed under the GNU General Public License v2.
 # See /LICENSE for more information.
@@ -10,7 +10,7 @@ include $(TOPDIR)/rules.mk
 PKG_NAME:=ctorrent-svn
 PKG_REV:=322
 PKG_VERSION:=r$(PKG_REV)
-PKG_RELEASE:=1
+PKG_RELEASE:=2
 
 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
 PKG_SOURCE_URL:=https://svn.code.sf.net/p/dtorrent/code/dtorrent/trunk
diff --git a/net/ctorrent-svn/patches/400-musl-compat.patch b/net/ctorrent-svn/patches/400-musl-compat.patch
new file mode 100644 (file)
index 0000000..e17c147
--- /dev/null
@@ -0,0 +1,10 @@
+--- a/compat.c
++++ b/compat.c
+@@ -51,6 +51,7 @@ int snprintf(char *str, size_t size, con
+ #ifndef HAVE_STRNSTR
+ #include <string.h>
++#include <sys/types.h>
+ /* FUNCTION PROGRAMER: Siberiaic Sang */
+ char *strnstr(const char *haystack, const char *needle, size_t haystacklen)
+ {
index 16504e2a34b24d19311e2b72de5dced30275bd3f..6a8e48189b4a9c35f56e118970e45bf084121491 100644 (file)
@@ -1,5 +1,5 @@
 #
-# Copyright (C) 2006-2008 OpenWrt.org
+# Copyright (C) 2006-2015 OpenWrt.org
 #
 # This is free software, licensed under the GNU General Public License v2.
 # See /LICENSE for more information.
@@ -9,7 +9,7 @@ include $(TOPDIR)/rules.mk
 
 PKG_NAME:=ctorrent
 PKG_VERSION:=dnh3.3.2
-PKG_RELEASE:=6
+PKG_RELEASE:=7
 
 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
 PKG_SOURCE_URL:=@SF/dtorrent \
diff --git a/net/ctorrent/patches/200-musl-compat.patch b/net/ctorrent/patches/200-musl-compat.patch
new file mode 100644 (file)
index 0000000..65cb71e
--- /dev/null
@@ -0,0 +1,10 @@
+--- a/compat.c
++++ b/compat.c
+@@ -63,6 +63,7 @@ int snprintf(char *str, size_t size, con
+ #ifndef HAVE_STRNSTR
+ #include <string.h>
++#include <sys/types.h>
+ /* FUNCTION PROGRAMER: Siberiaic Sang */
+ char *strnstr(const char *haystack, const char *needle, size_t haystacklen)
+ {
index 96de63c22eda34f9271dfd4bb821abae624083ea..f11d26a234772e9fb50976a51b894b8d3daf58ec 100644 (file)
@@ -9,7 +9,7 @@ include $(TOPDIR)/rules.mk
 
 PKG_NAME:=davfs2
 PKG_VERSION:=1.5.2
-PKG_RELEASE:=1
+PKG_RELEASE:=2
 
 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
 PKG_SOURCE_URL:=http://download.savannah.gnu.org/releases/davfs2/
diff --git a/net/davfs2/patches/100-musl-compat.patch b/net/davfs2/patches/100-musl-compat.patch
new file mode 100644 (file)
index 0000000..e819cbc
--- /dev/null
@@ -0,0 +1,194 @@
+--- a/configure.ac
++++ b/configure.ac
+@@ -42,7 +42,7 @@ DAV_CHECK_NEON
+ # Checks for header files.
+ AC_HEADER_DIRENT
+ AC_HEADER_STDC
+-AC_CHECK_HEADERS([fcntl.h libintl.h langinfo.h limits.h locale.h mntent.h stddef.h stdint.h stdlib.h string.h sys/file.h sys/mount.h sys/time.h syslog.h termios.h unistd.h utime.h])
++AC_CHECK_HEADERS([error.h fcntl.h libintl.h langinfo.h limits.h locale.h mntent.h stddef.h stdint.h stdlib.h string.h sys/file.h sys/mount.h sys/time.h sys/select.h sys/types.h syslog.h termios.h unistd.h utime.h])
+ # Checks for typedefs, structures, and compiler characteristics.
+ AC_C_CONST
+@@ -78,7 +78,7 @@ AC_FUNC_SELECT_ARGTYPES
+ AC_FUNC_STRFTIME
+ AC_FUNC_STAT
+ AC_FUNC_UTIME_NULL
+-AC_CHECK_FUNCS([endpwent ftruncate getmntent memset mkdir nl_langinfo rpmatch select setlocale strcasecmp strchr strdup strerror strpbrk strrchr strstr strtol strtoull utime])
++AC_CHECK_FUNCS([endpwent ftruncate getmntent memset mkdir nl_langinfo rpmatch select setlocale strcasecmp strchr strdup strerror strpbrk strrchr strstr strtol strtoull utime canonicalize_file_name fopencookie])
+ # Misc.
+ DAV_DEFAULTS
+--- a/src/cache.c
++++ b/src/cache.c
+@@ -19,12 +19,12 @@
+ #include "config.h"
++#include "compat.h"
+ #ifdef HAVE_DIRENT_H
+ #include <dirent.h>
+ #endif
+ #include <errno.h>
+-#include <error.h>
+ #ifdef HAVE_FCNTL_H
+ #include <fcntl.h>
+ #endif
+--- a/src/dav_fuse.c
++++ b/src/dav_fuse.c
+@@ -47,6 +47,9 @@
+ #ifdef HAVE_SYS_STAT_H
+ #include <sys/stat.h>
+ #endif
++#ifdef HAVE_SYS_SELECT_H
++#include <sys/select.h>
++#endif
+ #include "defaults.h"
+ #include "mount_davfs.h"
+--- a/src/kernel_interface.c
++++ b/src/kernel_interface.c
+@@ -19,8 +19,8 @@
+ #include "config.h"
++#include "compat.h"
+-#include <error.h>
+ #ifdef HAVE_FCNTL_H
+ #include <fcntl.h>
+ #endif
+@@ -51,6 +51,9 @@
+ #ifdef HAVE_SYS_STAT_H
+ #include <sys/stat.h>
+ #endif
++#ifdef HAVE_SYS_TYPES_H
++#include <sys/types.h>
++#endif
+ #include <sys/wait.h>
+ #include "defaults.h"
+--- a/src/mount_davfs.c
++++ b/src/mount_davfs.c
+@@ -19,10 +19,10 @@
+ #include "config.h"
++#include "compat.h"
+ #include <ctype.h>
+ #include <errno.h>
+-#include <error.h>
+ #ifdef HAVE_FCNTL_H
+ #include <fcntl.h>
+ #endif
+--- a/src/umount_davfs.c
++++ b/src/umount_davfs.c
+@@ -19,8 +19,8 @@
+ #include "config.h"
++#include "compat.h"
+-#include <error.h>
+ #include <errno.h>
+ #include <getopt.h>
+ #ifdef HAVE_LIBINTL_H
+--- a/src/webdav.c
++++ b/src/webdav.c
+@@ -19,9 +19,9 @@
+ #include "config.h"
++#include "compat.h"
+ #include <errno.h>
+-#include <error.h>
+ #ifdef HAVE_FCNTL_H
+ #include <fcntl.h>
+ #endif
+@@ -368,6 +368,7 @@ dav_init_webdav(const dav_args *args)
+         error(EXIT_FAILURE, errno, _("socket library initialization failed"));
+     if (args->neon_debug & ~NE_DBG_HTTPPLAIN) {
++#ifdef HAVE_FOPENCOOKIE
+         char *buf = malloc(log_bufsize);
+         cookie_io_functions_t *log_func = malloc(sizeof(cookie_io_functions_t));
+         if (!log_func) abort();
+@@ -380,6 +381,9 @@ dav_init_webdav(const dav_args *args)
+             error(EXIT_FAILURE, errno,
+                   _("can't open stream to log neon-messages"));
+         ne_debug_init(log_stream, args->neon_debug);
++#else
++      error(EXIT_FAILURE, 0, "neon debugging unsupported");
++#endif
+     }
+     session = ne_session_create(args->scheme, args->host, args->port);
+--- /dev/null
++++ b/src/compat.h
+@@ -0,0 +1,64 @@
++#ifndef _COMPAT_H
++#define _COMPAT_H
++
++#ifndef _PATH_MOUNTED
++# define _PATH_MOUNTED "/proc/mounts"
++#endif
++
++#ifndef _PATH_MNTTAB
++# define _PATH_MNTTAB "/etc/fstab"
++#endif
++
++#ifdef HAVE_ERROR_H
++# include <error.h>
++#else
++# include <stdio.h>
++# include <stdarg.h>
++# include <stdlib.h>
++# include <string.h>
++static void error_at_line(int status, int errnum, const char *filename,
++                          unsigned int linenum, const char *format, ...)
++{
++      va_list ap;
++
++      fflush(stdout);
++
++      if (filename != NULL)
++              fprintf(stderr, "%s:%u: ", filename, linenum);
++
++      va_start(ap, format);
++      vfprintf(stderr, format, ap);
++      va_end(ap);
++
++      if (errnum != 0)
++              fprintf(stderr, ": %s", strerror(errnum));
++
++      fprintf(stderr, "\n");
++
++      if (status != 0)
++              exit(status);
++}
++
++#define error(status, errnum, format...) \
++      error_at_line(status, errnum, NULL, 0, format)
++
++#endif /* HAVE_ERROR_H */
++
++#ifndef HAVE_CANONICALIZE_FILE_NAME
++#include <limits.h>
++#include <string.h>
++#include <stdlib.h>
++static char * canonicalize_file_name(const char *path)
++{
++      char buf[PATH_MAX] = { };
++
++      snprintf(buf, sizeof(buf) - 1, "%s", path);
++
++      if (!realpath(path, buf))
++              return NULL;
++
++      return strdup(buf);
++}
++#endif
++
++#endif /* _COMPAT_H */
index 32a872185b82a40467f134baac40d78125650ec4..6439e92dc9251f03435e265919c80325e589c0c6 100644 (file)
@@ -9,7 +9,7 @@ include $(TOPDIR)/rules.mk
 
 PKG_NAME:=dnscrypt-proxy
 PKG_VERSION:=1.5.0
-PKG_RELEASE:=1
+PKG_RELEASE:=2
 
 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
 PKG_SOURCE_URL:=http://download.dnscrypt.org/dnscrypt-proxy
index d0dbc2d003a71dd7c5d47cfaab976a142b1132a7..63e0e86b72341fc3dcd7d4b75b7ceedd37a6858d 100644 (file)
@@ -3,3 +3,4 @@ config dnscrypt-proxy
        option port '5353'
        # option resolver 'opendns'
        # option resolvers_list '/usr/share/dnscrypt-proxy/dnscrypt-resolvers.csv'
+       # option ephemeral_keys '1'
index 24f29ae2cd3ed4828435b6c83d06aa0128761e92..7c9f58db4b024a8db3231959dbec84ccb31882fd 100644 (file)
@@ -8,12 +8,14 @@ start_instance () {
        config_get port            "$section" 'port'
        config_get resolver        "$section" 'resolver'
        config_get resolvers_list  "$section" 'resolvers_list'
+       config_get_bool ephemeral_keys "$section" 'ephemeral_keys'
 
        service_start /usr/sbin/dnscrypt-proxy -d \
                -a ${address}:${port} \
                -u nobody \
                -L ${resolvers_list:-'/usr/share/dnscrypt-proxy/dnscrypt-resolvers.csv'} \
-               -R ${resolver:-'opendns'}
+               -R ${resolver:-'opendns'} \
+               ${ephemeral_keys:+'-E'}
 }
 
 start() {
diff --git a/net/esniper/Makefile b/net/esniper/Makefile
new file mode 100644 (file)
index 0000000..9607d76
--- /dev/null
@@ -0,0 +1,42 @@
+#
+# Copyright (C) 2015 Thomas Weißschuh
+#
+# This is free software, licensed under the GNU General Public License v2.
+# See /LICENSE for more information.
+#
+
+include $(TOPDIR)/rules.mk
+
+PKG_NAME:=esniper
+PKG_VERSION:=2.31.0
+PKG_RELEASE:=1
+PKG_LICENSE:=BSD-2-Clause
+PKG_LICENSE_FILES:=COPYING
+PKG_MAINTAINER:=Thomas Weißschuh <openwrt@t-8ch.de>
+
+VERSION_TRANSFORMED:=$(subst .,-,$(PKG_VERSION))
+
+PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)-$(VERSION_TRANSFORMED)
+PKG_SOURCE:=$(PKG_NAME)-$(VERSION_TRANSFORMED).tgz
+PKG_SOURCE_URL:=@SF/$(PKG_NAME)
+PKG_MD5SUM:=4b411588c4a223acef7333ab684c7618
+
+PKG_BUILD_PARALLEL:=1
+
+include $(INCLUDE_DIR)/package.mk
+
+define Package/esniper
+  SECTION:=net
+  CATEGORY:=Network
+  TITLE:=Simple, lightweight tool for sniping eBay auctions
+  URL:=http://esniper.sourceforge.net/
+  DEPENDS:=+libcurl +ca-certificates
+endef
+
+define Package/esniper/install
+       $(INSTALL_DIR) $(1)/usr/bin
+       $(INSTALL_BIN) $(PKG_BUILD_DIR)/esniper $(1)/usr/bin/
+       $(INSTALL_BIN) $(PKG_BUILD_DIR)/frontends/snipe $(1)/usr/bin/
+endef
+
+$(eval $(call BuildPackage,esniper))
index 8c8dadc74a6ca03f38ff8d6676c724e147e36f4d..0d4c8554cd1bdc7ccb414e4b97efbfeda42b0f9a 100644 (file)
@@ -8,14 +8,11 @@
 include $(TOPDIR)/rules.mk
 
 PKG_NAME:=gnunet
-PKG_SOURCE_VERSION:=35991
+PKG_SOURCE_VERSION:=36068
 PKG_VERSION:=0.10.1-svn$(PKG_SOURCE_VERSION)
 PKG_RELEASE:=1
 
 # ToDo:
-#  - break-out transports
-#    -> get rid of microhttpd and gnurl dependency for gns and vpn
-#       requires upstream to split config files
 #  - break-out {peer,name,data}store for each backend
 #  - package testing stuff
 
@@ -74,8 +71,8 @@ define Package/gnunet/description
  well as many missing features in this release.
 
  This package provides the core components of GNUnet including the
- CADET routing engine, a DHT implementation and most transports as well
- as their helpers.
+ CADET routing engine, a DHT implementation and basic transports as
well as their helpers.
 endef
 
 define BuildComponent
@@ -144,9 +141,7 @@ define Package/gnunet/install
        done )
 
        ( for plug in ats_proportional block_dht block_regex datacache_heap  \
-           transport_http_client transport_http_server \
-           transport_https_client transport_https_server \
-           transport_tcp transport_udp transport_unix transport_wlan; do \
+           transport_tcp transport_udp transport_unix; do \
                $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/lib/gnunet/libgnunet_plugin_$$$$plug*.so $(1)/usr/lib/gnunet ; \
        done )
 
@@ -178,6 +173,20 @@ define Build/InstallDev
        $(CP) $(PKG_INSTALL_DIR)/usr/include/gnunet/*.h $(1)/usr/include/gnunet
 endef
 
+define Package/gnunet/postinst
+#!/bin/sh
+grep -qc "/etc/gnunet" "$${IPKG_INSTROOT}"/etc/sysupgrade.conf >/dev/null ||
+       echo "/etc/gnunet/" >> "$${IPKG_INSTROOT}"/etc/sysupgrade.conf
+
+endef
+
+define Package/gnunet/postrm
+#!/bin/sh
+grep -qc "/etc/gnunet" "$${IPKG_INSTROOT}"/etc/sysupgrade.conf >/dev/null &&
+       sed -i '/\/etc\/gnunet/d' "$${IPKG_INSTROOT}"/etc/sysupgrade.conf
+
+endef
+
 DEPENDS_conversation:=+gnunet-gns +libgst1app +libgst1audio +libgstreamer1 +glib2 +pulseaudio-daemon +libopus +libogg
 BIN_conversation:=conversation conversation-test
 LIB_conversation:=conversation microphone speaker
@@ -185,6 +194,15 @@ PLUGIN_conversation:=gnsrecord_conversation
 LIBEXEC_conversation:=helper-audio-playback helper-audio-record
 CONF_conversation:=conversation
 
+DEPENDS_transport-http_client:=+libgnurl
+PLUGIN_transport-http_client:=transport_http_client transport_https_client
+
+DEPENDS_transport-http_server:=+libmicrohttpd
+PLUGIN_transport-http_server:=transport_http_server transport_https_server
+
+PLUGIN_transport-wifi:=transport_wlan
+LIBEXEC_transport-wifi:=helper-transport-wlan
+
 DEPENDS_experiments:=+libglpk
 PLUGIN_experiments:=ats_mlp ats_ril
 
@@ -192,7 +210,7 @@ DEPENDS_fs:=+gnunet-datastore +libextractor
 BIN_fs:=auto-share directory download download-manager.scm fs publish unindex search
 LIB_fs:=fs
 PLUGIN_fs:=block_fs
-LIB_EXEC_fs:=helper-fs-publish service-fs
+LIBEXEC_fs:=helper-fs-publish service-fs
 CONF_fs:=fs
 
 DEPENDS_gns:=+gnunet-vpn
@@ -206,7 +224,7 @@ CONF_gns:=dns gns namecache namestore resolver
 DEPENDS_datastore:=+gnunet-gns +libsqlite3
 BIN_datastore:=datastore
 LIB_datastore:=datastore
-PLUGIN_datastore:=datacache_sqlite datastore_heap datastore_sqlite namecache_sqlite namestore_sqlite peerstore_sqlite
+PLUGIN_datastore:=datastore_heap
 LIBEXEC_datastore:=daemon-latency-logger service-datastore
 CONF_datastore:=datastore
 
@@ -226,9 +244,10 @@ PLUGIN_transport-bluetooth:=transport_bluetooth
 LIBEXEC_transport-bluetooth:=helper-transport-bluetooth
 
 DEPENDS_utils:=+certtool +openssl-util
-BIN_utils:=config gns-import.sh gns-proxy-setup-ca transport-certificate-creation
+BIN_utils:=gns-proxy-setup-ca transport-certificate-creation
 
 DEPENDS_vpn:=+kmod-tun
+BIN_vpn:=vpn
 LIB_vpn:=tun vpn
 LIBEXEC_vpn:=daemon-exit daemon-pt helper-exit helper-vpn service-vpn
 CONF_vpn:=exit pt vpn
@@ -240,6 +259,9 @@ $(eval $(call BuildComponent,fs,file-sharing components,))
 $(eval $(call BuildComponent,gns,name resolution components,y))
 $(eval $(call BuildComponent,datastore,storage components,))
 $(eval $(call BuildComponent,transport-bluetooth,bluetooth transport,))
+$(eval $(call BuildComponent,transport-http_client,HTTP/HTTPS client transport,y))
+$(eval $(call BuildComponent,transport-http_server,HTTP/HTTPS server transport,))
+$(eval $(call BuildComponent,transport-wlan,WLAN transport,))
 $(eval $(call BuildComponent,utils,administration utililties,))
 $(eval $(call BuildComponent,vpn,vpn components,y))
 $(eval $(call BuildComponent,mysql,mySQL datastore backend,))
index 66e2600d419e677c737e21bdfbcb59b66ae81cc5..6e12030a3e3a8841376ecab8b4e1e25225c4d204 100644 (file)
@@ -8,6 +8,7 @@ USE_PROCD=1
 PROG=/usr/lib/gnunet/libexec/gnunet-service-arm
 
 GNUNET_HOME=/var/run/gnunet
+LOGFILE=$GNUNET_HOME/gnunet.log
 CONFIGFILE=$GNUNET_HOME/gnunet.conf
 SUID_ROOT_HELPERS="exit nat-server nat-client transport-bluetooth transport-wlan vpn"
 
@@ -37,10 +38,38 @@ prepare_config() {
        touch $CONFIGFILE
        chown root:gnunet $CONFIGFILE
        chmod 0640 $CONFIGFILE
-       gnunet-config -c /tmp/run/gnunet/gnunet.conf -s PATHS -o GNUNET_HOME -V $GNUNET_HOME
-       defaultservices=$( gnunet-config -c /tmp/run/gnunet/gnunet.conf -s arm -o DEFAULTSERVICES )
-       defaultservices="$defaultservices gns2dns"
-       gnunet-config -c /tmp/run/gnunet/gnunet.conf -s arm -o DEFAULTSERVICES -V "$defaultservices"
+       gnunet-config -c $CONFIGFILE -s PATHS -o GNUNET_HOME -V $GNUNET_HOME
+
+       # minimal persistency in /etc/gnunet
+       [ ! -d /etc/gnunet ] && {
+               mkdir -p /etc/gnunet
+               chown gnunet:gnunet /etc/gnunet
+       }
+       gnunet-config -c $CONFIGFILE -s PATHS -o GNUNET_CONFIG_HOME -V /etc/gnunet
+       gnunet-config -c $CONFIGFILE -s PEER -o PRIVATE_KEY -V /etc/gnunet/private_key.ecc
+       gnunet-config -c $CONFIGFILE -s identity -o EGODIR -V /etc/gnunet/identity/egos
+       gnunet-config -c $CONFIGFILE -s revocation -o DATABASE -V /etc/gnunet/revocation.dat
+       gnunet-config -c $CONFIGFILE -s nse -o PROOFFILE -V /etc/gnunet/proof.dat
+       gnunet-config -c $CONFIGFILE -s namestore-sqlite -o FILENAME -V /etc/gnunet/namestore.sqlite
+
+       # minimal datastore (todo: make this configurable)
+       gnunet-config -c $CONFIGFILE -s datastore -o QUOTA -V "4 MB"
+
+       # limit dhtcache memory usage to 4 MB
+       gnunet-config -c $CONFIGFILE -s dhtcache -o QUOTA -V "4 MB"
+
+       # enable dns2gns
+       gnunet-config -c $CONFIGFILE -s dns2gns -o AUTOSTART -V YES
+
+       # enable all installed transport plugins
+       transport_plugins=$(gnunet-config -c $CONFIGFILE -s transport -o PLUGINS)
+       for transplug in /usr/lib/gnunet/libgnunet_plugin_transport_*.so; do
+               transplug=$( echo $transplug |
+                       sed -ne 's!^.*_transport_\(.*\)\.so$!\1!p' )
+               [ -n "$( echo $transport_plugins | grep $transplug )" ] ||
+                       transport_plugins="$transport_plugins $transplug"
+       done
+       gnunet-config -c $CONFIGFILE -s transport -o PLUGINS -V "$transport_plugins"
 }
 
 start_service() {
@@ -49,7 +78,7 @@ start_service() {
 
        procd_open_instance
        procd_set_param user gnunet
-       procd_set_param command $PROG -c $CONFIGFILE
+       procd_set_param command $PROG -c $CONFIGFILE -l $LOGFILE
        procd_set_param respawn
        procd_close_instance
 }
index e1415de219a07343b8d264654188b2321d3ea2d6..c63b1ffbb400b0e61287ee33cb50b8b79b5e2d40 100644 (file)
@@ -9,7 +9,7 @@ include $(TOPDIR)/rules.mk
 
 PKG_NAME:=gnurl
 PKG_VERSION:=7.40.0
-PKG_RELEASE:=3
+PKG_RELEASE:=5
 
 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.bz2
 PKG_SOURCE_URL:=https://gnunet.org/sites/default/files
@@ -53,6 +53,7 @@ CONFIGURE_ARGS += \
        --with-gnutls="$(STAGING_DIR)/usr" \
        --with-libidn="$(STAGING_DIR)/usr" \
        --with-zlib="$(STAGING_DIR)/usr" \
+       --with-ca-path="/etc/ssl/certs/" \
        --enable-shared \
        --enable-static \
        --without-axtls \
diff --git a/net/gnurl/patches/010-backport-gtls-add-support-for-CURLOPT_CAPATH.patch b/net/gnurl/patches/010-backport-gtls-add-support-for-CURLOPT_CAPATH.patch
new file mode 100644 (file)
index 0000000..37d862f
--- /dev/null
@@ -0,0 +1,100 @@
+From 5a1614cecdd57cab8b4ae3e9bc19dfff5ba77e80 Mon Sep 17 00:00:00 2001
+From: Alessandro Ghedini <alessandro@ghedini.me>
+Date: Sun, 8 Mar 2015 20:11:06 +0100
+Subject: [PATCH] gtls: add support for CURLOPT_CAPATH
+
+---
+ acinclude.m4                       |  4 ++--
+ docs/libcurl/opts/CURLOPT_CAPATH.3 |  5 ++---
+ lib/vtls/gtls.c                    | 22 ++++++++++++++++++++++
+ lib/vtls/gtls.h                    |  3 +++
+ 4 files changed, 29 insertions(+), 5 deletions(-)
+
+diff --git a/acinclude.m4 b/acinclude.m4
+index 6ed7ffb..ca01869 100644
+--- a/acinclude.m4
++++ b/acinclude.m4
+@@ -2615,8 +2615,8 @@ AC_HELP_STRING([--without-ca-path], [Don't use a default CA path]),
+     capath="no"
+   elif test "x$want_capath" != "xno" -a "x$want_capath" != "xunset"; then
+     dnl --with-ca-path given
+-    if test "x$OPENSSL_ENABLED" != "x1" -a "x$POLARSSL_ENABLED" != "x1"; then
+-      AC_MSG_ERROR([--with-ca-path only works with openSSL or PolarSSL])
++    if test "x$OPENSSL_ENABLED" != "x1" -a "x$GNUTLS_ENABLED" != "x1" -a "x$POLARSSL_ENABLED" != "x1"; then
++      AC_MSG_ERROR([--with-ca-path only works with OpenSSL, GnuTLS or PolarSSL])
+     fi
+     capath="$want_capath"
+     ca="no"
+diff --git a/docs/libcurl/opts/CURLOPT_CAPATH.3 b/docs/libcurl/opts/CURLOPT_CAPATH.3
+index 642953d..6695f9f 100644
+--- a/docs/libcurl/opts/CURLOPT_CAPATH.3
++++ b/docs/libcurl/opts/CURLOPT_CAPATH.3
+@@ -43,9 +43,8 @@ All TLS based protocols: HTTPS, FTPS, IMAPS, POP3, SMTPS etc.
+ .SH EXAMPLE
+ TODO
+ .SH AVAILABILITY
+-This option is OpenSSL-specific and does nothing if libcurl is built to use
+-GnuTLS. NSS-powered libcurl provides the option only for backward
+-compatibility.
++This option is supported by the OpenSSL, GnuTLS and PolarSSL backends. The NSS
++backend provides the option only for backward compatibility.
+ .SH RETURN VALUE
+ Returns CURLE_OK if TLS enabled, and CURLE_UNKNOWN_OPTION if not, or
+ CURLE_OUT_OF_MEMORY if there was insufficient heap space.
+diff --git a/lib/vtls/gtls.c b/lib/vtls/gtls.c
+index 05aef19..c792540 100644
+--- a/lib/vtls/gtls.c
++++ b/lib/vtls/gtls.c
+@@ -97,6 +97,10 @@ static bool gtls_inited = FALSE;
+ #  if (GNUTLS_VERSION_NUMBER >= 0x03020d)
+ #    define HAS_OCSP
+ #  endif
++
++#  if (GNUTLS_VERSION_NUMBER >= 0x030306)
++#    define HAS_CAPATH
++#  endif
+ #endif
+ #ifdef HAS_OCSP
+@@ -462,6 +466,24 @@ gtls_connect_step1(struct connectdata *conn,
+             rc, data->set.ssl.CAfile);
+   }
++#ifdef HAS_CAPATH
++  if(data->set.ssl.CApath) {
++    /* set the trusted CA cert directory */
++    rc = gnutls_certificate_set_x509_trust_dir(conn->ssl[sockindex].cred,
++                                                data->set.ssl.CApath,
++                                                GNUTLS_X509_FMT_PEM);
++    if(rc < 0) {
++      infof(data, "error reading ca cert file %s (%s)\n",
++            data->set.ssl.CAfile, gnutls_strerror(rc));
++      if(data->set.ssl.verifypeer)
++        return CURLE_SSL_CACERT_BADFILE;
++    }
++    else
++      infof(data, "found %d certificates in %s\n",
++            rc, data->set.ssl.CApath);
++  }
++#endif
++
+   if(data->set.ssl.CRLfile) {
+     /* set the CRL list file */
+     rc = gnutls_certificate_set_x509_crl_file(conn->ssl[sockindex].cred,
+diff --git a/lib/vtls/gtls.h b/lib/vtls/gtls.h
+index c3867e5..af1cb5b 100644
+--- a/lib/vtls/gtls.h
++++ b/lib/vtls/gtls.h
+@@ -54,6 +54,9 @@ bool Curl_gtls_cert_status_request(void);
+ /* Set the API backend definition to GnuTLS */
+ #define CURL_SSL_BACKEND CURLSSLBACKEND_GNUTLS
++/* this backend supports the CAPATH option */
++#define have_curlssl_ca_path 1
++
+ /* API setup for GnuTLS */
+ #define curlssl_init Curl_gtls_init
+ #define curlssl_cleanup Curl_gtls_cleanup
+-- 
+2.4.4
+
index cd37fc776ceefc326a53f77c86b6964a286ffe4e..6ac8a3a634897dfe0cf531ae4e2ee96e47ec7891 100644 (file)
@@ -9,12 +9,12 @@
 include $(TOPDIR)/rules.mk
 
 PKG_NAME:=haproxy
-PKG_VERSION:=1.5.13
+PKG_VERSION:=1.5.14
 PKG_RELEASE:=00
 PKG_SOURCE:=haproxy-$(PKG_VERSION).tar.gz
 PKG_SOURCE_URL:=http://haproxy.1wt.eu/download/1.5/src/
 PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)-$(BUILD_VARIANT)/$(PKG_NAME)-$(PKG_VERSION)
-PKG_MD5SUM:=30cf07875ecae4fd6c4c309627afa8f1
+PKG_MD5SUM:=ad9d7262b96ba85a0f8c6acc6cb9edde
 PKG_MAINTAINER:=Thomas Heil <heil@terminal-consulting.de>
 PKG_LICENSE:=GPL-2.0
 
diff --git a/net/iotivity/Makefile b/net/iotivity/Makefile
new file mode 100644 (file)
index 0000000..7653d62
--- /dev/null
@@ -0,0 +1,216 @@
+#
+# Copyright (C) 2015 OpenWrt.org
+#
+# This is free software, licensed under the GNU General Public License v2.
+# See /LICENSE for more information.
+#
+
+include $(TOPDIR)/rules.mk
+
+PKG_NAME:=iotivity
+PKG_VERSION:=0.9.1
+PKG_RELEASE:=1
+
+PKG_SOURCE_PROTO:=git
+PKG_SOURCE_URL:=https://gerrit.iotivity.org/gerrit/iotivity
+PKG_SOURCE_SUBDIR:=$(PKG_NAME)-$(PKG_VERSION)
+PKG_SOURCE_VERSION:=0.9.1
+PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION)-$(PKG_SOURCE_VERSION).tar.gz
+PKG_MIRROR_MD5SUM:=
+PKG_USE_MIPS16:=0
+
+PKG_MAINTAINER:=Hauke Mehrtens <hauke.mehrtens@lantiq.com>
+
+PKG_LICENSE:=Apache-2.0
+PKG_LICENSE_FILES:=LICENSE.md
+
+PKG_BUILD_DEPENDS:= +boost +libexpat
+
+include $(INCLUDE_DIR)/package.mk
+include $(INCLUDE_DIR)/scons.mk
+
+
+define Package/iotivity
+  SECTION:=net
+  CATEGORY:=Network
+  DEPENDS:=@!USE_UCLIBC +libpthread +librt +libstdcpp +libuuid
+  TITLE:=IoTivity Library
+  URL:=https://www.iotivity.org
+endef
+
+define Package/iotivity/description
+    IoTivity is a framework for the Internet of Things based on the
+    Open Interconnect Consortium Specification.
+endef
+
+
+define Package/iotivity-things-manager-lib
+  SECTION:=net
+  CATEGORY:=Network
+  DEPENDS:=iotivity
+  TITLE:=IoTivity things manager lib
+  URL:=https://www.iotivity.org
+endef
+
+define Package/iotivity-things-manager-lib/description
+    IoTivity things-manager lib
+endef
+
+
+define Package/iotivity-plugin-manager-lib
+  SECTION:=net
+  CATEGORY:=Network
+  DEPENDS:=iotivity +libexpat
+  TITLE:=IoTivity plugin manager lib
+  URL:=https://www.iotivity.org
+endef
+
+define Package/iotivity-plugin-manager-lib/description
+    IoTivity plugin manager lib
+endef
+
+
+define Package/iotivity-mqttclient
+  SECTION:=net
+  CATEGORY:=Network
+  DEPENDS:=iotivity +iotivity-plugin-manager-lib +boost +boost-system
+  TITLE:=IoTivity mqtt Client
+  URL:=https://www.iotivity.org
+endef
+
+define Package/iotivity-mqttclient/description
+    IoTivity mqtt Client
+endef
+
+
+define Package/iotivity-oic-middle
+  SECTION:=net
+  CATEGORY:=Network
+  DEPENDS:=iotivity
+  TITLE:=IoTivity OIC Middle
+  URL:=https://www.iotivity.org
+endef
+
+define Package/iotivity-oic-middle/description
+    IoTivity OIC Middle
+endef
+
+
+define Package/iotivity-things-manager
+  SECTION:=net
+  CATEGORY:=Network
+  DEPENDS:=iotivity +iotivity-things-manager-lib
+  TITLE:=IoTivity things manager
+  URL:=https://www.iotivity.org
+endef
+
+define Package/iotivity-things-manager/description
+    IoTivity things manager
+endef
+
+
+define Package/iotivity-example-garage
+  SECTION:=net
+  CATEGORY:=Network
+  DEPENDS:=iotivity
+  TITLE:=IoTivity Garage example
+  URL:=https://www.iotivity.org
+endef
+
+define Package/iotivity-example-garage/description
+    An IoTivity example application
+endef
+
+
+PKG_CEREAL_NAME:=cereal
+PKG_CEREAL_VERSION:=7121e91e6ab8c3e6a6516d9d9c3e6804e6f65245
+PKG_CEREAL_SOURCE:=$(PKG_CEREAL_NAME)-$(PKG_CEREAL_VERSION).tar.bz2
+PKG_CEREAL_PROTO:=git
+PKG_CEREAL_SOURCE_URL:=https://github.com/USCiLab/cereal.git
+PKG_CEREAL_SUBDIR:=$(PKG_CEREAL_NAME)
+#PKG_CEREAL_MIRROR_MD5SUM:=?
+
+define Download/iotivity-cereal
+  FILE:=$(PKG_CEREAL_SOURCE)
+  URL:=$(PKG_CEREAL_SOURCE_URL)
+  PROTO:=$(PKG_CEREAL_PROTO)
+  VERSION:=$(PKG_CEREAL_VERSION)
+  SUBDIR:=$(PKG_CEREAL_SUBDIR)
+  #MIRROR_MD5SUM:=$(PKG_CEREAL_MIRROR_MD5SUM)
+endef
+$(eval $(call Download,iotivity-cereal))
+
+
+SCONS_OPTIONS += \
+       TARGET_OS=linux \
+       TARGET_TRANSPORT=ALL \
+       TARGET_ARCH=$(ARCH) \
+       STAGING_DIR=$(STAGING_DIR) \
+       mqttclient examples samples libTGMSDK ConServerApp ConClientApp BootstrapServerApp
+
+ifneq ($(findstring c,$(OPENWRT_VERBOSE)),)
+  SCONS_OPTIONS += VERBOSE=true
+endif
+
+define Build/Prepare
+       $(call Build/Prepare/Default)
+       $(TAR) -C $(PKG_BUILD_DIR)/extlibs/cereal -xjf $(DL_DIR)/$(PKG_CEREAL_SOURCE)
+endef
+
+define Build/Configure
+       (cd $(PKG_BUILD_DIR); \
+               $(SCONS_VARS) \
+               scons \
+                       $(SCONS_OPTIONS) \
+       )
+endef
+
+
+define Package/iotivity/install
+       $(INSTALL_DIR) $(1)/usr/lib
+       $(INSTALL_BIN) $(PKG_BUILD_DIR)/out/linux/$(ARCH)/release/liboc.so $(1)/usr/lib/liboc.so
+       $(INSTALL_BIN) $(PKG_BUILD_DIR)/out/linux/$(ARCH)/release/liboc_logger.so $(1)/usr/lib/liboc_logger.so
+       $(INSTALL_BIN) $(PKG_BUILD_DIR)/out/linux/$(ARCH)/release/liboctbstack.so $(1)/usr/lib/liboctbstack.so
+endef
+
+define Package/iotivity-things-manager-lib/install
+       $(INSTALL_DIR) $(1)/usr/lib
+       $(INSTALL_BIN) $(PKG_BUILD_DIR)/out/linux/$(ARCH)/release/libTGMSDKLibrary.so $(1)/usr/lib/libTGMSDKLibrary.so
+endef
+
+define Package/iotivity-plugin-manager-lib/install
+       $(INSTALL_DIR) $(1)/usr/lib
+       $(INSTALL_BIN) $(PKG_BUILD_DIR)/out/linux/$(ARCH)/release/libpmimpl.so $(1)/usr/lib/libpmimpl.so
+endef
+
+define Package/iotivity-mqttclient/install
+       $(INSTALL_DIR) $(1)/usr/bin
+       $(INSTALL_BIN) $(PKG_BUILD_DIR)/out/linux/$(ARCH)/release/service/protocol-plugin/sample-app/linux/mqtt/mqttclient $(1)/usr/bin/mqttclient
+endef
+
+define Package/iotivity-oic-middle/install
+       $(INSTALL_DIR) $(1)/usr/bin
+       $(INSTALL_BIN) $(PKG_BUILD_DIR)/out/linux/$(ARCH)/release/examples/OICMiddle/OICMiddle $(1)/usr/bin/OICMiddle
+endef
+
+define Package/iotivity-things-manager/install
+       $(INSTALL_DIR) $(1)/usr/bin
+       $(INSTALL_BIN) $(PKG_BUILD_DIR)/out/linux/$(ARCH)/release/service/things-manager/sampleapp/linux/configuration/bootstrapserver $(1)/usr/bin/bootstrapserver
+       $(INSTALL_BIN) $(PKG_BUILD_DIR)/out/linux/$(ARCH)/release/service/things-manager/sampleapp/linux/configuration/con-server $(1)/usr/bin/con-server
+       $(INSTALL_BIN) $(PKG_BUILD_DIR)/out/linux/$(ARCH)/release/service/things-manager/sampleapp/linux/configuration/con-client $(1)/usr/bin/con-client
+endef
+
+define Package/iotivity-example-garage/install
+       $(INSTALL_DIR) $(1)/usr/bin
+       $(INSTALL_BIN) $(PKG_BUILD_DIR)/out/linux/$(ARCH)/release/resource/examples/garageclient $(1)/usr/bin/garageclient
+       $(INSTALL_BIN) $(PKG_BUILD_DIR)/out/linux/$(ARCH)/release/resource/examples/garageserver $(1)/usr/bin/garageserver
+endef
+
+
+$(eval $(call BuildPackage,iotivity))
+$(eval $(call BuildPackage,iotivity-things-manager-lib))
+$(eval $(call BuildPackage,iotivity-plugin-manager-lib))
+$(eval $(call BuildPackage,iotivity-mqttclient))
+$(eval $(call BuildPackage,iotivity-oic-middle))
+$(eval $(call BuildPackage,iotivity-things-manager))
+$(eval $(call BuildPackage,iotivity-example-garage))
diff --git a/net/iotivity/patches/001-no_unit_test.patch b/net/iotivity/patches/001-no_unit_test.patch
new file mode 100644 (file)
index 0000000..6ba2265
--- /dev/null
@@ -0,0 +1,11 @@
+--- a/resource/SConscript
++++ b/resource/SConscript
+@@ -61,7 +61,7 @@ if target_os == 'linux':
+       SConscript('csdk/stack/samples/linux/secure/SConscript')
+       # Build C/C++ unit tests
+-      SConscript('unit_tests.scons')
++      # SConscript('unit_tests.scons')
+ elif target_os == 'darwin':
+       # Build linux samples for now.
diff --git a/net/iotivity/patches/002-do-not-chck-for-boost.patch b/net/iotivity/patches/002-do-not-chck-for-boost.patch
new file mode 100644 (file)
index 0000000..21109fd
--- /dev/null
@@ -0,0 +1,29 @@
+From 51e26e002aa043435f94ac0f071066090d5c2de8 Mon Sep 17 00:00:00 2001
+From: Hauke Mehrtens <hauke@hauke-m.de>
+Date: Mon, 22 Jun 2015 20:23:36 +0200
+Subject: [PATCH 5/5] do not chck for boost
+
+Boost is not needed for every package just for some.
+
+Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
+---
+ service/third_party_libs.scons | 8 --------
+ 1 file changed, 8 deletions(-)
+
+--- a/service/third_party_libs.scons
++++ b/service/third_party_libs.scons
+@@ -49,14 +49,6 @@ if target_os in ['linux', 'tizen']:
+               conf = Configure(lib_env)
+-              if target_os not in ['tizen'] and not conf.CheckLib('boost_thread', language='C++'):
+-                      print 'Did not find boost_thread, exiting!'
+-                      Exit(1)
+-
+-              if target_os not in ['tizen'] and not conf.CheckLib('boost_system', language='C++'):
+-                      print 'Did not find boost_system, exiting!'
+-                      Exit(1)
+-
+               lib_env = conf.Finish()
+ ######################################################################
diff --git a/net/iotivity/patches/004-use-env.patch b/net/iotivity/patches/004-use-env.patch
new file mode 100644 (file)
index 0000000..62a2b76
--- /dev/null
@@ -0,0 +1,38 @@
+From 884e831ed07607097614276f6bbf192993228100 Mon Sep 17 00:00:00 2001
+From: Hauke Mehrtens <hauke.mehrtens@lantiq.com>
+Date: Tue, 2 Jun 2015 11:08:17 +0200
+Subject: [PATCH 3/4] 004-use-env.patch
+
+---
+ build_common/SConscript | 22 ++++++++++++++++++++++
+ 1 file changed, 22 insertions(+)
+
+--- a/build_common/SConscript
++++ b/build_common/SConscript
+@@ -106,6 +106,26 @@ tc_set_msg = '''
+ * cause inexplicable errors.                                                  *
+ *******************************************************************************
+ '''
++env['ENV'] = os.environ
++if 'CC' in os.environ:
++      env['CC'] = Split(os.environ['CC'])
++      print "using CC from enviroment: %s" % env['CC']
++if 'CXX' in os.environ:
++      env['CXX'] = Split(os.environ['CXX'])
++      print "using CXX from enviroment: %s" % env['CXX']
++if 'CFLAGS' in os.environ:
++      env['CFLAGS'] = Split(os.environ['CFLAGS'])
++      print "using CFLAGS from enviroment: %s" % env['CFLAGS']
++if 'CXXFLAGS' in os.environ:
++      env['CXXFLAGS'] = Split(os.environ['CXXFLAGS'])
++      print "using CXXFLAGS from enviroment: %s" % env['CXXFLAGS']
++if 'CPPFLAGS' in os.environ:
++      env['CPPFLAGS'] = Split(os.environ['CPPFLAGS'])
++      print "using CPPFLAGS from enviroment: %s" % env['CPPFLAGS']
++if 'LDFLAGS' in os.environ:
++      env['LINKFLAGS'] = Split(os.environ['LDFLAGS'])
++      print "using LDFLAGS/LINKFLAGS from enviroment: %s" % env['LINKFLAGS']
++
+ if env.get('VERBOSE') == False:
+       env['CCCOMSTR'] = "Compiling $TARGET"
+       env['CXXCOMSTR'] = "Compiling $TARGET"
diff --git a/net/iotivity/patches/010-libcoap-fix-big-endian-problems.patch b/net/iotivity/patches/010-libcoap-fix-big-endian-problems.patch
new file mode 100644 (file)
index 0000000..63a9ad5
--- /dev/null
@@ -0,0 +1,32 @@
+From 62c0a14ccd333d0e55fc431f151253a72a2836d0 Mon Sep 17 00:00:00 2001
+From: Hauke Mehrtens <hauke.mehrtens@lantiq.com>
+Date: Mon, 8 Jun 2015 21:57:52 +0200
+Subject: [PATCH] libcoap: fix big endian problems
+
+When this is build for a big endian Linux system WORDS_BIGENDIAN was
+not be set. This patch sets it correctly so it will not generate broken
+code on big endian systems.
+This was tested on MIPS BE 32 Bit.
+
+Change-Id: I59dd07d8020c553318e2aa43894a2185fe9b9286
+Signed-off-by: Hauke Mehrtens <hauke.mehrtens@lantiq.com>
+Reviewed-on: https://gerrit.iotivity.org/gerrit/1219
+Tested-by: jenkins-iotivity <jenkins-iotivity@opendaylight.org>
+Reviewed-by: Erich Keane <erich.keane@intel.com>
+---
+ resource/csdk/connectivity/lib/libcoap-4.1.1/config.h | 4 ++--
+ 1 file changed, 2 insertions(+), 2 deletions(-)
+
+--- a/resource/csdk/connectivity/lib/libcoap-4.1.1/config.h
++++ b/resource/csdk/connectivity/lib/libcoap-4.1.1/config.h
+@@ -135,8 +135,8 @@
+ #  define WORDS_BIGENDIAN 1
+ # endif
+ #else
+-# ifndef WORDS_BIGENDIAN
+-/* #  undef WORDS_BIGENDIAN */
++# if defined(__BYTE_ORDER__) && (__BYTE_ORDER__ == __ORDER_BIG_ENDIAN__)
++#  define WORDS_BIGENDIAN 1
+ # endif
+ #endif
diff --git a/net/iotivity/patches/011-cdsk-fix-big-endian-problem.patch b/net/iotivity/patches/011-cdsk-fix-big-endian-problem.patch
new file mode 100644 (file)
index 0000000..833f600
--- /dev/null
@@ -0,0 +1,35 @@
+From 7189bc088f558945972d82a9a3427001cb20000a Mon Sep 17 00:00:00 2001
+From: Hauke Mehrtens <hauke.mehrtens@lantiq.com>
+Date: Mon, 8 Jun 2015 22:03:19 +0200
+Subject: [PATCH] cdsk: fix big endian problem
+
+Without this patch the client will endianes swap the port number when
+sending the detailed request after it got the answer for his multicast
+get. Use the same method for storing the port number in the address
+array in ever part of the code and do not use memcpy and manual
+bytewise coping mixed over the code. memcpy was used once and byte wise
+copy was used twice so I choose the majority.
+This was tested on MIPS BE 32 Bit.
+
+Change-Id: Ib486171987004d10209d2bbf6b1d9ada75235651
+Signed-off-by: Hauke Mehrtens <hauke.mehrtens@lantiq.com>
+Reviewed-on: https://gerrit.iotivity.org/gerrit/1220
+Tested-by: jenkins-iotivity <jenkins-iotivity@opendaylight.org>
+Reviewed-by: Doug Hudson <douglas.hudson@intel.com>
+Reviewed-by: Erich Keane <erich.keane@intel.com>
+---
+ resource/csdk/stack/src/ocstack.c | 3 ++-
+ 1 file changed, 2 insertions(+), 1 deletion(-)
+
+--- a/resource/csdk/stack/src/ocstack.c
++++ b/resource/csdk/stack/src/ocstack.c
+@@ -723,7 +723,8 @@ OCStackResult UpdateResponseAddr(OCDevAd
+         address->addr[i] = atoi(tok);
+     }
+-    memcpy(&address->addr[4], &endPoint->addressInfo.IP.port, sizeof(uint16_t));
++    address->addr[4] = (uint8_t)endPoint->addressInfo.IP.port;
++    address->addr[5] = (uint8_t)(endPoint->addressInfo.IP.port >> 8);
+     ret = OC_STACK_OK;
+ exit:
diff --git a/net/iotivity/patches/020-Do-not-set-architecture-specific-flags.patch b/net/iotivity/patches/020-Do-not-set-architecture-specific-flags.patch
new file mode 100644 (file)
index 0000000..4c12064
--- /dev/null
@@ -0,0 +1,60 @@
+From 980ef34a085f654e74c9896e8143e6f970049b6c Mon Sep 17 00:00:00 2001
+From: Hauke Mehrtens <hauke@hauke-m.de>
+Date: Mon, 22 Jun 2015 19:39:58 +0200
+Subject: [PATCH 3/5] Do not set architecture specific flags
+
+Setting architecture specific flags causes problems when you want to
+build something which is not covered by these.
+
+Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
+---
+ build_common/linux/SConscript                     | 20 --------------------
+ resource/csdk/connectivity/build/linux/SConscript | 20 --------------------
+ 2 files changed, 40 deletions(-)
+
+--- a/build_common/linux/SConscript
++++ b/build_common/linux/SConscript
+@@ -24,20 +24,3 @@ env.AppendUnique(LINKFLAGS = ['-ldl', '-
+ # Set arch flags
+ target_arch = env.get('TARGET_ARCH')
+-if target_arch in ['x86']:
+-      env.AppendUnique(CCFLAGS = ['-m32'])
+-      env.AppendUnique(LINKFLAGS = ['-m32'])
+-elif target_arch in ['x86_64']:
+-      env.AppendUnique(CCFLAGS = ['-m64'])
+-      env.AppendUnique(LINKFLAGS = ['-m64'])
+-elif target_arch.find('v7a-hard') > 0:
+-      env.AppendUnique(CPPFLAGS = ['-march=armv7-a'])
+-      env.AppendUnique(CPPFLAGS = ['-mfloat-abi=hard'])
+-      env.AppendUnique(CCFLAGS = ['-mfloat-abi=hard'])
+-      env.AppendUnique(LINKFLAGS = ['-mfloat-abi=hard'])
+-elif target_arch.find('v7a') > 0:
+-      env.AppendUnique(CPPFLAGS = ['-march=armv7-a'])
+-elif target_arch.find('arm64') >= 0:
+-      env.AppendUnique(CPPFLAGS = ['-march=armv8-a'])
+-else:
+-      env.AppendUnique(CPPFLAGS = ['-march=armv5te'])
+--- a/resource/csdk/connectivity/build/linux/SConscript
++++ b/resource/csdk/connectivity/build/linux/SConscript
+@@ -22,20 +22,3 @@ env.AppendUnique(LINKFLAGS = ['-ldl', '-
+ # Set arch flags
+ target_arch = env.get('TARGET_ARCH')
+-if target_arch in ['x86']:
+-      env.AppendUnique(CCFLAGS = ['-m32'])
+-      env.AppendUnique(LINKFLAGS = ['-m32'])
+-elif target_arch in ['x86_64']:
+-      env.AppendUnique(CCFLAGS = ['-m64'])
+-      env.AppendUnique(LINKFLAGS = ['-m64'])
+-elif target_arch.find('v7a-hard') > 0:
+-      env.AppendUnique(CPPFLAGS = ['-march=armv7-a'])
+-      env.AppendUnique(CPPFLAGS = ['-mfloat-abi=hard'])
+-      env.AppendUnique(CCFLAGS = ['-mfloat-abi=hard'])
+-      env.AppendUnique(LINKFLAGS = ['-mfloat-abi=hard'])
+-elif target_arch.find('v7a') > 0:
+-      env.AppendUnique(CPPFLAGS = ['-march=armv7-a'])
+-elif target_arch.find('arm64') > 0:
+-      env.AppendUnique(CPPFLAGS = ['-march=armv8-a'])
+-else:
+-      env.AppendUnique(CPPFLAGS = ['-march=armv5te'])
diff --git a/net/iotivity/patches/021-add-some-more-architectures.patch b/net/iotivity/patches/021-add-some-more-architectures.patch
new file mode 100644 (file)
index 0000000..6d570aa
--- /dev/null
@@ -0,0 +1,35 @@
+From f78ba209b14908bf2b6197293e1f9e3458ddba8e Mon Sep 17 00:00:00 2001
+From: Hauke Mehrtens <hauke@hauke-m.de>
+Date: Mon, 22 Jun 2015 19:59:47 +0200
+Subject: [PATCH 4/5] add some more architectures
+
+This does not scale and this check should be removed.
+
+Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
+---
+ build_common/SConscript                     | 2 +-
+ resource/csdk/connectivity/build/SConscript | 2 +-
+ 2 files changed, 2 insertions(+), 2 deletions(-)
+
+--- a/build_common/SConscript
++++ b/build_common/SConscript
+@@ -14,7 +14,7 @@ host_target_map = {
+ # Map of os and allowed archs (os: allowed archs)
+ os_arch_map = {
+-              'linux': ['x86', 'x86_64', 'arm', 'arm64'],
++              'linux': ['x86', 'x86_64', 'arm', 'arm64', 'mips', 'mipsel', 'mips64', 'mips64el', 'i386', 'powerpc', 'sparc', 'aarch64'],
+               'tizen': ['x86', 'x86_64', 'arm', 'arm64', 'armeabi-v7a'],
+               'android': ['x86', 'x86_64', 'armeabi', 'armeabi-v7a', 'armeabi-v7a-hard', 'arm64-v8a'],
+               'windows': ['x86', 'amd64', 'arm'],
+--- a/resource/csdk/connectivity/build/SConscript
++++ b/resource/csdk/connectivity/build/SConscript
+@@ -14,7 +14,7 @@ host_target_map = {
+ # Map of os and allowed archs (os: allowed archs)
+ os_arch_map = {
+-              'linux': ['x86', 'x86_64', 'arm', 'arm64'],
++              'linux': ['x86', 'x86_64', 'arm', 'arm64', 'mips', 'mipsel', 'mips64', 'mips64el', 'i386', 'powerpc', 'sparc', 'aarch64'],
+               'tizen': ['x86', 'x86_64', 'arm', 'arm64'],
+               'android': ['x86', 'x86_64', 'armeabi', 'armeabi-v7a', 'armeabi-v7a-hard', 'arm64-v8a'],
+               'windows': ['x86', 'amd64', 'arm'],
diff --git a/net/iotivity/patches/030-fix-missing-lib.patch b/net/iotivity/patches/030-fix-missing-lib.patch
new file mode 100644 (file)
index 0000000..c5ba270
--- /dev/null
@@ -0,0 +1,11 @@
+--- a/service/protocol-plugin/sample-app/linux/SConscript
++++ b/service/protocol-plugin/sample-app/linux/SConscript
+@@ -41,7 +41,7 @@ if target_os not in ['windows', 'winrt']
+ sample_env.AppendUnique(LIBS = ['oc', 'oc_logger', 'octbstack',
+                                 'connectivity_abstraction', 'coap',
+-                                'ppm', 'pmimpl', 'dl'])
++                                'ppm', 'boost_system', 'pmimpl', 'dl'])
+ if env.get('SECURED') == '1':
+     sample_env.AppendUnique(LIBS = ['tinydtls'])
diff --git a/net/iotivity/patches/040-fix-things-manager.patch b/net/iotivity/patches/040-fix-things-manager.patch
new file mode 100644 (file)
index 0000000..972841b
--- /dev/null
@@ -0,0 +1,11 @@
+--- a/service/things-manager/sampleapp/linux/configuration/SConscript
++++ b/service/things-manager/sampleapp/linux/configuration/SConscript
+@@ -57,7 +57,7 @@ conserver = linux_sample_env.Program('co
+ conclient = linux_sample_env.Program('con-client', 'con-client.cpp')
+ bootstrapserver = linux_sample_env.Program('bootstrapserver', 'bootstrapserver.cpp')
+ Alias("ConServerApp", conserver)
+-Alias("ConCleintApp", conclient)
++Alias("ConClientApp", conclient)
+ Alias("BootstrapServerApp", bootstrapserver)
+ env.AppendTarget('ConServerApp')
+ env.AppendTarget('ConClientApp')
diff --git a/net/iotivity/patches/050-fix-OICMidle.patch b/net/iotivity/patches/050-fix-OICMidle.patch
new file mode 100644 (file)
index 0000000..a03ed26
--- /dev/null
@@ -0,0 +1,14 @@
+--- a/resource/csdk/stack/include/octypes.h
++++ b/resource/csdk/stack/include/octypes.h
+@@ -35,9 +35,9 @@ extern "C" {
+ //Don't want to expose to application layer that lower level stack is using CoAP.
+ /// Authority + URI string to prefix well known queries
+-#define OC_WELL_KNOWN_QUERY                  "224.0.1.187:5683/oc/core"
++#define OC_WELL_KNOWN_QUERY                  "/oc/core"
+ #define OC_MULTICAST_DISCOVERY_URI           "/oc/core"
+-#define OC_EXPLICIT_DEVICE_DISCOVERY_URI     "224.0.1.187:5683/oc/core/d?rt=core.led"
++#define OC_EXPLICIT_DEVICE_DISCOVERY_URI     "/oc/core/d?rt=core.led"
+ /// Multicast address and port string to prefix multicast queries
+ #define OC_MULTICAST_PREFIX                  "224.0.1.187:5683"
+ /// IP Multicast address to use for multicast requests
index 41f7f885bad2245a781732fd5d6de267bf30e96f..a1c439e133ee5ab4d07934b0e2db91af62b30b1d 100644 (file)
@@ -76,12 +76,15 @@ endif
 endef
 
 define Package/ipsec-tools/install
-       $(INSTALL_DIR) $(1)/etc
-       $(INSTALL_CONF) ./files/racoon.conf $(1)/etc/racoon.conf
        $(INSTALL_DIR) $(1)/etc/racoon
-       $(INSTALL_CONF) $(PKG_BUILD_DIR)/src/racoon/samples/psk.txt $(1)/etc/racoon/
+       $(INSTALL_CONF) ./files/functions.sh $(1)/etc/racoon/
+       $(INSTALL_BIN) ./files/p1client-up $(1)/etc/racoon/
+       $(INSTALL_BIN) ./files/p1client-down $(1)/etc/racoon/
+       $(INSTALL_BIN) ./files/vpnctl $(1)/etc/racoon/
        $(INSTALL_DIR) $(1)/etc/init.d
        $(INSTALL_BIN) ./files/racoon.init $(1)/etc/init.d/racoon
+       $(INSTALL_DIR) $(1)/etc/config
+       $(INSTALL_CONF) ./files/racoon $(1)/etc/config/
        $(INSTALL_DIR) $(1)/usr/lib
        $(CP) $(PKG_INSTALL_DIR)/usr/lib/libipsec.so.* $(1)/usr/lib/
        $(CP) $(PKG_INSTALL_DIR)/usr/lib/libracoon.so.* $(1)/usr/lib/
@@ -93,8 +96,7 @@ define Package/ipsec-tools/install
 endef
 
 define Package/ipsec-tools/conffiles
-/etc/racoon.conf
-/etc/racoon/psk.txt
+/etc/config/racoon
 endef
 
 $(eval $(call BuildPackage,ipsec-tools))
diff --git a/net/ipsec-tools/files/functions.sh b/net/ipsec-tools/files/functions.sh
new file mode 100644 (file)
index 0000000..e3e739b
--- /dev/null
@@ -0,0 +1,137 @@
+#!/bin/sh
+#
+# Copyright (C) 2015 Vitaly Protsko <villy@sft.ru>
+
+errno=0
+
+get_fieldval() {
+  local __data="$3"
+  local __rest
+
+  test -z "$1" && return
+
+  while true ; do
+    __rest=${__data#* }
+    test "$__rest" = "$__data" && break
+
+    if [ "${__data/ *}" = "$2" ]; then
+      eval "$1=${__rest/ *}"
+      break
+    fi
+
+    __data="$__rest"
+  done
+}
+
+manage_fw() {
+  local cmd=/usr/sbin/iptables
+  local mode
+  local item
+
+  if [ -z "$4" ]; then
+    $log "Bad usage of manage_fw"
+    errno=3; return 3
+  fi
+
+  case "$1" in
+    add|up|1) mode=A ;;
+    del|down|0) mode=D ;;
+    *) return 3 ;;
+  esac
+
+  for item in $4 ; do
+    $cmd -$mode forwarding_$2_rule -s $item -j ACCEPT
+    $cmd -$mode output_$3_rule -d $item -j ACCEPT
+    $cmd -$mode forwarding_$3_rule -d $item -j ACCEPT
+    $cmd -t nat -$mode postrouting_$3_rule -d $item -j ACCEPT
+  done
+}
+
+manage_sa() {
+  local spdcmd
+  local rtcmd
+  local gate
+  local litem
+  local ritem
+
+  if [ -z "$4" ]; then
+    $log "Bad usage of manage_sa"
+    errno=3; return 3
+  fi
+
+  case "$1" in
+    add|up|1) spdcmd=add; rtcmd=add ;;
+    del|down|0) spdcmd=delete; rtcmd=del ;;
+    *) errno=3; return 3 ;;
+  esac
+
+  get_fieldval gate src "$(/usr/sbin/ip route get $4)"
+  if [ -z "$gate" ]; then
+    $log "Can not find outbound IP for $4"
+    errno=3; return 3
+  fi
+
+
+  for litem in $2 ; do
+    for ritem in $3 ; do
+      echo "
+spd$spdcmd $litem $ritem any -P out ipsec esp/tunnel/$gate-$4/require;
+spd$spdcmd $ritem $litem any -P in ipsec esp/tunnel/$4-$gate/require;
+" | /usr/sbin/setkey -c 1>&2
+    done
+  done
+
+  test -n "$5" && gate=$5
+
+  for ritem in $3 ; do
+    (sleep 3; /usr/sbin/ip route $rtcmd $ritem via $gate) &
+  done
+}
+
+
+. /lib/functions/network.sh
+
+get_zoneiflist() {
+  local item
+  local data
+  local addr
+
+  item=0
+  data=$(uci get firewall.@zone[0].name)
+  while [ -n "$data" ]; do
+    test "$data" = "$1" && break
+    let "item=$item+1"
+    data=$(uci get firewall.@zone[$item].name)
+  done
+
+  if [ -z "$data" ]; then
+    errno=1
+    return $errno
+  fi
+  data=$(uci get firewall.@zone[$item].network)
+
+  echo "$data"
+}
+
+get_zoneiplist() {
+  local item
+  local addr
+  local data
+  local result
+
+  data=$(get_zoneiflist $1)
+  test $? -gt 0 -o $errno -gt 0 -o -z "$data" && return $errno
+
+  for item in $data ; do
+    if network_is_up $item ; then
+      network_get_ipaddrs addr $item
+      test $? -eq 0 && result="$result $addr"
+    fi
+  done
+
+  result=$(echo $result)
+  echo "$result"
+}
+
+
+# EOF /etc/racoon/functions.sh
diff --git a/net/ipsec-tools/files/p1client-down b/net/ipsec-tools/files/p1client-down
new file mode 100644 (file)
index 0000000..8c5a195
--- /dev/null
@@ -0,0 +1,41 @@
+#!/bin/sh
+#
+
+log="logger -t p1client-down[$$]"
+
+. /lib/functions.sh
+. /etc/racoon/functions.sh
+
+if [ -z "$SPLIT_INCLUDE_CIDR" ]; then
+  $log "Connection without server-pushed routing is not supported"
+  exit 1
+fi
+
+$log "Shutting down tunnel to server $REMOTE_ADDR"
+$log "Closing tunnel(-s) to $SPLIT_INCLUDE_CIDR through $INTERNAL_ADDR4"
+
+config_load racoon
+config_get confIntZone racoon int_zone lan
+config_get confExtZone racoon ext_zone wan
+
+manage_fw del $confIntZone $confExtZone "$INTERNAL_ADDR4 $SPLIT_INCLUDE_CIDR"
+
+data=$(get_zoneiflist $confIntZone)
+if [ -n "$data" ]; then
+  for item in $data ; do
+    network_get_subnet locnet $item
+    if [ -n "$locnet" ]; then
+      manage_sa del "$locnet" "$SPLIT_INCLUDE_CIDR" $REMOTE_ADDR $INTERNAL_ADDR4
+    else
+      $log "Can not find subnet on interface $item"
+    fi
+  done
+else
+  $log "Can not find subnets in zone $confIntZone"
+fi
+
+get_fieldval data dev "$(/usr/sbin/ip route get $REMOTE_ADDR)"
+ip address del $INTERNAL_ADDR4/32 dev $data
+
+
+# EOF /etc/racoon/p1client-down
diff --git a/net/ipsec-tools/files/p1client-up b/net/ipsec-tools/files/p1client-up
new file mode 100644 (file)
index 0000000..8a9678a
--- /dev/null
@@ -0,0 +1,41 @@
+#!/bin/sh
+#
+
+log="logger -t p1client-up[$$]"
+
+. /lib/functions.sh
+. /etc/racoon/functions.sh
+
+if [ -z "$SPLIT_INCLUDE_CIDR" ]; then
+  $log "Connection without server-pushed routing is not supported"
+  exit 1
+fi
+
+$log "Setting up tunnel to server $REMOTE_ADDR"
+$log "Making tunnel(-s) to $SPLIT_INCLUDE_CIDR through $INTERNAL_ADDR4"
+
+get_fieldval data dev "$(/usr/sbin/ip route get $REMOTE_ADDR)"
+ip address add $INTERNAL_ADDR4/32 dev $data
+
+config_load racoon
+config_get confIntZone racoon int_zone lan
+config_get confExtZone racoon ext_zone wan
+
+data=$(get_zoneiflist $confIntZone)
+if [ -n "$data" ]; then
+  for item in $data ; do
+    network_get_subnet locnet $item
+    if [ -n "$locnet" ]; then
+      manage_sa add "$locnet" "$SPLIT_INCLUDE_CIDR" $REMOTE_ADDR $INTERNAL_ADDR4
+    else
+      $log "Can not find subnet on interface $item"
+    fi
+  done
+else
+  $log "Can not find interfaces in zone $confIntZone"
+fi
+
+manage_fw add $confIntZone $confExtZone "$INTERNAL_ADDR4 $SPLIT_INCLUDE_CIDR"
+
+
+# EOF /etc/racoon/p1client-up
diff --git a/net/ipsec-tools/files/racoon b/net/ipsec-tools/files/racoon
new file mode 100644 (file)
index 0000000..11cd2f2
--- /dev/null
@@ -0,0 +1,109 @@
+#/etc/config/racoon
+#
+# Copyright 2015 Vitaly Protsko <villy@sft.ru>
+
+# * WARNING: this is "not working" example
+# * Defaults are commented out
+# * Resuting config will appear in /var/racoon/
+
+config racoon
+#      option  debug           0
+#      option  ext_zone        'wan'
+#      option  int_zone        'lan'
+#      option  port            500
+#      option  natt_port       4500
+# following 4 or 6, no default
+#      option  ipversion       4
+
+config p1_proposal 'example_prop1'
+#      option  lifetime        28800
+       option  enc_alg         'aes'
+       option  hash_alg        'sha1'
+       option  auth_method     'rsasig'
+       option  dh_group        2
+
+config p1_proposal 'example_anon'
+#      option  lifetime        28800
+       option  enc_alg         'aes'
+       option  hash_alg        'sha1'
+       option  auth_method     'xauth_rsa_server'
+       option  dh_group        2
+
+config p1_proposal 'example_xauth'
+#      option  lifetime        28800
+       option  enc_alg         'aes'
+       option  hash_alg        'sha1'
+       option  auth_method     'xauth_rsa_client'
+       option  dh_group        2
+
+config p2_proposal 'example_prop2'
+       option  pfs_group       2
+       option  enc_alg         'aes'
+       option  auth_alg        'hmac_sha1'
+
+config p2_proposal 'example_in2'
+       option  pfs_group       2
+#      option  lifetime        14400
+       option  enc_alg         'aes'
+       option  auth_alg        'hmac_sha1'
+
+config sainfo 'office'
+       option  p2_proposal     'example_prop2'
+       option  local_net       '192.168.8.0/24'
+       option  remote_net      '192.168.1.0/24'
+
+config sainfo 'welcome'
+       option  p2_proposal     'example_in2'
+       option  local_net       '192.168.8.0/24'
+       option  remote_net      '192.168.10.0/24'
+       option  dns4            '192.168.8.1'
+       option  defdomain       'myhome.local'
+
+config sainfo 'client'
+       p2_proposal             'std_p2'
+
+config tunnel 'Office'
+       option  enabled         1
+# initial_contact
+#      option  init            1
+       option  remote          'vpn.example.tld'
+       option  exchange_mode   'main'
+       option  certificate     'example_cert'
+#      option  peer_id_type    'asn1dn'
+#      option  prop_check      'obey'
+#      option  verify_id       1
+#      option  weak_p1check    1
+#      option  dpd_delay       ''
+       list    p1_proposal     'example_prop1'
+       list    sainfo          'office'
+
+# WARNING:     Only ONE tunnel with remote anonymous
+#              can be configured and it can have only
+#              ONE sainfo. Otherwise resulting racoon
+#              configuration will be unusable
+config tunnel 'Incoming'
+       option  enabled         1
+       option  remote          'anonymous'
+       option  pre_shared_key  'testitnow'
+       option  exchange_mode   'aggressive,main'
+       option  my_id_type      'fqdn'
+       option  my_id           'myserver.homeip.net'
+       list    p1_proposal     'example_anon'
+       list    sainfo          'welcome'
+
+config tunnel 'Client'
+       option  enabled         1
+       option  remote          'vpn.example.tld'
+       option  username        'testuser'
+       option  password        'testW0rD'
+#      option  mode_cfg        1
+       list    p1_proposal     'example_xauth'
+       list    sainfo          'client'
+
+# Insert corresponding data in PEM format as one line
+config 'certificate' 'example_cert'
+       option  'key'   '-----BEGIN PRIVATE KEY----- ~ -----END PRIVATE KEY-----'
+       option  'crt'   '-----BEGIN CERTIFICATE----- ~ -----END CERTIFICATE-----'
+
+config 'certificate' 'example_ca_cert'
+       option  'crt'   '-----BEGIN CERTIFICATE----- ~ -----END CERTIFICATE-----'
diff --git a/net/ipsec-tools/files/racoon.conf b/net/ipsec-tools/files/racoon.conf
deleted file mode 100644 (file)
index 5c05bcd..0000000
+++ /dev/null
@@ -1,36 +0,0 @@
-# Simple racoon.conf
-# 
-# Refer to http://wiki.openwrt.org/doc/howto/vpn.ipsec.basics.racoon for
-# details about configuring racoon in OpenWRT.
-#
-# Also read the Linux IPSEC Howto up at 
-# http://www.ipsec-howto.org/t1.html 
-#
-# Manual pages for ipsec-tools are not included with OpenWRT. Refer to
-# the following locations to view them online:
-# http://linux.die.net/man/8/racoon
-# http://linux.die.net/man/5/racoon.conf
-# http://linux.die.net/man/8/setkey
-#
-
-log notify;
-path pre_shared_key "/etc/racoon/psk.txt";
-path certificate "/etc/racoon/certs";
-
-#remote 172.31.1.1 {
-#        exchange_mode main,aggressive;
-#        proposal {
-#                encryption_algorithm 3des;
-#                hash_algorithm sha1;
-#                authentication_method pre_shared_key;
-#                dh_group modp1024;
-#        }
-#        generate_policy off;
-#}
-# 
-#sainfo address 192.168.203.10[any] any address 192.168.22.0/24[any] any {
-#        pfs_group modp768;
-#        encryption_algorithm 3des;
-#        authentication_algorithm hmac_md5;
-#        compression_algorithm deflate;
-#}
index 68053c91ee39187533a2806b26d09ebcf37bb2c2..6520d5bdeb9e3772d36a567d00849218a2b18044 100644 (file)
 #!/bin/sh /etc/rc.common
-# Copyright (C) 2009-2011 OpenWrt.org
-# Copyright (C) 2011 Artem Makhutov
-# Copyright (C) 2014 Noah Meyerhans <frodo@morgul.net>
+#
+# Copyright (C) 2015 Vitaly Protsko <villy@sft.ru>
+
+#set -vx
 
 USE_PROCD=1
 
-START=49
+START=60
+STOP=40
+
+let connWait=2/2
+confDir=/var/racoon
+confExtZone=
+confIntZone=
+confPort=
+confNATPort=
+confIPMode=
+
+confPh1ID=0
+
+log="logger -t init.d/racoon[$$] "
+
+. /etc/racoon/functions.sh
+
+setup_load() {
+  config_get confExtZone "$1" ext_zone wan
+  config_get confIntZone "$1" int_zone lan
+  config_get confPort    "$1" port 500
+  config_get confNATPort "$1" natt_port 4500
+  config_get confIPMode  "$1" ipversion ""
+
+  case X$confIPMode in
+    X4|X6) ;;
+    *) unset confIPMode ;;
+  esac
+}
+
+write_header() {
+  echo "
+# autogenerated, don't edit, look at /etc/config/racoon
+#
+path certificate \"$confDir/cert\";
+path script \"/etc/racoon\";
+path pre_shared_key \"$confDir/psk.txt\";
+path pidfile \"$confDir/racoon.pid\";
+padding { maximum_length 20; randomize off; strict_check off; exclusive_tail off; }
+timer { counter 5; interval 20 sec; persend 1; phase1 30 sec; phase2 15 sec; }
+"
+}
+
+setup_conf() {
+  local conf=$confDir/racoon.conf
+  local peerconf=$confDir/peers.txt
+  local pskconf=$confDir/psk.txt
+  local item
+  local data
+
+  data="$(get_zoneiplist $confExtZone)"
+  if [ "X$data" = X ]; then
+    $log "No IP addresses found for zone $confExtZone, exitng"
+    errno=2; return 2
+  fi
+
+  write_header > $conf
+  echo -n > $peerconf
+  echo -n > $pskconf
+  chmod 0600 $conf $peerconf $pskconf
+
+  echo "listen {" >> $conf
+  for item in $data ; do
+    echo "  isakmp $item [$confPort]; isakmp_natt $item [$confNATPort];" >> $conf
+  done
+  echo "}" >> $conf
+
+  config_get_bool item "$1" debug 0
+  data=warning
+  test $item -ne 0 && data=debug
+  echo "log $data;" >> $conf
+
+  setup_fw add
+}
+
+setup_p1() {
+  local conf=$confDir/racoon.conf
+  local data
+
+  echo "  proposal {" >> $conf
+  config_get data "$1" lifetime 28800
+  echo "    lifetime time $data sec;" >> $conf
+
+  config_get data "$1" enc_alg
+  test -n "$data" && echo "    encryption_algorithm $data;" >> $conf
+
+  config_get data "$1" hash_alg
+  test -n "$data" && echo "    hash_algorithm $data;" >> $conf
+
+  config_get data "$1" auth_method
+  test -n "$data" && echo "    authentication_method $data;" >> $conf
+
+  config_get data "$1" dh_group 2
+  echo -e "    dh_group $data;\n  }" >> $conf
+}
+
+setup_fw() {
+  local cmd=/usr/sbin/iptables
+  local mode
+
+  case "$1" in
+    add|up|1) mode=A ;;
+    del|down|0) mode=D ;;
+    *) return 3 ;;
+  esac
+
+  $cmd -$mode input_${confExtZone}_rule -p AH -j ACCEPT
+  $cmd -$mode input_${confExtZone}_rule -p ESP -j ACCEPT
+  $cmd -$mode input_${confExtZone}_rule -p UDP --dport $confPort -j ACCEPT
+  $cmd -$mode input_${confExtZone}_rule -p UDP --dport $confNATPort -j ACCEPT
+}
+
+setup_sa() {
+  local conf=$confDir/racoon.conf
+  local remote="${2/ *}"
+  local client="${2#* }"
+  local locnet
+  local remnet
+  local p2
+  local data
+
+  test "$2" = "$client" && unset client
+
+  if [ -z "$client" ]; then
+    config_get locnet "$1" local_net
+    config_get remnet "$1" remote_net
+    if [ -z "$locnet" ] || [ -z "$remnet" ]; then
+      $log "Remote and local networks for $1 must be configured ($2)"
+      errno=4; return 4
+    fi
+
+    if [ "$remote" = "anonymous" ]; then
+      echo "sainfo anonymous {" >> $conf
+     else
+      echo "sainfo address $locnet any address $remnet any {" >> $conf
+    fi
+  else
+    echo "sainfo anonymous {" >> $conf
+  fi
+
+  config_get p2 "$1" p2_proposal
+  if [ -z "$p2" ]; then
+    $log "Phase2 proposal must be configured in $1 sainfo"
+    errno=5; return 5
+  fi
+
+  echo "  remoteid $confPh1ID;" >> $conf
+
+  config_get data "$p2" pfs_group
+  test -n "$data" && echo "  pfs_group $data;" >> $conf
+  config_get data "$p2" lifetime 14400
+  test -n "$data" && echo "  lifetime time $data sec;" >> $conf
+  config_get data "$p2" enc_alg
+  test -n "$data" && echo "  encryption_algorithm $data;" >> $conf
+  config_get data "$p2" auth_alg
+  test -n "$data" && echo "  authentication_algorithm $data;" >> $conf
+
+  echo -e "  compression_algorithm deflate;\n}" >> $conf
+
+  if [ "$remote" = "anonymous" ]; then
+    echo -e "mode_cfg {\n  auth_source system;\n  conf_source local;" >> $conf
+
+    config_get data "$1" dns4
+    test -n "$data" && echo "  dns4 $data;" >> $conf
+    config_get data "$1" defdomain
+    test -n "$data" && echo "  default_domain \"$data\";" >> $conf
+
+    data=${remnet%/*}
+    let "data=${data##*.}+1"
+    echo "  network4 ${remnet%.*}.$data;" >> $conf
+
+    let "data=255<<(24-${remnet#*/}+8)&255"
+    echo "  netmask4 255.255.255.$data;" >> $conf
+
+    echo -e "  split_network include $locnet;\n}" >> $conf
+
+  elif [ -z "$client" ]; then
+    manage_sa add $locnet $remnet $remote
+    test $? -gt 0 -o $errno -gt 0 && return $errno
+
+    manage_fw add $confIntZone $confExtZone $remnet
+  fi
+}
+
+setup_tunnel() {
+  local conf=$confDir/racoon.conf
+  local peerconf=$confDir/peers.txt
+  local data
+  local remote
+  local xauth
+
+  config_get_bool data "$1" enabled 0
+  test "$data" = "0" && return 0
+
+  config_get remote "$1" remote
+  if [ "$remote" = "anonymous" ]; then
+    echo -e "remote anonymous {\n  generate_policy on;" >> $conf
+  else
+    data=$(nslookup "$remote" | awk 'NR == 5 {print $3}')
+    test -n "$data" && remote="$data"
+    echo -e "remote \"$1\" {\n  remote_address $remote;" >> $conf
+    echo "$data" >> $peerconf
+  fi
+
+  config_get data "$1" pre_shared_key ""
+  if [ -n "$data" ]; then
+    if [ "$remote" != "anonymous" ]; then
+      echo "$remote $data" >> $confDir/psk.txt
+    else
+      echo "* $data" >> $confDir/psk.txt
+    fi
+  fi
+
+  let confPh1ID=$confPh1ID+1
+  echo "  ph1id $confPh1ID;" >> $conf
+
+  config_get xauth "$1" username ""
+
+  config_get data "$1" certificate ""
+  if [ -n "$data" ]; then
+    echo -en "  verify_cert on;\n  my_identifier asn1dn;\n  certificate_type x509 " >> $conf
+    echo -en "\"$data.crt\" \"$data.key\";\n  send_cr off;\n  peers_identifier " >> $conf
+  else
+    config_get data "$1" my_id_type ""
+    if [ -n "$data" ]; then
+      echo -n "  my_identifier $data" >> $conf
+      config_get data "$1" my_id ""
+      if [ -n "$data" ]; then
+       echo " \"$data\";" >> $conf
+      elif [ -n "$xauth" ]; then
+       echo " \"$xauth\";" >> $conf
+      else
+       echo ";" >> $conf
+      fi
+    elif [ -n "$xauth" ]; then
+      echo "  my_identifier user_fqdn \"$xauth\";" >> $conf
+    fi
+    echo -n "  peers_identifier " >> $conf
+  fi
+
+  if [ "$remote" = "anonymous" ]; then
+    echo "user_fqdn;" >> $conf
+  else
+    config_get data "$1" peer_id_type "asn1dn"
+    echo -n "$data" >> $conf
+
+    config_get data "$1" peer_id ""
+    test -n "$data" && echo -n " \"$data\"" >> $conf
+
+    echo ";" >> $conf
+  fi
+
+  if [ -n "$xauth" ]; then
+    config_get data "$1" password
+    if [ -z "$data" ]; then
+      $log "Password must be given in $1 tunnel"
+      errno=7; return 7
+    fi
+    echo "$xauth $data" >> $confDir/psk.txt
+
+    echo "  xauth_login \"$xauth\";" >> $conf
+    echo -e "  script \"p1client-up\" phase1_up;\n  script \"p1client-down\" phase1_down;" >> $conf
+  fi
+
+  config_get data "$1" exchange_mode
+  if [ -z "$data" ]; then
+    data=main
+    test -n "$xauth" && data="${data},aggressive"
+  fi
+  echo -e "  exchange_mode $data;\n  nat_traversal on;\n  support_proxy on;" >> $conf
+
+  config_get data "$1" prop_check "obey"
+  test -n "$data" && echo "  proposal_check $data;" >> $conf
+
+  config_get_bool data "$1" weak_p1check 1
+  if [ $data -eq 0 ]; then data=off; else data=on; fi
+  echo "  weak_phase1_check $data;" >> $conf
+
+  config_get_bool data "$1" verify_id 1
+  if [ $data -eq 0 ]; then data=off; else data=on; fi
+  echo "  verify_identifier $data;" >> $conf
+
+  config_get data "$1" dpd_delay ""
+  test -n "$data" && echo "  dpd_delay $data;" >> $conf
+
+  unset data
+  test -n "$xauth" && data="on"
+  config_get data "$1" mode_cfg "$data"
+  test -n "$data" && echo "  mode_cfg $data;" >> $conf
+
+  config_get_bool data "$1" init 0
+  if [ $data -eq 0 ]; then data=off; else data=on; fi
+  echo "  initial_contact $data;" >> $conf
+
+
+  config_list_foreach "$1" p1_proposal setup_p1
+  echo "}" >> $conf
+
+  config_list_foreach "$1" sainfo setup_sa "$remote $xauth"
+}
+
+setup_cert() {
+  local item
+  local data
+
+  for item in key crt ; do
+    config_get data "$1" $item ""
+    test -z "$data" && continue
+
+    echo "$data" |\
+    sed 's/-\+[A-Z ]\+-\+/\n&\n/g' | sed 's/.\{50,50\}/&\n/g' | sed '/^$/d'\
+    > $confDir/cert/$1.$item
+
+    chmod 600 $confDir/cert/$1.$item
+  done
+
+  if [ -s $confDir/cert/$1.crt ]; then
+    data=$(openssl x509 -noout -hash -in $confDir/cert/$1.crt)
+    ln -sf $confDir/cert/$1.crt $confDir/cert/$data.0
+  fi
+}
+
+destroy_sa() {
+  local locnet
+  local remnet
+
+  config_get locnet "$1" local_net
+  config_get remnet "$1" remote_net
+  if [ -z "$locnet" ] || [ -z "$remnet" ]; then
+    $log "Remote and local networks for $1 must be configured"
+    errno=4; return 4
+  fi
+
+  manage_sa del $locnet $remnet $2
+  manage_fw del $confIntZone $confExtZone $remnet
+}
+
+destroy_tunnel() {
+  local data
+
+  config_get_bool data "$1" enabled 0
+  test "$data" = "0" && return 0
+
+  config_get remote "$1" remote
+  data=$(nslookup "$remote" | awk 'NR == 5 {print $3}')
+  test -n "$data" && remote="$data"
+
+  config_get data "$1" username ""
+  if [ -z "$data" ]; then
+    config_list_foreach "$1" sainfo destroy_sa $remote
+  fi
+}
+
+destroy_conf() {
+  setup_fw del
+}
+
+check_software() {
+  local item
+
+  for item in /usr/sbin/setkey /usr/bin/openssl /usr/sbin/ip ; do
+    if [ ! -x $item ]; then
+      $log "Needed program $item not found, exiting"
+      errno=9; return 9
+    fi
+  done
+}
+
+cleanup_conf() {
+  config_load racoon
+  config_foreach setup_load racoon
+  config_foreach destroy_conf racoon
+  config_foreach destroy_tunnel tunnel
+
+  /usr/sbin/setkey -P -F
+  /usr/sbin/setkey -F
+}
+
+check_dir() {
+  local item
+
+  for item in $confDir $confDir/cert ; do
+    if [ ! -d $item ]; then
+      mkdir -m 0700 -p $item
+    fi
+  done
+}
+
+wait4wanzone() {
+  local item=$connWait
+  local data
+
+  data="$(get_zoneiplist $confExtZone)"
+  while [ $item -gt 0 ]; do
+    test -n "$data" && break
+    sleep 2
+    let "item=$item-1"
+    data="$(get_zoneiplist $confExtZone)"
+  done
+
+  test -z "$data" && return 10
+}
 
 start_service() {
-    mkdir -m 0700 -p /var/racoon
-    [ -f /etc/ipsec.conf ] && /usr/sbin/setkey -f /etc/ipsec.conf
-    procd_open_instance
-    procd_set_param command /usr/sbin/racoon -F -f /etc/racoon.conf
-    procd_set_param respawn
-    procd_close_instance
+  check_software
+  test $? -gt 0 -o $errno -gt 0 && exit $errno
+
+  check_dir
+
+  config_load racoon
+  config_foreach setup_load racoon
+
+  config_foreach wait4wanzone racoon
+  if [ $? -gt 0 ] || [ $errno -gt 0 ]; then
+    $log "No active interfaces in $confExtZone zone found, exiting"
+    exit $errno
+  fi
+
+  config_foreach setup_conf racoon
+  test $? -gt 0 -o $errno -gt 0 && exit $errno
+
+  config_foreach setup_tunnel tunnel
+  test $? -gt 0 -o $errno -gt 0 && exit $errno
+
+  config_foreach setup_cert certificate
+
+  procd_open_instance
+  procd_set_param command /usr/sbin/racoon
+  test -n "$confIPMode" && procd_append_param command -$confIPMode
+  procd_append_param command -F -f $confDir/racoon.conf
+  procd_set_param file $confDir/racoon.conf
+  procd_close_instance
+
+  if [ -x /etc/racoon/vpnctl ]; then
+    let connWait=$connWait*2+2
+    ( sleep $connWait; /etc/racoon/vpnctl up ) &
+  fi
+}
+
+service_triggers() {
+  local item
+  local data
+
+  procd_add_reload_trigger "racoon" "network"
+
+  config_load racoon
+  config_foreach setup_load racoon
+
+  data=$(get_zoneiflist $confExtZone)
+  if [ $? -gt 0 ] || [ $errno -gt 0 ] || [ -z "$data" ]; then
+    $log "Can not find interfaces for $confExtZone zone"
+  else
+    for item in $data ; do
+      procd_add_reload_interface_trigger $item
+    done
+  fi
+}
+
+stop_service() {
+  cleanup_conf
+  procd_kill racoon 
 }
+
+trap "cleanup_conf" 1 2 3 4 5 6 7 8 9 10
+
+
+# EOF /etc/init.d/racoon
diff --git a/net/ipsec-tools/files/vpnctl b/net/ipsec-tools/files/vpnctl
new file mode 100644 (file)
index 0000000..5fb6667
--- /dev/null
@@ -0,0 +1,19 @@
+#!/bin/sh
+#
+
+case X$1 in
+  Xup|X1|Xstart) connMode=vpn-connect ;;
+  Xdown|X0|Xstop) connMode=vpn-disconnect ;;
+  *)
+    echo "Usage: $0: up|1|start || down|0|stop"
+    exit 1 ;;
+esac
+
+if [ -s /var/racoon/peers.txt ]; then
+  (while read ipa ; do
+    racoonctl $connMode $ipa
+  done) < /var/racoon/peers.txt
+fi
+
+
+# EOF /usr/bin/vpnctl
index fa32c655497f5eaabb8d02462638281ad30737f8..0ed810f045056676cf30f30aba24c1baaa70f9b8 100644 (file)
@@ -8,13 +8,13 @@
 include $(TOPDIR)/rules.mk
 
 PKG_NAME:=knot
-PKG_VERSION:=1.6.3
+PKG_VERSION:=1.6.4
 PKG_RELEASE:=1
 
-PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
+PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.xz
 PKG_SOURCE_SUBDIR:=$(PKG_NAME)-$(PKG_VERSION)
 PKG_SOURCE_URL:=https://secure.nic.cz/files/knot-dns/
-PKG_MD5SUM:=fb744b50493ac7e724d5228ade2e35b1
+PKG_MD5SUM:=a8ac2be2dc7d22c6df1aa5387ae4096b
 
 PKG_MAINTAINER:=Daniel Salzman <daniel.salzman@nic.cz>
 PKG_LICENSE:=GPL-2.0+
index cc7f81d41faf33c9c27648f776d5826361ccdb38..efe1d076184fca8c1f154efb4849e081d6a67ed0 100644 (file)
 include $(TOPDIR)/rules.mk
 
 PKG_NAME:=knxd
-PKG_VERSION=2015-06-02-$(PKG_SOURCE_VERSION)
-PKG_RELEASE:=1
+PKG_VERSION=2015-06-27-$(PKG_SOURCE_VERSION)
+PKG_RELEASE:=2
 
 PKG_SOURCE_PROTO:=git
 PKG_SOURCE_URL:=https://github.com/knxd/knxd.git
-PKG_SOURCE_VERSION:=3d3b1a5e8112397d297625d673a2a94507f9ebce
+PKG_SOURCE_VERSION:=50e7f6e6bfa13c2b6140b0f76aaa70234bf44b1d
 PKG_SOURCE_SUBDIR:=$(PKG_NAME)
 PKG_SOURCE:=$(PKG_NAME)-$(PKG_SOURCE_VERSION).tar.gz
 
@@ -38,7 +38,7 @@ define Package/knxd
   SECTION:=net
   CATEGORY:=Network
   TITLE:=EIB KNX daemon
-  DEPENDS:=+pthsem +libusb-1.0
+  DEPENDS:=+pthsem +libusb-1.0 +libstdcpp
 endef
 
 define Package/knxd/description
@@ -86,7 +86,7 @@ CONFIGURE_ARGS+= \
        --without-libstdc
 
 EXTRA_LDFLAGS+= \
-       -fno-builtin -nodefaultlibs -lc -lgcc
+       -fno-builtin -largp
 
 define Build/InstallDev
        $(INSTALL_DIR) $(1)/usr/include
diff --git a/net/knxd/patches/0100-musl-compat b/net/knxd/patches/0100-musl-compat
new file mode 100644 (file)
index 0000000..0c2a09b
--- /dev/null
@@ -0,0 +1,10 @@
+--- a/src/examples/common.h    2015-06-27 15:20:15.266563893 +0200
++++ b/src/examples/common.h    2015-06-27 15:23:09.406457392 +0200
+@@ -20,6 +20,7 @@
+ #include <stdlib.h>
+ #include <errno.h>
+ #include <unistd.h>
++#include <sys/select.h>
+ #include "eibclient.h"
+ /** unsigned char*/
index 932fc2a7358246e9203d8687f256521d8eb9b1c6..b42e2a84d94e7dbb9d7111a0284a66b8db183476 100644 (file)
@@ -9,7 +9,7 @@ include $(TOPDIR)/rules.mk
 
 PKG_NAME:=lighttpd
 PKG_VERSION:=1.4.35
-PKG_RELEASE:=4
+PKG_RELEASE:=5
 
 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.xz
 PKG_SOURCE_URL:=http://download.lighttpd.net/lighttpd/releases-1.4.x
@@ -60,7 +60,7 @@ CONFIGURE_ARGS+= \
        --without-fam \
        --without-gdbm \
        --without-ldap \
-       --without-lua \
+       --with-lua \
        --without-memcache \
        --with-pcre \
        --without-valgrind \
@@ -161,7 +161,7 @@ $(eval $(call BuildPlugin,access,Access restrictions,,30))
 $(eval $(call BuildPlugin,accesslog,Access logging,,30))
 $(eval $(call BuildPlugin,alias,Directory alias,,30))
 $(eval $(call BuildPlugin,cgi,CGI,,30))
-$(eval $(call BuildPlugin,cml,Cache Meta Language,,30))
+$(eval $(call BuildPlugin,cml,Cache Meta Language,+liblua,30))
 $(eval $(call BuildPlugin,compress,Compress output,+PACKAGE_lighttpd-mod-compress:zlib,30))
 $(eval $(call BuildPlugin,evasive,Evasive,,30))
 $(eval $(call BuildPlugin,evhost,Exnhanced Virtual-Hosting,,30))
@@ -169,7 +169,7 @@ $(eval $(call BuildPlugin,expire,Expire,,30))
 $(eval $(call BuildPlugin,extforward,Extract client,,30))
 $(eval $(call BuildPlugin,fastcgi,FastCGI,,30))
 $(eval $(call BuildPlugin,flv_streaming,FLV streaming,,30))
-$(eval $(call BuildPlugin,magnet,Magnet,,30))
+$(eval $(call BuildPlugin,magnet,Magnet,+liblua,30))
 $(eval $(call BuildPlugin,mysql_vhost,Mysql virtual hosting,+PACKAGE_lighttpd-mod-mysql_vhost:libmysqlclient,30))
 $(eval $(call BuildPlugin,proxy,Proxy,,30))
 $(eval $(call BuildPlugin,rewrite,URL rewriting,+PACKAGE_lighttpd-mod-rewrite:libpcre,30))
index 06083fc961bcd3704a70b61162c5d5ab52c77fc2..3af3842bef3ce99d3eb71333cdaf64d899240904 100644 (file)
@@ -9,7 +9,7 @@ include $(TOPDIR)/rules.mk
 
 PKG_NAME:=linknx
 PKG_VERSION:=0.0.1.32
-PKG_RELEASE:=6
+PKG_RELEASE:=7
 PKG_MD5SUM:=7ecc1208f59bceb05068c752b2250b63
 
 PKG_MAINTAINER:=Othmar Truniger <github@truniger.ch>
@@ -18,6 +18,7 @@ PKG_LICENSE:=GPL-2.0+
 PKG_SOURCE_URL:=@SF/linknx
 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
 PKG_BUILD_DEPENDS:=argp-standalone
+PKG_FORTIFY_SOURCE:=1
 
 include $(INCLUDE_DIR)/package.mk
 
diff --git a/net/linknx/patches/010-musl-compat b/net/linknx/patches/010-musl-compat
new file mode 100644 (file)
index 0000000..15c757e
--- /dev/null
@@ -0,0 +1,10 @@
+--- a/src/eibclient.c  2007-10-11 01:55:31.000000000 +0200
++++ b/src/eibclient.c  2015-06-27 22:18:01.433296921 +0200
+@@ -32,6 +32,7 @@
+ #include <netinet/in.h>
+ #include <netdb.h>
+ #include <errno.h>
++#include <string.h>
+ #include "config.h"
diff --git a/net/linknx/patches/012-fix-linknx.cpp b/net/linknx/patches/012-fix-linknx.cpp
new file mode 100644 (file)
index 0000000..8394cf1
--- /dev/null
@@ -0,0 +1,11 @@
+--- a/src/linknx.cpp   2012-06-04 22:12:13.000000000 +0200
++++ b/src/linknx.cpp   2015-06-27 22:35:23.705721355 +0200
+@@ -136,7 +136,7 @@
+     if (errno)
+         printf (": %s\n", strerror (errno));
+     else
+-        printf ("\n", strerror (errno));
++        printf ("\n");
+     exit (1);
+ }
index c4fbc128338e0e775d817f568e668259008de612..fd8cd87ceeb119be7fa98633293f7b507b2a4ee4 100644 (file)
@@ -9,7 +9,7 @@ include $(TOPDIR)/rules.mk
 
 PKG_NAME:=luci-app-sqm
 PKG_VERSION:=3
-PKG_RELEASE:=2
+PKG_RELEASE:=5
 PKG_LICENSE:=GPLv2
 LUCI_DIR:=/usr/lib/lua/luci
 
index 49ab13057d2e19e61c654eef268a36b9fb997f3a..6609fc382da31de99d841a88debb1e473ea8fa78 100644 (file)
@@ -36,9 +36,30 @@ s.addremove = true -- set to true to allow adding SQM instances in the GUI
 s.anonymous = true
 
 -- BASIC
-e = s:taboption("tab_basic", Flag, "enabled", translate("Enable"))
+e = s:taboption("tab_basic", Flag, "enabled", translate("Enable this SQM instance."))
 e.rmempty = false
 
+-- sm: following jow's advise, be helpful to the user and enable
+--     sqm's init script if even a single sm instance/interface
+--     is enabled; this is unexpected in that the init script gets
+--     enabled as soon as at least one sqm instance is enabled
+--     and that state is saved, so it does not require "Save & Apply"
+--     to effect the init scripts.
+--     the implementation was inpired/lifted from 
+--     https://github.com/openwrt/luci/blob/master/applications/luci-app-minidlna/luasrc/model/cbi/minidlna.lua
+function e.write(self, section, value)
+    if value == "1" then
+       luci.sys.init.enable("sqm")
+       m.message = translate("The SQM GUI has just enabled the sqm initscript on your behalf. Remember to disable the sqm initscript manually under System Startup menu in case this change was not wished for.")
+--     luci.sys.call("/etc/init.d/sqm start >/dev/null")
+--    else
+--     luci.sys.call("/etc/init.d/sqm stop >/dev/null")
+--     luci.sys.init.disable("sqm")
+    end
+    return Flag.write(self, section, value)
+end
+-- TODO: inform the user what we just did...
+
 n = s:taboption("tab_basic", ListValue, "interface", translate("Interface name"))
 -- sm lifted from luci-app-wol, the original implementation failed to show pppoe-ge00 type interface names
 for _, iface in ipairs(ifaces) do
@@ -71,6 +92,7 @@ c:value("codel")
 c:value("ns2_codel")
 c:value("pie")
 c:value("sfq")
+c:value("cake")
 c.default = "fq_codel"
 c.rmempty = false
 
@@ -89,7 +111,7 @@ sc.default = "simple.qos"
 sc.rmempty = false
 sc.description = qos_desc
 
-ad = s:taboption("tab_qdisc", Flag, "qdisc_advanced", translate("Show and Use Advanced Configuration"))
+ad = s:taboption("tab_qdisc", Flag, "qdisc_advanced", translate("Show and Use Advanced Configuration. Advanced options will only be used as long as this box is checked."))
 ad.default = false
 ad.rmempty = true
 
@@ -121,7 +143,7 @@ eecn.default = "NOECN"
 eecn.rmempty = true
 eecn:depends("qdisc_advanced", "1")
 
-ad2 = s:taboption("tab_qdisc", Flag, "qdisc_really_really_advanced", translate("Show and Use Dangerous Configuration"))
+ad2 = s:taboption("tab_qdisc", Flag, "qdisc_really_really_advanced", translate("Show and Use Dangerous Configuration. Dangerous options will only be used as long as this box is checked."))
 ad2.default = false
 ad2.rmempty = true
 ad2:depends("qdisc_advanced", "1")
@@ -178,7 +200,7 @@ po:depends("linklayer", "ethernet")
 po:depends("linklayer", "atm")
 
 
-adll = s:taboption("tab_linklayer", Flag, "linklayer_advanced", translate("Show Advanced Linklayer Options, (only needed if MTU > 1500)"))
+adll = s:taboption("tab_linklayer", Flag, "linklayer_advanced", translate("Show Advanced Linklayer Options, (only needed if MTU > 1500). Advanced options will only be used as long as this box is checked."))
 adll.rmempty = true
 adll:depends("linklayer", "ethernet")
 -- adll:depends("linklayer", "adsl")
@@ -206,6 +228,7 @@ smpu.rmempty = true
 smpu:depends("linklayer_advanced", "1")
 
 lla = s:taboption("tab_linklayer", ListValue, "linklayer_adaptation_mechanism", translate("Which linklayer adaptation mechanism to use; for testing only"))
+lla:value("cake")
 lla:value("htb_private")
 lla:value("tc_stab", "tc_stab ("..translate("default")..")")
 lla.default = "tc_stab"
index 1a46601117264730050e13e07658f453a0d969f9..f3ca9bacffc8711db7145102483afefdfb559c92 100644 (file)
@@ -10,7 +10,7 @@ include $(TOPDIR)/rules.mk
 PKG_NAME:=mtr
 PKG_REV:=dd2b750
 PKG_VERSION:=0.85+newdns-$(PKG_REV)
-PKG_RELEASE:=1
+PKG_RELEASE:=2
 
 PKG_SOURCE_PROTO:=git
 PKG_SOURCE_URL:=https://github.com/traviscross/mtr.git
diff --git a/net/mtr/patches/100-disabled-ipv6-fix.patch b/net/mtr/patches/100-disabled-ipv6-fix.patch
new file mode 100644 (file)
index 0000000..5ef9984
--- /dev/null
@@ -0,0 +1,49 @@
+--- a/net.c
++++ b/net.c
+@@ -307,9 +307,11 @@ void net_send_tcp(int index)
+   struct sockaddr_storage local;
+   struct sockaddr_storage remote;
+   struct sockaddr_in *local4 = (struct sockaddr_in *) &local;
+-  struct sockaddr_in6 *local6 = (struct sockaddr_in6 *) &local;
+   struct sockaddr_in *remote4 = (struct sockaddr_in *) &remote;
++#ifdef ENABLE_IPV6
++  struct sockaddr_in6 *local6 = (struct sockaddr_in6 *) &local;
+   struct sockaddr_in6 *remote6 = (struct sockaddr_in6 *) &remote;
++#endif
+   socklen_t len;
+   ttl = index + 1;
+@@ -566,8 +568,10 @@ void net_send_query(int index)
+   /* sendto() assumes packet length includes the IPv4 header but not the 
+      IPv6 header. */
+-  spacketsize = abs(packetsize)       -
+-              ( ( af == AF_INET ) ? 0 : sizeof (struct ip6_hdr) );
++  spacketsize = abs(packetsize);
++#ifdef ENABLE_IPV6
++  spacketsize -= ( ( af == AF_INET ) ? 0 : sizeof (struct ip6_hdr) );
++#endif
+   rv = sendto(sendsock, packet, spacketsize, 0, remotesockaddr, salen);
+   if (first && (rv < 0) && ((errno == EINVAL) || (errno == EMSGSIZE))) {
+     /* Try the first packet again using host byte order. */
+--- a/dns.c
++++ b/dns.c
+@@ -49,7 +49,7 @@
+ #include <unistd.h>
+ #include <fcntl.h>
+ //#include <ctype.h>
+-//#include <string.h>
++#include <string.h>
+ #include <stdio.h>
+ #include <stdlib.h>
+ #include <signal.h>
+--- a/net.h
++++ b/net.h
+@@ -20,6 +20,7 @@
+ #include <netdb.h>
+ #include <arpa/inet.h>
+ #include <netinet/in.h>
++#include <sys/select.h>
+ #include <sys/socket.h>
+ #ifdef ENABLE_IPV6
+ #include <netinet/ip6.h>
index 6656806b5a32e1b70d43d8aeddaa6a41d59539ad..d74b15263ddeb43581c1d4eb0b40304e0072c904 100644 (file)
@@ -9,7 +9,7 @@ include $(TOPDIR)/rules.mk
 
 PKG_NAME:=luci-app-mwan3
 PKG_VERSION:=1.4
-PKG_RELEASE:=2
+PKG_RELEASE:=3
 PKG_MAINTAINER:=Aedan Renner <chipdankly@gmail.com>
 PKG_LICENSE:=GPLv2
 
index b8f6605832b9e2f443a8c360152f273706365c32..6e2875e3de7b3e246a6aab8a2e833d3db131db1d 100755 (executable)
@@ -13,7 +13,7 @@ send_alert()
 gather_event_info()
 {
        # create event information message
-       local EVENT_INFO="Interface [ "$INTERFACE" ($DEVICE) ] on router [ "$(uci get -p /var/state system.@system[0].hostname)" ] has triggered a hotplug [ "$ACTION" ] event on "$(date +"%a %b %d %Y %T %Z")""
+       local EVENT_INFO="Interface [ "$INTERFACE" ($DEVICE) ] on router [ "$(uci -p /var/state get system.@system[0].hostname)" ] has triggered a hotplug [ "$ACTION" ] event on "$(date +"%a %b %d %Y %T %Z")""
 
        # get current interface, policy and rule status
        local CURRENT_STATUS="$(/usr/sbin/mwan3 status)"
index d40ad0116d1d3cefcaa8fe14e2b47584eda1a53b..7fe4442c9a9b4bdfddc0a21b94557749e4c65819 100644 (file)
@@ -60,9 +60,9 @@ function index()
 end
 
 function getInterfaceStatus(ruleNumber, interfaceName)
-       if ut.trim(sys.exec("uci get -p /var/state mwan3." .. interfaceName .. ".enabled")) == "1" then
+       if ut.trim(sys.exec("uci -p /var/state get mwan3." .. interfaceName .. ".enabled")) == "1" then
                if ut.trim(sys.exec("ip route list table " .. ruleNumber)) ~= "" then
-                       if ut.trim(sys.exec("uci get -p /var/state mwan3." .. interfaceName .. ".track_ip")) ~= "" then
+                       if ut.trim(sys.exec("uci -p /var/state get mwan3." .. interfaceName .. ".track_ip")) ~= "" then
                                return "online"
                        else
                                return "notMonitored"
@@ -98,7 +98,7 @@ function interfaceStatus()
                wansid = {}
 
                for wanName, interfaceState in string.gfind(statusString, "([^%[]+)%[([^%]]+)%]") do
-                       local wanInterfaceName = ut.trim(sys.exec("uci get -p /var/state network." .. wanName .. ".ifname"))
+                       local wanInterfaceName = ut.trim(sys.exec("uci -p /var/state get network." .. wanName .. ".ifname"))
                                if wanInterfaceName == "" then
                                        wanInterfaceName = "X"
                                end
@@ -159,7 +159,7 @@ function diagnosticsData(interface, tool, task)
                        results = "MWAN3 started"
                end
        else
-               local interfaceDevice = ut.trim(sys.exec("uci get -p /var/state network." .. interface .. ".ifname"))
+               local interfaceDevice = ut.trim(sys.exec("uci -p /var/state get network." .. interface .. ".ifname"))
                if interfaceDevice ~= "" then
                        if tool == "ping" then
                                local gateway = ut.trim(sys.exec("route -n | awk '{if ($8 == \"" .. interfaceDevice .. "\" && $1 == \"0.0.0.0\" && $3 == \"0.0.0.0\") print $2}'"))
@@ -168,7 +168,7 @@ function diagnosticsData(interface, tool, task)
                                                local pingCommand = "ping -c 3 -W 2 -I " .. interfaceDevice .. " " .. gateway
                                                results = pingCommand .. "\n\n" .. sys.exec(pingCommand)
                                        else
-                                               local tracked = ut.trim(sys.exec("uci get -p /var/state mwan3." .. interface .. ".track_ip"))
+                                               local tracked = ut.trim(sys.exec("uci -p /var/state get mwan3." .. interface .. ".track_ip"))
                                                if tracked ~= "" then
                                                        for z in tracked:gmatch("[^ ]+") do
                                                                local pingCommand = "ping -c 3 -W 2 -I " .. interfaceDevice .. " " .. z
@@ -223,16 +223,18 @@ function diagnosticsData(interface, tool, task)
 end
 
 function troubleshootingData()
+       local ver = require "luci.version"
+
        local mArray = {}
 
        -- software versions
-       local wrtRelease = ut.trim(luci.version.distversion)
+       local wrtRelease = ut.trim(ver.distversion)
                if wrtRelease ~= "" then
                        wrtRelease = "OpenWrt - " .. wrtRelease
                else
                        wrtRelease = "OpenWrt - unknown"
                end
-       local luciRelease = ut.trim(luci.version.luciversion)
+       local luciRelease = ut.trim(ver.luciversion)
                if luciRelease ~= "" then
                        luciRelease = "\nLuCI - " .. luciRelease
                else
@@ -300,7 +302,7 @@ function troubleshootingData()
        mArray.routelist = { routeString }
 
        -- default firewall output policy
-       local firewallOut = ut.trim(sys.exec("uci get -p /var/state firewall.@defaults[0].output"))
+       local firewallOut = ut.trim(sys.exec("uci -p /var/state get firewall.@defaults[0].output"))
                if firewallOut == "" then
                        firewallOut = "No data found"
                end
index 5b31390b660cfea5bae7d042db459de76178381a..a8e68a01be84b059112792db9345e0f77906ede2 100644 (file)
@@ -6,7 +6,7 @@ function interfaceCheck() -- find issues with too many interfaces, reliability a
                        local interfaceName = section[".name"]
                        interfaceNumber = interfaceNumber+1 -- count number of mwan interfaces configured
                        -- create list of metrics for none and duplicate checking
-                       local metricValue = ut.trim(sys.exec("uci get -p /var/state network." .. interfaceName .. ".metric"))
+                       local metricValue = ut.trim(sys.exec("uci -p /var/state get network." .. interfaceName .. ".metric"))
                        if metricValue == "" then
                                errorFound = 1
                                errorNoMetricList = errorNoMetricList .. interfaceName .. " "
@@ -14,17 +14,17 @@ function interfaceCheck() -- find issues with too many interfaces, reliability a
                                metricList = metricList .. interfaceName .. " " .. metricValue .. "\n"
                        end
                        -- check if any interfaces have a higher reliability requirement than tracking IPs configured
-                       local trackingNumber = tonumber(ut.trim(sys.exec("echo $(uci get -p /var/state mwan3." .. interfaceName .. ".track_ip) | wc -w")))
+                       local trackingNumber = tonumber(ut.trim(sys.exec("echo $(uci -p /var/state get mwan3." .. interfaceName .. ".track_ip) | wc -w")))
                        if trackingNumber > 0 then
-                               local reliabilityNumber = tonumber(ut.trim(sys.exec("uci get -p /var/state mwan3." .. interfaceName .. ".reliability")))
+                               local reliabilityNumber = tonumber(ut.trim(sys.exec("uci -p /var/state get mwan3." .. interfaceName .. ".reliability")))
                                if reliabilityNumber and reliabilityNumber > trackingNumber then
                                        errorFound = 1
                                        errorReliabilityList = errorReliabilityList .. interfaceName .. " "
                                end
                        end
                        -- check if any interfaces are not properly configured in /etc/config/network or have no default route in main routing table
-                       if ut.trim(sys.exec("uci get -p /var/state network." .. interfaceName)) == "interface" then
-                               local interfaceDevice = ut.trim(sys.exec("uci get -p /var/state network." .. interfaceName .. ".ifname"))
+                       if ut.trim(sys.exec("uci -p /var/state get network." .. interfaceName)) == "interface" then
+                               local interfaceDevice = ut.trim(sys.exec("uci -p /var/state get network." .. interfaceName .. ".ifname"))
                                if interfaceDevice == "uci: Entry not found" or interfaceDevice == "" then
                                        errorFound = 1
                                        errorNetConfigList = errorNetConfigList .. interfaceName .. " "
@@ -220,7 +220,7 @@ up = mwan_interface:option(DummyValue, "up", translate("Interface up"))
 metric = mwan_interface:option(DummyValue, "metric", translate("Metric"))
        metric.rawhtml = true
        function metric.cfgvalue(self, s)
-               local metricValue = sys.exec("uci get -p /var/state network." .. s .. ".metric")
+               local metricValue = sys.exec("uci -p /var/state get network." .. s .. ".metric")
                if metricValue ~= "" then
                        return metricValue
                else
index 16a7ec394e9886c46331057ea398064ea9f9a0dd..387ff01a8d8a17099a6eeac2a9d626c631799c6d 100644 (file)
@@ -1,13 +1,13 @@
 -- ------ extra functions ------ --
 
 function interfaceCheck()
-       metricValue = ut.trim(sys.exec("uci get -p /var/state network." .. arg[1] .. ".metric"))
+       metricValue = ut.trim(sys.exec("uci -p /var/state get network." .. arg[1] .. ".metric"))
        if metricValue == "" then -- no metric
                errorNoMetric = 1
        else -- if metric exists create list of interface metrics to compare against for duplicates
                uci.cursor():foreach("mwan3", "interface",
                        function (section)
-                               local metricValue = ut.trim(sys.exec("uci get -p /var/state network." .. section[".name"] .. ".metric"))
+                               local metricValue = ut.trim(sys.exec("uci -p /var/state get network." .. section[".name"] .. ".metric"))
                                metricList = metricList .. section[".name"] .. " " .. metricValue .. "\n"
                        end
                )
@@ -22,16 +22,16 @@ function interfaceCheck()
                end
        end
        -- check if this interface has a higher reliability requirement than track IPs configured
-       local trackingNumber = tonumber(ut.trim(sys.exec("echo $(uci get -p /var/state mwan3." .. arg[1] .. ".track_ip) | wc -w")))
+       local trackingNumber = tonumber(ut.trim(sys.exec("echo $(uci -p /var/state get mwan3." .. arg[1] .. ".track_ip) | wc -w")))
        if trackingNumber > 0 then
-               local reliabilityNumber = tonumber(ut.trim(sys.exec("uci get -p /var/state mwan3." .. arg[1] .. ".reliability")))
+               local reliabilityNumber = tonumber(ut.trim(sys.exec("uci -p /var/state get mwan3." .. arg[1] .. ".reliability")))
                if reliabilityNumber and reliabilityNumber > trackingNumber then
                        errorReliability = 1
                end
        end
        -- check if any interfaces are not properly configured in /etc/config/network or have no default route in main routing table
-       if ut.trim(sys.exec("uci get -p /var/state network." .. arg[1])) == "interface" then
-               local interfaceDevice = ut.trim(sys.exec("uci get -p /var/state network." .. arg[1] .. ".ifname"))
+       if ut.trim(sys.exec("uci -p /var/state get network." .. arg[1])) == "interface" then
+               local interfaceDevice = ut.trim(sys.exec("uci -p /var/state get network." .. arg[1] .. ".ifname"))
                if interfaceDevice == "uci: Entry not found" or interfaceDevice == "" then
                        errorNetConfig = 1
                        errorRoute = 1
index cbd8bdd03ed2b2d97e46e678914e040cef3b7677..a22e01054c05cc255d14466de2ec84fd13d98653 100644 (file)
@@ -3,10 +3,10 @@
 function ruleCheck() -- determine if rules needs a proper protocol configured
        uci.cursor():foreach("mwan3", "rule",
                function (section)
-                       local sourcePort = ut.trim(sys.exec("uci get -p /var/state mwan3." .. section[".name"] .. ".src_port"))
-                       local destPort = ut.trim(sys.exec("uci get -p /var/state mwan3." .. section[".name"] .. ".dest_port"))
+                       local sourcePort = ut.trim(sys.exec("uci -p /var/state get mwan3." .. section[".name"] .. ".src_port"))
+                       local destPort = ut.trim(sys.exec("uci -p /var/state get mwan3." .. section[".name"] .. ".dest_port"))
                        if sourcePort ~= "" or destPort ~= "" then -- ports configured
-                               local protocol = ut.trim(sys.exec("uci get -p /var/state mwan3." .. section[".name"] .. ".proto"))
+                               local protocol = ut.trim(sys.exec("uci -p /var/state get mwan3." .. section[".name"] .. ".proto"))
                                if protocol == "" or protocol == "all" then -- no or improper protocol
                                        error_protocol_list = error_protocol_list .. section[".name"] .. " "
                                end
index d880a72e2979eb18e715481ffcb027a722ffef7a..f7fb341e1f991dcd0772d3169f150402123cc2a5 100644 (file)
@@ -1,10 +1,10 @@
 -- ------ extra functions ------ --
 
 function ruleCheck() -- determine if rule needs a protocol specified
-       local sourcePort = ut.trim(sys.exec("uci get -p /var/state mwan3." .. arg[1] .. ".src_port"))
-       local destPort = ut.trim(sys.exec("uci get -p /var/state mwan3." .. arg[1] .. ".dest_port"))
+       local sourcePort = ut.trim(sys.exec("uci -p /var/state get mwan3." .. arg[1] .. ".src_port"))
+       local destPort = ut.trim(sys.exec("uci -p /var/state get mwan3." .. arg[1] .. ".dest_port"))
        if sourcePort ~= "" or destPort ~= "" then -- ports configured
-               local protocol = ut.trim(sys.exec("uci get -p /var/state mwan3." .. arg[1] .. ".proto"))
+               local protocol = ut.trim(sys.exec("uci -p /var/state get mwan3." .. arg[1] .. ".proto"))
                if protocol == "" or protocol == "all" then -- no or improper protocol
                        error_protocol = 1
                end
index 38d038035fd58567c6ee3eae2c5cbe85e7856e13..2bf4ca1f06ba84f224e3dd3d84facd0bbf26aef7 100644 (file)
@@ -122,6 +122,7 @@ SNMP_MIB_MODULES_INCLUDED = \
        ucd-snmp/loadave \
        ucd-snmp/memory \
        ucd-snmp/pass \
+       ucd-snmp/pass_persist \
        ucd-snmp/proc \
        ucd-snmp/vmstat \
        util_funcs \
diff --git a/net/netperf/Makefile b/net/netperf/Makefile
new file mode 100644 (file)
index 0000000..4d7ea00
--- /dev/null
@@ -0,0 +1,49 @@
+#
+# Copyright (C) 2006-2011 OpenWrt.org
+#
+# This is free software, licensed under the GNU General Public License v2.
+# See /LICENSE for more information.
+#
+
+include $(TOPDIR)/rules.mk
+
+PKG_NAME:=netperf
+PKG_VERSION:=2.6.0
+PKG_RELEASE:=1
+PKG_LICENSE:=Custom
+
+PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.bz2
+PKG_SOURCE_URL:=ftp://ftp.netperf.org/netperf/
+PKG_MD5SUM:=9654ffdfd4c4f2c93ce3733cd9ed9236
+
+include $(INCLUDE_DIR)/package.mk
+
+define Package/netperf
+  SECTION:=net
+  CATEGORY:=Network
+  TITLE:=Network performance measurement tool
+  URL:=http://www.netperf.org/
+  MAINTAINER:=Toke Høiland-Jørgensen <toke@toke.dk>
+endef
+
+CONFIGURE_ARGS += --enable-demo
+
+define Package/netperf/install
+       $(INSTALL_DIR) $(1)/etc/init.d
+       $(INSTALL_BIN) ./files/netserver.init $(1)/etc/init.d/netserver
+       $(INSTALL_DIR) $(1)/usr/bin
+       $(INSTALL_BIN) $(PKG_BUILD_DIR)/src/netperf $(1)/usr/bin/
+       $(INSTALL_BIN) $(PKG_BUILD_DIR)/src/netserver $(1)/usr/bin/
+       $(INSTALL_DIR) $(1)/lib/netperf
+       $(INSTALL_BIN) $(PKG_BUILD_DIR)/doc/examples/arr_script $(1)/lib/netperf
+       $(INSTALL_BIN) $(PKG_BUILD_DIR)/doc/examples/packet_byte_script $(1)/lib/netperf
+       $(INSTALL_BIN) $(PKG_BUILD_DIR)/doc/examples/sctp_stream_script $(1)/lib/netperf
+       $(INSTALL_BIN) $(PKG_BUILD_DIR)/doc/examples/snapshot_script $(1)/lib/netperf
+       $(INSTALL_BIN) $(PKG_BUILD_DIR)/doc/examples/tcp_range_script $(1)/lib/netperf
+       $(INSTALL_BIN) $(PKG_BUILD_DIR)/doc/examples/tcp_rr_script $(1)/lib/netperf
+       $(INSTALL_BIN) $(PKG_BUILD_DIR)/doc/examples/tcp_stream_script $(1)/lib/netperf
+       $(INSTALL_BIN) $(PKG_BUILD_DIR)/doc/examples/udp_rr_script $(1)/lib/netperf
+       $(INSTALL_BIN) $(PKG_BUILD_DIR)/doc/examples/udp_stream_script $(1)/lib/netperf
+endef
+
+$(eval $(call BuildPackage,netperf))
diff --git a/net/netperf/files/netserver.init b/net/netperf/files/netserver.init
new file mode 100644 (file)
index 0000000..42fcf33
--- /dev/null
@@ -0,0 +1,12 @@
+#!/bin/sh /etc/rc.common
+# Copyright (C) 2006-2011 OpenWrt.org
+
+START=50
+
+start() {
+       service_start /usr/bin/netserver
+}
+
+stop() {
+       service_stop /usr/bin/netserver
+}
diff --git a/net/netperf/patches/001-musl-fix.patch b/net/netperf/patches/001-musl-fix.patch
new file mode 100644 (file)
index 0000000..6774c48
--- /dev/null
@@ -0,0 +1,12 @@
+diff --git a/src/netrt_rtnetlink.c b/src/netrt_rtnetlink.c
+index 10e4750..318c0c2 100644
+--- a/src/netrt_rtnetlink.c
++++ b/src/netrt_rtnetlink.c
+@@ -5,7 +5,6 @@
+ #include <stdio.h>
+ #include <stdlib.h>
+ #include <string.h>
+-#include <bits/sockaddr.h>
+ #include <asm/types.h>
+ #include <linux/rtnetlink.h>
+ #include <netinet/in.h>
diff --git a/net/ngircd/Makefile b/net/ngircd/Makefile
new file mode 100644 (file)
index 0000000..a431cd9
--- /dev/null
@@ -0,0 +1,109 @@
+#
+# Copyright (C) 2008-2015 OpenWrt.org
+#
+# This is free software, licensed under the GNU General Public License v2.
+# See /LICENSE for more information.
+#
+
+include $(TOPDIR)/rules.mk
+
+PKG_NAME:=ngircd
+PKG_VERSION:=22.1
+PKG_RELEASE:=1
+PKG_MAINTAINER:=Claudio Leite <leitec@staticky.com>
+PKG_LICENSE:=GPL-2.0
+PKG_LICENSE_FILES:=COPYING
+
+PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
+PKG_SOURCE_URL:= \
+        http://ngircd.barton.de/pub/ngircd/ \
+        ftp://ftp.berlios.de/pub/ngircd/
+PKG_MD5SUM:=586c4fef1fbb77dcbe723e9136ec08eb
+
+PKG_INSTALL:=1
+
+PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)-$(BUILD_VARIANT)/$(PKG_NAME)-$(PKG_VERSION)
+
+include $(INCLUDE_DIR)/package.mk
+
+define Package/ngircd/Default
+  SECTION:=net
+  CATEGORY:=Network
+  SUBMENU:=Instant Messaging
+  DEPENDS:=+zlib
+  TITLE:=Next Generation IRC Server
+  URL:=http://ngircd.barton.de
+endef
+
+define Package/ngircd/Default/description
+  ngIRCd is an Open Source server for the Internet Relay Chat (IRC), which
+  is developed and published under the terms of the GNU General Public Licence.
+  ngIRCd means "next generation IRC daemon", it's written from scratch and
+  not deduced from the "grandfather of IRC daemons", the daemon of the IRCNet.
+endef
+
+define Package/ngircd
+  $(call Package/ngircd/Default)
+  TITLE+= (with OpenSSL support)
+  DEPENDS+= +libopenssl
+  VARIANT:=ssl
+endef
+
+define Package/ngircd/conffiles
+/etc/ngircd.conf
+endef
+
+define Package/ngircd/description
+  $(call Package/ngircd/Default/description)
+  This package is built with OpenSSL support.
+endef
+
+define Package/ngircd-nossl
+$(call Package/ngircd/Default)
+  TITLE+= (without OpenSSL support)
+  VARIANT:=nossl
+endef
+
+Package/ngircd-nossl/conffiles = $(Package/ngircd/conffiles)
+
+define Package/ngircd-nossl/description
+  $(call Package/ngircd/Default/description)
+  This package is built without OpenSSL support.
+endef
+
+ifeq ($(CONFIG_IPV6),y)
+       CONFIGURE_ARGS += \
+               --enable-ipv6
+endif
+
+ifeq ($(BUILD_VARIANT),ssl)
+       CONFIGURE_ARGS += \
+               --with-openssl="$(STAGING_DIR)/usr"
+endif
+
+ifeq ($(BUILD_VARIANT),nossl)
+       CONFIGURE_ARGS += \
+               --without-openssl
+endif
+
+# The test for HAVE_WORKING_GETADDRINFO fails
+# when cross-compiling.
+#
+define Build/Configure
+       $(call Build/Configure/Default)
+       $(SED) 's/\/\* #undef HAVE_WORKING_GETADDRINFO \*\//#define HAVE_WORKING_GETADDRINFO 1/' $(PKG_BUILD_DIR)/src/config.h
+endef
+
+define Package/ngircd/install
+       $(INSTALL_DIR) $(1)/usr/sbin
+       $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/sbin/ngircd $(1)/usr/sbin/
+       $(INSTALL_DIR) $(1)/etc
+       $(INSTALL_CONF) $(PKG_INSTALL_DIR)/etc/ngircd.conf $(1)/etc/
+       $(INSTALL_DIR) $(1)/etc/init.d
+       $(INSTALL_BIN) ./files/ngircd.init $(1)/etc/init.d/ngircd
+endef
+
+Package/ngircd-nossl/install = $(Package/ngircd/install)
+
+$(eval $(call BuildPackage,ngircd))
+$(eval $(call BuildPackage,ngircd-nossl))
diff --git a/net/ngircd/files/ngircd.init b/net/ngircd/files/ngircd.init
new file mode 100644 (file)
index 0000000..6a21358
--- /dev/null
@@ -0,0 +1,11 @@
+#!/bin/sh /etc/rc.common
+
+START=65
+
+start() {
+       service_start /usr/sbin/ngircd
+}
+
+stop() {
+       service_stop /usr/sbin/ngircd
+}
index b9c9706cb0cd256e0a411dc36e0f3402a697983b..787e77955b5330572654dd89e0aed697e6f24cc3 100644 (file)
@@ -9,7 +9,7 @@ include $(TOPDIR)/rules.mk
 
 PKG_NAME:=ntp
 PKG_VERSION:=4.2.8p2
-PKG_RELEASE:=2
+PKG_RELEASE:=3
 
 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
 PKG_SOURCE_URL:=http://www.eecis.udel.edu/~ntp/ntp_spool/ntp4/ntp-4.2/
@@ -93,7 +93,9 @@ endef
 CONFIGURE_VARS += \
        ac_cv_header_md5_h=no \
        ac_cv_lib_rt_sched_setscheduler=no \
-       ac_cv_header_dns_sd_h=no
+       ac_cv_header_dns_sd_h=no \
+       hw_cv_func_snprintf_c99=yes \
+       hw_cv_func_vsnprintf_c99=yes \
 
 CONFIGURE_ARGS += \
        --disable-all-clocks \
index 3941e2fc0e7ca081e3986f13987a33eb2079dbdb..7828a25ca49f5c1ebb362233e7df131a7487a126 100644 (file)
@@ -10,12 +10,16 @@ include $(TOPDIR)/rules.mk
 
 PKG_NAME:=ntripcaster
 PKG_VERSION:=0.1.5
-PKG_RELEASE:=1
-PKG_LICENSE:=GPL-2.0+
 
-PKG_SOURCE:=$(PKG_NAME)$(PKG_VERSION).zip
-PKG_SOURCE_URL:=http://igs.bkg.bund.de/root_ftp/NTRIP/software/
-PKG_MD5SUM:=8c85a6c31d8c5cdf2638fe103207a1fd
+PKG_RELEASE=$(PKG_SOURCE_VERSION)
+
+PKG_SOURCE_PROTO:=git
+PKG_SOURCE_URL:=https://github.com/nunojpg/ntripcaster.git
+PKG_SOURCE_SUBDIR:=$(PKG_NAME)-$(PKG_VERSION)
+PKG_SOURCE_VERSION:=03878920195cf854b38a1ea424f1cae57353fa87
+PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION)-$(PKG_SOURCE_VERSION).tar.gz
+
+PKG_LICENSE:=GPL-2.0+
 
 PKG_MAINTAINER:=Nuno Goncalves <nunojpg@gmail.com>
 
@@ -34,19 +38,12 @@ define Package/ntripcaster/description
   BKG Standard Ntrip Broadcaster
 endef
 
-define Build/Prepare
-       mkdir -p $(PKG_BUILD_DIR)
-       unzip $(DL_DIR)/$(PKG_SOURCE) -d $(PKG_BUILD_DIR)
-       mv $(PKG_BUILD_DIR)/$(PKG_NAME)$(PKG_VERSION)/* $(PKG_BUILD_DIR)
-       chmod +x $(PKG_BUILD_DIR)/configure
-endef
-
 define Package/ntripcaster/install
-       $(INSTALL_DIR) $(1)/usr/local/ntripcaster/bin
-       $(INSTALL_BIN) $(PKG_BUILD_DIR)/src/ntripcaster $(1)/usr/local/ntripcaster/bin/
-       $(INSTALL_DIR) $(1)/usr/local/ntripcaster/conf
-       $(INSTALL_DATA) $(PKG_BUILD_DIR)/conf/ntripcaster.conf.dist $(1)/usr/local/ntripcaster/conf/
-       $(INSTALL_DATA) $(PKG_BUILD_DIR)/conf/sourcetable.dat.dist $(1)/usr/local/ntripcaster/conf/
+       $(INSTALL_DIR) $(1)/usr/bin
+       $(INSTALL_BIN) $(PKG_BUILD_DIR)/src/ntripcaster $(1)/usr/bin/
+       $(INSTALL_DIR) $(1)/usr/share/ntripcaster/conf
+       $(INSTALL_DATA) $(PKG_BUILD_DIR)/conf/ntripcaster.conf.dist $(1)/usr/share/ntripcaster/conf/
+       $(INSTALL_DATA) $(PKG_BUILD_DIR)/conf/sourcetable.dat.dist $(1)/usr/share/ntripcaster/conf/
 endef
 
 $(eval $(call BuildPackage,ntripcaster))
index 249f75ba21a1a182f5ddd5d5e387db1d38d905e1..f0d92d58e8aa99ad18035bf4afa58f1eef13bedf 100644 (file)
@@ -1,6 +1,6 @@
 #
 # Copyright (C) 2011 segal.ubi.pt
-# Copyright (C) 2010-2014 OpenWrt.org
+# Copyright (C) 2010-2015 OpenWrt.org
 #
 # This is free software, licensed under the GNU General Public License v2.
 # See /LICENSE for more information.
@@ -10,12 +10,16 @@ include $(TOPDIR)/rules.mk
 
 PKG_NAME:=ntripclient
 PKG_VERSION:=1.5.0
-PKG_RELEASE:=2
-PKG_LICENSE:=GPL-2.0+
 
-PKG_SOURCE:=$(PKG_NAME).zip
-PKG_SOURCE_URL:=http://igs.bkg.bund.de/root_ftp/NTRIP/software/
-PKG_MD5SUM:=4b357fa648d74e4e13c4b5a2a39f5624
+PKG_RELEASE=$(PKG_SOURCE_VERSION)
+
+PKG_SOURCE_PROTO:=git
+PKG_SOURCE_URL:=https://github.com/nunojpg/ntripclient.git
+PKG_SOURCE_SUBDIR:=$(PKG_NAME)-$(PKG_VERSION)
+PKG_SOURCE_VERSION:=dcfb2cb3e6f31b7291a94e7f86379c78ffc0d44e
+PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION)-$(PKG_SOURCE_VERSION).tar.gz
+
+PKG_LICENSE:=GPL-2.0+
 
 PKG_MAINTAINER:=Nuno Goncalves <nunojpg@gmail.com>
 
@@ -33,11 +37,6 @@ define Package/ntripclient/description
   Ntrip Version 2.0 Command Line Client, reading from Ntrip Version 1.0 or 2.0 Caster
 endef
 
-define Build/Prepare
-       mkdir -p $(PKG_BUILD_DIR)
-       unzip $(DL_DIR)/$(PKG_SOURCE) -d $(PKG_BUILD_DIR)
-endef
-
 MAKE_FLAGS += \
        OPTS="$(TARGET_CFLAGS)"
 
diff --git a/net/ntripclient/patches/100-musl-compat.patch b/net/ntripclient/patches/100-musl-compat.patch
new file mode 100644 (file)
index 0000000..10f690f
--- /dev/null
@@ -0,0 +1,10 @@
+--- a/ntripclient.c
++++ b/ntripclient.c
+@@ -44,6 +44,7 @@
+   #include <fcntl.h>
+   #include <unistd.h>
+   #include <arpa/inet.h>
++  #include <sys/select.h>
+   #include <sys/socket.h>
+   #include <netinet/in.h>
+   #include <netdb.h>
index 1bb0e873df974211d1ba7f3b96144db782ff5a5c..a3e3cf978c3f66fc51848d8fd13d7b428f6c91fb 100644 (file)
@@ -10,12 +10,16 @@ include $(TOPDIR)/rules.mk
 
 PKG_NAME:=ntripserver
 PKG_VERSION:=1.5.1
-PKG_RELEASE:=2
-PKG_LICENSE:=GPL-2.0+
 
-PKG_SOURCE:=$(PKG_NAME).zip
-PKG_SOURCE_URL:=http://igs.bkg.bund.de/root_ftp/NTRIP/software/
-PKG_MD5SUM:=cecff5da0173896df041bd889935fc12
+PKG_RELEASE=$(PKG_SOURCE_VERSION)
+
+PKG_SOURCE_PROTO:=git
+PKG_SOURCE_URL:=https://github.com/nunojpg/ntripserver.git
+PKG_SOURCE_SUBDIR:=$(PKG_NAME)-$(PKG_VERSION)
+PKG_SOURCE_VERSION:=c3034ab575e8442222eb8c2ee9e224cac99cfa6d
+PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION)-$(PKG_SOURCE_VERSION).tar.gz
+
+PKG_LICENSE:=GPL-2.0+
 
 PKG_MAINTAINER:=Nuno Goncalves <nunojpg@gmail.com>
 
@@ -30,17 +34,13 @@ define Package/ntripserver
 endef
 
 define Package/ntripserver/description
-  Ntrip Version 2.0 Command Line Server, reading from SISNeT Server, TCP/UDP IP Port, Serial port, or NtripCaster to support an Ntrip Version 1.0 or 2.0 Caster
+  Ntrip Version 2.0 Command Line Server, reading from SISNeT Server, TCP/UDP IP
+  Port, Serial port, or NtripCaster to support an Ntrip Version 1.0 or 2.0 Caster
 endef
 
 MAKE_FLAGS += \
        OPTS="$(TARGET_CFLAGS)"
 
-define Build/Prepare
-       mkdir -p $(PKG_BUILD_DIR)
-       unzip $(DL_DIR)/$(PKG_SOURCE) -d $(PKG_BUILD_DIR)
-endef
-
 define Package/ntripserver/install
        $(INSTALL_DIR) $(1)/usr/bin
        $(INSTALL_BIN) $(PKG_BUILD_DIR)/ntripserver $(1)/usr/bin/
index a59e9dc0d6497693e230fb62f51849c9c54628fc..6845aed8d30246a550fcbf9553c2ee55254daffe 100644 (file)
@@ -8,14 +8,14 @@
 include $(TOPDIR)/rules.mk
 
 PKG_NAME:=ocserv
-PKG_VERSION:=0.10.5
-PKG_RELEASE:=2
+PKG_VERSION:=0.10.6
+PKG_RELEASE:=1
 PKG_USE_MIPS16:=0
 
 PKG_BUILD_DIR :=$(BUILD_DIR)/$(PKG_NAME)-$(PKG_VERSION)
 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.xz
 PKG_SOURCE_URL:=ftp://ftp.infradead.org/pub/ocserv/
-PKG_MD5SUM:=17ee861f352d6ef7cd33114819b215ba
+PKG_MD5SUM:=b99c74b781a180348f3a3240940fc838
 
 PKG_LICENSE:=GPLv2
 PKG_LICENSE_FILES:=COPYING
index 961f33e4efb272698d4079bb95e91ecd51884ba0..9d000ccc82d45eab01b309e799d123e4fba62c37 100644 (file)
@@ -1,5 +1,10 @@
 The openconnect server expects to be configured using the uci interface.
 
+It is recommended to setup a dynamic DNS address with openwrt prior
+to starting the server. That is because during the first startup
+a certificate file which contain the setup dynamic DNS name will be
+created.
+
 To setup a server the provides access to LAN with network address
 10.100.2.0/255.255.255.0 using the VPN address range
 10.100.3.0/255.255.255.0 add the following to /etc/config/ocserv:
@@ -65,6 +70,20 @@ config forwarding
 config forwarding
         option dest 'vpn'
         option src 'lan'
+
+config rule
+        option target 'ACCEPT'
+        option src 'wan'
+        option proto 'tcp'
+        option dest_port '4443'
+        option name 'vpn'
+
+config rule
+        option target 'ACCEPT'
+        option src 'wan'
+        option proto 'udp'
+        option dest_port '4443'
+        option name 'vpn'
 -----------------------------------------------------------------
 
 
index 0af8176b40b7cdafdebfed61c0da851c3b6ce81b..c2284aab1bd9ddfee804fcd48e81eb1b6dd5faa6 100644 (file)
@@ -1,5 +1,5 @@
 #
-# Copyright (C) 2006-2011 OpenWrt.org
+# Copyright (C) 2006-2015 OpenWrt.org
 # Copyright (C) 2015 Christian Beier <dontmind@freeshell.org>
 #
 # This is free software, licensed under the GNU General Public License v2.
@@ -9,13 +9,13 @@
 include $(TOPDIR)/rules.mk
 
 PKG_NAME:=ola
-PKG_VERSION:=0.9.3
+PKG_VERSION:=0.9.7
 PKG_RELEASE:=1
 
 PKG_SOURCE_PROTO:=git
 PKG_SOURCE_URL:=https://github.com/OpenLightingProject/ola.git
 PKG_SOURCE_SUBDIR:=$(PKG_NAME)-$(PKG_VERSION)
-PKG_SOURCE_VERSION:=d949ab88ab2c12d4d94b50a0a0df633d634f08fd
+PKG_SOURCE_VERSION:=2a306e4f0221fea9f4833ba04b042e72c6f10cd3
 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION)-$(PKG_SOURCE_VERSION).tar.gz
 PKG_LICENSE:=LGPL-2.1+
 
@@ -25,34 +25,36 @@ PKG_INSTALL:=1
 PKG_BUILD_PARALLEL:=1
 PKG_USE_MIPS16:=0
 
-PKG_BUILD_DEPENDS:=protobuf/host ola/host
+HOST_BUILD_DEPENDS:=protobuf/host
+PKG_BUILD_DEPENDS:=ola/host
 
+include $(INCLUDE_DIR)/host-build.mk
 include $(INCLUDE_DIR)/package.mk
 
-
 define Package/ola
   SECTION:=net
   CATEGORY:=Network
   TITLE:=Open Lighting Architecture Daemon
   URL:=https://www.openlighting.org/
   MAINTAINER:=Christian Beier <dontmind@freeshell.org>
-  DEPENDS:=+protobuf +libusb-1.0 +libuuid +libstdcpp +libpthread +librt +zlib +libncurses +sudo @BROKEN
+  DEPENDS:=+protobuf +libusb-1.0 +libuuid +libstdcpp +libpthread +librt +zlib +libncurses +sudo
 endef
 
 define Package/ola/description
-  OLA (Open Lighting Architecture) is a framework that allows applications to 
+  OLA (Open Lighting Architecture) is a framework that allows applications to
   send and receive DMX512, using various hardware devices and 'DMX over IP'
   protocols. It enables software controllers talk to DMX hardware.
 endef
 
+CONFIGURE_ARGS += \
+       --disable-dependency-tracking \
+       --disable-static \
+       --disable-fatal-warnings \
+       --disable-unittests \
+       --disable-http \
+        --with-ola-protoc-plugin=$(HOST_BUILD_DIR)/protoc/ola_protoc_plugin
 
-include $(INCLUDE_DIR)/host-build.mk
-
-# When building the host part, disable as much as possible to speed up
-# the configure step and avoid missing host dependencies.
-# Stolen from http://git.buildroot.net/buildroot/commit/?id=66056a5179ef49f2ec10ba5d7fbd1a58863d1350
-define Host/Configure
-   $(call Host/Configure/Default,\
+HOST_CONFIGURE_ARGS += \
        --disable-all-plugins \
        --disable-slp \
        --disable-osc \
@@ -63,52 +65,38 @@ define Host/Configure
        --disable-examples \
        --disable-unittests \
        --disable-doxygen-html \
-       --disable-doxygen-doc)
-endef
+       --disable-doxygen-doc
 
 # only build the ola_protoc thingy
 define Host/Compile
        cd $(HOST_BUILD_DIR); \
-           $(MAKE) protoc/ola_protoc
+               $(MAKE) protoc/ola_protoc_plugin
 endef
 
-# only need ola_protoc
+# nothing to install for host part
 define Host/Install
-       $(INSTALL_DIR) $(STAGING_DIR_HOST)/bin
-       $(CP) $(HOST_BUILD_DIR)/protoc/ola_protoc $(STAGING_DIR_HOST)/bin/
-endef
-
-$(eval $(call HostBuild))
-
-
-
-define Build/Configure
-  $(call Build/Configure/Default,\
-       --disable-dependency-tracking \
-       --disable-static \
-       --disable-fatal-warnings \
-       --disable-unittests \
-       --disable-http  \
-       --with-ola-protoc=$(STAGING_DIR_HOST)/bin/ola_protoc)
 endef
 
 
 define Build/InstallDev
-       mkdir -p $(1)/usr/include
+       $(INSTALL_DIR) $(1)/usr/include
        $(CP) $(PKG_INSTALL_DIR)/usr/include/ola $(1)/usr/include/
-       mkdir -p $(1)/usr/include
        $(CP) $(PKG_INSTALL_DIR)/usr/include/olad $(1)/usr/include/
-       mkdir -p $(1)/usr/lib
+
+       $(INSTALL_DIR) $(1)/usr/lib
        $(CP) $(PKG_INSTALL_DIR)/usr/lib/*.so* $(1)/usr/lib/
 endef
 
 define Package/ola/install
        $(INSTALL_DIR) $(1)/usr/bin
        $(CP) $(PKG_INSTALL_DIR)/usr/bin/* $(1)/usr/bin
+
        $(INSTALL_DIR) $(1)/usr/lib
        $(CP) $(PKG_INSTALL_DIR)/usr/lib/*.so* $(1)/usr/lib
+
        $(INSTALL_DIR) $(1)/etc/init.d
        $(INSTALL_BIN) ./files/olad.init $(1)/etc/init.d/olad
+
        $(INSTALL_DIR) $(1)/usr/share/ola/pids
        $(CP) $(PKG_INSTALL_DIR)/usr/share/ola/pids/* $(1)/usr/share/ola/pids
 endef
@@ -117,12 +105,10 @@ define Package/ola/postinst
 #!/bin/sh
 
 # make sure the conf dir exists and is writeable by the group olad uses
-mkdir -p /etc/ola
-chgrp nogroup /etc/ola
-chmod 775 $(1)/etc/ola
-
-exit 0
+mkdir -p $${IPKG_INSTROOT}/etc/ola
+chgrp nogroup $${IPKG_INSTROOT}/etc/ola
+chmod 775 $${IPKG_INSTROOT}/etc/ola
 endef
 
-
+$(eval $(call HostBuild))
 $(eval $(call BuildPackage,ola))
index 9a0e1133344cb2f4f6453f758b3b9c5594852bf5..f1dff362de81d33baf7b82105bd838a2e0547374 100644 (file)
@@ -1,5 +1,5 @@
 #!/bin/sh /etc/rc.common
-# Copyright (C) 2009-2011 OpenWrt.org
+# Copyright (C) 2009-2015 OpenWrt.org
 # Copyright (C) 2015 Christian Beier <dontmind@freeshell.org>
 
 USE_PROCD=1
@@ -7,9 +7,8 @@ USE_PROCD=1
 START=90
 
 start_service() {
-    procd_open_instance
-    procd_set_param command sudo -u nobody /usr/bin/olad --syslog --log-level 3 --config-dir /etc/ola
-    procd_set_param respawn
-    procd_close_instance
+       procd_open_instance
+       procd_set_param command sudo -u nobody /usr/bin/olad --syslog --log-level 2 --config-dir /etc/ola
+       procd_set_param respawn
+       procd_close_instance
 }
-
diff --git a/net/ola/patches/001-include-endian_h.patch b/net/ola/patches/001-include-endian_h.patch
new file mode 100644 (file)
index 0000000..784f10c
--- /dev/null
@@ -0,0 +1,15 @@
+diff --git a/common/network/NetworkUtils.cpp b/common/network/NetworkUtils.cpp
+index 3914818..094a311 100644
+--- a/common/network/NetworkUtils.cpp
++++ b/common/network/NetworkUtils.cpp
+@@ -39,6 +39,10 @@ typedef uint32_t in_addr_t;
+ #include <resolv.h>
+ #endif
++#ifdef HAVE_ENDIAN_H
++#include <endian.h>
++#endif
++
+ #if defined(HAVE_LINUX_NETLINK_H) && defined(HAVE_LINUX_RTNETLINK_H)
+ #define USE_NETLINK_FOR_DEFAULT_ROUTE 1
+ #include <linux/netlink.h>
index 38ac391c1877e571af13847cb058533944f67626..d0547f92b48b7cdcd093175df52e151ff68e4f35 100644 (file)
@@ -9,7 +9,7 @@ include $(TOPDIR)/rules.mk
 
 PKG_NAME:=openconnect
 PKG_VERSION:=7.06
-PKG_RELEASE:=1
+PKG_RELEASE:=2
 PKG_USE_MIPS16:=0
 
 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
index 9b1e652bd7e12a3c81188718d055d9fa692c41e3..0152dfefd468bb5d9a1dcfd65732b74ab94bd69b 100755 (executable)
@@ -26,11 +26,12 @@ proto_openconnect_setup() {
        json_get_vars server port username serverhash authgroup password password2 interface token_mode token_secret os csd_wrapper
 
        grep -q tun /proc/modules || insmod tun
+       ifname="vpn-$config"
 
        logger -t openconnect "initializing..."
        serv_addr=
        for ip in $(resolveip -t 10 "$server"); do
-               ( proto_add_host_dependency "$config" "$ip" $interface )
+               ( proto_add_host_dependency "$interface" "$ip" "$ifname" )
                serv_addr=1
        done
        [ -n "$serv_addr" ] || {
@@ -42,7 +43,7 @@ proto_openconnect_setup() {
 
        [ -n "$port" ] && port=":$port"
 
-       cmdline="$server$port -i vpn-$config --non-inter --syslog --script /lib/netifd/vpnc-script"
+       cmdline="$server$port -i "$ifname" --non-inter --syslog --script /lib/netifd/vpnc-script"
 
        # migrate to standard config files
        [ -f "/etc/config/openconnect-user-cert-vpn-$config.pem" ] && mv "/etc/config/openconnect-user-cert-vpn-$config.pem" "/etc/openconnect/user-cert-vpn-$config.pem"
index 0d0639feefc13ec4c721effd4187ac566484d4a6..d1c50fd6faec62518c492346c2543f44ae8033bb 100644 (file)
@@ -1,58 +1,63 @@
 #!/bin/sh /etc/rc.common
-# Copyright (C) 2006 OpenWrt.org
+# Copyright (C) 2015 OpenWrt.org
 
 START=60
+USE_PROCD=1
+
 BIN=/usr/sbin/pptpd
-DEFAULT=/etc/default/$BIN
-RUN_D=/var/run
-PID_F=$RUN_D/$BIN.pid
 CONFIG=/var/etc/pptpd.conf
 CHAP_SECRETS=/var/etc/chap-secrets
 
+validate_login_section() {
+       uci_validate_section pptpd login "${1}" \
+               'username:string' \
+               'password:string'
+}
+
+validate_pptpd_section() {
+       uci_validate_section pptpd service "${1}" \
+               'enabled:uinteger' \
+               'localip:string' \
+               'remoteip:string'
+}
+
 setup_login() {
-       local section="$1"
+       validate_login_section "${1}" || {
+               echo "validation failed"
+               return 1
+       }
 
-       config_get username "$section" username
-       config_get password "$section" password
-       [ -n "$username" ] || return 0
-       [ -n "$password" ] || return 0
+       [ -n "${username}" ] || return 0
+       [ -n "${password}" ] || return 0
 
-       echo "$username pptp-server $password *" >> $CHAP_SECRETS
+       echo "${username} pptp-server ${password} *" >> $CHAP_SECRETS
 }
 
 setup_config() {
-       local section="$1"
+       validate_pptpd_section "${1}" || {
+               echo "validation failed"
+               return 1
+       }
 
-       config_get enabled "$section" enabled
        [ "$enabled" -eq 0 ] && return 1
 
        mkdir -p /var/etc
        cp /etc/pptpd.conf $CONFIG
 
-       config_get localip "$section" localip
-       config_get remoteip "$section" remoteip
        [ -n "$localip" ] && echo "localip  $localip" >> $CONFIG
        [ -n "$remoteip" ] && echo "remoteip  $remoteip" >> $CONFIG
-       return 0
-}
 
-start_pptpd() {
-       [ -f $DEFAULT ] && . $DEFAULT
-       mkdir -p $RUN_D
-       for m in arc4 sha1_generic slhc crc-ccitt ppp_generic ppp_async ppp_mppe; do
-               insmod $m >/dev/null 2>&1
-       done
-       ln -sfn $CHAP_SECRETS /etc/ppp/chap-secrets
-       service_start $BIN $OPTIONS -c $CONFIG
+       return 0
 }
 
-start() {
+start_service() {
        config_load pptpd
        setup_config pptpd || return
        config_foreach setup_login login
-       start_pptpd
-}
 
-stop() {
-       service_stop $BIN
+       ln -sfn $CHAP_SECRETS /etc/ppp/chap-secrets
+
+       procd_open_instance
+       procd_set_param command $BIN -c $CONFIG
+       procd_close_instance
 }
diff --git a/net/shadowsocks-client/patches/100-fortify-source-compat.patch b/net/shadowsocks-client/patches/100-fortify-source-compat.patch
new file mode 100644 (file)
index 0000000..e4e1538
--- /dev/null
@@ -0,0 +1,72 @@
+--- a/client.c
++++ b/client.c
+@@ -111,7 +111,7 @@ int client_do_local_read(int sockfd, str
+                       goto out;
+       }
+-      if (encrypt(sockfd, ln) == -1)
++      if (crypto_encrypt(sockfd, ln) == -1)
+               goto out;
+       ret = do_send(ln->server_sockfd, ln, "cipher", 0);
+@@ -172,7 +172,7 @@ int client_do_server_read(int sockfd, st
+               }
+       }
+-      if (decrypt(sockfd, ln) == -1)
++      if (crypto_decrypt(sockfd, ln) == -1)
+               goto out;
+       if (ln->state & SS_UDP) {
+--- a/crypto.c
++++ b/crypto.c
+@@ -185,7 +185,7 @@ err:
+       return -1;
+ }
+-int encrypt(int sockfd, struct link *ln)
++int crypto_encrypt(int sockfd, struct link *ln)
+ {
+       int len, cipher_len;
+       EVP_CIPHER_CTX *ctx_p;
+@@ -223,7 +223,7 @@ err:
+       return -1;
+ }
+-int decrypt(int sockfd, struct link *ln)
++int crypto_decrypt(int sockfd, struct link *ln)
+ {
+       int len, text_len;
+       EVP_CIPHER_CTX *ctx_p;
+--- a/crypto.h
++++ b/crypto.h
+@@ -15,7 +15,7 @@ extern int iv_len;
+ int crypto_init(char *key, char *method);
+ void crypto_exit(void);
+-int encrypt(int sockfd, struct link *ln);
+-int decrypt(int sockfd, struct link *ln);
++int crypto_encrypt(int sockfd, struct link *ln);
++int crypto_decrypt(int sockfd, struct link *ln);
+ #endif
+--- a/server.c
++++ b/server.c
+@@ -36,7 +36,7 @@ int server_do_remote_read(int sockfd, st
+                       goto out;
+       }
+-      if (encrypt(sockfd, ln) == -1)
++      if (crypto_encrypt(sockfd, ln) == -1)
+               goto out;
+       ret = do_send(ln->local_sockfd, ln, "cipher", 0);
+@@ -91,7 +91,7 @@ int server_do_local_read(int sockfd, str
+               }
+       }
+-      if (decrypt(sockfd, ln) == -1)
++      if (crypto_decrypt(sockfd, ln) == -1)
+               goto out;
+       if (ln->state & SS_UDP) {
diff --git a/net/shadowsocks-libev/Makefile b/net/shadowsocks-libev/Makefile
new file mode 100644 (file)
index 0000000..2d05729
--- /dev/null
@@ -0,0 +1,91 @@
+#
+# Copyright (C) 2015 OpenWrt.org
+#
+# This is free software, licensed under the GNU General Public License v2.
+# See /LICENSE for more information.
+#
+
+include $(TOPDIR)/rules.mk
+
+PKG_NAME:=shadowsocks-libev
+PKG_VERSION:=2.2.2
+PKG_RELEASE:=1
+
+PKG_SOURCE_PROTO:=git
+PKG_SOURCE_URL:=https://github.com/shadowsocks/shadowsocks-libev.git
+PKG_SOURCE_SUBDIR:=$(PKG_NAME)-$(PKG_VERSION)-$(PKG_RELEASE)
+PKG_SOURCE_VERSION:=4883903e657095b93f88a3a3b9a0dccdffdaa397
+PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION)-$(PKG_SOURCE_VERSION).tar.gz
+PKG_MAINTAINER:=Jian Chang <aa65535@live.com>
+
+PKG_LICENSE:=GPLv2
+PKG_LICENSE_FILES:=LICENSE
+
+PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)-$(BUILD_VARIANT)/$(PKG_NAME)-$(PKG_VERSION)-$(PKG_RELEASE)
+
+PKG_INSTALL:=1
+PKG_FIXUP:=autoreconf
+PKG_USE_MIPS16:=0
+PKG_BUILD_PARALLEL:=1
+
+include $(INCLUDE_DIR)/package.mk
+
+define Package/shadowsocks-libev/Default
+       SECTION:=net
+       CATEGORY:=Network
+       TITLE:=Lightweight Secured Socks5 Proxy $(2)
+       URL:=https://github.com/shadowsocks/shadowsocks-libev
+       VARIANT:=$(1)
+       DEPENDS:=$(3) +resolveip +ipset +ip +iptables-mod-tproxy
+endef
+
+Package/shadowsocks-libev = $(call Package/shadowsocks-libev/Default,openssl,(OpenSSL),+libopenssl)
+Package/shadowsocks-libev-polarssl = $(call Package/shadowsocks-libev/Default,polarssl,(PolarSSL),+libpolarssl)
+
+define Package/shadowsocks-libev/description
+Shadowsocks-libev is a lightweight secured scoks5 proxy for embedded devices and low end boxes.
+endef
+
+Package/shadowsocks-libev-polarssl/description = $(Package/shadowsocks-libev/description)
+
+define Package/shadowsocks-libev/conffiles
+/etc/config/shadowsocks-libev
+endef
+
+Package/shadowsocks-libev-polarssl/conffiles = $(Package/shadowsocks-libev/conffiles)
+
+define Package/shadowsocks-libev/postinst
+#!/bin/sh
+uci -q batch <<-EOF >/dev/null
+       delete firewall.shadowsocks_libev
+       set firewall.shadowsocks_libev=include
+       set firewall.shadowsocks_libev.type=script
+       set firewall.shadowsocks_libev.path=/usr/share/shadowsocks-libev/firewall.include
+       set firewall.shadowsocks_libev.reload=1
+       commit firewall
+EOF
+exit 0
+endef
+
+Package/shadowsocks-libev-polarssl/postinst = $(Package/shadowsocks-libev/postinst)
+
+ifeq ($(BUILD_VARIANT),polarssl)
+       CONFIGURE_ARGS += --with-crypto-library=polarssl
+endif
+
+define Package/shadowsocks-libev/install
+       $(INSTALL_DIR) $(1)/usr/bin
+       $(INSTALL_BIN) $(PKG_BUILD_DIR)/src/ss-{redir,tunnel} $(1)/usr/bin
+       $(INSTALL_BIN) ./files/ss-rules $(1)/usr/bin
+       $(INSTALL_DIR) $(1)/etc/config
+       $(INSTALL_DATA) ./files/shadowsocks-libev.config $(1)/etc/config/shadowsocks-libev
+       $(INSTALL_DIR) $(1)/etc/init.d
+       $(INSTALL_BIN) ./files/shadowsocks-libev.init $(1)/etc/init.d/shadowsocks-libev
+       $(INSTALL_DIR) $(1)/usr/share/shadowsocks-libev
+       $(INSTALL_DATA) ./files/firewall.include $(1)/usr/share/shadowsocks-libev/firewall.include
+endef
+
+Package/shadowsocks-libev-polarssl/install = $(Package/shadowsocks-libev/install)
+
+$(eval $(call BuildPackage,shadowsocks-libev))
+$(eval $(call BuildPackage,shadowsocks-libev-polarssl))
diff --git a/net/shadowsocks-libev/files/firewall.include b/net/shadowsocks-libev/files/firewall.include
new file mode 100644 (file)
index 0000000..3a00e80
--- /dev/null
@@ -0,0 +1,6 @@
+#!/bin/sh
+
+if pidof ss-redir>/dev/null; then
+       /etc/init.d/shadowsocks-libev rules
+       logger -t ShadowSocks-libev "Reloading ShadowSocks-libev due to restart of firewall"
+fi
diff --git a/net/shadowsocks-libev/files/shadowsocks-libev.config b/net/shadowsocks-libev/files/shadowsocks-libev.config
new file mode 100644 (file)
index 0000000..2f7be3d
--- /dev/null
@@ -0,0 +1,15 @@
+
+config shadowsocks-libev
+       option enable '1'
+       option server '127.0.0.1'
+       option server_port '8388'
+       option local_port '1080'
+       option password 'barfoo!'
+       option timeout '60'
+       option encrypt_method 'rc4-md5'
+       option ignore_list '/dev/null'
+       option udp_relay '0'
+       option tunnel_enable '1'
+       option tunnel_port '5300'
+       option tunnel_forward '8.8.4.4:53'
+       option lan_ac_mode '0'
diff --git a/net/shadowsocks-libev/files/shadowsocks-libev.init b/net/shadowsocks-libev/files/shadowsocks-libev.init
new file mode 100644 (file)
index 0000000..3d149e7
--- /dev/null
@@ -0,0 +1,115 @@
+#!/bin/sh /etc/rc.common
+
+START=90
+STOP=15
+
+SERVICE_USE_PID=1
+SERVICE_WRITE_PID=1
+SERVICE_DAEMONIZE=1
+EXTRA_COMMANDS="rules"
+CONFIG_FILE=/var/etc/shadowsocks-libev.json
+
+get_config() {
+       config_get_bool enable $1 enable
+       config_get server $1 server
+       config_get server_port $1 server_port
+       config_get local_port $1 local_port
+       config_get password $1 password
+       config_get timeout $1 timeout
+       config_get encrypt_method $1 encrypt_method
+       config_get ignore_list $1 ignore_list
+       config_get udp_relay $1 udp_relay
+       config_get_bool tunnel_enable $1 tunnel_enable
+       config_get tunnel_port $1 tunnel_port
+       config_get tunnel_forward $1 tunnel_forward
+       config_get lan_ac_mode $1 lan_ac_mode
+       config_get lan_ac_ip $1 lan_ac_ip
+       config_get wan_bp_ip $1 wan_bp_ip
+       config_get wan_fw_ip $1 wan_fw_ip
+       config_get ipt_ext $1 ipt_ext
+       : ${tunnel_port:=5300}
+       : ${tunnel_forward:=8.8.4.4:53}
+}
+
+start_rules() {
+       local ac_args
+
+       if [ -n "$lan_ac_ip" ]; then
+               case $lan_ac_mode in
+                       1) ac_args="w$lan_ac_ip"
+                       ;;
+                       2) ac_args="b$lan_ac_ip"
+                       ;;
+               esac
+       fi
+       /usr/bin/ss-rules \
+               -s "$server" \
+               -l "$local_port" \
+               -i "$ignore_list" \
+               -a "$ac_args" \
+               -b "$wan_bp_ip" \
+               -w "$wan_fw_ip" \
+               -e "$ipt_ext" \
+               -o $udp
+       return $?
+}
+
+start_redir() {
+       service_start /usr/bin/ss-redir \
+               -c "$CONFIG_FILE" $udp
+       return $?
+}
+
+start_tunnel() {
+       service_start /usr/bin/ss-tunnel \
+               -c "$CONFIG_FILE" \
+               -l "$tunnel_port" \
+               -L "$tunnel_forward" \
+               -u
+       return $?
+}
+
+rules() {
+       config_load shadowsocks-libev
+       config_foreach get_config shadowsocks-libev
+       [ "$enable" = 1 ] || exit 0
+       [ "$udp_relay" = 1 ] && udp="-u"
+       mkdir -p $(dirname $CONFIG_FILE)
+
+       : ${server:?}
+       : ${server_port:?}
+       : ${local_port:?}
+       : ${password:?}
+       : ${encrypt_method:?}
+       cat <<-EOF >$CONFIG_FILE
+               {
+                   "server": "$server",
+                   "server_port": $server_port,
+                   "local_address": "0.0.0.0",
+                   "local_port": $local_port,
+                   "password": "$password",
+                   "timeout": $timeout,
+                   "method": "$encrypt_method"
+               }
+EOF
+       start_rules
+}
+
+boot() {
+       until iptables-save -t nat | grep -q "^:zone_lan_prerouting"; do
+               sleep 1
+       done
+       start
+}
+
+start() {
+       rules && start_redir
+       [ "$tunnel_enable" = 1 ] && start_tunnel
+}
+
+stop() {
+       /usr/bin/ss-rules -f
+       service_stop /usr/bin/ss-redir
+       service_stop /usr/bin/ss-tunnel
+       rm -f $CONFIG_FILE
+}
diff --git a/net/shadowsocks-libev/files/ss-rules b/net/shadowsocks-libev/files/ss-rules
new file mode 100644 (file)
index 0000000..e9e2295
--- /dev/null
@@ -0,0 +1,203 @@
+#!/bin/sh
+
+usage() {
+       cat <<-EOF
+               Usage: ss-rules [options]
+
+               Valid options are:
+
+                   -s <server_host>        hostname or ip of shadowsocks remote server
+                   -l <local_port>         port number of shadowsocks local server
+                   -i <ip_list_file>       a file content is bypassed ip list
+                   -a <lan_ips>            lan ip of access control, need a prefix to
+                                           define access control mode
+                   -b <wan_ips>            wan ip of will be bypassed
+                   -w <wan_ips>            wan ip of will be forwarded
+                   -e <extra_options>      extra options for iptables
+                   -o                      apply the rules to the OUTPUT chain
+                   -u                      enable udprelay mode, TPROXY is required
+                   -f                      flush the rules
+EOF
+}
+
+loger() {
+       # 1.alert 2.crit 3.err 4.warn 5.notice 6.info 7.debug
+       logger -st ss-rules[$$] -p$1 $2
+}
+
+ipt_n="iptables -t nat"
+ipt_m="iptables -t mangle"
+
+flush_r() {
+       local IPT
+
+       IPT=$(iptables-save -t nat)
+       eval $(echo "$IPT" | grep "_SS_SPEC_RULE_" | \
+               sed -e 's/^-A/$ipt_n -D/' -e 's/$/;/')
+
+       for chain in $(echo "$IPT" | awk '/^:SS_SPEC/{print $1}'); do
+               $ipt_n -F ${chain:1} 2>/dev/null && $ipt_n -X ${chain:1}
+       done
+
+       IPT=$(iptables-save -t mangle)
+       eval $(echo "$IPT" | grep "_SS_SPEC_RULE_" | \
+               sed -e 's/^-A/$ipt_m -D/' -e 's/$/;/')
+
+       for chain in $(echo "$IPT" | awk '/^:SS_SPEC/{print $1}'); do
+               $ipt_m -F ${chain:1} 2>/dev/null && $ipt_m -X ${chain:1}
+       done
+
+       ip rule del fwmark 0x01/0x01 table 100 2>/dev/null
+       ip route del local 0.0.0.0/0 dev lo table 100 2>/dev/null
+       ipset -X ss_spec_lan_ac 2>/dev/null
+       ipset -X ss_spec_wan_ac 2>/dev/null
+       return 0
+}
+
+ipset_r() {
+       ipset -! -R <<-EOF || return 1
+               create ss_spec_wan_ac hash:net
+               $(echo -e "$IPLIST" | sed -e "s/^/add ss_spec_wan_ac /")
+               $(for ip in $WAN_FW_IP; do echo "add ss_spec_wan_ac $ip nomatch"; done)
+EOF
+       $ipt_n -N SS_SPEC_WAN_AC && \
+       $ipt_n -A SS_SPEC_WAN_AC -m set --match-set ss_spec_wan_ac dst -j RETURN && \
+       $ipt_n -A SS_SPEC_WAN_AC -j SS_SPEC_WAN_FW
+       return $?
+}
+
+fw_rule() {
+       $ipt_n -N SS_SPEC_WAN_FW && \
+       $ipt_n -A SS_SPEC_WAN_FW -p tcp \
+               -j REDIRECT --to-ports $LOCAL_PORT 2>/dev/null || {
+               loger 3 "Can't redirect, please check the iptables."
+               exit 1
+       }
+       return $?
+}
+
+ac_rule() {
+       local TAG ROUTECHAIN
+
+       if [ -n "$LAN_AC_IP" ]; then
+               if [ "${LAN_AC_IP:0:1}" = "w" ]; then
+                       TAG="nomatch"
+               else
+                       if [ "${LAN_AC_IP:0:1}" != "b" ]; then
+                               loger 3 "Bad argument \`-a $LAN_AC_IP\`."
+                               return 2
+                       fi
+               fi
+       fi
+
+       ROUTECHAIN=PREROUTING
+       if iptables-save -t nat | grep -q "^:zone_lan_prerouting"; then
+               ROUTECHAIN=zone_lan_prerouting
+       fi
+
+       ipset -! -R <<-EOF || return 1
+               create ss_spec_lan_ac hash:net
+               $(for ip in ${LAN_AC_IP:1}; do echo "add ss_spec_lan_ac $ip $TAG"; done)
+EOF
+       $ipt_n -A $ROUTECHAIN -p tcp $EXT_ARGS \
+               -m set ! --match-set ss_spec_lan_ac src \
+               -m comment --comment "_SS_SPEC_RULE_" -j SS_SPEC_WAN_AC
+
+       if [ "$OUTPUT" = 1 ]; then
+               $ipt_n -A OUTPUT -p tcp $EXT_ARGS \
+                       -m comment --comment "_SS_SPEC_RULE_" -j SS_SPEC_WAN_AC
+       fi
+       return $?
+}
+
+tp_rule() {
+       [ "$TPROXY" = 1 ] || return 0
+       ip rule add fwmark 0x01/0x01 table 100
+       ip route add local 0.0.0.0/0 dev lo table 100
+       $ipt_m -N SS_SPEC_TPROXY
+       $ipt_m -A SS_SPEC_TPROXY -p udp -m set ! --match-set ss_spec_wan_ac dst \
+               -j TPROXY --on-port $LOCAL_PORT --tproxy-mark 0x01/0x01
+       $ipt_m -A PREROUTING -p udp $EXT_ARGS \
+               -m set ! --match-set ss_spec_lan_ac src \
+               -m comment --comment "_SS_SPEC_RULE_" -j SS_SPEC_TPROXY
+       return $?
+}
+
+while getopts ":s:l:c:i:e:a:b:w:ouf" arg; do
+       case $arg in
+               s)
+                       SERVER=$OPTARG
+                       ;;
+               l)
+                       LOCAL_PORT=$OPTARG
+                       ;;
+               i)
+                       IGNORE=$OPTARG
+                       ;;
+               e)
+                       EXT_ARGS=$OPTARG
+                       ;;
+               a)
+                       LAN_AC_IP=$OPTARG
+                       ;;
+               b)
+                       WAN_BP_IP=$(for ip in $OPTARG; do echo $ip; done)
+                       ;;
+               w)
+                       WAN_FW_IP=$OPTARG
+                       ;;
+               o)
+                       OUTPUT=1
+                       ;;
+               u)
+                       TPROXY=1
+                       ;;
+               f)
+                       flush_r
+                       exit 0
+                       ;;
+       esac
+done
+
+if [ -z "$SERVER" -o -z "$LOCAL_PORT" ]; then
+       usage
+       exit 2
+fi
+
+SERVER=$(resolveip -t60 $SERVER)
+
+if [ -z "$SERVER" ]; then
+       loger 3 "Can't resolve the server hostname."
+       exit 1
+fi
+
+if [ -f "$IGNORE" ]; then
+       IGNORE_IP=$(cat $IGNORE 2>/dev/null)
+fi
+
+IPLIST=$(cat <<-EOF | grep -E "^([0-9]{1,3}\.){3}[0-9]{1,3}"
+       $SERVER
+       0.0.0.0/8
+       10.0.0.0/8
+       100.64.0.0/10
+       127.0.0.0/8
+       169.254.0.0/16
+       172.16.0.0/12
+       192.0.0.0/24
+       192.0.2.0/24
+       192.88.99.0/24
+       192.168.0.0/16
+       198.18.0.0/15
+       198.51.100.0/24
+       203.0.113.0/24
+       224.0.0.0/4
+       240.0.0.0/4
+       255.255.255.255
+       $WAN_BP_IP
+       $IGNORE_IP
+EOF
+)
+
+flush_r && fw_rule && ipset_r && ac_rule && tp_rule
+
+exit $?
index 68a599063e7b73d0114f5e2c0982c836c429eb0c..6a58481378e18ea93a0a083cc740f8018c9eac6a 100644 (file)
@@ -9,7 +9,7 @@ include $(TOPDIR)/rules.mk
 
 PKG_NAME:=sqm-scripts
 PKG_VERSION:=8
-PKG_RELEASE:=4
+PKG_RELEASE:=7
 PKG_LICENSE:=GPLv2
 
 PKG_BUILD_DIR := $(BUILD_DIR)/$(PKG_NAME)
index d03980853ba6f899c4be45a2b3c6909a3cf007fc..13a7a0b84162440fde2b44fe14cdc1de40099189 100644 (file)
@@ -8,7 +8,7 @@ config queue 'eth1'
         option script 'simple.qos'
         option qdisc_advanced '0'
         option ingress_ecn 'ECN'
-        option egress_ecn 'NOECN'
+        option egress_ecn 'ECN'
         option qdisc_really_really_advanced '0'
         option itarget 'auto'
         option etarget 'auto'
index a0b2c6ffde1230954c8a9fd627708cb020a5c11e..ec4583da0da1beada3378794f1f8bf992da4d7ab 100644 (file)
@@ -6,7 +6,7 @@
 
 #improve the logread output
 sqm_logger() {
-    logger -t SQM -s ${1}
+    logger -t SQM -s "${1}"
 }
 
 insmod() {
@@ -139,6 +139,23 @@ get_stab_string() {
        echo ${STABSTRING}
 }
 
+#sm: cake knows how to handle ATM and per packet overhead, so expose and use this...
+get_cake_lla_string() {
+       STABSTRING=""
+       if [ "${LLAM}" = "cake" -a "${LINKLAYER}" != "none" ]; 
+       then
+               if [ "${LINKLAYER}" = "atm" ];
+               then
+                   STABSTRING="atm"
+               fi
+               
+               STABSTRING="${STABSTRING} overhead ${OVERHEAD}"
+               sqm_logger "cake link layer adjustments: ${STABSTRING}"
+       fi
+       echo ${STABSTRING}
+}
+
+
 sqm_stop() {
        $TC qdisc del dev $IFACE ingress
        $TC qdisc del dev $IFACE root
index 6e5af4a941ee35e25ba756fc071c7b089069fe81..5a36df1cf21da91935d1c7d6d33cbafeacbaea39 100755 (executable)
@@ -7,7 +7,7 @@
 # it under the terms of the GNU General Public License version 2 as
 # published by the Free Software Foundation.
 #
-#       Copyright (C) 2012-4 Michael D. Taht, Toke Høiland-Jørgensen, Sebastian Moeller
+#       Copyright (C) 2012-5 Michael D. Taht, Toke Høiland-Jørgensen, Sebastian Moeller
 
 # Compared to the complexity that debloat had become
 # this cleanly shows a means of going from diffserv marking
@@ -25,13 +25,20 @@ ipt_setup() {
 
 ipt -t mangle -N QOS_MARK_${IFACE}
 
-ipt -t mangle -A QOS_MARK_${IFACE} -j MARK --set-mark 0x2${IPT_MASK_STRING}
-# You can go further with classification but...
-ipt -t mangle -A QOS_MARK_${IFACE} -m dscp --dscp-class CS1 -j MARK --set-mark 0x3${IPT_MASK_STRING}
-ipt -t mangle -A QOS_MARK_${IFACE} -m dscp --dscp-class CS6 -j MARK --set-mark 0x1${IPT_MASK_STRING}
-ipt -t mangle -A QOS_MARK_${IFACE} -m dscp --dscp-class EF -j MARK --set-mark 0x1${IPT_MASK_STRING}
-ipt -t mangle -A QOS_MARK_${IFACE} -m dscp --dscp-class AF42 -j MARK --set-mark 0x1${IPT_MASK_STRING}
-ipt -t mangle -A QOS_MARK_${IFACE} -m tos  --tos Minimize-Delay -j MARK --set-mark 0x1${IPT_MASK_STRING}
+case $QDISC in
+       cake*) 
+           sqm_logger cake does all the diffserv work - no need for iptables rules 
+           ;;
+       *) 
+           ipt -t mangle -A QOS_MARK_${IFACE} -j MARK --set-mark 0x2${IPT_MASK_STRING} 
+           # You can go further with classification but...
+           ipt -t mangle -A QOS_MARK_${IFACE} -m dscp --dscp-class CS1 -j MARK --set-mark 0x3${IPT_MASK_STRING}
+           ipt -t mangle -A QOS_MARK_${IFACE} -m dscp --dscp-class CS6 -j MARK --set-mark 0x1${IPT_MASK_STRING}
+           ipt -t mangle -A QOS_MARK_${IFACE} -m dscp --dscp-class EF -j MARK --set-mark 0x1${IPT_MASK_STRING}
+           ipt -t mangle -A QOS_MARK_${IFACE} -m dscp --dscp-class AF42 -j MARK --set-mark 0x1${IPT_MASK_STRING}
+           ipt -t mangle -A QOS_MARK_${IFACE} -m tos  --tos Minimize-Delay -j MARK --set-mark 0x1${IPT_MASK_STRING}
+           ;;
+esac
 
 # and it might be a good idea to do it for udp tunnels too
 
@@ -43,9 +50,11 @@ ipt -t mangle -A QOS_MARK_${IFACE} -m tos  --tos Minimize-Delay -j MARK --set-ma
 if [ "$SQUASH_DSCP" = "1" ]
 then
 sqm_logger "Squashing differentiated services code points (DSCP) from ingress."
+CAKE_OPTS=besteffort # someday squash
 ipt -t mangle -I PREROUTING -i $IFACE -m dscp ! --dscp 0 -j DSCP --set-dscp-class be
 else
 sqm_logger "Keeping differentiated services code points (DSCP) from ingress."
+CAKE_OPTS=""
 ipt -t mangle -A PREROUTING -i $IFACE -m mark --mark 0x00${IPT_MASK_STRING} -g QOS_MARK_${IFACE} 
 fi
 
@@ -81,47 +90,53 @@ BE_CEIL=`expr $CEIL - 16`  # A little slop at the top
 LQ="quantum `get_mtu $IFACE $CEIL`"
 
 $TC qdisc del dev $IFACE root 2> /dev/null
-$TC qdisc add dev $IFACE root handle 1: `get_stab_string` htb default 12
-$TC class add dev $IFACE parent 1: classid 1:1 htb $LQ rate ${CEIL}kbit ceil ${CEIL}kbit `get_htb_adsll_string`
-$TC class add dev $IFACE parent 1:1 classid 1:10 htb $LQ rate ${CEIL}kbit ceil ${CEIL}kbit prio 0 `get_htb_adsll_string`
-$TC class add dev $IFACE parent 1:1 classid 1:11 htb $LQ rate 128kbit ceil ${PRIO_RATE}kbit prio 1 `get_htb_adsll_string`
-$TC class add dev $IFACE parent 1:1 classid 1:12 htb $LQ rate ${BE_RATE}kbit ceil ${BE_CEIL}kbit prio 2 `get_htb_adsll_string`
-$TC class add dev $IFACE parent 1:1 classid 1:13 htb $LQ rate ${BK_RATE}kbit ceil ${BE_CEIL}kbit prio 3 `get_htb_adsll_string`
-
-$TC qdisc add dev $IFACE parent 1:11 handle 110: $QDISC `get_limit ${ELIMIT}` `get_target "${ETARGET}" ${UPLINK}` `get_ecn ${EECN}` `get_quantum 300` `get_flows ${PRIO_RATE}` ${EQDISC_OPTS}
-$TC qdisc add dev $IFACE parent 1:12 handle 120: $QDISC `get_limit ${ELIMIT}` `get_target "${ETARGET}" ${UPLINK}` `get_ecn ${EECN}` `get_quantum 300` `get_flows ${BE_RATE}` ${EQDISC_OPTS}
-$TC qdisc add dev $IFACE parent 1:13 handle 130: $QDISC `get_limit ${ELIMIT}` `get_target "${ETARGET}" ${UPLINK}` `get_ecn ${EECN}` `get_quantum 300` `get_flows ${BK_RATE}` ${EQDISC_OPTS}
-
-
-# Need a catchall rule
-
-$TC filter add dev $IFACE parent 1:0 protocol all prio 999 u32 \
-        match ip protocol 0 0x00 flowid 1:12  
-
-# FIXME should probably change the filter here to do pre-nat
+case $QDISC in
+       cake*) 
+           $TC qdisc add dev $IFACE root `get_stab_string` $QDISC bandwidth ${CEIL}kbit `get_cake_lla_string` ${EQDISC_OPTS}
+           ;;
+       *)      
+           $TC qdisc add dev $IFACE root handle 1: `get_stab_string` htb default 12
+           $TC class add dev $IFACE parent 1: classid 1:1 htb $LQ rate ${CEIL}kbit ceil ${CEIL}kbit `get_htb_adsll_string`
+           $TC class add dev $IFACE parent 1:1 classid 1:10 htb $LQ rate ${CEIL}kbit ceil ${CEIL}kbit prio 0 `get_htb_adsll_string`
+           $TC class add dev $IFACE parent 1:1 classid 1:11 htb $LQ rate 128kbit ceil ${PRIO_RATE}kbit prio 1 `get_htb_adsll_string`
+           $TC class add dev $IFACE parent 1:1 classid 1:12 htb $LQ rate ${BE_RATE}kbit ceil ${BE_CEIL}kbit prio 2 `get_htb_adsll_string`
+           $TC class add dev $IFACE parent 1:1 classid 1:13 htb $LQ rate ${BK_RATE}kbit ceil ${BE_CEIL}kbit prio 3 `get_htb_adsll_string`
+
+           $TC qdisc add dev $IFACE parent 1:11 handle 110: $QDISC `get_limit ${ELIMIT}` `get_target "${ETARGET}" ${UPLINK}` `get_ecn ${EECN}` `get_quantum 300` `get_flows ${PRIO_RATE}` ${EQDISC_OPTS}
+           $TC qdisc add dev $IFACE parent 1:12 handle 120: $QDISC `get_limit ${ELIMIT}` `get_target "${ETARGET}" ${UPLINK}` `get_ecn ${EECN}` `get_quantum 300` `get_flows ${BE_RATE}` ${EQDISC_OPTS}
+           $TC qdisc add dev $IFACE parent 1:13 handle 130: $QDISC `get_limit ${ELIMIT}` `get_target "${ETARGET}" ${UPLINK}` `get_ecn ${EECN}` `get_quantum 300` `get_flows ${BK_RATE}` ${EQDISC_OPTS}
+
+           # Need a catchall rule
+
+           $TC filter add dev $IFACE parent 1:0 protocol all prio 999 u32 \
+               match ip protocol 0 0x00 flowid 1:12  
+
+           # FIXME should probably change the filter here to do pre-nat
         
-$TC filter add dev $IFACE parent 1:0 protocol ip prio 1 handle 1 fw classid 1:11
-$TC filter add dev $IFACE parent 1:0 protocol ip prio 2 handle 2 fw classid 1:12
-$TC filter add dev $IFACE parent 1:0 protocol ip prio 3 handle 3 fw classid 1:13
+           $TC filter add dev $IFACE parent 1:0 protocol ip prio 1 handle 1 fw classid 1:11
+           $TC filter add dev $IFACE parent 1:0 protocol ip prio 2 handle 2 fw classid 1:12
+           $TC filter add dev $IFACE parent 1:0 protocol ip prio 3 handle 3 fw classid 1:13
 
-# ipv6 support. Note that the handle indicates the fw mark bucket that is looked for
+           # ipv6 support. Note that the handle indicates the fw mark bucket that is looked for
 
-$TC filter add dev $IFACE parent 1:0 protocol ipv6 prio 4 handle 1 fw classid 1:11
-$TC filter add dev $IFACE parent 1:0 protocol ipv6 prio 5 handle 2 fw classid 1:12
-$TC filter add dev $IFACE parent 1:0 protocol ipv6 prio 6 handle 3 fw classid 1:13
+           $TC filter add dev $IFACE parent 1:0 protocol ipv6 prio 4 handle 1 fw classid 1:11
+           $TC filter add dev $IFACE parent 1:0 protocol ipv6 prio 5 handle 2 fw classid 1:12
+           $TC filter add dev $IFACE parent 1:0 protocol ipv6 prio 6 handle 3 fw classid 1:13
 
-# Arp traffic
+           # Arp traffic
 
-$TC filter add dev $IFACE parent 1:0 protocol arp prio 7 handle 1 fw classid 1:11
+           $TC filter add dev $IFACE parent 1:0 protocol arp prio 7 handle 1 fw classid 1:11
 
-# ICMP traffic - Don't impress your friends. Deoptimize to manage ping floods
-# better instead
+           # ICMP traffic - Don't impress your friends. Deoptimize to manage ping floods
+           # better instead
 
-$TC filter add dev $IFACE parent 1:0 protocol ip prio 8 \
-        u32 match ip protocol 1 0xff flowid 1:13
+           $TC filter add dev $IFACE parent 1:0 protocol ip prio 8 \
+                u32 match ip protocol 1 0xff flowid 1:13
 
-$TC filter add dev $IFACE parent 1:0 protocol ipv6 prio 9 \
-        u32 match ip protocol 1 0xff flowid 1:13
+           $TC filter add dev $IFACE parent 1:0 protocol ipv6 prio 9 \
+                u32 match ip protocol 1 0xff flowid 1:13
+           ;;
+esac
 
 #diffserv $IFACE
 
@@ -144,31 +159,43 @@ $TC qdisc del dev $DEV root  2> /dev/null
 
 if [ "$SQUASH_INGRESS" = "1" ]
 then
-sqm_logger "Do not perform DSCP based filtering on ingress. (1-tier classification)"
-# Revert to no dscp based filtering
-$TC qdisc del dev $DEV root 2>/dev/null
-$TC qdisc add dev $DEV root handle 1: `get_stab_string` htb default 10
-$TC class add dev $DEV parent 1: classid 1:1 htb $LQ rate ${DOWNLINK}kbit ceil ${DOWNLINK}kbit `get_htb_adsll_string`
-$TC class add dev $DEV parent 1:1 classid 1:10 htb $LQ rate ${DOWNLINK}kbit ceil ${DOWNLINK}kbit prio 0 `get_htb_adsll_string`
-$TC qdisc add dev $DEV parent 1:10 handle 110: $QDISC `get_limit ${ILIMIT}` `get_target "${ITARGET}" ${DOWNLINK}` `get_ecn ${IECN}` `get_flows ${DOWNLINK}` ${IQDISC_OPTS}
+       sqm_logger "Do not perform DSCP based filtering on ingress. (1-tier classification)"
+       # Revert to no dscp based filtering
+       case $QDISC in
+               cake*) 
+                   $TC qdisc add dev $DEV root `get_stab_string` $QDISC bandwidth ${DOWNLINK}kbit besteffort `get_cake_lla_string` ${IQDISC_OPTS}
+                   ;;
+               *)      
+                   $TC qdisc add dev $DEV root handle 1: `get_stab_string` htb default 10
+                   $TC class add dev $DEV parent 1: classid 1:1 htb $LQ rate ${DOWNLINK}kbit ceil ${DOWNLINK}kbit `get_htb_adsll_string`
+                   $TC class add dev $DEV parent 1:1 classid 1:10 htb $LQ rate ${DOWNLINK}kbit ceil ${DOWNLINK}kbit prio 0 `get_htb_adsll_string`
+                   $TC qdisc add dev $DEV parent 1:10 handle 110: $QDISC `get_limit ${ILIMIT}` `get_target "${ITARGET}" ${DOWNLINK}` `get_ecn ${IECN}` `get_flows ${DOWNLINK}` ${IQDISC_OPTS}
+                   ;;
+       esac
 
 else
-sqm_logger "Perform DSCP based filtering on ingress. (3-tier classification)"
-$TC qdisc add dev $DEV root handle 1: `get_stab_string` htb default 12
-$TC class add dev $DEV parent 1: classid 1:1 htb $LQ rate ${CEIL}kbit ceil ${CEIL}kbit `get_htb_adsll_string`
-$TC class add dev $DEV parent 1:1 classid 1:10 htb $LQ rate ${CEIL}kbit ceil ${CEIL}kbit prio 0 `get_htb_adsll_string`
-$TC class add dev $DEV parent 1:1 classid 1:11 htb $LQ rate 32kbit ceil ${PRIO_RATE}kbit prio 1 `get_htb_adsll_string`
-$TC class add dev $DEV parent 1:1 classid 1:12 htb $LQ rate ${BE_RATE}kbit ceil ${BE_CEIL}kbit prio 2 `get_htb_adsll_string`
-$TC class add dev $DEV parent 1:1 classid 1:13 htb $LQ rate ${BK_RATE}kbit ceil ${BE_CEIL}kbit prio 3 `get_htb_adsll_string`
-
-# I'd prefer to use a pre-nat filter but that causes permutation...
-
-$TC qdisc add dev $DEV parent 1:11 handle 110: $QDISC `get_limit ${ILIMIT}` `get_target "${ITARGET}" ${DOWNLINK}` `get_ecn ${IECN}` `get_quantum 500` `get_flows ${PRIO_RATE}` ${IQDISC_OPTS}
-$TC qdisc add dev $DEV parent 1:12 handle 120: $QDISC `get_limit ${ILIMIT}` `get_target "${ITARGET}" ${DOWNLINK}` `get_ecn ${IECN}` `get_quantum 1500` `get_flows ${BE_RATE}` ${IQDISC_OPTS}
-$TC qdisc add dev $DEV parent 1:13 handle 130: $QDISC `get_limit ${ILIMIT}` `get_target "${ITARGET}" ${DOWNLINK}` `get_ecn ${IECN}` `get_quantum 300` `get_flows ${BK_RATE}` ${IQDISC_OPTS}
-
-diffserv $DEV
-
+    sqm_logger "Perform DSCP based filtering on ingress. (3-tier classification)"
+    case $QDISC in
+           cake*) 
+                   $TC qdisc add dev $DEV root `get_stab_string` $QDISC bandwidth ${DOWNLINK}kbit `get_cake_lla_string` $CAKE_OPTS ${IQDISC_OPTS}
+                   ;;
+           *)  
+                   $TC qdisc add dev $DEV root handle 1: `get_stab_string` htb default 12
+                   $TC class add dev $DEV parent 1: classid 1:1 htb $LQ rate ${CEIL}kbit ceil ${CEIL}kbit `get_htb_adsll_string`
+                   $TC class add dev $DEV parent 1:1 classid 1:10 htb $LQ rate ${CEIL}kbit ceil ${CEIL}kbit prio 0 `get_htb_adsll_string`
+                   $TC class add dev $DEV parent 1:1 classid 1:11 htb $LQ rate 32kbit ceil ${PRIO_RATE}kbit prio 1 `get_htb_adsll_string`
+                   $TC class add dev $DEV parent 1:1 classid 1:12 htb $LQ rate ${BE_RATE}kbit ceil ${BE_CEIL}kbit prio 2 `get_htb_adsll_string`
+                   $TC class add dev $DEV parent 1:1 classid 1:13 htb $LQ rate ${BK_RATE}kbit ceil ${BE_CEIL}kbit prio 3 `get_htb_adsll_string`
+
+                   # I'd prefer to use a pre-nat filter but that causes permutation...
+
+                   $TC qdisc add dev $DEV parent 1:11 handle 110: $QDISC `get_limit ${ILIMIT}` `get_target "${ITARGET}" ${DOWNLINK}` `get_ecn ${IECN}` `get_quantum 500` `get_flows ${PRIO_RATE}` ${IQDISC_OPTS}
+                   $TC qdisc add dev $DEV parent 1:12 handle 120: $QDISC `get_limit ${ILIMIT}` `get_target "${ITARGET}" ${DOWNLINK}` `get_ecn ${IECN}` `get_quantum 1500` `get_flows ${BE_RATE}` ${IQDISC_OPTS}
+                   $TC qdisc add dev $DEV parent 1:13 handle 130: $QDISC `get_limit ${ILIMIT}` `get_target "${ITARGET}" ${DOWNLINK}` `get_ecn ${IECN}` `get_quantum 300` `get_flows ${BK_RATE}` ${IQDISC_OPTS}
+
+                   diffserv $DEV
+                   ;;
+    esac
 fi
 
 ifconfig $DEV up
index f06c25211ea544550727f1e270785bba90b6fad7..95362afffb243489c0d539983f891320cf7e3d68 100755 (executable)
@@ -7,7 +7,7 @@
 # it under the terms of the GNU General Public License version 2 as
 # published by the Free Software Foundation.
 #
-#       Copyright (C) 2012-4 Michael D. Taht, Toke Høiland-Jørgensen, Sebastian Moeller
+#       Copyright (C) 2012-5 Michael D. Taht, Toke Høiland-Jørgensen, Sebastian Moeller
 
 . /usr/lib/sqm/functions.sh
 sqm_logger "Starting simplest.qos"
@@ -17,10 +17,17 @@ egress() {
 LQ="quantum `get_mtu $IFACE ${UPLINK}`"
 
 $TC qdisc del dev $IFACE root 2>/dev/null
-$TC qdisc add dev $IFACE root handle 1: `get_stab_string` htb default 10
-$TC class add dev $IFACE parent 1: classid 1:1 htb $LQ rate ${UPLINK}kbit ceil ${UPLINK}kbit `get_htb_adsll_string`
-$TC class add dev $IFACE parent 1:1 classid 1:10 htb $LQ rate ${UPLINK}kbit ceil ${UPLINK}kbit prio 0 `get_htb_adsll_string`
-$TC qdisc add dev $IFACE parent 1:10 handle 110: $QDISC `get_limit ${ELIMIT}` `get_target "${ETARGET}" ${UPLINK}` `get_ecn ${EECN}` `get_flows ${UPLINK}` ${EQDISC_OPTS}
+case $QDISC in
+       cake*) 
+           $TC qdisc add dev $IFACE root `get_stab_string` cake bandwidth ${UPLINK}kbit besteffort `get_cake_lla_string` ${EQDISC_OPTS}
+           ;;
+       *)
+           $TC qdisc add dev $IFACE root handle 1: `get_stab_string` htb default 10
+           $TC class add dev $IFACE parent 1: classid 1:1 htb $LQ rate ${UPLINK}kbit ceil ${UPLINK}kbit `get_htb_adsll_string`
+           $TC class add dev $IFACE parent 1:1 classid 1:10 htb $LQ rate ${UPLINK}kbit ceil ${UPLINK}kbit prio 0 `get_htb_adsll_string`
+           $TC qdisc add dev $IFACE parent 1:10 handle 110: $QDISC `get_limit ${ELIMIT}` `get_target "${ETARGET}" ${UPLINK}` `get_ecn ${EECN}` `get_flows ${UPLINK}` ${EQDISC_OPTS}
+           ;;
+esac
 
 }
 
@@ -33,16 +40,23 @@ $TC qdisc add dev $IFACE handle ffff: ingress
 LQ="quantum `get_mtu $IFACE ${DOWNLINK}`"
  
 $TC qdisc del dev $DEV root 2>/dev/null
-$TC qdisc add dev $DEV root handle 1: `get_stab_string` htb default 10
-$TC class add dev $DEV parent 1: classid 1:1 htb $LQ rate ${DOWNLINK}kbit ceil ${DOWNLINK}kbit `get_htb_adsll_string`
-$TC class add dev $DEV parent 1:1 classid 1:10 htb $LQ rate ${DOWNLINK}kbit ceil ${DOWNLINK}kbit prio 0 `get_htb_adsll_string`
-
-# FIXME: I'd prefer to use a pre-nat filter but we need to detect if nat is on this interface
-# AND we need to permute by a random number which we can't do from userspace filters
-
-# Most high rate flows are REALLY close. This stomps on those harder, but hurts on high rate long distance
-#$TC qdisc add dev $DEV parent 1:10 handle 110: $QDISC limit $LIMIT $ECN interval 20ms target 3ms `get_flows ${DOWNLINK}`
-$TC qdisc add dev $DEV parent 1:10 handle 110: $QDISC `get_limit ${ILIMIT}` `get_target "${ITARGET}" ${DOWNLINK}` `get_ecn ${IECN}` `get_flows ${DOWNLINK}` ${IQDISC_OPTS}
+case $QDISC in
+       cake*) 
+           $TC qdisc add dev $DEV root `get_stab_string` cake bandwidth ${DOWNLINK}kbit besteffort `get_cake_lla_string` ${IQDISC_OPTS}
+           ;;
+       *)
+           $TC qdisc add dev $DEV root handle 1: `get_stab_string` htb default 10
+           $TC class add dev $DEV parent 1: classid 1:1 htb $LQ rate ${DOWNLINK}kbit ceil ${DOWNLINK}kbit `get_htb_adsll_string`
+           $TC class add dev $DEV parent 1:1 classid 1:10 htb $LQ rate ${DOWNLINK}kbit ceil ${DOWNLINK}kbit prio 0 `get_htb_adsll_string`
+
+           # FIXME: I'd prefer to use a pre-nat filter but we need to detect if nat is on this interface
+           # AND we need to permute by a random number which we can't do from userspace filters
+
+           # Most high rate flows are REALLY close. This stomps on those harder, but hurts on high rate long distance
+           #$TC qdisc add dev $DEV parent 1:10 handle 110: $QDISC limit $LIMIT $ECN interval 20ms target 3ms `get_flows ${DOWNLINK}`
+           $TC qdisc add dev $DEV parent 1:10 handle 110: $QDISC `get_limit ${ILIMIT}` `get_target "${ITARGET}" ${DOWNLINK}` `get_ecn ${IECN}` `get_flows ${DOWNLINK}` ${IQDISC_OPTS}
+           ;;
+esac
 
 ifconfig $DEV up
 
index d5873c7b25d2e3745fb9732e686a6deced33cd38..4c1a6e445d4c0bcdc7dc5e482cb7032603fd865a 100644 (file)
@@ -8,15 +8,15 @@
 include $(TOPDIR)/rules.mk
 
 PKG_NAME:=squid
-PKG_VERSION:=3.5.2
-PKG_RELEASE:=4
+PKG_VERSION:=3.5.5
+PKG_RELEASE:=1
 
 PKG_LICENSE:=GPL-2.0
 PKG_MAINTAINER:=Luka Perkov <luka@openwrt.org>
 
 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.xz
 PKG_SOURCE_URL:=http://www.squid-cache.org/Versions/v3/3.5/
-PKG_MD5SUM:=0330ec9f69e333c2a81fa4502ba96a22
+PKG_MD5SUM:=9a323a97753143ddd935aed58a0193ae
 
 PKG_BUILD_PARALLEL:=1
 PKG_INSTALL:=1
index a6cc6e23cb8464009a801833897f67d906c8943a..c7493bbceee54959fbe069d5323ad3f86513aaf5 100644 (file)
@@ -1,49 +1,24 @@
 --- a/src/Makefile.in
 +++ b/src/Makefile.in
-@@ -7759,7 +7759,7 @@ cache_cf.o: cf_parser.cci
- # cf_gen builds the configuration files.
+@@ -7761,3 +7761,3 @@ cache_cf.o: cf_parser.cci
  cf_gen$(EXEEXT): $(cf_gen_SOURCES) $(cf_gen_DEPENDENCIES) cf_gen_defines.cci
 -      $(BUILDCXX) $(BUILDCXXFLAGS) -o $@ $(srcdir)/cf_gen.cc -I$(srcdir) -I$(top_builddir)/include/ -I$(top_builddir)/src
 +      g++ -o $@ $(srcdir)/cf_gen.cc -I$(srcdir) -I$(top_builddir)/include/ -I$(top_builddir)/src
  
- # squid.conf.default is built by cf_gen when making cf_parser.cci
- squid.conf.default squid.conf.documented: cf_parser.cci
 --- a/configure
 +++ b/configure
-@@ -22935,7 +22935,7 @@ $as_echo_n "checking whether the SSL_get
-   if test "$cross_compiling" = yes; then :
-   { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
- $as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
--as_fn_error $? "cannot run test program while cross compiling
-+_as_fn_error $? "cannot run test program while cross compiling
- See \`config.log' for more details" "$LINENO" 5; }
- else
-   cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-@@ -22983,7 +22983,7 @@ $as_echo_n "checking whether the workaro
-   if test "$cross_compiling" = yes; then :
-   { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
+@@ -20133,3 +20133,3 @@ if test "$cross_compiling" = yes; then :
  $as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
 -as_fn_error $? "cannot run test program while cross compiling
 +_as_fn_error $? "cannot run test program while cross compiling
  See \`config.log' for more details" "$LINENO" 5; }
- else
-   cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-@@ -28201,7 +28201,7 @@ else
-     if test "$cross_compiling" = yes; then :
-   { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
+@@ -28289,3 +28289,3 @@ else
  $as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
 -as_fn_error $? "cannot run test program while cross compiling
 +_as_fn_error $? "cannot run test program while cross compiling
  See \`config.log' for more details" "$LINENO" 5; }
- else
-   cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-@@ -28226,7 +28226,7 @@ else
-     if test "$cross_compiling" = yes; then :
-   { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
+@@ -28314,3 +28314,3 @@ else
  $as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
 -as_fn_error $? "cannot run test program while cross compiling
 +_as_fn_error $? "cannot run test program while cross compiling
  See \`config.log' for more details" "$LINENO" 5; }
- else
-   cat confdefs.h - <<_ACEOF >conftest.$ac_ext
diff --git a/net/squid/patches/200-musl-compat.patch b/net/squid/patches/200-musl-compat.patch
deleted file mode 100644 (file)
index 7cbd9da..0000000
+++ /dev/null
@@ -1,15 +0,0 @@
---- a/lib/rfcnb/rfcnb-io.c
-+++ b/lib/rfcnb/rfcnb-io.c
-@@ -36,11 +36,11 @@
- #include "rfcnb/rfcnb-util.h"
- #include "rfcnb/std-includes.h"
-+#include <signal.h>
- #if HAVE_STRING_H
- #include <string.h>
- #endif
- #include <sys/uio.h>
--#include <sys/signal.h>
- int RFCNB_Timeout = 0;          /* Timeout in seconds ... */
index e7f1c0e6bbbf53386876b2629edaac8f66731708..1c0fe7663999a4bfac5dae84cffcebb43751950a 100644 (file)
@@ -38,6 +38,7 @@ define Build/Compile
                CFLAGS="$(TARGET_CFLAGS)" \
                USELIBCONFIG= \
                USELIBWRAP= \
+               USELIBPCRE= \
                all
 endef
 
diff --git a/net/sslh/patches/002-no_regex_probes.patch b/net/sslh/patches/002-no_regex_probes.patch
new file mode 100644 (file)
index 0000000..130c311
--- /dev/null
@@ -0,0 +1,90 @@
+From 3aefaf300478cd6fbc4892d5baaf70521ed323af Mon Sep 17 00:00:00 2001
+From: Yves Rutschle <git1@rutschle.net>
+Date: Thu, 9 Jul 2015 15:31:42 +0200
+Subject: [PATCH] Added Makefile option to build without libpcre
+
+---
+--- a/Makefile
++++ b/Makefile
+@@ -2,6 +2,7 @@
+ VERSION=$(shell ./genver.sh -r)
+ USELIBCONFIG=1        # Use libconfig? (necessary to use configuration files)
++USELIBPCRE=1  # Use libpcre? (necessary to use regex probe)
+ USELIBWRAP?=  # Use libwrap?
+ USELIBCAP=    # Use libcap?
+ COV_TEST=     # Perform test coverage?
+@@ -27,6 +28,10 @@ ifneq ($(strip $(USELIBWRAP)),)
+       CPPFLAGS+=-DLIBWRAP
+ endif
++ifneq ($(strip $(USELIBPCRE)),)
++      CPPFLAGS+=-DLIBPCRE
++endif
++
+ ifneq ($(strip $(USELIBCONFIG)),)
+       LIBS:=$(LIBS) -lconfig
+       CPPFLAGS+=-DLIBCONFIG
+--- a/probe.c
++++ b/probe.c
+@@ -21,7 +21,9 @@
+ #define _GNU_SOURCE
+ #include <stdio.h>
++#ifdef LIBPCRE
+ #include <regex.h>
++#endif
+ #include <ctype.h>
+ #include "probe.h"
+@@ -226,6 +228,7 @@ static int is_tls_protocol(const char *p
+ static int regex_probe(const char *p, int len, struct proto *proto)
+ {
++#ifdef LIBPCRE
+     regex_t **probe = proto->data;
+     regmatch_t pos = { 0, len };
+@@ -233,6 +236,11 @@ static int regex_probe(const char *p, in
+         /* try them all */;
+     return (*probe != NULL);
++#else
++    /* Should never happen as we check when loading config file */
++    fprintf(stderr, "FATAL: regex probe called but not built in\n");
++    exit(5);
++#endif
+ }
+ /* 
+--- a/sslh-main.c
++++ b/sslh-main.c
+@@ -25,7 +25,9 @@
+ #ifdef LIBCONFIG
+ #include <libconfig.h>
+ #endif
++#ifdef LIBPCRE
+ #include <regex.h>
++#endif
+ #include "common.h"
+ #include "probe.h"
+@@ -174,6 +176,7 @@ static int config_listen(config_t *confi
+ #ifdef LIBCONFIG
+ static void setup_regex_probe(struct proto *p, config_setting_t* probes)
+ {
++#ifdef LIBPCRE
+     int num_probes, errsize, i, res;
+     char *err;
+     const char * expr;
+@@ -201,6 +204,10 @@ static void setup_regex_probe(struct pro
+             exit(1);
+         }
+     }
++#else
++    fprintf(stderr, "line %d: regex probe specified but not compiled in\n", config_setting_source_line(probes));
++    exit(5);
++#endif
+ }
+ #endif
index 1facb1e137ccf56b53d0f9e18488a53f11b3abd3..c7d40283c2d5df77b57aeef5306f28bdf8b42344 100644 (file)
@@ -8,12 +8,12 @@
 include $(TOPDIR)/rules.mk
 
 PKG_NAME:=tinc
-PKG_VERSION:=1.0.25
-PKG_RELEASE:=2
+PKG_VERSION:=1.0.26
+PKG_RELEASE:=1
 
 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
 PKG_SOURCE_URL:=http://www.tinc-vpn.org/packages
-PKG_MD5SUM:=0b91b693f7cf76f481b547d0c86f9578
+PKG_MD5SUM:=a8c168227fa42cbfcd4983247bf609ca
 
 PKG_INSTALL:=1
 
diff --git a/net/tinc/patches/100-musl-compat.patch b/net/tinc/patches/100-musl-compat.patch
deleted file mode 100644 (file)
index e0910b1..0000000
+++ /dev/null
@@ -1,11 +0,0 @@
---- a/src/have.h
-+++ b/src/have.h
-@@ -196,4 +196,8 @@
- #include <netinet/if_ether.h>
- #endif
-+#ifdef HAVE_LINUX_IF_TUN_H
-+#include <linux/if_tun.h>
-+#endif
-+
- #endif /* __TINC_SYSTEM_H__ */
index bc54bb75f3cdaa955282204dacb58e600106e7ec..e39c3b2e324eaf706f1660138b54898d3f942400 100644 (file)
@@ -9,7 +9,7 @@ include $(TOPDIR)/rules.mk
 
 PKG_NAME:=unbound
 PKG_VERSION:=1.5.3
-PKG_RELEASE:=1
+PKG_RELEASE:=2
 
 PKG_LICENSE:=BSD-3-Clause
 PKG_LICENSE_FILES:=LICENSE
@@ -109,7 +109,6 @@ define Package/libunbound/description
 endef
 
 CONFIGURE_ARGS += \
-       --disable-ecdsa \
        --disable-gost \
        --enable-allsymbols \
        --with-libexpat="$(STAGING_DIR)/usr" \
index 95995e10c71accc26fd30695490137acc6baa849..052da0c3b53be9bb1d009a4cca699f1a658e6df9 100644 (file)
@@ -10,7 +10,7 @@ include $(TOPDIR)/rules.mk
 PKG_NAME:=vpnc
 PKG_REV:=550
 PKG_VERSION:=0.5.3.r$(PKG_REV)
-PKG_RELEASE:=2
+PKG_RELEASE:=3
 
 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
 PKG_SOURCE_URL:=http://svn.unix-ag.uni-kl.de/vpnc/trunk/
index 31d0070dcf8a7c3753bd330a218de10a69a6a1a8..c408d78aecaec225022b27bbd9e2fab84634b82d 100755 (executable)
@@ -42,7 +42,7 @@ proto_vpnc_setup() {
        logger -t vpnc "initializing..."
        serv_addr=
        for ip in $(resolveip -t 10 "$server"); do
-               ( proto_add_host_dependency "$config" "$ip" $interface )
+               ( proto_add_host_dependency "vpn-$config" "$ip" $interface )
                serv_addr=1
        done
        [ -n "$serv_addr" ] || {
index f24a79b8b1cdb232e3bdace33b22244c0c89414b..e68b3eb21d5e5a5da486a08f98a45eda046274f7 100644 (file)
@@ -9,7 +9,7 @@ include $(TOPDIR)/rules.mk
 
 PKG_NAME:=vsftpd
 PKG_VERSION:=3.0.2
-PKG_RELEASE:=5
+PKG_RELEASE:=6
 
 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
 PKG_SOURCE_URL:=https://security.appspot.com/downloads/
diff --git a/net/vsftpd/patches/007-CVE-2015-1419.patch b/net/vsftpd/patches/007-CVE-2015-1419.patch
new file mode 100644 (file)
index 0000000..173027a
--- /dev/null
@@ -0,0 +1,98 @@
+Description: CVE-2015-1419: config option deny_file is not handled correctly
+Author: Marcus Meissner <meissner@suse.com>
+Origin: https://bugzilla.novell.com/show_bug.cgi?id=CVE-2015-1419
+Bug-Debian: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=776922
+Last-Update: 2015-02-24
+---
+This patch header follows DEP-3: http://dep.debian.net/deps/dep3/
+--- a/ls.c
++++ b/ls.c
+@@ -7,6 +7,7 @@
+  * Would you believe, code to handle directory listing.
+  */
++#include <stdlib.h>
+ #include "ls.h"
+ #include "access.h"
+ #include "defs.h"
+@@ -243,11 +244,42 @@ vsf_filename_passes_filter(const struct
+   struct mystr temp_str = INIT_MYSTR;
+   struct mystr brace_list_str = INIT_MYSTR;
+   struct mystr new_filter_str = INIT_MYSTR;
++  struct mystr normalize_filename_str = INIT_MYSTR;
++  const char *normname;
++  const char *path;
+   int ret = 0;
+   char last_token = 0;
+   int must_match_at_current_pos = 1;
++
+   str_copy(&filter_remain_str, p_filter_str);
+-  str_copy(&name_remain_str, p_filename_str);
++
++  /* normalize filepath */
++  path = str_strdup(p_filename_str);
++  normname = realpath(path, NULL);
++  if (normname == NULL)
++     goto out;
++  str_alloc_text(&normalize_filename_str, normname);
++
++  if (!str_isempty (&filter_remain_str) && !str_isempty(&normalize_filename_str)) {
++    if (str_get_char_at(p_filter_str, 0) == '/') {
++      if (str_get_char_at(&normalize_filename_str, 0) != '/') {
++        str_getcwd (&name_remain_str);
++
++        if (str_getlen(&name_remain_str) > 1) /* cwd != root dir */
++          str_append_char (&name_remain_str, '/');
++
++        str_append_str (&name_remain_str, &normalize_filename_str);
++      }
++      else
++       str_copy (&name_remain_str, &normalize_filename_str);
++    } else {
++      if (str_get_char_at(p_filter_str, 0) != '{')
++        str_basename (&name_remain_str, &normalize_filename_str);
++      else
++        str_copy (&name_remain_str, &normalize_filename_str);
++    }
++  } else
++    str_copy(&name_remain_str, &normalize_filename_str);
+   while (!str_isempty(&filter_remain_str) && *iters < VSFTP_MATCHITERS_MAX)
+   {
+@@ -360,6 +392,9 @@ vsf_filename_passes_filter(const struct
+     ret = 0;
+   }
+ out:
++  free(normname);
++  free(path);
++  str_free(&normalize_filename_str);
+   str_free(&filter_remain_str);
+   str_free(&name_remain_str);
+   str_free(&temp_str);
+--- a/str.c
++++ b/str.c
+@@ -711,3 +711,14 @@ str_replace_unprintable(struct mystr* p_
+   }
+ }
++void
++str_basename (struct mystr* d_str, const struct mystr* path)
++{
++  static struct mystr tmp;
++
++  str_copy (&tmp, path);
++  str_split_char_reverse(&tmp, d_str, '/');
++
++  if (str_isempty(d_str))
++   str_copy (d_str, path);
++}
+--- a/str.h
++++ b/str.h
+@@ -100,6 +100,7 @@ void str_replace_unprintable(struct myst
+ int str_atoi(const struct mystr* p_str);
+ filesize_t str_a_to_filesize_t(const struct mystr* p_str);
+ unsigned int str_octal_to_uint(const struct mystr* p_str);
++void str_basename (struct mystr* d_str, const struct mystr* path);
+ /* PURPOSE: Extract a line of text (delimited by \n or EOF) from a string
+  * buffer, starting at character position 'p_pos'. The extracted line will
index f0cba304feed0eb583f41d4bdc724cec448519d0..7836eee8cde4528f8afc8557035a909208aa64e3 100644 (file)
@@ -9,7 +9,7 @@ include $(TOPDIR)/rules.mk
 
 PKG_NAME:=znc
 PKG_VERSION:=1.6.0
-PKG_RELEASE:=1
+PKG_RELEASE:=3
 
 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
 PKG_SOURCE_URL:=http://znc.in/releases \
index 7cc7fa70fdbd836406692f0322bf724692f2a7fe..2ee5a1e588eccf3ee06b4857474103e64ca26ef8 100644 (file)
@@ -38,7 +38,9 @@ add_network() {
        config_get name "$network" name
        echo "  <Network $name>" >> $ZNC_CONFIG
        config_list_foreach "$network" server "add_param \"             Server\""
+       config_list_foreach "$network" fingerprint "add_param \"                trustedserverfingerprint\""
        config_list_foreach "$network" channel "add_chan"
+       echo "  </Network>" >> $ZNC_CONFIG
 }
 
 znc_global() {
@@ -142,6 +144,7 @@ add_user() {
        if [ "$server" ]; then
                echo "  <Network Default>" >> $ZNC_CONFIG
                config_list_foreach "$user" server "add_param \"                Server\""
+               config_list_foreach "$user" fingerprint "add_param \"           trustedserverfingerprint\""
                config_list_foreach "$user" channel "add_chan"
                echo "  </Network>" >> $ZNC_CONFIG
        fi
index 2518ddae1805412710722ffe3de9ae053169ea44..6236acecb0f617a34cee396357dc04bb478b7066 100644 (file)
@@ -13,15 +13,15 @@ index 0000000..3de527b
 \ No newline at end of file
 diff --git a/src/pregen/DAAP2SQL.c b/src/pregen/DAAP2SQL.c
 new file mode 100644
-index 0000000..3f94589
+index 0000000..f13209c
 --- /dev/null
 +++ b/src/pregen/DAAP2SQL.c
-@@ -0,0 +1,929 @@
+@@ -0,0 +1,975 @@
 +/** \file
 + *  This C source file was generated by $ANTLR version 3.2 debian-7ubuntu3
 + *
 + *     -  From the grammar source file : DAAP2SQL.g
-+ *     -                            On : 2014-09-30 21:42:43
++ *     -                            On : 2015-06-27 19:05:20
 + *     -           for the tree parser : DAAP2SQLTreeParser *
 + * Editing it, at least manually, is not wise. 
 + *
@@ -582,11 +582,7 @@ index 0000000..3f94589
 +
 +                      {
 +
-+                                              if (!a.valid || !b.valid)
-+                                              {
-+                                                      retval.valid= 0;
-+                                              }
-+                                              else
++                                              if (a.valid && b.valid)
 +                                              {
 +                                                      retval.result= a.result->factory->newRaw(a.result->factory);
 +                                                      retval.result->append8(retval.result, "(");
@@ -595,13 +591,27 @@ index 0000000..3f94589
 +                                                      retval.result->appendS(retval.result, b.result);
 +                                                      retval.result->append8(retval.result, ")");
 +                                              }
++                                              else if (a.valid)
++                                              {
++                                                      retval.result= a.result->factory->newRaw(a.result->factory);
++                                                      retval.result->appendS(retval.result, a.result);
++                                              }
++                                              else if (b.valid)
++                                              {
++                                                      retval.result= b.result->factory->newRaw(b.result->factory);
++                                                      retval.result->appendS(retval.result, b.result);
++                                              }
++                                              else
++                                              {
++                                                      retval.valid= 0;
++                                              }
 +                                      
 +                      }
 +
 +                  }
 +                  break;
 +              case 2:
-+                  // DAAP2SQL.g:86:4: ^( OPOR a= expr b= expr )
++                  // DAAP2SQL.g:96:4: ^( OPOR a= expr b= expr )
 +                  {
 +                       MATCHT(OPOR, &FOLLOW_OPOR_in_expr118); 
 +                      if  (HASEXCEPTION())
@@ -643,11 +653,7 @@ index 0000000..3f94589
 +
 +                      {
 +
-+                                              if (!a.valid || !b.valid)
-+                                              {
-+                                                      retval.valid= 0;
-+                                              }
-+                                              else
++                                              if (a.valid && b.valid)
 +                                              {
 +                                                      retval.result= a.result->factory->newRaw(a.result->factory);
 +                                                      retval.result->append8(retval.result, "(");
@@ -656,13 +662,27 @@ index 0000000..3f94589
 +                                                      retval.result->appendS(retval.result, b.result);
 +                                                      retval.result->append8(retval.result, ")");
 +                                              }
++                                              else if (a.valid)
++                                              {
++                                                      retval.result= a.result->factory->newRaw(a.result->factory);
++                                                      retval.result->appendS(retval.result, a.result);
++                                              }
++                                              else if (b.valid)
++                                              {
++                                                      retval.result= b.result->factory->newRaw(b.result->factory);
++                                                      retval.result->appendS(retval.result, b.result);
++                                              }
++                                              else
++                                              {
++                                                      retval.valid= 0;
++                                              }
 +                                      
 +                      }
 +
 +                  }
 +                  break;
 +              case 3:
-+                  // DAAP2SQL.g:102:4: STR
++                  // DAAP2SQL.g:122:4: STR
 +                  {
 +                      STR1 = (pANTLR3_BASE_TREE) MATCHT(STR, &FOLLOW_STR_in_expr140); 
 +                      if  (HASEXCEPTION())
@@ -765,13 +785,22 @@ index 0000000..3f94589
 +                                                              goto STR_result_valid_0; /* ABORT */
 +                                                      }
 +
++                                                      /* No need to exclude empty artist and album, as forked-daapd makes sure there always exists an artist/album. */
++                                                      if (neg_op && op == ':'
++                                                              && (strcmp((char *)field, "daap.songalbumartist") == 0 
++                                                                      || strcmp((char *)field, "daap.songartist") == 0 
++                                                                      || strcmp((char *)field, "daap.songalbum") == 0))
++                                                      {
++                                                              DPRINTF(E_DBG, L_DAAP, "Ignoring clause '%s%s%c'\n", field, (neg_op) ? "!" : "", op);
++                                                              retval.valid= 0;
++                                                              goto STR_result_valid_0;
++                                                      }
++                                                      
 +                                                      /* Need to check against NULL too */
 +                                                      if (op == ':')
 +                                                              retval.result->append8(retval.result, "(");
 +                                              }
 +
-+                                              retval.result->append8(retval.result, dqfm->db_col);
-+
 +                                              /* Int field: check integer conversion */
 +                                              if (dqfm->as_int)
 +                                              {
@@ -796,6 +825,21 @@ index 0000000..3f94589
 +                                                      }
 +
 +                                                      *end = '\0'; /* Cut out potential garbage - we're being kind */
++
++                                                      /* forked-daapd only has media_kind = 1 for music - so remove media_kind = 32 to imporve select query performance. */
++                                                      if (llval == 32
++                                                              && (strcmp((char *)field, "com.apple.itunes.mediakind") == 0 
++                                                                      || strcmp((char *)field, "com.apple.itunes.extended-media-kind") == 0))
++                                                      {
++                                                              DPRINTF(E_DBG, L_DAAP, "Ignoring clause '%s%s%c%s'\n", field, (neg_op) ? "!" : "", op, val);
++                                                              
++                                                              if (neg_op)
++                                                                      retval.result->append8(retval.result, "1 = 1");
++                                                              else
++                                                                      retval.result->append8(retval.result, "1 = 0");
++                                                              
++                                                              goto STR_out;
++                                                      }
 +                                              }
 +                                              /* String field: escape string, check for '*' */
 +                                              else
@@ -823,12 +867,14 @@ index 0000000..3f94589
 +                                                              val[0] = '%';
 +                                                      }
 +
-+                                                      if (val[strlen((char *)val) - 1] == '*')
++                                                      if (val[0] && val[1] && val[strlen((char *)val) - 1] == '*')
 +                                                      {
 +                                                              op = '%';
 +                                                              val[strlen((char *)val) - 1] = '%';
 +                                                      }
 +                                              }
++                                              
++                                              retval.result->append8(retval.result, dqfm->db_col);
 +
 +                                              switch(op)
 +                                              {
@@ -948,7 +994,7 @@ index 0000000..3f94589
 + */
 diff --git a/src/pregen/DAAP2SQL.h b/src/pregen/DAAP2SQL.h
 new file mode 100644
-index 0000000..e170f6c
+index 0000000..2b1e806
 --- /dev/null
 +++ b/src/pregen/DAAP2SQL.h
 @@ -0,0 +1,195 @@
@@ -956,7 +1002,7 @@ index 0000000..e170f6c
 + *  This C header file was generated by $ANTLR version 3.2 debian-7ubuntu3
 + *
 + *     -  From the grammar source file : DAAP2SQL.g
-+ *     -                            On : 2014-09-30 21:42:43
++ *     -                            On : 2015-06-27 19:05:20
 + *     -           for the tree parser : DAAP2SQLTreeParser *
 + * Editing it, at least manually, is not wise. 
 + *
@@ -1161,7 +1207,7 @@ index 0000000..385d80b
 \ No newline at end of file
 diff --git a/src/pregen/DAAPLexer.c b/src/pregen/DAAPLexer.c
 new file mode 100644
-index 0000000..12e7ef3
+index 0000000..b72f28a
 --- /dev/null
 +++ b/src/pregen/DAAPLexer.c
 @@ -0,0 +1,1101 @@
@@ -1169,7 +1215,7 @@ index 0000000..12e7ef3
 + *  This C source file was generated by $ANTLR version 3.2 debian-7ubuntu3
 + *
 + *     -  From the grammar source file : DAAP.g
-+ *     -                            On : 2014-09-30 21:42:40
++ *     -                            On : 2015-06-27 19:05:17
 + *     -                 for the lexer : DAAPLexerLexer *
 + * Editing it, at least manually, is not wise. 
 + *
@@ -2268,7 +2314,7 @@ index 0000000..12e7ef3
 + */
 diff --git a/src/pregen/DAAPLexer.h b/src/pregen/DAAPLexer.h
 new file mode 100644
-index 0000000..ba8f58b
+index 0000000..401b214
 --- /dev/null
 +++ b/src/pregen/DAAPLexer.h
 @@ -0,0 +1,188 @@
@@ -2276,7 +2322,7 @@ index 0000000..ba8f58b
 + *  This C header file was generated by $ANTLR version 3.2 debian-7ubuntu3
 + *
 + *     -  From the grammar source file : DAAP.g
-+ *     -                            On : 2014-09-30 21:42:40
++ *     -                            On : 2015-06-27 19:05:17
 + *     -                 for the lexer : DAAPLexerLexer *
 + * Editing it, at least manually, is not wise. 
 + *
@@ -2462,7 +2508,7 @@ index 0000000..ba8f58b
 +/* END - Note:Keep extra line feed to satisfy UNIX systems */
 diff --git a/src/pregen/DAAPParser.c b/src/pregen/DAAPParser.c
 new file mode 100644
-index 0000000..6d0239d
+index 0000000..7a9aae9
 --- /dev/null
 +++ b/src/pregen/DAAPParser.c
 @@ -0,0 +1,1014 @@
@@ -2470,7 +2516,7 @@ index 0000000..6d0239d
 + *  This C source file was generated by $ANTLR version 3.2 debian-7ubuntu3
 + *
 + *     -  From the grammar source file : DAAP.g
-+ *     -                            On : 2014-09-30 21:42:39
++ *     -                            On : 2015-06-27 19:05:16
 + *     -                for the parser : DAAPParserParser *
 + * Editing it, at least manually, is not wise. 
 + *
@@ -3482,7 +3528,7 @@ index 0000000..6d0239d
 + */
 diff --git a/src/pregen/DAAPParser.h b/src/pregen/DAAPParser.h
 new file mode 100644
-index 0000000..dcc664f
+index 0000000..82ce85e
 --- /dev/null
 +++ b/src/pregen/DAAPParser.h
 @@ -0,0 +1,226 @@
@@ -3490,7 +3536,7 @@ index 0000000..dcc664f
 + *  This C header file was generated by $ANTLR version 3.2 debian-7ubuntu3
 + *
 + *     -  From the grammar source file : DAAP.g
-+ *     -                            On : 2014-09-30 21:42:39
++ *     -                            On : 2015-06-27 19:05:16
 + *     -                for the parser : DAAPParserParser *
 + * Editing it, at least manually, is not wise. 
 + *
@@ -3727,7 +3773,7 @@ index 0000000..89256ff
 \ No newline at end of file
 diff --git a/src/pregen/RSP2SQL.c b/src/pregen/RSP2SQL.c
 new file mode 100644
-index 0000000..b5c9550
+index 0000000..05b54d3
 --- /dev/null
 +++ b/src/pregen/RSP2SQL.c
 @@ -0,0 +1,2546 @@
@@ -3735,7 +3781,7 @@ index 0000000..b5c9550
 + *  This C source file was generated by $ANTLR version 3.2 debian-7ubuntu3
 + *
 + *     -  From the grammar source file : RSP2SQL.g
-+ *     -                            On : 2014-09-30 21:42:42
++ *     -                            On : 2015-06-27 19:05:19
 + *     -           for the tree parser : RSP2SQLTreeParser *
 + * Editing it, at least manually, is not wise. 
 + *
@@ -6279,7 +6325,7 @@ index 0000000..b5c9550
 + */
 diff --git a/src/pregen/RSP2SQL.h b/src/pregen/RSP2SQL.h
 new file mode 100644
-index 0000000..2789fc7
+index 0000000..a94e317
 --- /dev/null
 +++ b/src/pregen/RSP2SQL.h
 @@ -0,0 +1,291 @@
@@ -6287,7 +6333,7 @@ index 0000000..2789fc7
 + *  This C header file was generated by $ANTLR version 3.2 debian-7ubuntu3
 + *
 + *     -  From the grammar source file : RSP2SQL.g
-+ *     -                            On : 2014-09-30 21:42:42
++ *     -                            On : 2015-06-27 19:05:19
 + *     -           for the tree parser : RSP2SQLTreeParser *
 + * Editing it, at least manually, is not wise. 
 + *
@@ -6588,7 +6634,7 @@ index 0000000..53d8cda
 \ No newline at end of file
 diff --git a/src/pregen/RSPLexer.c b/src/pregen/RSPLexer.c
 new file mode 100644
-index 0000000..ee23c08
+index 0000000..bc4245a
 --- /dev/null
 +++ b/src/pregen/RSPLexer.c
 @@ -0,0 +1,4867 @@
@@ -6596,7 +6642,7 @@ index 0000000..ee23c08
 + *  This C source file was generated by $ANTLR version 3.2 debian-7ubuntu3
 + *
 + *     -  From the grammar source file : RSP.g
-+ *     -                            On : 2014-09-30 21:42:41
++ *     -                            On : 2015-06-27 19:05:18
 + *     -                 for the lexer : RSPLexerLexer *
 + * Editing it, at least manually, is not wise. 
 + *
@@ -11461,7 +11507,7 @@ index 0000000..ee23c08
 + */
 diff --git a/src/pregen/RSPLexer.h b/src/pregen/RSPLexer.h
 new file mode 100644
-index 0000000..4f4d06b
+index 0000000..d93f93e
 --- /dev/null
 +++ b/src/pregen/RSPLexer.h
 @@ -0,0 +1,254 @@
@@ -11469,7 +11515,7 @@ index 0000000..4f4d06b
 + *  This C header file was generated by $ANTLR version 3.2 debian-7ubuntu3
 + *
 + *     -  From the grammar source file : RSP.g
-+ *     -                            On : 2014-09-30 21:42:41
++ *     -                            On : 2015-06-27 19:05:18
 + *     -                 for the lexer : RSPLexerLexer *
 + * Editing it, at least manually, is not wise. 
 + *
@@ -11721,7 +11767,7 @@ index 0000000..4f4d06b
 +/* END - Note:Keep extra line feed to satisfy UNIX systems */
 diff --git a/src/pregen/RSPParser.c b/src/pregen/RSPParser.c
 new file mode 100644
-index 0000000..c538e49
+index 0000000..c0f3e2a
 --- /dev/null
 +++ b/src/pregen/RSPParser.c
 @@ -0,0 +1,2684 @@
@@ -11729,7 +11775,7 @@ index 0000000..c538e49
 + *  This C source file was generated by $ANTLR version 3.2 debian-7ubuntu3
 + *
 + *     -  From the grammar source file : RSP.g
-+ *     -                            On : 2014-09-30 21:42:40
++ *     -                            On : 2015-06-27 19:05:18
 + *     -                for the parser : RSPParserParser *
 + * Editing it, at least manually, is not wise. 
 + *
@@ -13250,7 +13296,7 @@ index 0000000..c538e49
 +
 +                       
 +                      /* AST REWRITE
-+                       * elements          : NOT, FIELD, strop, STR
++                       * elements          : NOT, strop, STR, FIELD
 +                       * token labels      : 
 +                       * rule labels       : retval
 +                       * token list labels : 
@@ -13557,7 +13603,7 @@ index 0000000..c538e49
 +
 +                       
 +                      /* AST REWRITE
-+                       * elements          : FIELD, intop, INT
++                       * elements          : intop, INT, FIELD
 +                       * token labels      : 
 +                       * rule labels       : retval
 +                       * token list labels : 
@@ -13632,7 +13678,7 @@ index 0000000..c538e49
 +
 +                       
 +                      /* AST REWRITE
-+                       * elements          : NOT, INT, FIELD, intop
++                       * elements          : INT, FIELD, intop, NOT
 +                       * token labels      : 
 +                       * rule labels       : retval
 +                       * token list labels : 
@@ -13867,7 +13913,7 @@ index 0000000..c538e49
 +
 +             
 +            /* AST REWRITE
-+             * elements          : FIELD, datespec, dateop
++             * elements          : datespec, FIELD, dateop
 +             * token labels      : 
 +             * rule labels       : retval
 +             * token list labels : 
@@ -14167,7 +14213,7 @@ index 0000000..c538e49
 +
 +                       
 +                      /* AST REWRITE
-+                       * elements          : dateintval, INT, dateref, dateop
++                       * elements          : INT, dateintval, dateop, dateref
 +                       * token labels      : 
 +                       * rule labels       : retval
 +                       * token list labels : 
@@ -14411,7 +14457,7 @@ index 0000000..c538e49
 + */
 diff --git a/src/pregen/RSPParser.h b/src/pregen/RSPParser.h
 new file mode 100644
-index 0000000..d0744a2
+index 0000000..4b3bbfe
 --- /dev/null
 +++ b/src/pregen/RSPParser.h
 @@ -0,0 +1,365 @@
@@ -14419,7 +14465,7 @@ index 0000000..d0744a2
 + *  This C header file was generated by $ANTLR version 3.2 debian-7ubuntu3
 + *
 + *     -  From the grammar source file : RSP.g
-+ *     -                            On : 2014-09-30 21:42:40
++ *     -                            On : 2015-06-27 19:05:18
 + *     -                for the parser : RSPParserParser *
 + * Editing it, at least manually, is not wise. 
 + *
@@ -14780,3 +14826,8446 @@ index 0000000..d0744a2
 +#endif
 +
 +/* END - Note:Keep extra line feed to satisfy UNIX systems */
+diff --git a/src/pregen/SMARTPL.u b/src/pregen/SMARTPL.u
+new file mode 100644
+index 0000000..2a66bf3
+--- /dev/null
++++ b/src/pregen/SMARTPL.u
+@@ -0,0 +1,6 @@
++SMARTPLParser.c : SMARTPL.g
++./SMARTPL.tokens : SMARTPL.g
++SMARTPLParser.h : SMARTPL.g
++SMARTPLLexer.c : SMARTPL.g
++SMARTPLLexer.h : SMARTPL.g
++ANTLR_PRODUCTS += SMARTPLParser.c ./SMARTPL.tokens SMARTPLParser.h SMARTPLLexer.c SMARTPLLexer.h 
+\ No newline at end of file
+diff --git a/src/pregen/SMARTPL2SQL.c b/src/pregen/SMARTPL2SQL.c
+new file mode 100644
+index 0000000..c435f37
+--- /dev/null
++++ b/src/pregen/SMARTPL2SQL.c
+@@ -0,0 +1,1649 @@
++/** \file
++ *  This C source file was generated by $ANTLR version 3.2 debian-7ubuntu3
++ *
++ *     -  From the grammar source file : SMARTPL2SQL.g
++ *     -                            On : 2015-06-27 19:05:21
++ *     -           for the tree parser : SMARTPL2SQLTreeParser *
++ * Editing it, at least manually, is not wise. 
++ *
++ * C language generator and runtime by Jim Idle, jimi|hereisanat|idle|dotgoeshere|ws.
++ *
++ *
++*/
++// [The "BSD licence"]
++// Copyright (c) 2005-2009 Jim Idle, Temporal Wave LLC
++// http://www.temporal-wave.com
++// http://www.linkedin.com/in/jimidle
++//
++// All rights reserved.
++//
++// Redistribution and use in source and binary forms, with or without
++// modification, are permitted provided that the following conditions
++// are met:
++// 1. Redistributions of source code must retain the above copyright
++//    notice, this list of conditions and the following disclaimer.
++// 2. Redistributions in binary form must reproduce the above copyright
++//    notice, this list of conditions and the following disclaimer in the
++//    documentation and/or other materials provided with the distribution.
++// 3. The name of the author may not be used to endorse or promote products
++//    derived from this software without specific prior written permission.
++//
++// THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
++// IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
++// OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
++// IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
++// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
++// NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
++// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
++// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
++// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
++// THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
++
++
++/* =============================================================================
++ * This is what the grammar programmer asked us to put at the top of every file.
++ */
++
++      #include <stdio.h>
++      #include <stdlib.h>
++      #include <string.h>
++      #include <limits.h>
++      #include <errno.h>
++      #include <time.h>
++      #include <sqlite3.h>
++
++      #include "logger.h"
++      #include "db.h"
++
++/* End of Header action.
++ * =============================================================================
++ */
++/* -----------------------------------------
++ * Include the ANTLR3 generated header file.
++ */
++#include    "SMARTPL2SQL.h"
++/* ----------------------------------------- */
++
++
++
++
++
++/* MACROS that hide the C interface implementations from the
++ * generated code, which makes it a little more understandable to the human eye.
++ * I am very much against using C pre-processor macros for function calls and bits
++ * of code as you cannot see what is happening when single stepping in debuggers
++ * and so on. The exception (in my book at least) is for generated code, where you are
++ * not maintaining it, but may wish to read and understand it. If you single step it, you know that input()
++ * hides some indirect calls, but is always referring to the input stream. This is
++ * probably more readable than ctx->input->istream->input(snarfle0->blarg) and allows me to rejig
++ * the runtime interfaces without changing the generated code too often, without
++ * confusing the reader of the generated output, who may not wish to know the gory
++ * details of the interface inheritance.
++ */
++ 
++#define               CTX     ctx
++
++/* Aids in accessing scopes for grammar programmers
++ */
++#undef        SCOPE_TYPE
++#undef        SCOPE_STACK
++#undef        SCOPE_TOP
++#define       SCOPE_TYPE(scope)   pSMARTPL2SQL_##scope##_SCOPE
++#define SCOPE_STACK(scope)  pSMARTPL2SQL_##scope##Stack
++#define       SCOPE_TOP(scope)    ctx->pSMARTPL2SQL_##scope##Top
++#define       SCOPE_SIZE(scope)               ctx->pSMARTPL2SQL_##scope##Stack_limit
++#define SCOPE_INSTANCE(scope, i)      (ctx->SCOPE_STACK(scope)->get(ctx->SCOPE_STACK(scope),i))
++
++/* Macros for accessing things in the parser
++ */
++ 
++#undef            PARSER
++#undef            RECOGNIZER              
++#undef            HAVEPARSEDRULE
++#undef            INPUT
++#undef            STRSTREAM
++#undef            HASEXCEPTION
++#undef            EXCEPTION
++#undef            MATCHT
++#undef            MATCHANYT
++#undef            FOLLOWSTACK
++#undef            FOLLOWPUSH
++#undef            FOLLOWPOP
++#undef            PRECOVER
++#undef            PREPORTERROR
++#undef            LA
++#undef            LT
++#undef            CONSTRUCTEX
++#undef            CONSUME
++#undef            MARK
++#undef            REWIND
++#undef            REWINDLAST
++#undef            PERRORRECOVERY
++#undef            HASFAILED
++#undef            FAILEDFLAG
++#undef            RECOVERFROMMISMATCHEDSET
++#undef            RECOVERFROMMISMATCHEDELEMENT
++#undef            BACKTRACKING
++#undef      ADAPTOR
++#undef            RULEMEMO            
++#undef                SEEK    
++#undef                INDEX
++#undef                DBG
++
++#define           PARSER                                                      ctx->pTreeParser  
++#define           RECOGNIZER                                          PARSER->rec
++#define               PSRSTATE                                                RECOGNIZER->state
++#define           HAVEPARSEDRULE(r)                           RECOGNIZER->alreadyParsedRule(RECOGNIZER, r)
++#define           INPUT                                                       PARSER->ctnstream
++#define               ISTREAM                                                 INPUT->tnstream->istream
++#define           STRSTREAM                                           INPUT->tnstream
++#define           HASEXCEPTION()                                      (PSRSTATE->error == ANTLR3_TRUE)
++#define           EXCEPTION                                           PSRSTATE->exception
++#define           MATCHT(t, fs)                                       RECOGNIZER->match(RECOGNIZER, t, fs)
++#define           MATCHANYT()                                         RECOGNIZER->matchAny(RECOGNIZER)
++#define           FOLLOWSTACK                                     PSRSTATE->following
++#define           FOLLOWPUSH(x)                                       FOLLOWSTACK->push(FOLLOWSTACK, ((void *)(&(x))), NULL)
++#define           FOLLOWPOP()                                         FOLLOWSTACK->pop(FOLLOWSTACK)
++#define           PRECOVER()                                          RECOGNIZER->recover(RECOGNIZER)
++#define           PREPORTERROR()                                      RECOGNIZER->reportError(RECOGNIZER)
++#define           LA(n)                                                       ISTREAM->_LA(ISTREAM, n)
++#define           LT(n)                                                       INPUT->tnstream->_LT(INPUT->tnstream, n)
++#define           CONSTRUCTEX()                                       RECOGNIZER->exConstruct(RECOGNIZER)
++#define           CONSUME()                                           ISTREAM->consume(ISTREAM)
++#define           MARK()                                                      ISTREAM->mark(ISTREAM)
++#define           REWIND(m)                                           ISTREAM->rewind(ISTREAM, m)
++#define           REWINDLAST()                                        ISTREAM->rewindLast(ISTREAM)
++#define           PERRORRECOVERY                                      PSRSTATE->errorRecovery
++#define           FAILEDFLAG                                          PSRSTATE->failed
++#define           HASFAILED()                                         (FAILEDFLAG == ANTLR3_TRUE)
++#define           BACKTRACKING                                        PSRSTATE->backtracking
++#define           RECOVERFROMMISMATCHEDSET(s)         RECOGNIZER->recoverFromMismatchedSet(RECOGNIZER, s)
++#define           RECOVERFROMMISMATCHEDELEMENT(e)     RECOGNIZER->recoverFromMismatchedElement(RECOGNIZER, s)
++#define     ADAPTOR                         INPUT->adaptor
++#define               RULEMEMO                                                PSRSTATE->ruleMemo
++#define               SEEK(n)                                                 ISTREAM->seek(ISTREAM, n)
++#define               INDEX()                                                 ISTREAM->index(ISTREAM)
++#define               DBG                                                             RECOGNIZER->debugger
++
++
++#define               TOKTEXT(tok, txt)                               tok, (pANTLR3_UINT8)txt
++
++/* The 4 tokens defined below may well clash with your own #defines or token types. If so
++ * then for the present you must use different names for your defines as these are hard coded
++ * in the code generator. It would be better not to use such names internally, and maybe
++ * we can change this in a forthcoming release. I deliberately do not #undef these
++ * here as this will at least give you a redefined error somewhere if they clash.
++ */
++#define           UP      ANTLR3_TOKEN_UP
++#define           DOWN    ANTLR3_TOKEN_DOWN
++#define           EOR     ANTLR3_TOKEN_EOR
++#define           INVALID ANTLR3_TOKEN_INVALID
++
++
++/* =============================================================================
++ * Functions to create and destroy scopes. First come the rule scopes, followed
++ * by the global declared scopes.
++ */
++
++
++
++/* ============================================================================= */
++
++/* =============================================================================
++ * Start of recognizer
++ */
++
++
++
++/** \brief Table of all token names in symbolic order, mainly used for
++ *         error reporting.
++ */
++pANTLR3_UINT8   SMARTPL2SQLTokenNames[28+4]
++     = {
++        (pANTLR3_UINT8) "<invalid>",       /* String to print to indicate an invalid token */
++        (pANTLR3_UINT8) "<EOR>",
++        (pANTLR3_UINT8) "<DOWN>", 
++        (pANTLR3_UINT8) "<UP>", 
++        (pANTLR3_UINT8) "STR",
++        (pANTLR3_UINT8) "OR",
++        (pANTLR3_UINT8) "AND",
++        (pANTLR3_UINT8) "NOT",
++        (pANTLR3_UINT8) "LPAR",
++        (pANTLR3_UINT8) "RPAR",
++        (pANTLR3_UINT8) "STRTAG",
++        (pANTLR3_UINT8) "INCLUDES",
++        (pANTLR3_UINT8) "IS",
++        (pANTLR3_UINT8) "INTTAG",
++        (pANTLR3_UINT8) "INTBOOL",
++        (pANTLR3_UINT8) "INT",
++        (pANTLR3_UINT8) "DATETAG",
++        (pANTLR3_UINT8) "AFTER",
++        (pANTLR3_UINT8) "BEFORE",
++        (pANTLR3_UINT8) "ENUMTAG",
++        (pANTLR3_UINT8) "ENUMVAL",
++        (pANTLR3_UINT8) "DATE",
++        (pANTLR3_UINT8) "AGO",
++        (pANTLR3_UINT8) "DATINTERVAL",
++        (pANTLR3_UINT8) "GREATER",
++        (pANTLR3_UINT8) "GREATEREQUAL",
++        (pANTLR3_UINT8) "LESS",
++        (pANTLR3_UINT8) "LESSEQUAL",
++        (pANTLR3_UINT8) "EQUAL",
++        (pANTLR3_UINT8) "WHITESPACE",
++        (pANTLR3_UINT8) "'{'",
++        (pANTLR3_UINT8) "'}'"
++       };
++
++        
++
++// Forward declare the locally static matching functions we have generated.
++//
++static SMARTPL2SQL_playlist_return    playlist    (pSMARTPL2SQL ctx);
++static pANTLR3_STRING expression    (pSMARTPL2SQL ctx);
++static int    dateval    (pSMARTPL2SQL ctx);
++static int    interval    (pSMARTPL2SQL ctx);
++static void   SMARTPL2SQLFree(pSMARTPL2SQL ctx);
++/* For use in tree output where we are accumulating rule labels via label += ruleRef
++ * we need a function that knows how to free a return scope when the list is destroyed. 
++ * We cannot just use ANTLR3_FREE because in debug tracking mode, this is a macro.
++ */
++static        void ANTLR3_CDECL freeScope(void * scope)
++{
++    ANTLR3_FREE(scope);
++}
++
++/** \brief Name of the grammar file that generated this code
++ */
++static const char fileName[] = "SMARTPL2SQL.g";
++
++/** \brief Return the name of the grammar file that generated this code.
++ */
++static const char * getGrammarFileName()
++{
++      return fileName;
++}
++/** \brief Create a new SMARTPL2SQL parser and return a context for it.
++ *
++ * \param[in] instream Pointer to an input stream interface.
++ *
++ * \return Pointer to new parser context upon success.
++ */
++ANTLR3_API pSMARTPL2SQL
++SMARTPL2SQLNew   (pANTLR3_COMMON_TREE_NODE_STREAM instream)
++{
++      // See if we can create a new parser with the standard constructor
++      //
++      return SMARTPL2SQLNewSSD(instream, NULL);
++}
++
++/** \brief Create a new SMARTPL2SQL parser and return a context for it.
++ *
++ * \param[in] instream Pointer to an input stream interface.
++ *
++ * \return Pointer to new parser context upon success.
++ */
++ANTLR3_API pSMARTPL2SQL
++SMARTPL2SQLNewSSD   (pANTLR3_COMMON_TREE_NODE_STREAM instream, pANTLR3_RECOGNIZER_SHARED_STATE state)
++{
++    pSMARTPL2SQL ctx;     /* Context structure we will build and return   */
++    
++    ctx       = (pSMARTPL2SQL) ANTLR3_CALLOC(1, sizeof(SMARTPL2SQL));
++    
++    if        (ctx == NULL)
++    {
++              // Failed to allocate memory for parser context
++              //
++        return  NULL;
++    }
++    
++    /* -------------------------------------------------------------------
++     * Memory for basic structure is allocated, now to fill in
++     * the base ANTLR3 structures. We initialize the function pointers
++     * for the standard ANTLR3 parser function set, but upon return
++     * from here, the programmer may set the pointers to provide custom
++     * implementations of each function. 
++     *
++     * We don't use the macros defined in SMARTPL2SQL.h here, in order that you can get a sense
++     * of what goes where.
++     */
++
++    /* Create a base Tree parser/recognizer, using the supplied tree node stream
++     */
++    ctx->pTreeParser          = antlr3TreeParserNewStream(ANTLR3_SIZE_HINT, instream, state);
++    /* Install the implementation of our SMARTPL2SQL interface
++     */
++    ctx->playlist     = playlist;
++    ctx->expression   = expression;
++    ctx->dateval      = dateval;
++    ctx->interval     = interval;
++    ctx->free                 = SMARTPL2SQLFree;
++    ctx->getGrammarFileName   = getGrammarFileName;
++    
++    /* Install the scope pushing methods.
++     */
++
++        
++    
++
++      
++    /* Install the token table
++     */
++    PSRSTATE->tokenNames   = SMARTPL2SQLTokenNames;
++    
++    
++    /* Return the newly built parser to the caller
++     */
++    return  ctx;
++}
++
++/** Free the parser resources
++ */
++ static void
++ SMARTPL2SQLFree(pSMARTPL2SQL ctx)
++ {
++    /* Free any scope memory
++     */
++    
++        
++      // Free this parser
++      //
++    ctx->pTreeParser->free(ctx->pTreeParser);
++    ANTLR3_FREE(ctx);
++
++    /* Everything is released, so we can return
++     */
++    return;
++ }
++ 
++/** Return token names used by this tree parser
++ *
++ * The returned pointer is used as an index into the token names table (using the token 
++ * number as the index).
++ * 
++ * \return Pointer to first char * in the table.
++ */
++static pANTLR3_UINT8    *getTokenNames() 
++{
++        return SMARTPL2SQLTokenNames; 
++}
++
++
++
++    
++/* Declare the bitsets
++ */
++
++/** Bitset defining follow set for error recovery in rule state: FOLLOW_STR_in_playlist66  */
++static        ANTLR3_BITWORD FOLLOW_STR_in_playlist66_bits[]  = { ANTLR3_UINT64_LIT(0x0000000040000000) };
++static  ANTLR3_BITSET_LIST FOLLOW_STR_in_playlist66   = { FOLLOW_STR_in_playlist66_bits, 1    };
++/** Bitset defining follow set for error recovery in rule state: FOLLOW_30_in_playlist68  */
++static        ANTLR3_BITWORD FOLLOW_30_in_playlist68_bits[]   = { ANTLR3_UINT64_LIT(0x00000000000924E0) };
++static  ANTLR3_BITSET_LIST FOLLOW_30_in_playlist68    = { FOLLOW_30_in_playlist68_bits, 1     };
++/** Bitset defining follow set for error recovery in rule state: FOLLOW_expression_in_playlist74  */
++static        ANTLR3_BITWORD FOLLOW_expression_in_playlist74_bits[]   = { ANTLR3_UINT64_LIT(0x0000000080000000) };
++static  ANTLR3_BITSET_LIST FOLLOW_expression_in_playlist74    = { FOLLOW_expression_in_playlist74_bits, 1     };
++/** Bitset defining follow set for error recovery in rule state: FOLLOW_31_in_playlist76  */
++static        ANTLR3_BITWORD FOLLOW_31_in_playlist76_bits[]   = { ANTLR3_UINT64_LIT(0x0000000000000002) };
++static  ANTLR3_BITSET_LIST FOLLOW_31_in_playlist76    = { FOLLOW_31_in_playlist76_bits, 1     };
++/** Bitset defining follow set for error recovery in rule state: FOLLOW_NOT_in_expression101  */
++static        ANTLR3_BITWORD FOLLOW_NOT_in_expression101_bits[]       = { ANTLR3_UINT64_LIT(0x0000000000000004) };
++static  ANTLR3_BITSET_LIST FOLLOW_NOT_in_expression101        = { FOLLOW_NOT_in_expression101_bits, 1 };
++/** Bitset defining follow set for error recovery in rule state: FOLLOW_expression_in_expression107  */
++static        ANTLR3_BITWORD FOLLOW_expression_in_expression107_bits[]        = { ANTLR3_UINT64_LIT(0x0000000000000008) };
++static  ANTLR3_BITSET_LIST FOLLOW_expression_in_expression107 = { FOLLOW_expression_in_expression107_bits, 1  };
++/** Bitset defining follow set for error recovery in rule state: FOLLOW_AND_in_expression118  */
++static        ANTLR3_BITWORD FOLLOW_AND_in_expression118_bits[]       = { ANTLR3_UINT64_LIT(0x0000000000000004) };
++static  ANTLR3_BITSET_LIST FOLLOW_AND_in_expression118        = { FOLLOW_AND_in_expression118_bits, 1 };
++/** Bitset defining follow set for error recovery in rule state: FOLLOW_expression_in_expression124  */
++static        ANTLR3_BITWORD FOLLOW_expression_in_expression124_bits[]        = { ANTLR3_UINT64_LIT(0x00000000000924E0) };
++static  ANTLR3_BITSET_LIST FOLLOW_expression_in_expression124 = { FOLLOW_expression_in_expression124_bits, 1  };
++/** Bitset defining follow set for error recovery in rule state: FOLLOW_expression_in_expression130  */
++static        ANTLR3_BITWORD FOLLOW_expression_in_expression130_bits[]        = { ANTLR3_UINT64_LIT(0x0000000000000008) };
++static  ANTLR3_BITSET_LIST FOLLOW_expression_in_expression130 = { FOLLOW_expression_in_expression130_bits, 1  };
++/** Bitset defining follow set for error recovery in rule state: FOLLOW_OR_in_expression141  */
++static        ANTLR3_BITWORD FOLLOW_OR_in_expression141_bits[]        = { ANTLR3_UINT64_LIT(0x0000000000000004) };
++static  ANTLR3_BITSET_LIST FOLLOW_OR_in_expression141 = { FOLLOW_OR_in_expression141_bits, 1  };
++/** Bitset defining follow set for error recovery in rule state: FOLLOW_expression_in_expression147  */
++static        ANTLR3_BITWORD FOLLOW_expression_in_expression147_bits[]        = { ANTLR3_UINT64_LIT(0x00000000000924E0) };
++static  ANTLR3_BITSET_LIST FOLLOW_expression_in_expression147 = { FOLLOW_expression_in_expression147_bits, 1  };
++/** Bitset defining follow set for error recovery in rule state: FOLLOW_expression_in_expression153  */
++static        ANTLR3_BITWORD FOLLOW_expression_in_expression153_bits[]        = { ANTLR3_UINT64_LIT(0x0000000000000008) };
++static  ANTLR3_BITSET_LIST FOLLOW_expression_in_expression153 = { FOLLOW_expression_in_expression153_bits, 1  };
++/** Bitset defining follow set for error recovery in rule state: FOLLOW_STRTAG_in_expression163  */
++static        ANTLR3_BITWORD FOLLOW_STRTAG_in_expression163_bits[]    = { ANTLR3_UINT64_LIT(0x0000000000000800) };
++static  ANTLR3_BITSET_LIST FOLLOW_STRTAG_in_expression163     = { FOLLOW_STRTAG_in_expression163_bits, 1      };
++/** Bitset defining follow set for error recovery in rule state: FOLLOW_INCLUDES_in_expression165  */
++static        ANTLR3_BITWORD FOLLOW_INCLUDES_in_expression165_bits[]  = { ANTLR3_UINT64_LIT(0x0000000000000010) };
++static  ANTLR3_BITSET_LIST FOLLOW_INCLUDES_in_expression165   = { FOLLOW_INCLUDES_in_expression165_bits, 1    };
++/** Bitset defining follow set for error recovery in rule state: FOLLOW_STR_in_expression167  */
++static        ANTLR3_BITWORD FOLLOW_STR_in_expression167_bits[]       = { ANTLR3_UINT64_LIT(0x0000000000000002) };
++static  ANTLR3_BITSET_LIST FOLLOW_STR_in_expression167        = { FOLLOW_STR_in_expression167_bits, 1 };
++/** Bitset defining follow set for error recovery in rule state: FOLLOW_STRTAG_in_expression176  */
++static        ANTLR3_BITWORD FOLLOW_STRTAG_in_expression176_bits[]    = { ANTLR3_UINT64_LIT(0x0000000000001000) };
++static  ANTLR3_BITSET_LIST FOLLOW_STRTAG_in_expression176     = { FOLLOW_STRTAG_in_expression176_bits, 1      };
++/** Bitset defining follow set for error recovery in rule state: FOLLOW_IS_in_expression178  */
++static        ANTLR3_BITWORD FOLLOW_IS_in_expression178_bits[]        = { ANTLR3_UINT64_LIT(0x0000000000000010) };
++static  ANTLR3_BITSET_LIST FOLLOW_IS_in_expression178 = { FOLLOW_IS_in_expression178_bits, 1  };
++/** Bitset defining follow set for error recovery in rule state: FOLLOW_STR_in_expression180  */
++static        ANTLR3_BITWORD FOLLOW_STR_in_expression180_bits[]       = { ANTLR3_UINT64_LIT(0x0000000000000002) };
++static  ANTLR3_BITSET_LIST FOLLOW_STR_in_expression180        = { FOLLOW_STR_in_expression180_bits, 1 };
++/** Bitset defining follow set for error recovery in rule state: FOLLOW_INTTAG_in_expression189  */
++static        ANTLR3_BITWORD FOLLOW_INTTAG_in_expression189_bits[]    = { ANTLR3_UINT64_LIT(0x0000000000004000) };
++static  ANTLR3_BITSET_LIST FOLLOW_INTTAG_in_expression189     = { FOLLOW_INTTAG_in_expression189_bits, 1      };
++/** Bitset defining follow set for error recovery in rule state: FOLLOW_INTBOOL_in_expression191  */
++static        ANTLR3_BITWORD FOLLOW_INTBOOL_in_expression191_bits[]   = { ANTLR3_UINT64_LIT(0x0000000000008000) };
++static  ANTLR3_BITSET_LIST FOLLOW_INTBOOL_in_expression191    = { FOLLOW_INTBOOL_in_expression191_bits, 1     };
++/** Bitset defining follow set for error recovery in rule state: FOLLOW_INT_in_expression193  */
++static        ANTLR3_BITWORD FOLLOW_INT_in_expression193_bits[]       = { ANTLR3_UINT64_LIT(0x0000000000000002) };
++static  ANTLR3_BITSET_LIST FOLLOW_INT_in_expression193        = { FOLLOW_INT_in_expression193_bits, 1 };
++/** Bitset defining follow set for error recovery in rule state: FOLLOW_DATETAG_in_expression202  */
++static        ANTLR3_BITWORD FOLLOW_DATETAG_in_expression202_bits[]   = { ANTLR3_UINT64_LIT(0x0000000000020000) };
++static  ANTLR3_BITSET_LIST FOLLOW_DATETAG_in_expression202    = { FOLLOW_DATETAG_in_expression202_bits, 1     };
++/** Bitset defining follow set for error recovery in rule state: FOLLOW_AFTER_in_expression204  */
++static        ANTLR3_BITWORD FOLLOW_AFTER_in_expression204_bits[]     = { ANTLR3_UINT64_LIT(0x0000000000208000) };
++static  ANTLR3_BITSET_LIST FOLLOW_AFTER_in_expression204      = { FOLLOW_AFTER_in_expression204_bits, 1       };
++/** Bitset defining follow set for error recovery in rule state: FOLLOW_dateval_in_expression206  */
++static        ANTLR3_BITWORD FOLLOW_dateval_in_expression206_bits[]   = { ANTLR3_UINT64_LIT(0x0000000000000002) };
++static  ANTLR3_BITSET_LIST FOLLOW_dateval_in_expression206    = { FOLLOW_dateval_in_expression206_bits, 1     };
++/** Bitset defining follow set for error recovery in rule state: FOLLOW_DATETAG_in_expression215  */
++static        ANTLR3_BITWORD FOLLOW_DATETAG_in_expression215_bits[]   = { ANTLR3_UINT64_LIT(0x0000000000040000) };
++static  ANTLR3_BITSET_LIST FOLLOW_DATETAG_in_expression215    = { FOLLOW_DATETAG_in_expression215_bits, 1     };
++/** Bitset defining follow set for error recovery in rule state: FOLLOW_BEFORE_in_expression217  */
++static        ANTLR3_BITWORD FOLLOW_BEFORE_in_expression217_bits[]    = { ANTLR3_UINT64_LIT(0x0000000000208000) };
++static  ANTLR3_BITSET_LIST FOLLOW_BEFORE_in_expression217     = { FOLLOW_BEFORE_in_expression217_bits, 1      };
++/** Bitset defining follow set for error recovery in rule state: FOLLOW_dateval_in_expression219  */
++static        ANTLR3_BITWORD FOLLOW_dateval_in_expression219_bits[]   = { ANTLR3_UINT64_LIT(0x0000000000000002) };
++static  ANTLR3_BITSET_LIST FOLLOW_dateval_in_expression219    = { FOLLOW_dateval_in_expression219_bits, 1     };
++/** Bitset defining follow set for error recovery in rule state: FOLLOW_ENUMTAG_in_expression228  */
++static        ANTLR3_BITWORD FOLLOW_ENUMTAG_in_expression228_bits[]   = { ANTLR3_UINT64_LIT(0x0000000000001000) };
++static  ANTLR3_BITSET_LIST FOLLOW_ENUMTAG_in_expression228    = { FOLLOW_ENUMTAG_in_expression228_bits, 1     };
++/** Bitset defining follow set for error recovery in rule state: FOLLOW_IS_in_expression230  */
++static        ANTLR3_BITWORD FOLLOW_IS_in_expression230_bits[]        = { ANTLR3_UINT64_LIT(0x0000000000100000) };
++static  ANTLR3_BITSET_LIST FOLLOW_IS_in_expression230 = { FOLLOW_IS_in_expression230_bits, 1  };
++/** Bitset defining follow set for error recovery in rule state: FOLLOW_ENUMVAL_in_expression232  */
++static        ANTLR3_BITWORD FOLLOW_ENUMVAL_in_expression232_bits[]   = { ANTLR3_UINT64_LIT(0x0000000000000002) };
++static  ANTLR3_BITSET_LIST FOLLOW_ENUMVAL_in_expression232    = { FOLLOW_ENUMVAL_in_expression232_bits, 1     };
++/** Bitset defining follow set for error recovery in rule state: FOLLOW_DATE_in_dateval257  */
++static        ANTLR3_BITWORD FOLLOW_DATE_in_dateval257_bits[] = { ANTLR3_UINT64_LIT(0x0000000000000002) };
++static  ANTLR3_BITSET_LIST FOLLOW_DATE_in_dateval257  = { FOLLOW_DATE_in_dateval257_bits, 1   };
++/** Bitset defining follow set for error recovery in rule state: FOLLOW_interval_in_dateval266  */
++static        ANTLR3_BITWORD FOLLOW_interval_in_dateval266_bits[]     = { ANTLR3_UINT64_LIT(0x0000000000040000) };
++static  ANTLR3_BITSET_LIST FOLLOW_interval_in_dateval266      = { FOLLOW_interval_in_dateval266_bits, 1       };
++/** Bitset defining follow set for error recovery in rule state: FOLLOW_BEFORE_in_dateval268  */
++static        ANTLR3_BITWORD FOLLOW_BEFORE_in_dateval268_bits[]       = { ANTLR3_UINT64_LIT(0x0000000000200000) };
++static  ANTLR3_BITSET_LIST FOLLOW_BEFORE_in_dateval268        = { FOLLOW_BEFORE_in_dateval268_bits, 1 };
++/** Bitset defining follow set for error recovery in rule state: FOLLOW_DATE_in_dateval270  */
++static        ANTLR3_BITWORD FOLLOW_DATE_in_dateval270_bits[] = { ANTLR3_UINT64_LIT(0x0000000000000002) };
++static  ANTLR3_BITSET_LIST FOLLOW_DATE_in_dateval270  = { FOLLOW_DATE_in_dateval270_bits, 1   };
++/** Bitset defining follow set for error recovery in rule state: FOLLOW_interval_in_dateval279  */
++static        ANTLR3_BITWORD FOLLOW_interval_in_dateval279_bits[]     = { ANTLR3_UINT64_LIT(0x0000000000020000) };
++static  ANTLR3_BITSET_LIST FOLLOW_interval_in_dateval279      = { FOLLOW_interval_in_dateval279_bits, 1       };
++/** Bitset defining follow set for error recovery in rule state: FOLLOW_AFTER_in_dateval281  */
++static        ANTLR3_BITWORD FOLLOW_AFTER_in_dateval281_bits[]        = { ANTLR3_UINT64_LIT(0x0000000000200000) };
++static  ANTLR3_BITSET_LIST FOLLOW_AFTER_in_dateval281 = { FOLLOW_AFTER_in_dateval281_bits, 1  };
++/** Bitset defining follow set for error recovery in rule state: FOLLOW_DATE_in_dateval283  */
++static        ANTLR3_BITWORD FOLLOW_DATE_in_dateval283_bits[] = { ANTLR3_UINT64_LIT(0x0000000000000002) };
++static  ANTLR3_BITSET_LIST FOLLOW_DATE_in_dateval283  = { FOLLOW_DATE_in_dateval283_bits, 1   };
++/** Bitset defining follow set for error recovery in rule state: FOLLOW_interval_in_dateval292  */
++static        ANTLR3_BITWORD FOLLOW_interval_in_dateval292_bits[]     = { ANTLR3_UINT64_LIT(0x0000000000400000) };
++static  ANTLR3_BITSET_LIST FOLLOW_interval_in_dateval292      = { FOLLOW_interval_in_dateval292_bits, 1       };
++/** Bitset defining follow set for error recovery in rule state: FOLLOW_AGO_in_dateval294  */
++static        ANTLR3_BITWORD FOLLOW_AGO_in_dateval294_bits[]  = { ANTLR3_UINT64_LIT(0x0000000000000002) };
++static  ANTLR3_BITSET_LIST FOLLOW_AGO_in_dateval294   = { FOLLOW_AGO_in_dateval294_bits, 1    };
++/** Bitset defining follow set for error recovery in rule state: FOLLOW_INT_in_interval318  */
++static        ANTLR3_BITWORD FOLLOW_INT_in_interval318_bits[] = { ANTLR3_UINT64_LIT(0x0000000000800000) };
++static  ANTLR3_BITSET_LIST FOLLOW_INT_in_interval318  = { FOLLOW_INT_in_interval318_bits, 1   };
++/** Bitset defining follow set for error recovery in rule state: FOLLOW_DATINTERVAL_in_interval320  */
++static        ANTLR3_BITWORD FOLLOW_DATINTERVAL_in_interval320_bits[] = { ANTLR3_UINT64_LIT(0x0000000000000002) };
++static  ANTLR3_BITSET_LIST FOLLOW_DATINTERVAL_in_interval320  = { FOLLOW_DATINTERVAL_in_interval320_bits, 1   };
++     
++
++ 
++ 
++/* ==============================================
++ * Parsing rules
++ */
++/** 
++ * $ANTLR start playlist
++ * SMARTPL2SQL.g:43:1: playlist returns [ pANTLR3_STRING title, pANTLR3_STRING query ] : STR '{' e= expression '}' ;
++ */
++static SMARTPL2SQL_playlist_return
++playlist(pSMARTPL2SQL ctx)
++{   
++    SMARTPL2SQL_playlist_return retval;
++
++    pANTLR3_BASE_TREE    STR1;
++    pANTLR3_STRING e;
++    #undef    RETURN_TYPE_e
++    #define   RETURN_TYPE_e pANTLR3_STRING
++
++    /* Initialize rule variables
++     */
++
++
++     retval.title= NULL; retval.query= NULL; 
++    STR1       = NULL;
++    e = NULL;
++    retval.start = LT(1); retval.stop = retval.start;
++
++    {
++        // SMARTPL2SQL.g:45:2: ( STR '{' e= expression '}' )
++        // SMARTPL2SQL.g:45:4: STR '{' e= expression '}'
++        {
++            STR1 = (pANTLR3_BASE_TREE) MATCHT(STR, &FOLLOW_STR_in_playlist66); 
++            if  (HASEXCEPTION())
++            {
++                goto ruleplaylistEx;
++            }
++
++             MATCHT(30, &FOLLOW_30_in_playlist68); 
++            if  (HASEXCEPTION())
++            {
++                goto ruleplaylistEx;
++            }
++
++            FOLLOWPUSH(FOLLOW_expression_in_playlist74);
++            e=expression(ctx);
++
++            FOLLOWPOP();
++            if  (HASEXCEPTION())
++            {
++                goto ruleplaylistEx;
++            }
++
++             MATCHT(31, &FOLLOW_31_in_playlist76); 
++            if  (HASEXCEPTION())
++            {
++                goto ruleplaylistEx;
++            }
++
++            {
++
++                                      pANTLR3_UINT8 val;
++                                      val = (STR1->getText(STR1))->toUTF8((STR1->getText(STR1)))->chars;
++                                      val++;
++                                      val[strlen((const char *)val) - 1] = '\0';
++                                      
++                                      retval.title= (STR1->getText(STR1))->factory->newRaw((STR1->getText(STR1))->factory);
++                                      retval.title->append8(retval.title, (const char *)val);
++                                      
++                                      retval.query= e->factory->newRaw(e->factory);
++                                      retval.query->append8(retval.query, "(");
++                                      retval.query->appendS(retval.query, e);
++                                      retval.query->append8(retval.query, ")");
++                              
++            }
++
++        }
++
++    }
++    
++
++    // This is where rules clean up and exit
++    //
++    goto ruleplaylistEx; /* Prevent compiler warnings */
++    ruleplaylistEx: ;
++
++            if (HASEXCEPTION())
++            {
++                PREPORTERROR();
++                PRECOVER();
++            }
++
++
++    return retval;
++}
++/* $ANTLR end playlist */
++
++/** 
++ * $ANTLR start expression
++ * SMARTPL2SQL.g:62:1: expression returns [ pANTLR3_STRING result ] : ( ^( NOT a= expression ) | ^( AND a= expression b= expression ) | ^( OR a= expression b= expression ) | STRTAG INCLUDES STR | STRTAG IS STR | INTTAG INTBOOL INT | DATETAG AFTER dateval | DATETAG BEFORE dateval | ENUMTAG IS ENUMVAL );
++ */
++static pANTLR3_STRING
++expression(pSMARTPL2SQL ctx)
++{   
++    pANTLR3_STRING result = NULL;
++
++    pANTLR3_BASE_TREE    STR2;
++    pANTLR3_BASE_TREE    STRTAG3;
++    pANTLR3_BASE_TREE    STR4;
++    pANTLR3_BASE_TREE    STRTAG5;
++    pANTLR3_BASE_TREE    INTTAG6;
++    pANTLR3_BASE_TREE    INTBOOL7;
++    pANTLR3_BASE_TREE    INT8;
++    pANTLR3_BASE_TREE    DATETAG10;
++    pANTLR3_BASE_TREE    DATETAG12;
++    pANTLR3_BASE_TREE    ENUMTAG13;
++    pANTLR3_BASE_TREE    ENUMVAL14;
++    pANTLR3_STRING a;
++    #undef    RETURN_TYPE_a
++    #define   RETURN_TYPE_a pANTLR3_STRING
++
++    pANTLR3_STRING b;
++    #undef    RETURN_TYPE_b
++    #define   RETURN_TYPE_b pANTLR3_STRING
++
++    int dateval9;
++    #undef    RETURN_TYPE_dateval9
++    #define   RETURN_TYPE_dateval9 int
++
++    int dateval11;
++    #undef    RETURN_TYPE_dateval11
++    #define   RETURN_TYPE_dateval11 int
++
++    /* Initialize rule variables
++     */
++
++
++     result= NULL; 
++    STR2       = NULL;
++    STRTAG3       = NULL;
++    STR4       = NULL;
++    STRTAG5       = NULL;
++    INTTAG6       = NULL;
++    INTBOOL7       = NULL;
++    INT8       = NULL;
++    DATETAG10       = NULL;
++    DATETAG12       = NULL;
++    ENUMTAG13       = NULL;
++    ENUMVAL14       = NULL;
++    a = NULL;
++    b = NULL;
++    dateval9 = 0;
++    dateval11 = 0;
++
++    {
++        {
++            //  SMARTPL2SQL.g:64:2: ( ^( NOT a= expression ) | ^( AND a= expression b= expression ) | ^( OR a= expression b= expression ) | STRTAG INCLUDES STR | STRTAG IS STR | INTTAG INTBOOL INT | DATETAG AFTER dateval | DATETAG BEFORE dateval | ENUMTAG IS ENUMVAL )
++            
++            ANTLR3_UINT32 alt1;
++
++            alt1=9;
++
++            switch ( LA(1) ) 
++            {
++            case NOT:
++              {
++                      alt1=1;
++              }
++                break;
++            case AND:
++              {
++                      alt1=2;
++              }
++                break;
++            case OR:
++              {
++                      alt1=3;
++              }
++                break;
++            case STRTAG:
++              {
++                      switch ( LA(2) ) 
++                      {
++                      case INCLUDES:
++                              {
++                                      alt1=4;
++                              }
++                          break;
++                      case IS:
++                              {
++                                      alt1=5;
++                              }
++                          break;
++
++                      default:
++                          CONSTRUCTEX();
++                          EXCEPTION->type         = ANTLR3_NO_VIABLE_ALT_EXCEPTION;
++                          EXCEPTION->message      = (void *)"";
++                          EXCEPTION->decisionNum  = 1;
++                          EXCEPTION->state        = 4;
++
++
++                          goto ruleexpressionEx;
++                      }
++
++              }
++                break;
++            case INTTAG:
++              {
++                      alt1=6;
++              }
++                break;
++            case DATETAG:
++              {
++                      switch ( LA(2) ) 
++                      {
++                      case AFTER:
++                              {
++                                      alt1=7;
++                              }
++                          break;
++                      case BEFORE:
++                              {
++                                      alt1=8;
++                              }
++                          break;
++
++                      default:
++                          CONSTRUCTEX();
++                          EXCEPTION->type         = ANTLR3_NO_VIABLE_ALT_EXCEPTION;
++                          EXCEPTION->message      = (void *)"";
++                          EXCEPTION->decisionNum  = 1;
++                          EXCEPTION->state        = 6;
++
++
++                          goto ruleexpressionEx;
++                      }
++
++              }
++                break;
++            case ENUMTAG:
++              {
++                      alt1=9;
++              }
++                break;
++
++            default:
++                CONSTRUCTEX();
++                EXCEPTION->type         = ANTLR3_NO_VIABLE_ALT_EXCEPTION;
++                EXCEPTION->message      = (void *)"";
++                EXCEPTION->decisionNum  = 1;
++                EXCEPTION->state        = 0;
++
++
++                goto ruleexpressionEx;
++            }
++
++            switch (alt1) 
++            {
++              case 1:
++                  // SMARTPL2SQL.g:64:4: ^( NOT a= expression )
++                  {
++                       MATCHT(NOT, &FOLLOW_NOT_in_expression101); 
++                      if  (HASEXCEPTION())
++                      {
++                          goto ruleexpressionEx;
++                      }
++
++
++                      MATCHT(ANTLR3_TOKEN_DOWN, NULL); 
++                      if  (HASEXCEPTION())
++                      {
++                          goto ruleexpressionEx;
++                      }
++
++                      FOLLOWPUSH(FOLLOW_expression_in_expression107);
++                      a=expression(ctx);
++
++                      FOLLOWPOP();
++                      if  (HASEXCEPTION())
++                      {
++                          goto ruleexpressionEx;
++                      }
++
++
++                      MATCHT(ANTLR3_TOKEN_UP, NULL); 
++                      if  (HASEXCEPTION())
++                      {
++                          goto ruleexpressionEx;
++                      }
++
++                      {
++
++                                              result= a->factory->newRaw(a->factory);
++                                              result->append8(result, "NOT(");
++                                              result->appendS(result, a);
++                                              result->append8(result, ")");
++                                      
++                      }
++
++                  }
++                  break;
++              case 2:
++                  // SMARTPL2SQL.g:71:4: ^( AND a= expression b= expression )
++                  {
++                       MATCHT(AND, &FOLLOW_AND_in_expression118); 
++                      if  (HASEXCEPTION())
++                      {
++                          goto ruleexpressionEx;
++                      }
++
++
++                      MATCHT(ANTLR3_TOKEN_DOWN, NULL); 
++                      if  (HASEXCEPTION())
++                      {
++                          goto ruleexpressionEx;
++                      }
++
++                      FOLLOWPUSH(FOLLOW_expression_in_expression124);
++                      a=expression(ctx);
++
++                      FOLLOWPOP();
++                      if  (HASEXCEPTION())
++                      {
++                          goto ruleexpressionEx;
++                      }
++
++                      FOLLOWPUSH(FOLLOW_expression_in_expression130);
++                      b=expression(ctx);
++
++                      FOLLOWPOP();
++                      if  (HASEXCEPTION())
++                      {
++                          goto ruleexpressionEx;
++                      }
++
++
++                      MATCHT(ANTLR3_TOKEN_UP, NULL); 
++                      if  (HASEXCEPTION())
++                      {
++                          goto ruleexpressionEx;
++                      }
++
++                      {
++
++                                              result= a->factory->newRaw(a->factory);
++                                              result->append8(result, "(");
++                                              result->appendS(result, a);
++                                              result->append8(result, " AND ");
++                                              result->appendS(result, b);
++                                              result->append8(result, ")");
++                                      
++                      }
++
++                  }
++                  break;
++              case 3:
++                  // SMARTPL2SQL.g:80:4: ^( OR a= expression b= expression )
++                  {
++                       MATCHT(OR, &FOLLOW_OR_in_expression141); 
++                      if  (HASEXCEPTION())
++                      {
++                          goto ruleexpressionEx;
++                      }
++
++
++                      MATCHT(ANTLR3_TOKEN_DOWN, NULL); 
++                      if  (HASEXCEPTION())
++                      {
++                          goto ruleexpressionEx;
++                      }
++
++                      FOLLOWPUSH(FOLLOW_expression_in_expression147);
++                      a=expression(ctx);
++
++                      FOLLOWPOP();
++                      if  (HASEXCEPTION())
++                      {
++                          goto ruleexpressionEx;
++                      }
++
++                      FOLLOWPUSH(FOLLOW_expression_in_expression153);
++                      b=expression(ctx);
++
++                      FOLLOWPOP();
++                      if  (HASEXCEPTION())
++                      {
++                          goto ruleexpressionEx;
++                      }
++
++
++                      MATCHT(ANTLR3_TOKEN_UP, NULL); 
++                      if  (HASEXCEPTION())
++                      {
++                          goto ruleexpressionEx;
++                      }
++
++                      {
++
++                                              result= a->factory->newRaw(a->factory);
++                                              result->append8(result, "(");
++                                              result->appendS(result, a);
++                                              result->append8(result, " OR ");
++                                              result->appendS(result, b);
++                                              result->append8(result, ")");
++                                      
++                      }
++
++                  }
++                  break;
++              case 4:
++                  // SMARTPL2SQL.g:89:4: STRTAG INCLUDES STR
++                  {
++                      STRTAG3 = (pANTLR3_BASE_TREE) MATCHT(STRTAG, &FOLLOW_STRTAG_in_expression163); 
++                      if  (HASEXCEPTION())
++                      {
++                          goto ruleexpressionEx;
++                      }
++
++                       MATCHT(INCLUDES, &FOLLOW_INCLUDES_in_expression165); 
++                      if  (HASEXCEPTION())
++                      {
++                          goto ruleexpressionEx;
++                      }
++
++                      STR2 = (pANTLR3_BASE_TREE) MATCHT(STR, &FOLLOW_STR_in_expression167); 
++                      if  (HASEXCEPTION())
++                      {
++                          goto ruleexpressionEx;
++                      }
++
++                      {
++
++                                              pANTLR3_UINT8 val;
++                                              val = (STR2->getText(STR2))->toUTF8((STR2->getText(STR2)))->chars;
++                                              val++;
++                                              val[strlen((const char *)val) - 1] = '\0';
++                                              
++                                              result= (STR2->getText(STR2))->factory->newRaw((STR2->getText(STR2))->factory);
++                                              result->append8(result, "f.");
++                                              result->appendS(result, (STRTAG3->getText(STRTAG3))->toUTF8((STRTAG3->getText(STRTAG3))));
++                                              result->append8(result, " LIKE '%");
++                                              result->append8(result, sqlite3_mprintf("%q", (const char *)val));
++                                              result->append8(result, "%'");
++                                      
++                      }
++
++                  }
++                  break;
++              case 5:
++                  // SMARTPL2SQL.g:103:4: STRTAG IS STR
++                  {
++                      STRTAG5 = (pANTLR3_BASE_TREE) MATCHT(STRTAG, &FOLLOW_STRTAG_in_expression176); 
++                      if  (HASEXCEPTION())
++                      {
++                          goto ruleexpressionEx;
++                      }
++
++                       MATCHT(IS, &FOLLOW_IS_in_expression178); 
++                      if  (HASEXCEPTION())
++                      {
++                          goto ruleexpressionEx;
++                      }
++
++                      STR4 = (pANTLR3_BASE_TREE) MATCHT(STR, &FOLLOW_STR_in_expression180); 
++                      if  (HASEXCEPTION())
++                      {
++                          goto ruleexpressionEx;
++                      }
++
++                      {
++
++                                              pANTLR3_UINT8 val;
++                                              val = (STR4->getText(STR4))->toUTF8((STR4->getText(STR4)))->chars;
++                                              val++;
++                                              val[strlen((const char *)val) - 1] = '\0';
++                                              
++                                              result= (STR4->getText(STR4))->factory->newRaw((STR4->getText(STR4))->factory);
++                                              result->append8(result, "f.");
++                                              result->appendS(result, (STRTAG5->getText(STRTAG5))->toUTF8((STRTAG5->getText(STRTAG5))));
++                                              result->append8(result, " LIKE '");
++                                              result->append8(result, sqlite3_mprintf("%q", (const char *)val));
++                                              result->append8(result, "'");
++                                      
++                      }
++
++                  }
++                  break;
++              case 6:
++                  // SMARTPL2SQL.g:117:4: INTTAG INTBOOL INT
++                  {
++                      INTTAG6 = (pANTLR3_BASE_TREE) MATCHT(INTTAG, &FOLLOW_INTTAG_in_expression189); 
++                      if  (HASEXCEPTION())
++                      {
++                          goto ruleexpressionEx;
++                      }
++
++                      INTBOOL7 = (pANTLR3_BASE_TREE) MATCHT(INTBOOL, &FOLLOW_INTBOOL_in_expression191); 
++                      if  (HASEXCEPTION())
++                      {
++                          goto ruleexpressionEx;
++                      }
++
++                      INT8 = (pANTLR3_BASE_TREE) MATCHT(INT, &FOLLOW_INT_in_expression193); 
++                      if  (HASEXCEPTION())
++                      {
++                          goto ruleexpressionEx;
++                      }
++
++                      {
++
++                                              result= (INTTAG6->getText(INTTAG6))->factory->newRaw((INTTAG6->getText(INTTAG6))->factory);
++                                              result->append8(result, "f.");
++                                              result->appendS(result, (INTTAG6->getText(INTTAG6))->toUTF8((INTTAG6->getText(INTTAG6))));
++                                              result->append8(result, " ");
++                                              result->appendS(result, (INTBOOL7->getText(INTBOOL7))->toUTF8((INTBOOL7->getText(INTBOOL7))));
++                                              result->append8(result, " ");
++                                              result->appendS(result, (INT8->getText(INT8))->toUTF8((INT8->getText(INT8))));
++                                      
++                      }
++
++                  }
++                  break;
++              case 7:
++                  // SMARTPL2SQL.g:127:4: DATETAG AFTER dateval
++                  {
++                      DATETAG10 = (pANTLR3_BASE_TREE) MATCHT(DATETAG, &FOLLOW_DATETAG_in_expression202); 
++                      if  (HASEXCEPTION())
++                      {
++                          goto ruleexpressionEx;
++                      }
++
++                       MATCHT(AFTER, &FOLLOW_AFTER_in_expression204); 
++                      if  (HASEXCEPTION())
++                      {
++                          goto ruleexpressionEx;
++                      }
++
++                      FOLLOWPUSH(FOLLOW_dateval_in_expression206);
++                      dateval9=dateval(ctx);
++
++                      FOLLOWPOP();
++                      if  (HASEXCEPTION())
++                      {
++                          goto ruleexpressionEx;
++                      }
++
++                      {
++
++                                              char str[15];
++                                              sprintf(str, "%d", dateval9);
++                                              
++                                              result= (DATETAG10->getText(DATETAG10))->factory->newRaw((DATETAG10->getText(DATETAG10))->factory);
++                                              result->append8(result, "f.");
++                                              result->appendS(result, (DATETAG10->getText(DATETAG10))->toUTF8((DATETAG10->getText(DATETAG10))));
++                                              result->append8(result, " > ");
++                                              result->append8(result, str);
++                                      
++                      }
++
++                  }
++                  break;
++              case 8:
++                  // SMARTPL2SQL.g:138:4: DATETAG BEFORE dateval
++                  {
++                      DATETAG12 = (pANTLR3_BASE_TREE) MATCHT(DATETAG, &FOLLOW_DATETAG_in_expression215); 
++                      if  (HASEXCEPTION())
++                      {
++                          goto ruleexpressionEx;
++                      }
++
++                       MATCHT(BEFORE, &FOLLOW_BEFORE_in_expression217); 
++                      if  (HASEXCEPTION())
++                      {
++                          goto ruleexpressionEx;
++                      }
++
++                      FOLLOWPUSH(FOLLOW_dateval_in_expression219);
++                      dateval11=dateval(ctx);
++
++                      FOLLOWPOP();
++                      if  (HASEXCEPTION())
++                      {
++                          goto ruleexpressionEx;
++                      }
++
++                      {
++
++                                              char str[15];
++                                              sprintf(str, "%d", dateval11);
++                                              
++                                              result= (DATETAG12->getText(DATETAG12))->factory->newRaw((DATETAG12->getText(DATETAG12))->factory);
++                                              result->append8(result, "f.");
++                                              result->appendS(result, (DATETAG12->getText(DATETAG12))->toUTF8((DATETAG12->getText(DATETAG12))));
++                                              result->append8(result, " > ");
++                                              result->append8(result, str);
++                                      
++                      }
++
++                  }
++                  break;
++              case 9:
++                  // SMARTPL2SQL.g:149:4: ENUMTAG IS ENUMVAL
++                  {
++                      ENUMTAG13 = (pANTLR3_BASE_TREE) MATCHT(ENUMTAG, &FOLLOW_ENUMTAG_in_expression228); 
++                      if  (HASEXCEPTION())
++                      {
++                          goto ruleexpressionEx;
++                      }
++
++                       MATCHT(IS, &FOLLOW_IS_in_expression230); 
++                      if  (HASEXCEPTION())
++                      {
++                          goto ruleexpressionEx;
++                      }
++
++                      ENUMVAL14 = (pANTLR3_BASE_TREE) MATCHT(ENUMVAL, &FOLLOW_ENUMVAL_in_expression232); 
++                      if  (HASEXCEPTION())
++                      {
++                          goto ruleexpressionEx;
++                      }
++
++                      {
++
++                                              pANTLR3_UINT8 tag;
++                                              pANTLR3_UINT8 val;
++                                              char str[20];
++                                              
++                                              sprintf(str, "1=1");
++                                              
++                                              tag = (ENUMTAG13->getText(ENUMTAG13))->chars;
++                                              val = (ENUMVAL14->getText(ENUMVAL14))->chars;
++                                              if (strcmp((char *)tag, "media_kind") == 0)
++                                              {
++                                                      if (strcmp((char *)val, "music") == 0)
++                                                      {
++                                                              sprintf(str, "f.media_kind = %d", MEDIA_KIND_MUSIC);
++                                                      }
++                                                      else if (strcmp((char *)val, "movie") == 0)
++                                                      {
++                                                              sprintf(str, "f.media_kind = %d", MEDIA_KIND_MOVIE);
++                                                      }
++                                                      else if (strcmp((char *)val, "podcast") == 0)
++                                                      {
++                                                              sprintf(str, "f.media_kind = %d", MEDIA_KIND_PODCAST);
++                                                      }
++                                                      else if (strcmp((char *)val, "audiobook") == 0)
++                                                      {
++                                                              sprintf(str, "f.media_kind = %d", MEDIA_KIND_AUDIOBOOK);
++                                                      }
++                                                      else if (strcmp((char *)val, "tvshow") == 0)
++                                                      {
++                                                              sprintf(str, "f.media_kind = %d", MEDIA_KIND_TVSHOW);
++                                                      }
++                                              }
++                                              else if (strcmp((char *)tag, "data_kind") == 0)
++                                              {
++                                                      if (strcmp((char *)val, "file") == 0)
++                                                      {
++                                                              sprintf(str, "f.data_kind = %d", DATA_KIND_FILE);
++                                                      }
++                                                      else if (strcmp((char *)val, "url") == 0)
++                                                      {
++                                                              sprintf(str, "f.data_kind = %d", DATA_KIND_URL);
++                                                      }
++                                                      else if (strcmp((char *)val, "spotify") == 0)
++                                                      {
++                                                              sprintf(str, "f.data_kind = %d", DATA_KIND_SPOTIFY);
++                                                      }
++                                                      else if (strcmp((char *)val, "pipe") == 0)
++                                                      {
++                                                              sprintf(str, "f.data_kind = %d", DATA_KIND_PIPE);
++                                                      }
++                                              }
++                                              
++                                              result= (ENUMTAG13->getText(ENUMTAG13))->factory->newRaw((ENUMTAG13->getText(ENUMTAG13))->factory);
++                                              result->append8(result, str);
++                                      
++                      }
++
++                  }
++                  break;
++
++            }
++        }
++    }
++    
++
++    // This is where rules clean up and exit
++    //
++    goto ruleexpressionEx; /* Prevent compiler warnings */
++    ruleexpressionEx: ;
++
++            if (HASEXCEPTION())
++            {
++                PREPORTERROR();
++                PRECOVER();
++            }
++
++
++    return result;
++}
++/* $ANTLR end expression */
++
++/** 
++ * $ANTLR start dateval
++ * SMARTPL2SQL.g:207:1: dateval returns [ int result ] : ( DATE | interval BEFORE DATE | interval AFTER DATE | interval AGO );
++ */
++static int
++dateval(pSMARTPL2SQL ctx)
++{   
++    int result = 0;
++
++    pANTLR3_BASE_TREE    DATE15;
++    pANTLR3_BASE_TREE    DATE16;
++    pANTLR3_BASE_TREE    DATE18;
++    int interval17;
++    #undef    RETURN_TYPE_interval17
++    #define   RETURN_TYPE_interval17 int
++
++    int interval19;
++    #undef    RETURN_TYPE_interval19
++    #define   RETURN_TYPE_interval19 int
++
++    int interval20;
++    #undef    RETURN_TYPE_interval20
++    #define   RETURN_TYPE_interval20 int
++
++    /* Initialize rule variables
++     */
++
++
++     result= 0; 
++    DATE15       = NULL;
++    DATE16       = NULL;
++    DATE18       = NULL;
++    interval17 = 0;
++    interval19 = 0;
++    interval20 = 0;
++
++    {
++        {
++            //  SMARTPL2SQL.g:209:2: ( DATE | interval BEFORE DATE | interval AFTER DATE | interval AGO )
++            
++            ANTLR3_UINT32 alt2;
++
++            alt2=4;
++
++            switch ( LA(1) ) 
++            {
++            case DATE:
++              {
++                      alt2=1;
++              }
++                break;
++            case INT:
++              {
++                      switch ( LA(2) ) 
++                      {
++                      case DATINTERVAL:
++                              {
++                                      switch ( LA(3) ) 
++                                      {
++                                      case AGO:
++                                              {
++                                                      alt2=4;
++                                              }
++                                          break;
++                                      case BEFORE:
++                                              {
++                                                      alt2=2;
++                                              }
++                                          break;
++                                      case AFTER:
++                                              {
++                                                      alt2=3;
++                                              }
++                                          break;
++
++                                      default:
++                                          CONSTRUCTEX();
++                                          EXCEPTION->type         = ANTLR3_NO_VIABLE_ALT_EXCEPTION;
++                                          EXCEPTION->message      = (void *)"";
++                                          EXCEPTION->decisionNum  = 2;
++                                          EXCEPTION->state        = 3;
++
++
++                                          goto ruledatevalEx;
++                                      }
++
++                              }
++                          break;
++
++                      default:
++                          CONSTRUCTEX();
++                          EXCEPTION->type         = ANTLR3_NO_VIABLE_ALT_EXCEPTION;
++                          EXCEPTION->message      = (void *)"";
++                          EXCEPTION->decisionNum  = 2;
++                          EXCEPTION->state        = 2;
++
++
++                          goto ruledatevalEx;
++                      }
++
++              }
++                break;
++
++            default:
++                CONSTRUCTEX();
++                EXCEPTION->type         = ANTLR3_NO_VIABLE_ALT_EXCEPTION;
++                EXCEPTION->message      = (void *)"";
++                EXCEPTION->decisionNum  = 2;
++                EXCEPTION->state        = 0;
++
++
++                goto ruledatevalEx;
++            }
++
++            switch (alt2) 
++            {
++              case 1:
++                  // SMARTPL2SQL.g:209:4: DATE
++                  {
++                      DATE15 = (pANTLR3_BASE_TREE) MATCHT(DATE, &FOLLOW_DATE_in_dateval257); 
++                      if  (HASEXCEPTION())
++                      {
++                          goto ruledatevalEx;
++                      }
++
++                      {
++
++                                              pANTLR3_UINT8 datval;
++                                              
++                                              datval = (DATE15->getText(DATE15))->chars;
++                                              
++                                              if (strcmp((char *)datval, "today") == 0)
++                                              {
++                                                      result= time(NULL);
++                                              }
++                                              else if (strcmp((char *)datval, "yesterday") == 0)
++                                              {
++                                                      result= time(NULL) - 24 * 3600;
++                                              }
++                                              else if (strcmp((char *)datval, "last week") == 0)
++                                              {
++                                                      result= time(NULL) - 24 * 3600 * 7;
++                                              }
++                                              else if (strcmp((char *)datval, "last month") == 0)
++                                              {
++                                                      result= time(NULL) - 24 * 3600 * 30;
++                                              }
++                                              else if (strcmp((char *)datval, "last year") == 0)
++                                              {
++                                                      result= time(NULL) - 24 * 3600 * 365;
++                                              }
++                                              else
++                                              {
++                                                      struct tm tm;
++                                                      char year[5];
++                                                      char month[3];
++                                                      char day[3];
++                                                      
++                                                      memset((void*)&tm,0,sizeof(tm));
++                                                      memset(year, 0, sizeof(year));
++                                                      memset(month, 0, sizeof(month));
++                                                      memset(day, 0, sizeof(day));
++
++                                                      strncpy(year, (const char *)datval, 4);
++                                                      strncpy(month, (const char *)datval + 5, 2);
++                                                      strncpy(day, (const char *)datval + 8, 2);
++                                                      
++                                                      tm.tm_year = atoi(year) - 1900;
++                                                      tm.tm_mon = atoi(month) - 1;
++                                                      tm.tm_mday = atoi(day);
++                                                      
++                                                      result= mktime(&tm);
++                                              }
++                                      
++                      }
++
++                  }
++                  break;
++              case 2:
++                  // SMARTPL2SQL.g:258:4: interval BEFORE DATE
++                  {
++                      FOLLOWPUSH(FOLLOW_interval_in_dateval266);
++                      interval17=interval(ctx);
++
++                      FOLLOWPOP();
++                      if  (HASEXCEPTION())
++                      {
++                          goto ruledatevalEx;
++                      }
++
++                       MATCHT(BEFORE, &FOLLOW_BEFORE_in_dateval268); 
++                      if  (HASEXCEPTION())
++                      {
++                          goto ruledatevalEx;
++                      }
++
++                      DATE16 = (pANTLR3_BASE_TREE) MATCHT(DATE, &FOLLOW_DATE_in_dateval270); 
++                      if  (HASEXCEPTION())
++                      {
++                          goto ruledatevalEx;
++                      }
++
++                      {
++
++                                              pANTLR3_UINT8 datval;
++                                              
++                                              datval = (DATE16->getText(DATE16))->chars;
++                                              
++                                              if (strcmp((char *)datval, "yesterday") == 0)
++                                              {
++                                                      result= time(NULL) - 24 * 3600;
++                                              }
++                                              else if (strcmp((char *)datval, "last week") == 0)
++                                              {
++                                                      result= time(NULL) - 24 * 3600 * 7;
++                                              }
++                                              else if (strcmp((char *)datval, "last month") == 0)
++                                              {
++                                                      result= time(NULL) - 24 * 3600 * 30;
++                                              }
++                                              else if (strcmp((char *)datval, "last year") == 0)
++                                              {
++                                                      result= time(NULL) - 24 * 3600 * 365;
++                                              }
++                                              else
++                                              {
++                                                      result= time(NULL);
++                                              }
++                                              
++                                              result= result - interval17;
++                                      
++                      }
++
++                  }
++                  break;
++              case 3:
++                  // SMARTPL2SQL.g:287:4: interval AFTER DATE
++                  {
++                      FOLLOWPUSH(FOLLOW_interval_in_dateval279);
++                      interval19=interval(ctx);
++
++                      FOLLOWPOP();
++                      if  (HASEXCEPTION())
++                      {
++                          goto ruledatevalEx;
++                      }
++
++                       MATCHT(AFTER, &FOLLOW_AFTER_in_dateval281); 
++                      if  (HASEXCEPTION())
++                      {
++                          goto ruledatevalEx;
++                      }
++
++                      DATE18 = (pANTLR3_BASE_TREE) MATCHT(DATE, &FOLLOW_DATE_in_dateval283); 
++                      if  (HASEXCEPTION())
++                      {
++                          goto ruledatevalEx;
++                      }
++
++                      {
++
++                                              pANTLR3_UINT8 datval;
++                                              
++                                              datval = (DATE18->getText(DATE18))->chars;
++                                              
++                                              if (strcmp((char *)datval, "yesterday") == 0)
++                                              {
++                                                      result= time(NULL) - 24 * 3600;
++                                              }
++                                              else if (strcmp((char *)datval, "last week") == 0)
++                                              {
++                                                      result= time(NULL) - 24 * 3600 * 7;
++                                              }
++                                              else if (strcmp((char *)datval, "last month") == 0)
++                                              {
++                                                      result= time(NULL) - 24 * 3600 * 30;
++                                              }
++                                              else if (strcmp((char *)datval, "last year") == 0)
++                                              {
++                                                      result= time(NULL) - 24 * 3600 * 365;
++                                              }
++                                              else
++                                              {
++                                                      result= time(NULL);
++                                              }
++                                              
++                                              result= result + interval19;
++                                      
++                      }
++
++                  }
++                  break;
++              case 4:
++                  // SMARTPL2SQL.g:316:4: interval AGO
++                  {
++                      FOLLOWPUSH(FOLLOW_interval_in_dateval292);
++                      interval20=interval(ctx);
++
++                      FOLLOWPOP();
++                      if  (HASEXCEPTION())
++                      {
++                          goto ruledatevalEx;
++                      }
++
++                       MATCHT(AGO, &FOLLOW_AGO_in_dateval294); 
++                      if  (HASEXCEPTION())
++                      {
++                          goto ruledatevalEx;
++                      }
++
++                      {
++
++                                              result= time(NULL) - interval20;
++                                      
++                      }
++
++                  }
++                  break;
++
++            }
++        }
++    }
++    
++
++    // This is where rules clean up and exit
++    //
++    goto ruledatevalEx; /* Prevent compiler warnings */
++    ruledatevalEx: ;
++
++            if (HASEXCEPTION())
++            {
++                PREPORTERROR();
++                PRECOVER();
++            }
++
++
++    return result;
++}
++/* $ANTLR end dateval */
++
++/** 
++ * $ANTLR start interval
++ * SMARTPL2SQL.g:322:1: interval returns [ int result ] : INT DATINTERVAL ;
++ */
++static int
++interval(pSMARTPL2SQL ctx)
++{   
++    int result = 0;
++
++    pANTLR3_BASE_TREE    INT21;
++    pANTLR3_BASE_TREE    DATINTERVAL22;
++
++    /* Initialize rule variables
++     */
++
++
++     result= 0; 
++    INT21       = NULL;
++    DATINTERVAL22       = NULL;
++
++    {
++        // SMARTPL2SQL.g:324:2: ( INT DATINTERVAL )
++        // SMARTPL2SQL.g:324:4: INT DATINTERVAL
++        {
++            INT21 = (pANTLR3_BASE_TREE) MATCHT(INT, &FOLLOW_INT_in_interval318); 
++            if  (HASEXCEPTION())
++            {
++                goto ruleintervalEx;
++            }
++
++            DATINTERVAL22 = (pANTLR3_BASE_TREE) MATCHT(DATINTERVAL, &FOLLOW_DATINTERVAL_in_interval320); 
++            if  (HASEXCEPTION())
++            {
++                goto ruleintervalEx;
++            }
++
++            {
++
++                                      pANTLR3_UINT8 interval;
++                                      
++                                      result= atoi((const char *)(INT21->getText(INT21))->chars);
++                                      interval = (DATINTERVAL22->getText(DATINTERVAL22))->chars;
++                                      
++                                      if (strcmp((char *)interval, "days") == 0)
++                                      {
++                                              result= result * 24 * 3600;
++                                      }
++                                      else if (strcmp((char *)interval, "weeks") == 0)
++                                      {
++                                              result= result * 24 * 3600 * 7;
++                                      }
++                                      else if (strcmp((char *)interval, "months") == 0)
++                                      {
++                                              result= result * 24 * 3600 * 30;
++                                      }
++                                      else if (strcmp((char *)interval, "weeks") == 0)
++                                      {
++                                              result= result * 24 * 3600 * 365;
++                                      }
++                                      else
++                                      {
++                                              result= 0;
++                                      }
++                              
++            }
++
++        }
++
++    }
++    
++
++    // This is where rules clean up and exit
++    //
++    goto ruleintervalEx; /* Prevent compiler warnings */
++    ruleintervalEx: ;
++
++            if (HASEXCEPTION())
++            {
++                PREPORTERROR();
++                PRECOVER();
++            }
++
++
++    return result;
++}
++/* $ANTLR end interval */
++/* End of parsing rules
++ * ==============================================
++ */
++
++/* ==============================================
++ * Syntactic predicates
++ */
++/* End of syntactic predicates
++ * ==============================================
++ */
++
++ 
++ 
++
++
++
++/* End of code
++ * =============================================================================
++ */
+diff --git a/src/pregen/SMARTPL2SQL.h b/src/pregen/SMARTPL2SQL.h
+new file mode 100644
+index 0000000..322e8fd
+--- /dev/null
++++ b/src/pregen/SMARTPL2SQL.h
+@@ -0,0 +1,220 @@
++/** \file
++ *  This C header file was generated by $ANTLR version 3.2 debian-7ubuntu3
++ *
++ *     -  From the grammar source file : SMARTPL2SQL.g
++ *     -                            On : 2015-06-27 19:05:21
++ *     -           for the tree parser : SMARTPL2SQLTreeParser *
++ * Editing it, at least manually, is not wise. 
++ *
++ * C language generator and runtime by Jim Idle, jimi|hereisanat|idle|dotgoeshere|ws.
++ *
++ *
++ * The tree parser SMARTPL2SQL has the callable functions (rules) shown below,
++ * which will invoke the code for the associated rule in the source grammar
++ * assuming that the input stream is pointing to a token/text stream that could begin
++ * this rule.
++ * 
++ * For instance if you call the first (topmost) rule in a parser grammar, you will
++ * get the results of a full parse, but calling a rule half way through the grammar will
++ * allow you to pass part of a full token stream to the parser, such as for syntax checking
++ * in editors and so on.
++ *
++ * The parser entry points are called indirectly (by function pointer to function) via
++ * a parser context typedef pSMARTPL2SQL, which is returned from a call to SMARTPL2SQLNew().
++ *
++ * The methods in pSMARTPL2SQL are  as follows:
++ *
++ *  - SMARTPL2SQL_playlist_return      pSMARTPL2SQL->playlist(pSMARTPL2SQL)
++ *  - pANTLR3_STRING      pSMARTPL2SQL->expression(pSMARTPL2SQL)
++ *  - int      pSMARTPL2SQL->dateval(pSMARTPL2SQL)
++ *  - int      pSMARTPL2SQL->interval(pSMARTPL2SQL)
++ *
++ * The return type for any particular rule is of course determined by the source
++ * grammar file.
++ */
++// [The "BSD licence"]
++// Copyright (c) 2005-2009 Jim Idle, Temporal Wave LLC
++// http://www.temporal-wave.com
++// http://www.linkedin.com/in/jimidle
++//
++// All rights reserved.
++//
++// Redistribution and use in source and binary forms, with or without
++// modification, are permitted provided that the following conditions
++// are met:
++// 1. Redistributions of source code must retain the above copyright
++//    notice, this list of conditions and the following disclaimer.
++// 2. Redistributions in binary form must reproduce the above copyright
++//    notice, this list of conditions and the following disclaimer in the
++//    documentation and/or other materials provided with the distribution.
++// 3. The name of the author may not be used to endorse or promote products
++//    derived from this software without specific prior written permission.
++//
++// THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
++// IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
++// OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
++// IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
++// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
++// NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
++// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
++// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
++// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
++// THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
++
++#ifndef       _SMARTPL2SQL_H
++#define _SMARTPL2SQL_H
++/* =============================================================================
++ * Standard antlr3 C runtime definitions
++ */
++#include    <antlr3.h>
++
++/* End of standard antlr 3 runtime definitions
++ * =============================================================================
++ */
++ 
++#ifdef __cplusplus
++extern "C" {
++#endif
++
++// Forward declare the context typedef so that we can use it before it is
++// properly defined. Delegators and delegates (from import statements) are
++// interdependent and their context structures contain pointers to each other
++// C only allows such things to be declared if you pre-declare the typedef.
++//
++typedef struct SMARTPL2SQL_Ctx_struct SMARTPL2SQL, * pSMARTPL2SQL;
++
++
++
++      #include <stdio.h>
++      #include <stdlib.h>
++      #include <string.h>
++      #include <limits.h>
++      #include <errno.h>
++      #include <time.h>
++      #include <sqlite3.h>
++
++      #include "logger.h"
++      #include "db.h"
++
++
++#ifdef        ANTLR3_WINDOWS
++// Disable: Unreferenced parameter,                                                   - Rules with parameters that are not used
++//          constant conditional,                                                     - ANTLR realizes that a prediction is always true (synpred usually)
++//          initialized but unused variable                                   - tree rewrite variables declared but not needed
++//          Unreferenced local variable                                               - lexer rule declares but does not always use _type
++//          potentially unitialized variable used                     - retval always returned from a rule 
++//                    unreferenced local function has been removed    - susually getTokenNames or freeScope, they can go without warnigns
++//
++// These are only really displayed at warning level /W4 but that is the code ideal I am aiming at
++// and the codegen must generate some of these warnings by necessity, apart from 4100, which is
++// usually generated when a parser rule is given a parameter that it does not use. Mostly though
++// this is a matter of orthogonality hence I disable that one.
++//
++#pragma warning( disable : 4100 )
++#pragma warning( disable : 4101 )
++#pragma warning( disable : 4127 )
++#pragma warning( disable : 4189 )
++#pragma warning( disable : 4505 )
++#pragma warning( disable : 4701 )
++#endif
++typedef struct SMARTPL2SQL_playlist_return_struct
++{
++    pANTLR3_BASE_TREE       start;
++    pANTLR3_BASE_TREE       stop;   
++    pANTLR3_STRING title;
++    pANTLR3_STRING query;
++}
++    SMARTPL2SQL_playlist_return;
++
++
++
++/** Context tracking structure for SMARTPL2SQL
++ */
++struct SMARTPL2SQL_Ctx_struct
++{
++    /** Built in ANTLR3 context tracker contains all the generic elements
++     *  required for context tracking.
++     */
++    pANTLR3_TREE_PARSER           pTreeParser;
++
++
++     SMARTPL2SQL_playlist_return (*playlist)  (struct SMARTPL2SQL_Ctx_struct * ctx);
++     pANTLR3_STRING (*expression)     (struct SMARTPL2SQL_Ctx_struct * ctx);
++     int (*dateval)   (struct SMARTPL2SQL_Ctx_struct * ctx);
++     int (*interval)  (struct SMARTPL2SQL_Ctx_struct * ctx);
++    // Delegated rules
++    const char * (*getGrammarFileName)();
++    void          (*free)   (struct SMARTPL2SQL_Ctx_struct * ctx);
++        
++};
++
++// Function protoypes for the constructor functions that external translation units
++// such as delegators and delegates may wish to call.
++//
++ANTLR3_API pSMARTPL2SQL SMARTPL2SQLNew         (pANTLR3_COMMON_TREE_NODE_STREAM instream);
++ANTLR3_API pSMARTPL2SQL SMARTPL2SQLNewSSD      (pANTLR3_COMMON_TREE_NODE_STREAM instream, pANTLR3_RECOGNIZER_SHARED_STATE state);
++
++/** Symbolic definitions of all the tokens that the tree parser will work with.
++ * \{
++ *
++ * Antlr will define EOF, but we can't use that as it it is too common in
++ * in C header files and that would be confusing. There is no way to filter this out at the moment
++ * so we just undef it here for now. That isn't the value we get back from C recognizers
++ * anyway. We are looking for ANTLR3_TOKEN_EOF.
++ */
++#ifdef        EOF
++#undef        EOF
++#endif
++#ifdef        Tokens
++#undef        Tokens
++#endif 
++#define INTBOOL      14
++#define STRTAG      10
++#define AGO      22
++#define WHITESPACE      29
++#define GREATEREQUAL      25
++#define BEFORE      18
++#define DATETAG      16
++#define INT      15
++#define NOT      7
++#define AFTER      17
++#define AND      6
++#define EOF      -1
++#define INCLUDES      11
++#define STR      4
++#define T__30      30
++#define T__31      31
++#define GREATER      24
++#define LPAR      8
++#define ENUMTAG      19
++#define IS      12
++#define ENUMVAL      20
++#define EQUAL      28
++#define OR      5
++#define LESS      26
++#define RPAR      9
++#define DATE      21
++#define LESSEQUAL      27
++#define INTTAG      13
++#define DATINTERVAL      23
++#ifdef        EOF
++#undef        EOF
++#define       EOF     ANTLR3_TOKEN_EOF
++#endif
++
++#ifndef TOKENSOURCE
++#define TOKENSOURCE(lxr) lxr->pLexer->rec->state->tokSource
++#endif
++
++/* End of token definitions for SMARTPL2SQL
++ * =============================================================================
++ */
++/** \} */
++
++#ifdef __cplusplus
++}
++#endif
++
++#endif
++
++/* END - Note:Keep extra line feed to satisfy UNIX systems */
+diff --git a/src/pregen/SMARTPL2SQL.u b/src/pregen/SMARTPL2SQL.u
+new file mode 100644
+index 0000000..85567d1
+--- /dev/null
++++ b/src/pregen/SMARTPL2SQL.u
+@@ -0,0 +1,5 @@
++SMARTPL2SQL.g: SMARTPL.tokens
++SMARTPL2SQL.c : SMARTPL2SQL.g
++./SMARTPL2SQL.tokens : SMARTPL2SQL.g
++SMARTPL2SQL.h : SMARTPL2SQL.g
++ANTLR_PRODUCTS += SMARTPL2SQL.c ./SMARTPL2SQL.tokens SMARTPL2SQL.h 
+\ No newline at end of file
+diff --git a/src/pregen/SMARTPLLexer.c b/src/pregen/SMARTPLLexer.c
+new file mode 100644
+index 0000000..9ea1a83
+--- /dev/null
++++ b/src/pregen/SMARTPLLexer.c
+@@ -0,0 +1,4168 @@
++/** \file
++ *  This C source file was generated by $ANTLR version 3.2 debian-7ubuntu3
++ *
++ *     -  From the grammar source file : SMARTPL.g
++ *     -                            On : 2015-06-27 19:05:15
++ *     -                 for the lexer : SMARTPLLexerLexer *
++ * Editing it, at least manually, is not wise. 
++ *
++ * C language generator and runtime by Jim Idle, jimi|hereisanat|idle|dotgoeshere|ws.
++ *
++ *
++*/
++// [The "BSD licence"]
++// Copyright (c) 2005-2009 Jim Idle, Temporal Wave LLC
++// http://www.temporal-wave.com
++// http://www.linkedin.com/in/jimidle
++//
++// All rights reserved.
++//
++// Redistribution and use in source and binary forms, with or without
++// modification, are permitted provided that the following conditions
++// are met:
++// 1. Redistributions of source code must retain the above copyright
++//    notice, this list of conditions and the following disclaimer.
++// 2. Redistributions in binary form must reproduce the above copyright
++//    notice, this list of conditions and the following disclaimer in the
++//    documentation and/or other materials provided with the distribution.
++// 3. The name of the author may not be used to endorse or promote products
++//    derived from this software without specific prior written permission.
++//
++// THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
++// IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
++// OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
++// IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
++// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
++// NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
++// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
++// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
++// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
++// THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
++
++/* -----------------------------------------
++ * Include the ANTLR3 generated header file.
++ */
++#include    "SMARTPLLexer.h"
++/* ----------------------------------------- */
++
++
++/** String literals used by SMARTPLLexer that we must do things like MATCHS() with.
++ *  C will normally just lay down 8 bit characters, and you can use L"xxx" to
++ *  get wchar_t, but wchar_t is 16 bits on Windows, which is not UTF32 and so
++ *  we perform this little trick of defining the literals as arrays of UINT32
++ *  and passing in the address of these.
++ */
++static ANTLR3_UCHAR   lit_1[]  = { 0x61, 0x72, 0x74, 0x69, 0x73, 0x74,  ANTLR3_STRING_TERMINATOR};
++static ANTLR3_UCHAR   lit_2[]  = { 0x61, 0x6C, 0x62, 0x75, 0x6D, 0x5F, 0x61, 0x72, 0x74, 0x69, 0x73, 0x74,  ANTLR3_STRING_TERMINATOR};
++static ANTLR3_UCHAR   lit_3[]  = { 0x61, 0x6C, 0x62, 0x75, 0x6D,  ANTLR3_STRING_TERMINATOR};
++static ANTLR3_UCHAR   lit_4[]  = { 0x74, 0x69, 0x74, 0x6C, 0x65,  ANTLR3_STRING_TERMINATOR};
++static ANTLR3_UCHAR   lit_5[]  = { 0x67, 0x65, 0x6E, 0x72, 0x65,  ANTLR3_STRING_TERMINATOR};
++static ANTLR3_UCHAR   lit_6[]  = { 0x63, 0x6F, 0x6D, 0x70, 0x6F, 0x73, 0x65, 0x72,  ANTLR3_STRING_TERMINATOR};
++static ANTLR3_UCHAR   lit_7[]  = { 0x70, 0x61, 0x74, 0x68,  ANTLR3_STRING_TERMINATOR};
++static ANTLR3_UCHAR   lit_8[]  = { 0x74, 0x79, 0x70, 0x65,  ANTLR3_STRING_TERMINATOR};
++static ANTLR3_UCHAR   lit_9[]  = { 0x67, 0x72, 0x6F, 0x75, 0x70, 0x69, 0x6E, 0x67,  ANTLR3_STRING_TERMINATOR};
++static ANTLR3_UCHAR   lit_10[]  = { 0x70, 0x6C, 0x61, 0x79, 0x5F, 0x63, 0x6F, 0x75, 0x6E, 0x74,  ANTLR3_STRING_TERMINATOR};
++static ANTLR3_UCHAR   lit_11[]  = { 0x72, 0x61, 0x74, 0x69, 0x6E, 0x67,  ANTLR3_STRING_TERMINATOR};
++static ANTLR3_UCHAR   lit_12[]  = { 0x79, 0x65, 0x61, 0x72,  ANTLR3_STRING_TERMINATOR};
++static ANTLR3_UCHAR   lit_13[]  = { 0x63, 0x6F, 0x6D, 0x70, 0x69, 0x6C, 0x61, 0x74, 0x69, 0x6F, 0x6E,  ANTLR3_STRING_TERMINATOR};
++static ANTLR3_UCHAR   lit_14[]  = { 0x74, 0x69, 0x6D, 0x65, 0x5F, 0x61, 0x64, 0x64, 0x65, 0x64,  ANTLR3_STRING_TERMINATOR};
++static ANTLR3_UCHAR   lit_15[]  = { 0x74, 0x69, 0x6D, 0x65, 0x5F, 0x70, 0x6C, 0x61, 0x79, 0x65, 0x64,  ANTLR3_STRING_TERMINATOR};
++static ANTLR3_UCHAR   lit_16[]  = { 0x64, 0x61, 0x74, 0x61, 0x5F, 0x6B, 0x69, 0x6E, 0x64,  ANTLR3_STRING_TERMINATOR};
++static ANTLR3_UCHAR   lit_17[]  = { 0x6D, 0x65, 0x64, 0x69, 0x61, 0x5F, 0x6B, 0x69, 0x6E, 0x64,  ANTLR3_STRING_TERMINATOR};
++static ANTLR3_UCHAR   lit_18[]  = { 0x69, 0x6E, 0x63, 0x6C, 0x75, 0x64, 0x65, 0x73,  ANTLR3_STRING_TERMINATOR};
++static ANTLR3_UCHAR   lit_19[]  = { 0x69, 0x73,  ANTLR3_STRING_TERMINATOR};
++static ANTLR3_UCHAR   lit_20[]  = { 0x3E, 0x3D,  ANTLR3_STRING_TERMINATOR};
++static ANTLR3_UCHAR   lit_21[]  = { 0x3C, 0x3D,  ANTLR3_STRING_TERMINATOR};
++static ANTLR3_UCHAR   lit_22[]  = { 0x61, 0x66, 0x74, 0x65, 0x72,  ANTLR3_STRING_TERMINATOR};
++static ANTLR3_UCHAR   lit_23[]  = { 0x62, 0x65, 0x66, 0x6F, 0x72, 0x65,  ANTLR3_STRING_TERMINATOR};
++static ANTLR3_UCHAR   lit_24[]  = { 0x61, 0x67, 0x6F,  ANTLR3_STRING_TERMINATOR};
++static ANTLR3_UCHAR   lit_25[]  = { 0x41, 0x4E, 0x44,  ANTLR3_STRING_TERMINATOR};
++static ANTLR3_UCHAR   lit_26[]  = { 0x61, 0x6E, 0x64,  ANTLR3_STRING_TERMINATOR};
++static ANTLR3_UCHAR   lit_27[]  = { 0x4F, 0x52,  ANTLR3_STRING_TERMINATOR};
++static ANTLR3_UCHAR   lit_28[]  = { 0x6F, 0x72,  ANTLR3_STRING_TERMINATOR};
++static ANTLR3_UCHAR   lit_29[]  = { 0x4E, 0x4F, 0x54,  ANTLR3_STRING_TERMINATOR};
++static ANTLR3_UCHAR   lit_30[]  = { 0x6E, 0x6F, 0x74,  ANTLR3_STRING_TERMINATOR};
++static ANTLR3_UCHAR   lit_31[]  = { 0x74, 0x6F, 0x64, 0x61, 0x79,  ANTLR3_STRING_TERMINATOR};
++static ANTLR3_UCHAR   lit_32[]  = { 0x79, 0x65, 0x73, 0x74, 0x65, 0x72, 0x64, 0x61, 0x79,  ANTLR3_STRING_TERMINATOR};
++static ANTLR3_UCHAR   lit_33[]  = { 0x6C, 0x61, 0x73, 0x74, 0x20, 0x77, 0x65, 0x65, 0x6B,  ANTLR3_STRING_TERMINATOR};
++static ANTLR3_UCHAR   lit_34[]  = { 0x6C, 0x61, 0x73, 0x74, 0x20, 0x6D, 0x6F, 0x6E, 0x74, 0x68,  ANTLR3_STRING_TERMINATOR};
++static ANTLR3_UCHAR   lit_35[]  = { 0x6C, 0x61, 0x73, 0x74, 0x20, 0x79, 0x65, 0x61, 0x72,  ANTLR3_STRING_TERMINATOR};
++static ANTLR3_UCHAR   lit_36[]  = { 0x64, 0x61, 0x79, 0x73,  ANTLR3_STRING_TERMINATOR};
++static ANTLR3_UCHAR   lit_37[]  = { 0x77, 0x65, 0x65, 0x6B, 0x73,  ANTLR3_STRING_TERMINATOR};
++static ANTLR3_UCHAR   lit_38[]  = { 0x6D, 0x6F, 0x6E, 0x74, 0x68, 0x73,  ANTLR3_STRING_TERMINATOR};
++static ANTLR3_UCHAR   lit_39[]  = { 0x79, 0x65, 0x61, 0x72, 0x73,  ANTLR3_STRING_TERMINATOR};
++static ANTLR3_UCHAR   lit_40[]  = { 0x6D, 0x75, 0x73, 0x69, 0x63,  ANTLR3_STRING_TERMINATOR};
++static ANTLR3_UCHAR   lit_41[]  = { 0x6D, 0x6F, 0x76, 0x69, 0x65,  ANTLR3_STRING_TERMINATOR};
++static ANTLR3_UCHAR   lit_42[]  = { 0x70, 0x6F, 0x64, 0x63, 0x61, 0x73, 0x74,  ANTLR3_STRING_TERMINATOR};
++static ANTLR3_UCHAR   lit_43[]  = { 0x61, 0x75, 0x64, 0x69, 0x6F, 0x62, 0x6F, 0x6F, 0x6B,  ANTLR3_STRING_TERMINATOR};
++static ANTLR3_UCHAR   lit_44[]  = { 0x74, 0x76, 0x73, 0x68, 0x6F, 0x77,  ANTLR3_STRING_TERMINATOR};
++static ANTLR3_UCHAR   lit_45[]  = { 0x66, 0x69, 0x6C, 0x65,  ANTLR3_STRING_TERMINATOR};
++static ANTLR3_UCHAR   lit_46[]  = { 0x75, 0x72, 0x6C,  ANTLR3_STRING_TERMINATOR};
++static ANTLR3_UCHAR   lit_47[]  = { 0x73, 0x70, 0x6F, 0x74, 0x69, 0x66, 0x79,  ANTLR3_STRING_TERMINATOR};
++static ANTLR3_UCHAR   lit_48[]  = { 0x70, 0x69, 0x70, 0x65,  ANTLR3_STRING_TERMINATOR};
++
++
++
++
++/* MACROS that hide the C interface implementations from the
++ * generated code, which makes it a little more understandable to the human eye.
++ * I am very much against using C pre-processor macros for function calls and bits
++ * of code as you cannot see what is happening when single stepping in debuggers
++ * and so on. The exception (in my book at least) is for generated code, where you are
++ * not maintaining it, but may wish to read and understand it. If you single step it, you know that input()
++ * hides some indirect calls, but is always referring to the input stream. This is
++ * probably more readable than ctx->input->istream->input(snarfle0->blarg) and allows me to rejig
++ * the runtime interfaces without changing the generated code too often, without
++ * confusing the reader of the generated output, who may not wish to know the gory
++ * details of the interface inheritance.
++ */
++ 
++#define               CTX     ctx
++
++/* Aids in accessing scopes for grammar programmers
++ */
++#undef        SCOPE_TYPE
++#undef        SCOPE_STACK
++#undef        SCOPE_TOP
++#define       SCOPE_TYPE(scope)   pSMARTPLLexer_##scope##_SCOPE
++#define SCOPE_STACK(scope)  pSMARTPLLexer_##scope##Stack
++#define       SCOPE_TOP(scope)    ctx->pSMARTPLLexer_##scope##Top
++#define       SCOPE_SIZE(scope)               ctx->pSMARTPLLexer_##scope##Stack_limit
++#define SCOPE_INSTANCE(scope, i)      (ctx->SCOPE_STACK(scope)->get(ctx->SCOPE_STACK(scope),i))
++
++ 
++/* Macros for accessing things in a lexer
++ */
++#undef            LEXER
++#undef            RECOGNIZER              
++#undef            RULEMEMO                
++#undef            GETCHARINDEX
++#undef            GETLINE
++#undef            GETCHARPOSITIONINLINE
++#undef            EMIT
++#undef            EMITNEW
++#undef            MATCHC
++#undef            MATCHS
++#undef            MATCHRANGE
++#undef            LTOKEN
++#undef            HASFAILED
++#undef            FAILEDFLAG
++#undef            INPUT
++#undef            STRSTREAM
++#undef            LA
++#undef            HASEXCEPTION
++#undef            EXCEPTION
++#undef            CONSTRUCTEX
++#undef            CONSUME
++#undef            LRECOVER
++#undef            MARK
++#undef            REWIND
++#undef            REWINDLAST
++#undef            BACKTRACKING
++#undef                MATCHANY
++#undef                MEMOIZE
++#undef                HAVEPARSEDRULE
++#undef                GETTEXT
++#undef                INDEX
++#undef                SEEK
++#undef                PUSHSTREAM
++#undef                POPSTREAM
++#undef                SETTEXT
++#undef                SETTEXT8
++
++#define           LEXER                                       ctx->pLexer
++#define           RECOGNIZER                      LEXER->rec
++#define               LEXSTATE                                RECOGNIZER->state
++#define               TOKSOURCE                               LEXSTATE->tokSource
++#define           GETCHARINDEX()                      LEXER->getCharIndex(LEXER)
++#define           GETLINE()                           LEXER->getLine(LEXER)
++#define           GETTEXT()                           LEXER->getText(LEXER)
++#define           GETCHARPOSITIONINLINE() LEXER->getCharPositionInLine(LEXER)
++#define           EMIT()                                      LEXSTATE->type = _type; LEXER->emit(LEXER)
++#define           EMITNEW(t)                          LEXER->emitNew(LEXER, t)
++#define           MATCHC(c)                           LEXER->matchc(LEXER, c)
++#define           MATCHS(s)                           LEXER->matchs(LEXER, s)
++#define           MATCHRANGE(c1,c2)       LEXER->matchRange(LEXER, c1, c2)
++#define           MATCHANY()                          LEXER->matchAny(LEXER)
++#define           LTOKEN                              LEXSTATE->token
++#define           HASFAILED()                         (LEXSTATE->failed == ANTLR3_TRUE)
++#define           BACKTRACKING                        LEXSTATE->backtracking
++#define           FAILEDFLAG                          LEXSTATE->failed
++#define           INPUT                                       LEXER->input
++#define           STRSTREAM                           INPUT
++#define               ISTREAM                                 INPUT->istream
++#define               INDEX()                                 ISTREAM->index(ISTREAM)
++#define               SEEK(n)                                 ISTREAM->seek(ISTREAM, n)
++#define           EOF_TOKEN                           &(LEXSTATE->tokSource->eofToken)
++#define           HASEXCEPTION()                      (LEXSTATE->error == ANTLR3_TRUE)
++#define           EXCEPTION                           LEXSTATE->exception
++#define           CONSTRUCTEX()                       RECOGNIZER->exConstruct(RECOGNIZER)
++#define           LRECOVER()                          LEXER->recover(LEXER)
++#define           MARK()                                      ISTREAM->mark(ISTREAM)
++#define           REWIND(m)                           ISTREAM->rewind(ISTREAM, m)
++#define           REWINDLAST()                        ISTREAM->rewindLast(ISTREAM)
++#define               MEMOIZE(ri,si)                  RECOGNIZER->memoize(RECOGNIZER, ri, si)
++#define               HAVEPARSEDRULE(r)               RECOGNIZER->alreadyParsedRule(RECOGNIZER, r)
++#define               PUSHSTREAM(str)                 LEXER->pushCharStream(LEXER, str)
++#define               POPSTREAM()                             LEXER->popCharStream(LEXER)
++#define               SETTEXT(str)                    LEXSTATE->text = str
++#define               SKIP()                                  LEXSTATE->token = &(TOKSOURCE->skipToken)
++#define               USER1                                   LEXSTATE->user1
++#define               USER2                                   LEXSTATE->user2
++#define               USER3                                   LEXSTATE->user3
++#define               CUSTOM                                  LEXSTATE->custom
++#define               RULEMEMO                                LEXSTATE->ruleMemo
++#define               DBG                                             RECOGNIZER->debugger
++
++/* If we have been told we can rely on the standard 8 bit or 16 bit input
++ * stream, then we can define our macros to use the direct pointers
++ * in the input object, which is much faster than indirect calls. This
++ * is really only significant to lexers with a lot of fragment rules (which
++ * do not place LA(1) in a temporary at the moment) and even then
++ * only if there is a lot of input (order of say 1M or so).
++ */
++#if   defined(ANTLR3_INLINE_INPUT_ASCII) || defined(ANTLR3_INLINE_INPUT_UTF16)
++
++# ifdef       ANTLR3_INLINE_INPUT_ASCII
++
++/* 8 bit "ASCII" (actually any 8 bit character set) */
++
++#  define         NEXTCHAR                    ((pANTLR3_UINT8)(INPUT->nextChar))
++#  define         DATAP                               ((pANTLR3_UINT8)(INPUT->data))
++
++# else
++
++#  define         NEXTCHAR                    ((pANTLR3_UINT16)(INPUT->nextChar)) 
++#  define         DATAP                               ((pANTLR3_UINT16)(INPUT->data))
++
++# endif
++
++# define          LA(n) ((NEXTCHAR + n) > (DATAP + INPUT->sizeBuf) ? ANTLR3_CHARSTREAM_EOF : (ANTLR3_UCHAR)(*(NEXTCHAR + n - 1)))
++# define          CONSUME()                                                                                   \
++{                                                                                                                                     \
++    if        (NEXTCHAR < (DATAP + INPUT->sizeBuf))                                           \
++    {                                                                                                                         \
++              INPUT->charPositionInLine++;                                                            \
++              if  ((ANTLR3_UCHAR)(*NEXTCHAR) == INPUT->newlineChar)           \
++              {                                                                                                                       \
++                      INPUT->line++;                                                                                  \
++                      INPUT->charPositionInLine       = 0;                                            \
++                      INPUT->currentLine              = (void *)(NEXTCHAR + 1);               \
++              }                                                                                                                       \
++              INPUT->nextChar = (void *)(NEXTCHAR + 1);                                       \
++    }                                                                                                                         \
++}
++
++#else
++
++// Pick up the input character by calling the input stream implementation.
++//
++#define           CONSUME()                           INPUT->istream->consume(INPUT->istream)
++#define           LA(n)                                       INPUT->istream->_LA(INPUT->istream, n)
++
++#endif
++#define               TOKTEXT(tok, txt)                               tok, (pANTLR3_UINT8)txt
++
++/* The 4 tokens defined below may well clash with your own #defines or token types. If so
++ * then for the present you must use different names for your defines as these are hard coded
++ * in the code generator. It would be better not to use such names internally, and maybe
++ * we can change this in a forthcoming release. I deliberately do not #undef these
++ * here as this will at least give you a redefined error somewhere if they clash.
++ */
++#define           UP      ANTLR3_TOKEN_UP
++#define           DOWN    ANTLR3_TOKEN_DOWN
++#define           EOR     ANTLR3_TOKEN_EOR
++#define           INVALID ANTLR3_TOKEN_INVALID
++
++
++/* =============================================================================
++ * Functions to create and destroy scopes. First come the rule scopes, followed
++ * by the global declared scopes.
++ */
++
++
++
++/* ============================================================================= */
++
++/* =============================================================================
++ * Start of recognizer
++ */
++
++
++/* Forward declare the locally static matching functions we have generated and any predicate functions.
++ */
++static ANTLR3_INLINE  void    mT__30    (pSMARTPLLexer ctx);
++static ANTLR3_INLINE  void    mT__31    (pSMARTPLLexer ctx);
++static ANTLR3_INLINE  void    mSTRTAG    (pSMARTPLLexer ctx);
++static ANTLR3_INLINE  void    mINTTAG    (pSMARTPLLexer ctx);
++static ANTLR3_INLINE  void    mDATETAG    (pSMARTPLLexer ctx);
++static ANTLR3_INLINE  void    mENUMTAG    (pSMARTPLLexer ctx);
++static ANTLR3_INLINE  void    mINCLUDES    (pSMARTPLLexer ctx);
++static ANTLR3_INLINE  void    mIS    (pSMARTPLLexer ctx);
++static ANTLR3_INLINE  void    mINTBOOL    (pSMARTPLLexer ctx);
++static ANTLR3_INLINE  void    mGREATER    (pSMARTPLLexer ctx);
++static ANTLR3_INLINE  void    mGREATEREQUAL    (pSMARTPLLexer ctx);
++static ANTLR3_INLINE  void    mLESS    (pSMARTPLLexer ctx);
++static ANTLR3_INLINE  void    mLESSEQUAL    (pSMARTPLLexer ctx);
++static ANTLR3_INLINE  void    mEQUAL    (pSMARTPLLexer ctx);
++static ANTLR3_INLINE  void    mAFTER    (pSMARTPLLexer ctx);
++static ANTLR3_INLINE  void    mBEFORE    (pSMARTPLLexer ctx);
++static ANTLR3_INLINE  void    mAGO    (pSMARTPLLexer ctx);
++static ANTLR3_INLINE  void    mAND    (pSMARTPLLexer ctx);
++static ANTLR3_INLINE  void    mOR    (pSMARTPLLexer ctx);
++static ANTLR3_INLINE  void    mNOT    (pSMARTPLLexer ctx);
++static ANTLR3_INLINE  void    mLPAR    (pSMARTPLLexer ctx);
++static ANTLR3_INLINE  void    mRPAR    (pSMARTPLLexer ctx);
++static ANTLR3_INLINE  void    mDATE    (pSMARTPLLexer ctx);
++static ANTLR3_INLINE  void    mDATINTERVAL    (pSMARTPLLexer ctx);
++static ANTLR3_INLINE  void    mENUMVAL    (pSMARTPLLexer ctx);
++static ANTLR3_INLINE  void    mSTR    (pSMARTPLLexer ctx);
++static ANTLR3_INLINE  void    mINT    (pSMARTPLLexer ctx);
++static ANTLR3_INLINE  void    mWHITESPACE    (pSMARTPLLexer ctx);
++static ANTLR3_INLINE  void    mTokens    (pSMARTPLLexer ctx);
++static void   SMARTPLLexerFree(pSMARTPLLexer ctx);
++
++/* =========================================================================
++ * Lexer matching rules end.
++ * =========================================================================
++ */
++
++
++
++static void
++SMARTPLLexerFree  (pSMARTPLLexer ctx)
++{
++    LEXER->free(LEXER);
++    
++    ANTLR3_FREE(ctx);
++}
++
++/** \brief Name of the grammar file that generated this code
++ */
++static const char fileName[] = "SMARTPL.g";
++
++/** \brief Return the name of the grammar file that generated this code.
++ */
++static const char * getGrammarFileName()
++{
++      return fileName;
++}
++
++/** \brief Create a new lexer called SMARTPLLexer
++ *
++ * \param[in]    instream Pointer to an initialized input stream
++ * \return 
++ *     - Success pSMARTPLLexer initialized for the lex start
++ *     - Fail NULL
++ */
++ANTLR3_API pSMARTPLLexer SMARTPLLexerNew         
++(pANTLR3_INPUT_STREAM instream)
++{
++      // See if we can create a new lexer with the standard constructor
++      //
++      return SMARTPLLexerNewSSD(instream, NULL);
++}
++
++/** \brief Create a new lexer called SMARTPLLexer
++ *
++ * \param[in]    instream Pointer to an initialized input stream
++ * \param[state] state Previously created shared recognizer stat
++ * \return 
++ *     - Success pSMARTPLLexer initialized for the lex start
++ *     - Fail NULL
++ */
++ANTLR3_API pSMARTPLLexer SMARTPLLexerNewSSD         
++(pANTLR3_INPUT_STREAM instream, pANTLR3_RECOGNIZER_SHARED_STATE state)
++{
++    pSMARTPLLexer ctx; // Context structure we will build and return
++
++    ctx = (pSMARTPLLexer) ANTLR3_CALLOC(1, sizeof(SMARTPLLexer));
++
++    if  (ctx == NULL)
++    {
++        // Failed to allocate memory for lexer context
++        return  NULL;
++    }
++
++    /* -------------------------------------------------------------------
++     * Memory for basic structure is allocated, now to fill in
++     * in base ANTLR3 structures. We initialize the function pointers
++     * for the standard ANTLR3 lexer function set, but upon return
++     * from here, the programmer may set the pointers to provide custom
++     * implementations of each function. 
++     *
++     * We don't use the macros defined in SMARTPLLexer.h here so you can get a sense
++     * of what goes where.
++     */
++    
++    /* Create a base lexer, using the supplied input stream
++     */
++    ctx->pLexer       = antlr3LexerNewStream(ANTLR3_SIZE_HINT, instream, state);
++    
++    /* Check that we allocated the memory correctly
++     */
++    if        (ctx->pLexer == NULL)
++    {
++              ANTLR3_FREE(ctx);
++              return  NULL;
++    }
++    /* Install the implementation of our SMARTPLLexer interface
++     */
++    ctx->mT__30       = mT__30;
++    ctx->mT__31       = mT__31;
++    ctx->mSTRTAG      = mSTRTAG;
++    ctx->mINTTAG      = mINTTAG;
++    ctx->mDATETAG     = mDATETAG;
++    ctx->mENUMTAG     = mENUMTAG;
++    ctx->mINCLUDES    = mINCLUDES;
++    ctx->mIS  = mIS;
++    ctx->mINTBOOL     = mINTBOOL;
++    ctx->mGREATER     = mGREATER;
++    ctx->mGREATEREQUAL        = mGREATEREQUAL;
++    ctx->mLESS        = mLESS;
++    ctx->mLESSEQUAL   = mLESSEQUAL;
++    ctx->mEQUAL       = mEQUAL;
++    ctx->mAFTER       = mAFTER;
++    ctx->mBEFORE      = mBEFORE;
++    ctx->mAGO = mAGO;
++    ctx->mAND = mAND;
++    ctx->mOR  = mOR;
++    ctx->mNOT = mNOT;
++    ctx->mLPAR        = mLPAR;
++    ctx->mRPAR        = mRPAR;
++    ctx->mDATE        = mDATE;
++    ctx->mDATINTERVAL = mDATINTERVAL;
++    ctx->mENUMVAL     = mENUMVAL;
++    ctx->mSTR = mSTR;
++    ctx->mINT = mINT;
++    ctx->mWHITESPACE  = mWHITESPACE;
++    ctx->mTokens      = mTokens;
++    
++    /** When the nextToken() call is made to this lexer's pANTLR3_TOKEN_SOURCE
++     *  it will call mTokens() in this generated code, and will pass it the ctx
++     * pointer of this lexer, not the context of the base lexer, so store that now.
++     */
++    ctx->pLexer->ctx      = ctx;
++    
++    /**Install the token matching function
++     */
++    ctx->pLexer->mTokens = (void (*) (void *))(mTokens);
++    
++    ctx->getGrammarFileName   = getGrammarFileName;
++    ctx->free         = SMARTPLLexerFree;
++
++    
++    
++
++
++    /* Return the newly built lexer to the caller
++     */
++    return  ctx;
++}
++ 
++
++/* =========================================================================
++ * Functions to match the lexer grammar defined tokens from the input stream
++ */
++
++//   Comes from: 7:7: ( '{' )
++/** \brief Lexer rule generated by ANTLR3
++ *
++ * $ANTLR start T__30
++ *
++ * Looks to match the characters the constitute the token T__30
++ * from the attached input stream.
++ *
++ *
++ * \remark
++ *  - lexer->error == ANTLR3_TRUE if an exception was thrown.
++ */
++static ANTLR3_INLINE
++void mT__30(pSMARTPLLexer ctx)
++{
++      ANTLR3_UINT32   _type;
++
++    _type         = T__30;
++       
++    
++    // SMARTPL.g:7:7: ( '{' )
++    // SMARTPL.g:7:9: '{'
++    {
++        MATCHC('{'); 
++        if  (HASEXCEPTION())
++        {
++            goto ruleT__30Ex;
++        }
++
++
++    }
++
++      LEXSTATE->type = _type;
++
++    // This is where rules clean up and exit
++    //
++    goto ruleT__30Ex; /* Prevent compiler warnings */
++    ruleT__30Ex: ;
++
++}
++// $ANTLR end T__30
++
++//   Comes from: 8:7: ( '}' )
++/** \brief Lexer rule generated by ANTLR3
++ *
++ * $ANTLR start T__31
++ *
++ * Looks to match the characters the constitute the token T__31
++ * from the attached input stream.
++ *
++ *
++ * \remark
++ *  - lexer->error == ANTLR3_TRUE if an exception was thrown.
++ */
++static ANTLR3_INLINE
++void mT__31(pSMARTPLLexer ctx)
++{
++      ANTLR3_UINT32   _type;
++
++    _type         = T__31;
++       
++    
++    // SMARTPL.g:8:7: ( '}' )
++    // SMARTPL.g:8:9: '}'
++    {
++        MATCHC('}'); 
++        if  (HASEXCEPTION())
++        {
++            goto ruleT__31Ex;
++        }
++
++
++    }
++
++      LEXSTATE->type = _type;
++
++    // This is where rules clean up and exit
++    //
++    goto ruleT__31Ex; /* Prevent compiler warnings */
++    ruleT__31Ex: ;
++
++}
++// $ANTLR end T__31
++
++//   Comes from: 56:9: ( 'artist' | 'album_artist' | 'album' | 'title' | 'genre' | 'composer' | 'path' | 'type' | 'grouping' )
++/** \brief Lexer rule generated by ANTLR3
++ *
++ * $ANTLR start STRTAG
++ *
++ * Looks to match the characters the constitute the token STRTAG
++ * from the attached input stream.
++ *
++ *
++ * \remark
++ *  - lexer->error == ANTLR3_TRUE if an exception was thrown.
++ */
++static ANTLR3_INLINE
++void mSTRTAG(pSMARTPLLexer ctx)
++{
++      ANTLR3_UINT32   _type;
++
++    _type         = STRTAG;
++       
++    
++    {
++        //  SMARTPL.g:56:9: ( 'artist' | 'album_artist' | 'album' | 'title' | 'genre' | 'composer' | 'path' | 'type' | 'grouping' )
++        
++        ANTLR3_UINT32 alt1;
++
++        alt1=9;
++
++        switch ( LA(1) ) 
++        {
++        case 'a':
++              {
++                      switch ( LA(2) ) 
++                      {
++                      case 'r':
++                              {
++                                      alt1=1;
++                              }
++                          break;
++                      case 'l':
++                              {
++                                      switch ( LA(3) ) 
++                                      {
++                                      case 'b':
++                                              {
++                                                      switch ( LA(4) ) 
++                                                      {
++                                                      case 'u':
++                                                              {
++                                                                      switch ( LA(5) ) 
++                                                                      {
++                                                                      case 'm':
++                                                                              {
++                                                                                      switch ( LA(6) ) 
++                                                                                      {
++                                                                                      case '_':
++                                                                                              {
++                                                                                                      alt1=2;
++                                                                                              }
++                                                                                          break;
++
++                                                                                      default:
++                                                                                          alt1=3;}
++
++                                                                              }
++                                                                          break;
++
++                                                                      default:
++                                                                          CONSTRUCTEX();
++                                                                          EXCEPTION->type         = ANTLR3_NO_VIABLE_ALT_EXCEPTION;
++                                                                          EXCEPTION->message      = (void *)"";
++                                                                          EXCEPTION->decisionNum  = 1;
++                                                                          EXCEPTION->state        = 13;
++
++
++                                                                          goto ruleSTRTAGEx;
++                                                                      }
++
++                                                              }
++                                                          break;
++
++                                                      default:
++                                                          CONSTRUCTEX();
++                                                          EXCEPTION->type         = ANTLR3_NO_VIABLE_ALT_EXCEPTION;
++                                                          EXCEPTION->message      = (void *)"";
++                                                          EXCEPTION->decisionNum  = 1;
++                                                          EXCEPTION->state        = 12;
++
++
++                                                          goto ruleSTRTAGEx;
++                                                      }
++
++                                              }
++                                          break;
++
++                                      default:
++                                          CONSTRUCTEX();
++                                          EXCEPTION->type         = ANTLR3_NO_VIABLE_ALT_EXCEPTION;
++                                          EXCEPTION->message      = (void *)"";
++                                          EXCEPTION->decisionNum  = 1;
++                                          EXCEPTION->state        = 7;
++
++
++                                          goto ruleSTRTAGEx;
++                                      }
++
++                              }
++                          break;
++
++                      default:
++                          CONSTRUCTEX();
++                          EXCEPTION->type         = ANTLR3_NO_VIABLE_ALT_EXCEPTION;
++                          EXCEPTION->message      = (void *)"";
++                          EXCEPTION->decisionNum  = 1;
++                          EXCEPTION->state        = 1;
++
++
++                          goto ruleSTRTAGEx;
++                      }
++
++              }
++            break;
++        case 't':
++              {
++                      switch ( LA(2) ) 
++                      {
++                      case 'i':
++                              {
++                                      alt1=4;
++                              }
++                          break;
++                      case 'y':
++                              {
++                                      alt1=8;
++                              }
++                          break;
++
++                      default:
++                          CONSTRUCTEX();
++                          EXCEPTION->type         = ANTLR3_NO_VIABLE_ALT_EXCEPTION;
++                          EXCEPTION->message      = (void *)"";
++                          EXCEPTION->decisionNum  = 1;
++                          EXCEPTION->state        = 2;
++
++
++                          goto ruleSTRTAGEx;
++                      }
++
++              }
++            break;
++        case 'g':
++              {
++                      switch ( LA(2) ) 
++                      {
++                      case 'e':
++                              {
++                                      alt1=5;
++                              }
++                          break;
++                      case 'r':
++                              {
++                                      alt1=9;
++                              }
++                          break;
++
++                      default:
++                          CONSTRUCTEX();
++                          EXCEPTION->type         = ANTLR3_NO_VIABLE_ALT_EXCEPTION;
++                          EXCEPTION->message      = (void *)"";
++                          EXCEPTION->decisionNum  = 1;
++                          EXCEPTION->state        = 3;
++
++
++                          goto ruleSTRTAGEx;
++                      }
++
++              }
++            break;
++        case 'c':
++              {
++                      alt1=6;
++              }
++            break;
++        case 'p':
++              {
++                      alt1=7;
++              }
++            break;
++
++        default:
++            CONSTRUCTEX();
++            EXCEPTION->type         = ANTLR3_NO_VIABLE_ALT_EXCEPTION;
++            EXCEPTION->message      = (void *)"";
++            EXCEPTION->decisionNum  = 1;
++            EXCEPTION->state        = 0;
++
++
++            goto ruleSTRTAGEx;
++        }
++
++        switch (alt1) 
++        {
++      case 1:
++          // SMARTPL.g:56:11: 'artist'
++          {
++              MATCHS(lit_1); 
++              if  (HASEXCEPTION())
++              {
++                  goto ruleSTRTAGEx;
++              }
++
++
++
++          }
++          break;
++      case 2:
++          // SMARTPL.g:57:6: 'album_artist'
++          {
++              MATCHS(lit_2); 
++              if  (HASEXCEPTION())
++              {
++                  goto ruleSTRTAGEx;
++              }
++
++
++
++          }
++          break;
++      case 3:
++          // SMARTPL.g:58:6: 'album'
++          {
++              MATCHS(lit_3); 
++              if  (HASEXCEPTION())
++              {
++                  goto ruleSTRTAGEx;
++              }
++
++
++
++          }
++          break;
++      case 4:
++          // SMARTPL.g:59:6: 'title'
++          {
++              MATCHS(lit_4); 
++              if  (HASEXCEPTION())
++              {
++                  goto ruleSTRTAGEx;
++              }
++
++
++
++          }
++          break;
++      case 5:
++          // SMARTPL.g:60:6: 'genre'
++          {
++              MATCHS(lit_5); 
++              if  (HASEXCEPTION())
++              {
++                  goto ruleSTRTAGEx;
++              }
++
++
++
++          }
++          break;
++      case 6:
++          // SMARTPL.g:61:6: 'composer'
++          {
++              MATCHS(lit_6); 
++              if  (HASEXCEPTION())
++              {
++                  goto ruleSTRTAGEx;
++              }
++
++
++
++          }
++          break;
++      case 7:
++          // SMARTPL.g:62:6: 'path'
++          {
++              MATCHS(lit_7); 
++              if  (HASEXCEPTION())
++              {
++                  goto ruleSTRTAGEx;
++              }
++
++
++
++          }
++          break;
++      case 8:
++          // SMARTPL.g:63:6: 'type'
++          {
++              MATCHS(lit_8); 
++              if  (HASEXCEPTION())
++              {
++                  goto ruleSTRTAGEx;
++              }
++
++
++
++          }
++          break;
++      case 9:
++          // SMARTPL.g:64:6: 'grouping'
++          {
++              MATCHS(lit_9); 
++              if  (HASEXCEPTION())
++              {
++                  goto ruleSTRTAGEx;
++              }
++
++
++
++          }
++          break;
++
++        }
++    }
++      LEXSTATE->type = _type;
++
++    // This is where rules clean up and exit
++    //
++    goto ruleSTRTAGEx; /* Prevent compiler warnings */
++    ruleSTRTAGEx: ;
++
++}
++// $ANTLR end STRTAG
++
++//   Comes from: 67:9: ( 'play_count' | 'rating' | 'year' | 'compilation' )
++/** \brief Lexer rule generated by ANTLR3
++ *
++ * $ANTLR start INTTAG
++ *
++ * Looks to match the characters the constitute the token INTTAG
++ * from the attached input stream.
++ *
++ *
++ * \remark
++ *  - lexer->error == ANTLR3_TRUE if an exception was thrown.
++ */
++static ANTLR3_INLINE
++void mINTTAG(pSMARTPLLexer ctx)
++{
++      ANTLR3_UINT32   _type;
++
++    _type         = INTTAG;
++       
++    
++    {
++        //  SMARTPL.g:67:9: ( 'play_count' | 'rating' | 'year' | 'compilation' )
++        
++        ANTLR3_UINT32 alt2;
++
++        alt2=4;
++
++        switch ( LA(1) ) 
++        {
++        case 'p':
++              {
++                      alt2=1;
++              }
++            break;
++        case 'r':
++              {
++                      alt2=2;
++              }
++            break;
++        case 'y':
++              {
++                      alt2=3;
++              }
++            break;
++        case 'c':
++              {
++                      alt2=4;
++              }
++            break;
++
++        default:
++            CONSTRUCTEX();
++            EXCEPTION->type         = ANTLR3_NO_VIABLE_ALT_EXCEPTION;
++            EXCEPTION->message      = (void *)"";
++            EXCEPTION->decisionNum  = 2;
++            EXCEPTION->state        = 0;
++
++
++            goto ruleINTTAGEx;
++        }
++
++        switch (alt2) 
++        {
++      case 1:
++          // SMARTPL.g:67:11: 'play_count'
++          {
++              MATCHS(lit_10); 
++              if  (HASEXCEPTION())
++              {
++                  goto ruleINTTAGEx;
++              }
++
++
++
++          }
++          break;
++      case 2:
++          // SMARTPL.g:68:6: 'rating'
++          {
++              MATCHS(lit_11); 
++              if  (HASEXCEPTION())
++              {
++                  goto ruleINTTAGEx;
++              }
++
++
++
++          }
++          break;
++      case 3:
++          // SMARTPL.g:69:6: 'year'
++          {
++              MATCHS(lit_12); 
++              if  (HASEXCEPTION())
++              {
++                  goto ruleINTTAGEx;
++              }
++
++
++
++          }
++          break;
++      case 4:
++          // SMARTPL.g:70:6: 'compilation'
++          {
++              MATCHS(lit_13); 
++              if  (HASEXCEPTION())
++              {
++                  goto ruleINTTAGEx;
++              }
++
++
++
++          }
++          break;
++
++        }
++    }
++      LEXSTATE->type = _type;
++
++    // This is where rules clean up and exit
++    //
++    goto ruleINTTAGEx; /* Prevent compiler warnings */
++    ruleINTTAGEx: ;
++
++}
++// $ANTLR end INTTAG
++
++//   Comes from: 73:10: ( 'time_added' | 'time_played' )
++/** \brief Lexer rule generated by ANTLR3
++ *
++ * $ANTLR start DATETAG
++ *
++ * Looks to match the characters the constitute the token DATETAG
++ * from the attached input stream.
++ *
++ *
++ * \remark
++ *  - lexer->error == ANTLR3_TRUE if an exception was thrown.
++ */
++static ANTLR3_INLINE
++void mDATETAG(pSMARTPLLexer ctx)
++{
++      ANTLR3_UINT32   _type;
++
++    _type         = DATETAG;
++       
++    
++    {
++        //  SMARTPL.g:73:10: ( 'time_added' | 'time_played' )
++        
++        ANTLR3_UINT32 alt3;
++
++        alt3=2;
++
++        switch ( LA(1) ) 
++        {
++        case 't':
++              {
++                      switch ( LA(2) ) 
++                      {
++                      case 'i':
++                              {
++                                      switch ( LA(3) ) 
++                                      {
++                                      case 'm':
++                                              {
++                                                      switch ( LA(4) ) 
++                                                      {
++                                                      case 'e':
++                                                              {
++                                                                      switch ( LA(5) ) 
++                                                                      {
++                                                                      case '_':
++                                                                              {
++                                                                                      switch ( LA(6) ) 
++                                                                                      {
++                                                                                      case 'a':
++                                                                                              {
++                                                                                                      alt3=1;
++                                                                                              }
++                                                                                          break;
++                                                                                      case 'p':
++                                                                                              {
++                                                                                                      alt3=2;
++                                                                                              }
++                                                                                          break;
++
++                                                                                      default:
++                                                                                          CONSTRUCTEX();
++                                                                                          EXCEPTION->type         = ANTLR3_NO_VIABLE_ALT_EXCEPTION;
++                                                                                          EXCEPTION->message      = (void *)"";
++                                                                                          EXCEPTION->decisionNum  = 3;
++                                                                                          EXCEPTION->state        = 5;
++
++
++                                                                                          goto ruleDATETAGEx;
++                                                                                      }
++
++                                                                              }
++                                                                          break;
++
++                                                                      default:
++                                                                          CONSTRUCTEX();
++                                                                          EXCEPTION->type         = ANTLR3_NO_VIABLE_ALT_EXCEPTION;
++                                                                          EXCEPTION->message      = (void *)"";
++                                                                          EXCEPTION->decisionNum  = 3;
++                                                                          EXCEPTION->state        = 4;
++
++
++                                                                          goto ruleDATETAGEx;
++                                                                      }
++
++                                                              }
++                                                          break;
++
++                                                      default:
++                                                          CONSTRUCTEX();
++                                                          EXCEPTION->type         = ANTLR3_NO_VIABLE_ALT_EXCEPTION;
++                                                          EXCEPTION->message      = (void *)"";
++                                                          EXCEPTION->decisionNum  = 3;
++                                                          EXCEPTION->state        = 3;
++
++
++                                                          goto ruleDATETAGEx;
++                                                      }
++
++                                              }
++                                          break;
++
++                                      default:
++                                          CONSTRUCTEX();
++                                          EXCEPTION->type         = ANTLR3_NO_VIABLE_ALT_EXCEPTION;
++                                          EXCEPTION->message      = (void *)"";
++                                          EXCEPTION->decisionNum  = 3;
++                                          EXCEPTION->state        = 2;
++
++
++                                          goto ruleDATETAGEx;
++                                      }
++
++                              }
++                          break;
++
++                      default:
++                          CONSTRUCTEX();
++                          EXCEPTION->type         = ANTLR3_NO_VIABLE_ALT_EXCEPTION;
++                          EXCEPTION->message      = (void *)"";
++                          EXCEPTION->decisionNum  = 3;
++                          EXCEPTION->state        = 1;
++
++
++                          goto ruleDATETAGEx;
++                      }
++
++              }
++            break;
++
++        default:
++            CONSTRUCTEX();
++            EXCEPTION->type         = ANTLR3_NO_VIABLE_ALT_EXCEPTION;
++            EXCEPTION->message      = (void *)"";
++            EXCEPTION->decisionNum  = 3;
++            EXCEPTION->state        = 0;
++
++
++            goto ruleDATETAGEx;
++        }
++
++        switch (alt3) 
++        {
++      case 1:
++          // SMARTPL.g:73:12: 'time_added'
++          {
++              MATCHS(lit_14); 
++              if  (HASEXCEPTION())
++              {
++                  goto ruleDATETAGEx;
++              }
++
++
++
++          }
++          break;
++      case 2:
++          // SMARTPL.g:74:6: 'time_played'
++          {
++              MATCHS(lit_15); 
++              if  (HASEXCEPTION())
++              {
++                  goto ruleDATETAGEx;
++              }
++
++
++
++          }
++          break;
++
++        }
++    }
++      LEXSTATE->type = _type;
++
++    // This is where rules clean up and exit
++    //
++    goto ruleDATETAGEx; /* Prevent compiler warnings */
++    ruleDATETAGEx: ;
++
++}
++// $ANTLR end DATETAG
++
++//   Comes from: 77:10: ( 'data_kind' | 'media_kind' )
++/** \brief Lexer rule generated by ANTLR3
++ *
++ * $ANTLR start ENUMTAG
++ *
++ * Looks to match the characters the constitute the token ENUMTAG
++ * from the attached input stream.
++ *
++ *
++ * \remark
++ *  - lexer->error == ANTLR3_TRUE if an exception was thrown.
++ */
++static ANTLR3_INLINE
++void mENUMTAG(pSMARTPLLexer ctx)
++{
++      ANTLR3_UINT32   _type;
++
++    _type         = ENUMTAG;
++       
++    
++    {
++        //  SMARTPL.g:77:10: ( 'data_kind' | 'media_kind' )
++        
++        ANTLR3_UINT32 alt4;
++
++        alt4=2;
++
++        switch ( LA(1) ) 
++        {
++        case 'd':
++              {
++                      alt4=1;
++              }
++            break;
++        case 'm':
++              {
++                      alt4=2;
++              }
++            break;
++
++        default:
++            CONSTRUCTEX();
++            EXCEPTION->type         = ANTLR3_NO_VIABLE_ALT_EXCEPTION;
++            EXCEPTION->message      = (void *)"";
++            EXCEPTION->decisionNum  = 4;
++            EXCEPTION->state        = 0;
++
++
++            goto ruleENUMTAGEx;
++        }
++
++        switch (alt4) 
++        {
++      case 1:
++          // SMARTPL.g:77:12: 'data_kind'
++          {
++              MATCHS(lit_16); 
++              if  (HASEXCEPTION())
++              {
++                  goto ruleENUMTAGEx;
++              }
++
++
++
++          }
++          break;
++      case 2:
++          // SMARTPL.g:78:6: 'media_kind'
++          {
++              MATCHS(lit_17); 
++              if  (HASEXCEPTION())
++              {
++                  goto ruleENUMTAGEx;
++              }
++
++
++
++          }
++          break;
++
++        }
++    }
++      LEXSTATE->type = _type;
++
++    // This is where rules clean up and exit
++    //
++    goto ruleENUMTAGEx; /* Prevent compiler warnings */
++    ruleENUMTAGEx: ;
++
++}
++// $ANTLR end ENUMTAG
++
++//   Comes from: 81:10: ( 'includes' )
++/** \brief Lexer rule generated by ANTLR3
++ *
++ * $ANTLR start INCLUDES
++ *
++ * Looks to match the characters the constitute the token INCLUDES
++ * from the attached input stream.
++ *
++ *
++ * \remark
++ *  - lexer->error == ANTLR3_TRUE if an exception was thrown.
++ */
++static ANTLR3_INLINE
++void mINCLUDES(pSMARTPLLexer ctx)
++{
++      ANTLR3_UINT32   _type;
++
++    _type         = INCLUDES;
++       
++    
++    // SMARTPL.g:81:10: ( 'includes' )
++    // SMARTPL.g:81:12: 'includes'
++    {
++        MATCHS(lit_18); 
++        if  (HASEXCEPTION())
++        {
++            goto ruleINCLUDESEx;
++        }
++
++
++
++    }
++
++      LEXSTATE->type = _type;
++
++    // This is where rules clean up and exit
++    //
++    goto ruleINCLUDESEx; /* Prevent compiler warnings */
++    ruleINCLUDESEx: ;
++
++}
++// $ANTLR end INCLUDES
++
++//   Comes from: 84:6: ( 'is' )
++/** \brief Lexer rule generated by ANTLR3
++ *
++ * $ANTLR start IS
++ *
++ * Looks to match the characters the constitute the token IS
++ * from the attached input stream.
++ *
++ *
++ * \remark
++ *  - lexer->error == ANTLR3_TRUE if an exception was thrown.
++ */
++static ANTLR3_INLINE
++void mIS(pSMARTPLLexer ctx)
++{
++      ANTLR3_UINT32   _type;
++
++    _type         = IS;
++       
++    
++    // SMARTPL.g:84:6: ( 'is' )
++    // SMARTPL.g:84:8: 'is'
++    {
++        MATCHS(lit_19); 
++        if  (HASEXCEPTION())
++        {
++            goto ruleISEx;
++        }
++
++
++
++    }
++
++      LEXSTATE->type = _type;
++
++    // This is where rules clean up and exit
++    //
++    goto ruleISEx; /* Prevent compiler warnings */
++    ruleISEx: ;
++
++}
++// $ANTLR end IS
++
++//   Comes from: 87:10: ( ( GREATER | GREATEREQUAL | LESS | LESSEQUAL | EQUAL ) )
++/** \brief Lexer rule generated by ANTLR3
++ *
++ * $ANTLR start INTBOOL
++ *
++ * Looks to match the characters the constitute the token INTBOOL
++ * from the attached input stream.
++ *
++ *
++ * \remark
++ *  - lexer->error == ANTLR3_TRUE if an exception was thrown.
++ */
++static ANTLR3_INLINE
++void mINTBOOL(pSMARTPLLexer ctx)
++{
++      ANTLR3_UINT32   _type;
++
++    _type         = INTBOOL;
++       
++    
++    // SMARTPL.g:87:10: ( ( GREATER | GREATEREQUAL | LESS | LESSEQUAL | EQUAL ) )
++    // SMARTPL.g:87:12: ( GREATER | GREATEREQUAL | LESS | LESSEQUAL | EQUAL )
++    {
++
++        // SMARTPL.g:87:12: ( GREATER | GREATEREQUAL | LESS | LESSEQUAL | EQUAL )
++        {
++            int alt5=5;
++            switch ( LA(1) ) 
++            {
++            case '>':
++              {
++                      switch ( LA(2) ) 
++                      {
++                      case '=':
++                              {
++                                      alt5=2;
++                              }
++                          break;
++
++                      default:
++                          alt5=1;}
++
++              }
++                break;
++            case '<':
++              {
++                      switch ( LA(2) ) 
++                      {
++                      case '=':
++                              {
++                                      alt5=4;
++                              }
++                          break;
++
++                      default:
++                          alt5=3;}
++
++              }
++                break;
++            case '=':
++              {
++                      alt5=5;
++              }
++                break;
++
++            default:
++                CONSTRUCTEX();
++                EXCEPTION->type         = ANTLR3_NO_VIABLE_ALT_EXCEPTION;
++                EXCEPTION->message      = (void *)"";
++                EXCEPTION->decisionNum  = 5;
++                EXCEPTION->state        = 0;
++
++
++                goto ruleINTBOOLEx;
++            }
++
++            switch (alt5) 
++            {
++              case 1:
++                  // SMARTPL.g:87:13: GREATER
++                  {
++                      /* 87:13: GREATER */
++                      mGREATER(ctx ); 
++                      if  (HASEXCEPTION())
++                      {
++                          goto ruleINTBOOLEx;
++                      }
++
++
++                  }
++                  break;
++              case 2:
++                  // SMARTPL.g:87:21: GREATEREQUAL
++                  {
++                      /* 87:21: GREATEREQUAL */
++                      mGREATEREQUAL(ctx ); 
++                      if  (HASEXCEPTION())
++                      {
++                          goto ruleINTBOOLEx;
++                      }
++
++
++                  }
++                  break;
++              case 3:
++                  // SMARTPL.g:87:34: LESS
++                  {
++                      /* 87:34: LESS */
++                      mLESS(ctx ); 
++                      if  (HASEXCEPTION())
++                      {
++                          goto ruleINTBOOLEx;
++                      }
++
++
++                  }
++                  break;
++              case 4:
++                  // SMARTPL.g:87:39: LESSEQUAL
++                  {
++                      /* 87:39: LESSEQUAL */
++                      mLESSEQUAL(ctx ); 
++                      if  (HASEXCEPTION())
++                      {
++                          goto ruleINTBOOLEx;
++                      }
++
++
++                  }
++                  break;
++              case 5:
++                  // SMARTPL.g:87:49: EQUAL
++                  {
++                      /* 87:49: EQUAL */
++                      mEQUAL(ctx ); 
++                      if  (HASEXCEPTION())
++                      {
++                          goto ruleINTBOOLEx;
++                      }
++
++
++                  }
++                  break;
++
++            }
++        }
++
++    }
++
++      LEXSTATE->type = _type;
++
++    // This is where rules clean up and exit
++    //
++    goto ruleINTBOOLEx; /* Prevent compiler warnings */
++    ruleINTBOOLEx: ;
++
++}
++// $ANTLR end INTBOOL
++
++//   Comes from: 91:10: ( '>' )
++/** \brief Lexer rule generated by ANTLR3
++ *
++ * $ANTLR start GREATER
++ *
++ * Looks to match the characters the constitute the token GREATER
++ * from the attached input stream.
++ *
++ *
++ * \remark
++ *  - lexer->error == ANTLR3_TRUE if an exception was thrown.
++ */
++static ANTLR3_INLINE
++void mGREATER(pSMARTPLLexer ctx)
++{
++      ANTLR3_UINT32   _type;
++
++        
++    // SMARTPL.g:91:10: ( '>' )
++    // SMARTPL.g:91:12: '>'
++    {
++        MATCHC('>'); 
++        if  (HASEXCEPTION())
++        {
++            goto ruleGREATEREx;
++        }
++
++
++    }
++
++
++
++    // This is where rules clean up and exit
++    //
++    goto ruleGREATEREx; /* Prevent compiler warnings */
++    ruleGREATEREx: ;
++
++}
++// $ANTLR end GREATER
++
++//   Comes from: 95:13: ( '>=' )
++/** \brief Lexer rule generated by ANTLR3
++ *
++ * $ANTLR start GREATEREQUAL
++ *
++ * Looks to match the characters the constitute the token GREATEREQUAL
++ * from the attached input stream.
++ *
++ *
++ * \remark
++ *  - lexer->error == ANTLR3_TRUE if an exception was thrown.
++ */
++static ANTLR3_INLINE
++void mGREATEREQUAL(pSMARTPLLexer ctx)
++{
++      ANTLR3_UINT32   _type;
++
++        
++    // SMARTPL.g:95:13: ( '>=' )
++    // SMARTPL.g:95:15: '>='
++    {
++        MATCHS(lit_20); 
++        if  (HASEXCEPTION())
++        {
++            goto ruleGREATEREQUALEx;
++        }
++
++
++
++    }
++
++
++
++    // This is where rules clean up and exit
++    //
++    goto ruleGREATEREQUALEx; /* Prevent compiler warnings */
++    ruleGREATEREQUALEx: ;
++
++}
++// $ANTLR end GREATEREQUAL
++
++//   Comes from: 99:7: ( '<' )
++/** \brief Lexer rule generated by ANTLR3
++ *
++ * $ANTLR start LESS
++ *
++ * Looks to match the characters the constitute the token LESS
++ * from the attached input stream.
++ *
++ *
++ * \remark
++ *  - lexer->error == ANTLR3_TRUE if an exception was thrown.
++ */
++static ANTLR3_INLINE
++void mLESS(pSMARTPLLexer ctx)
++{
++      ANTLR3_UINT32   _type;
++
++        
++    // SMARTPL.g:99:7: ( '<' )
++    // SMARTPL.g:99:9: '<'
++    {
++        MATCHC('<'); 
++        if  (HASEXCEPTION())
++        {
++            goto ruleLESSEx;
++        }
++
++
++    }
++
++
++
++    // This is where rules clean up and exit
++    //
++    goto ruleLESSEx; /* Prevent compiler warnings */
++    ruleLESSEx: ;
++
++}
++// $ANTLR end LESS
++
++//   Comes from: 103:11: ( '<=' )
++/** \brief Lexer rule generated by ANTLR3
++ *
++ * $ANTLR start LESSEQUAL
++ *
++ * Looks to match the characters the constitute the token LESSEQUAL
++ * from the attached input stream.
++ *
++ *
++ * \remark
++ *  - lexer->error == ANTLR3_TRUE if an exception was thrown.
++ */
++static ANTLR3_INLINE
++void mLESSEQUAL(pSMARTPLLexer ctx)
++{
++      ANTLR3_UINT32   _type;
++
++        
++    // SMARTPL.g:103:11: ( '<=' )
++    // SMARTPL.g:103:13: '<='
++    {
++        MATCHS(lit_21); 
++        if  (HASEXCEPTION())
++        {
++            goto ruleLESSEQUALEx;
++        }
++
++
++
++    }
++
++
++
++    // This is where rules clean up and exit
++    //
++    goto ruleLESSEQUALEx; /* Prevent compiler warnings */
++    ruleLESSEQUALEx: ;
++
++}
++// $ANTLR end LESSEQUAL
++
++//   Comes from: 107:8: ( '=' )
++/** \brief Lexer rule generated by ANTLR3
++ *
++ * $ANTLR start EQUAL
++ *
++ * Looks to match the characters the constitute the token EQUAL
++ * from the attached input stream.
++ *
++ *
++ * \remark
++ *  - lexer->error == ANTLR3_TRUE if an exception was thrown.
++ */
++static ANTLR3_INLINE
++void mEQUAL(pSMARTPLLexer ctx)
++{
++      ANTLR3_UINT32   _type;
++
++        
++    // SMARTPL.g:107:8: ( '=' )
++    // SMARTPL.g:107:10: '='
++    {
++        MATCHC('='); 
++        if  (HASEXCEPTION())
++        {
++            goto ruleEQUALEx;
++        }
++
++
++    }
++
++
++
++    // This is where rules clean up and exit
++    //
++    goto ruleEQUALEx; /* Prevent compiler warnings */
++    ruleEQUALEx: ;
++
++}
++// $ANTLR end EQUAL
++
++//   Comes from: 110:8: ( 'after' )
++/** \brief Lexer rule generated by ANTLR3
++ *
++ * $ANTLR start AFTER
++ *
++ * Looks to match the characters the constitute the token AFTER
++ * from the attached input stream.
++ *
++ *
++ * \remark
++ *  - lexer->error == ANTLR3_TRUE if an exception was thrown.
++ */
++static ANTLR3_INLINE
++void mAFTER(pSMARTPLLexer ctx)
++{
++      ANTLR3_UINT32   _type;
++
++    _type         = AFTER;
++       
++    
++    // SMARTPL.g:110:8: ( 'after' )
++    // SMARTPL.g:110:10: 'after'
++    {
++        MATCHS(lit_22); 
++        if  (HASEXCEPTION())
++        {
++            goto ruleAFTEREx;
++        }
++
++
++
++    }
++
++      LEXSTATE->type = _type;
++
++    // This is where rules clean up and exit
++    //
++    goto ruleAFTEREx; /* Prevent compiler warnings */
++    ruleAFTEREx: ;
++
++}
++// $ANTLR end AFTER
++
++//   Comes from: 113:9: ( 'before' )
++/** \brief Lexer rule generated by ANTLR3
++ *
++ * $ANTLR start BEFORE
++ *
++ * Looks to match the characters the constitute the token BEFORE
++ * from the attached input stream.
++ *
++ *
++ * \remark
++ *  - lexer->error == ANTLR3_TRUE if an exception was thrown.
++ */
++static ANTLR3_INLINE
++void mBEFORE(pSMARTPLLexer ctx)
++{
++      ANTLR3_UINT32   _type;
++
++    _type         = BEFORE;
++       
++    
++    // SMARTPL.g:113:9: ( 'before' )
++    // SMARTPL.g:113:11: 'before'
++    {
++        MATCHS(lit_23); 
++        if  (HASEXCEPTION())
++        {
++            goto ruleBEFOREEx;
++        }
++
++
++
++    }
++
++      LEXSTATE->type = _type;
++
++    // This is where rules clean up and exit
++    //
++    goto ruleBEFOREEx; /* Prevent compiler warnings */
++    ruleBEFOREEx: ;
++
++}
++// $ANTLR end BEFORE
++
++//   Comes from: 116:7: ( 'ago' )
++/** \brief Lexer rule generated by ANTLR3
++ *
++ * $ANTLR start AGO
++ *
++ * Looks to match the characters the constitute the token AGO
++ * from the attached input stream.
++ *
++ *
++ * \remark
++ *  - lexer->error == ANTLR3_TRUE if an exception was thrown.
++ */
++static ANTLR3_INLINE
++void mAGO(pSMARTPLLexer ctx)
++{
++      ANTLR3_UINT32   _type;
++
++    _type         = AGO;
++       
++    
++    // SMARTPL.g:116:7: ( 'ago' )
++    // SMARTPL.g:116:9: 'ago'
++    {
++        MATCHS(lit_24); 
++        if  (HASEXCEPTION())
++        {
++            goto ruleAGOEx;
++        }
++
++
++
++    }
++
++      LEXSTATE->type = _type;
++
++    // This is where rules clean up and exit
++    //
++    goto ruleAGOEx; /* Prevent compiler warnings */
++    ruleAGOEx: ;
++
++}
++// $ANTLR end AGO
++
++//   Comes from: 119:7: ( 'AND' | 'and' )
++/** \brief Lexer rule generated by ANTLR3
++ *
++ * $ANTLR start AND
++ *
++ * Looks to match the characters the constitute the token AND
++ * from the attached input stream.
++ *
++ *
++ * \remark
++ *  - lexer->error == ANTLR3_TRUE if an exception was thrown.
++ */
++static ANTLR3_INLINE
++void mAND(pSMARTPLLexer ctx)
++{
++      ANTLR3_UINT32   _type;
++
++    _type         = AND;
++       
++    
++    {
++        //  SMARTPL.g:119:7: ( 'AND' | 'and' )
++        
++        ANTLR3_UINT32 alt6;
++
++        alt6=2;
++
++        switch ( LA(1) ) 
++        {
++        case 'A':
++              {
++                      alt6=1;
++              }
++            break;
++        case 'a':
++              {
++                      alt6=2;
++              }
++            break;
++
++        default:
++            CONSTRUCTEX();
++            EXCEPTION->type         = ANTLR3_NO_VIABLE_ALT_EXCEPTION;
++            EXCEPTION->message      = (void *)"";
++            EXCEPTION->decisionNum  = 6;
++            EXCEPTION->state        = 0;
++
++
++            goto ruleANDEx;
++        }
++
++        switch (alt6) 
++        {
++      case 1:
++          // SMARTPL.g:119:9: 'AND'
++          {
++              MATCHS(lit_25); 
++              if  (HASEXCEPTION())
++              {
++                  goto ruleANDEx;
++              }
++
++
++
++          }
++          break;
++      case 2:
++          // SMARTPL.g:120:6: 'and'
++          {
++              MATCHS(lit_26); 
++              if  (HASEXCEPTION())
++              {
++                  goto ruleANDEx;
++              }
++
++
++
++          }
++          break;
++
++        }
++    }
++      LEXSTATE->type = _type;
++
++    // This is where rules clean up and exit
++    //
++    goto ruleANDEx; /* Prevent compiler warnings */
++    ruleANDEx: ;
++
++}
++// $ANTLR end AND
++
++//   Comes from: 123:6: ( 'OR' | 'or' )
++/** \brief Lexer rule generated by ANTLR3
++ *
++ * $ANTLR start OR
++ *
++ * Looks to match the characters the constitute the token OR
++ * from the attached input stream.
++ *
++ *
++ * \remark
++ *  - lexer->error == ANTLR3_TRUE if an exception was thrown.
++ */
++static ANTLR3_INLINE
++void mOR(pSMARTPLLexer ctx)
++{
++      ANTLR3_UINT32   _type;
++
++    _type         = OR;
++       
++    
++    {
++        //  SMARTPL.g:123:6: ( 'OR' | 'or' )
++        
++        ANTLR3_UINT32 alt7;
++
++        alt7=2;
++
++        switch ( LA(1) ) 
++        {
++        case 'O':
++              {
++                      alt7=1;
++              }
++            break;
++        case 'o':
++              {
++                      alt7=2;
++              }
++            break;
++
++        default:
++            CONSTRUCTEX();
++            EXCEPTION->type         = ANTLR3_NO_VIABLE_ALT_EXCEPTION;
++            EXCEPTION->message      = (void *)"";
++            EXCEPTION->decisionNum  = 7;
++            EXCEPTION->state        = 0;
++
++
++            goto ruleOREx;
++        }
++
++        switch (alt7) 
++        {
++      case 1:
++          // SMARTPL.g:123:8: 'OR'
++          {
++              MATCHS(lit_27); 
++              if  (HASEXCEPTION())
++              {
++                  goto ruleOREx;
++              }
++
++
++
++          }
++          break;
++      case 2:
++          // SMARTPL.g:124:6: 'or'
++          {
++              MATCHS(lit_28); 
++              if  (HASEXCEPTION())
++              {
++                  goto ruleOREx;
++              }
++
++
++
++          }
++          break;
++
++        }
++    }
++      LEXSTATE->type = _type;
++
++    // This is where rules clean up and exit
++    //
++    goto ruleOREx; /* Prevent compiler warnings */
++    ruleOREx: ;
++
++}
++// $ANTLR end OR
++
++//   Comes from: 127:7: ( 'NOT' | 'not' )
++/** \brief Lexer rule generated by ANTLR3
++ *
++ * $ANTLR start NOT
++ *
++ * Looks to match the characters the constitute the token NOT
++ * from the attached input stream.
++ *
++ *
++ * \remark
++ *  - lexer->error == ANTLR3_TRUE if an exception was thrown.
++ */
++static ANTLR3_INLINE
++void mNOT(pSMARTPLLexer ctx)
++{
++      ANTLR3_UINT32   _type;
++
++    _type         = NOT;
++       
++    
++    {
++        //  SMARTPL.g:127:7: ( 'NOT' | 'not' )
++        
++        ANTLR3_UINT32 alt8;
++
++        alt8=2;
++
++        switch ( LA(1) ) 
++        {
++        case 'N':
++              {
++                      alt8=1;
++              }
++            break;
++        case 'n':
++              {
++                      alt8=2;
++              }
++            break;
++
++        default:
++            CONSTRUCTEX();
++            EXCEPTION->type         = ANTLR3_NO_VIABLE_ALT_EXCEPTION;
++            EXCEPTION->message      = (void *)"";
++            EXCEPTION->decisionNum  = 8;
++            EXCEPTION->state        = 0;
++
++
++            goto ruleNOTEx;
++        }
++
++        switch (alt8) 
++        {
++      case 1:
++          // SMARTPL.g:127:9: 'NOT'
++          {
++              MATCHS(lit_29); 
++              if  (HASEXCEPTION())
++              {
++                  goto ruleNOTEx;
++              }
++
++
++
++          }
++          break;
++      case 2:
++          // SMARTPL.g:128:6: 'not'
++          {
++              MATCHS(lit_30); 
++              if  (HASEXCEPTION())
++              {
++                  goto ruleNOTEx;
++              }
++
++
++
++          }
++          break;
++
++        }
++    }
++      LEXSTATE->type = _type;
++
++    // This is where rules clean up and exit
++    //
++    goto ruleNOTEx; /* Prevent compiler warnings */
++    ruleNOTEx: ;
++
++}
++// $ANTLR end NOT
++
++//   Comes from: 131:7: ( '(' )
++/** \brief Lexer rule generated by ANTLR3
++ *
++ * $ANTLR start LPAR
++ *
++ * Looks to match the characters the constitute the token LPAR
++ * from the attached input stream.
++ *
++ *
++ * \remark
++ *  - lexer->error == ANTLR3_TRUE if an exception was thrown.
++ */
++static ANTLR3_INLINE
++void mLPAR(pSMARTPLLexer ctx)
++{
++      ANTLR3_UINT32   _type;
++
++    _type         = LPAR;
++       
++    
++    // SMARTPL.g:131:7: ( '(' )
++    // SMARTPL.g:131:9: '('
++    {
++        MATCHC('('); 
++        if  (HASEXCEPTION())
++        {
++            goto ruleLPAREx;
++        }
++
++
++    }
++
++      LEXSTATE->type = _type;
++
++    // This is where rules clean up and exit
++    //
++    goto ruleLPAREx; /* Prevent compiler warnings */
++    ruleLPAREx: ;
++
++}
++// $ANTLR end LPAR
++
++//   Comes from: 134:7: ( ')' )
++/** \brief Lexer rule generated by ANTLR3
++ *
++ * $ANTLR start RPAR
++ *
++ * Looks to match the characters the constitute the token RPAR
++ * from the attached input stream.
++ *
++ *
++ * \remark
++ *  - lexer->error == ANTLR3_TRUE if an exception was thrown.
++ */
++static ANTLR3_INLINE
++void mRPAR(pSMARTPLLexer ctx)
++{
++      ANTLR3_UINT32   _type;
++
++    _type         = RPAR;
++       
++    
++    // SMARTPL.g:134:7: ( ')' )
++    // SMARTPL.g:134:9: ')'
++    {
++        MATCHC(')'); 
++        if  (HASEXCEPTION())
++        {
++            goto ruleRPAREx;
++        }
++
++
++    }
++
++      LEXSTATE->type = _type;
++
++    // This is where rules clean up and exit
++    //
++    goto ruleRPAREx; /* Prevent compiler warnings */
++    ruleRPAREx: ;
++
++}
++// $ANTLR end RPAR
++
++//   Comes from: 137:7: ( ( '0' .. '9' ) ( '0' .. '9' ) ( '0' .. '9' ) ( '0' .. '9' ) '-' ( '0' .. '1' ) ( '0' .. '9' ) '-' ( '0' .. '3' ) ( '0' .. '9' ) | 'today' | 'yesterday' | 'last week' | 'last month' | 'last year' )
++/** \brief Lexer rule generated by ANTLR3
++ *
++ * $ANTLR start DATE
++ *
++ * Looks to match the characters the constitute the token DATE
++ * from the attached input stream.
++ *
++ *
++ * \remark
++ *  - lexer->error == ANTLR3_TRUE if an exception was thrown.
++ */
++static ANTLR3_INLINE
++void mDATE(pSMARTPLLexer ctx)
++{
++      ANTLR3_UINT32   _type;
++
++    _type         = DATE;
++       
++    
++    {
++        //  SMARTPL.g:137:7: ( ( '0' .. '9' ) ( '0' .. '9' ) ( '0' .. '9' ) ( '0' .. '9' ) '-' ( '0' .. '1' ) ( '0' .. '9' ) '-' ( '0' .. '3' ) ( '0' .. '9' ) | 'today' | 'yesterday' | 'last week' | 'last month' | 'last year' )
++        
++        ANTLR3_UINT32 alt9;
++
++        alt9=6;
++
++        switch ( LA(1) ) 
++        {
++        case '0':
++        case '1':
++        case '2':
++        case '3':
++        case '4':
++        case '5':
++        case '6':
++        case '7':
++        case '8':
++        case '9':
++              {
++                      alt9=1;
++              }
++            break;
++        case 't':
++              {
++                      alt9=2;
++              }
++            break;
++        case 'y':
++              {
++                      alt9=3;
++              }
++            break;
++        case 'l':
++              {
++                      switch ( LA(2) ) 
++                      {
++                      case 'a':
++                              {
++                                      switch ( LA(3) ) 
++                                      {
++                                      case 's':
++                                              {
++                                                      switch ( LA(4) ) 
++                                                      {
++                                                      case 't':
++                                                              {
++                                                                      switch ( LA(5) ) 
++                                                                      {
++                                                                      case ' ':
++                                                                              {
++                                                                                      switch ( LA(6) ) 
++                                                                                      {
++                                                                                      case 'w':
++                                                                                              {
++                                                                                                      alt9=4;
++                                                                                              }
++                                                                                          break;
++                                                                                      case 'm':
++                                                                                              {
++                                                                                                      alt9=5;
++                                                                                              }
++                                                                                          break;
++                                                                                      case 'y':
++                                                                                              {
++                                                                                                      alt9=6;
++                                                                                              }
++                                                                                          break;
++
++                                                                                      default:
++                                                                                          CONSTRUCTEX();
++                                                                                          EXCEPTION->type         = ANTLR3_NO_VIABLE_ALT_EXCEPTION;
++                                                                                          EXCEPTION->message      = (void *)"";
++                                                                                          EXCEPTION->decisionNum  = 9;
++                                                                                          EXCEPTION->state        = 8;
++
++
++                                                                                          goto ruleDATEEx;
++                                                                                      }
++
++                                                                              }
++                                                                          break;
++
++                                                                      default:
++                                                                          CONSTRUCTEX();
++                                                                          EXCEPTION->type         = ANTLR3_NO_VIABLE_ALT_EXCEPTION;
++                                                                          EXCEPTION->message      = (void *)"";
++                                                                          EXCEPTION->decisionNum  = 9;
++                                                                          EXCEPTION->state        = 7;
++
++
++                                                                          goto ruleDATEEx;
++                                                                      }
++
++                                                              }
++                                                          break;
++
++                                                      default:
++                                                          CONSTRUCTEX();
++                                                          EXCEPTION->type         = ANTLR3_NO_VIABLE_ALT_EXCEPTION;
++                                                          EXCEPTION->message      = (void *)"";
++                                                          EXCEPTION->decisionNum  = 9;
++                                                          EXCEPTION->state        = 6;
++
++
++                                                          goto ruleDATEEx;
++                                                      }
++
++                                              }
++                                          break;
++
++                                      default:
++                                          CONSTRUCTEX();
++                                          EXCEPTION->type         = ANTLR3_NO_VIABLE_ALT_EXCEPTION;
++                                          EXCEPTION->message      = (void *)"";
++                                          EXCEPTION->decisionNum  = 9;
++                                          EXCEPTION->state        = 5;
++
++
++                                          goto ruleDATEEx;
++                                      }
++
++                              }
++                          break;
++
++                      default:
++                          CONSTRUCTEX();
++                          EXCEPTION->type         = ANTLR3_NO_VIABLE_ALT_EXCEPTION;
++                          EXCEPTION->message      = (void *)"";
++                          EXCEPTION->decisionNum  = 9;
++                          EXCEPTION->state        = 4;
++
++
++                          goto ruleDATEEx;
++                      }
++
++              }
++            break;
++
++        default:
++            CONSTRUCTEX();
++            EXCEPTION->type         = ANTLR3_NO_VIABLE_ALT_EXCEPTION;
++            EXCEPTION->message      = (void *)"";
++            EXCEPTION->decisionNum  = 9;
++            EXCEPTION->state        = 0;
++
++
++            goto ruleDATEEx;
++        }
++
++        switch (alt9) 
++        {
++      case 1:
++          // SMARTPL.g:137:9: ( '0' .. '9' ) ( '0' .. '9' ) ( '0' .. '9' ) ( '0' .. '9' ) '-' ( '0' .. '1' ) ( '0' .. '9' ) '-' ( '0' .. '3' ) ( '0' .. '9' )
++          {
++              // SMARTPL.g:137:9: ( '0' .. '9' )
++              // SMARTPL.g:137:10: '0' .. '9'
++              {
++                  MATCHRANGE('0', '9'); 
++                  if  (HASEXCEPTION())
++                  {
++                      goto ruleDATEEx;
++                  }
++
++
++              }
++
++              // SMARTPL.g:137:19: ( '0' .. '9' )
++              // SMARTPL.g:137:20: '0' .. '9'
++              {
++                  MATCHRANGE('0', '9'); 
++                  if  (HASEXCEPTION())
++                  {
++                      goto ruleDATEEx;
++                  }
++
++
++              }
++
++              // SMARTPL.g:137:29: ( '0' .. '9' )
++              // SMARTPL.g:137:30: '0' .. '9'
++              {
++                  MATCHRANGE('0', '9'); 
++                  if  (HASEXCEPTION())
++                  {
++                      goto ruleDATEEx;
++                  }
++
++
++              }
++
++              // SMARTPL.g:137:39: ( '0' .. '9' )
++              // SMARTPL.g:137:40: '0' .. '9'
++              {
++                  MATCHRANGE('0', '9'); 
++                  if  (HASEXCEPTION())
++                  {
++                      goto ruleDATEEx;
++                  }
++
++
++              }
++
++              MATCHC('-'); 
++              if  (HASEXCEPTION())
++              {
++                  goto ruleDATEEx;
++              }
++
++              // SMARTPL.g:137:52: ( '0' .. '1' )
++              // SMARTPL.g:137:53: '0' .. '1'
++              {
++                  MATCHRANGE('0', '1'); 
++                  if  (HASEXCEPTION())
++                  {
++                      goto ruleDATEEx;
++                  }
++
++
++              }
++
++              // SMARTPL.g:137:62: ( '0' .. '9' )
++              // SMARTPL.g:137:63: '0' .. '9'
++              {
++                  MATCHRANGE('0', '9'); 
++                  if  (HASEXCEPTION())
++                  {
++                      goto ruleDATEEx;
++                  }
++
++
++              }
++
++              MATCHC('-'); 
++              if  (HASEXCEPTION())
++              {
++                  goto ruleDATEEx;
++              }
++
++              // SMARTPL.g:137:75: ( '0' .. '3' )
++              // SMARTPL.g:137:76: '0' .. '3'
++              {
++                  MATCHRANGE('0', '3'); 
++                  if  (HASEXCEPTION())
++                  {
++                      goto ruleDATEEx;
++                  }
++
++
++              }
++
++              // SMARTPL.g:137:85: ( '0' .. '9' )
++              // SMARTPL.g:137:86: '0' .. '9'
++              {
++                  MATCHRANGE('0', '9'); 
++                  if  (HASEXCEPTION())
++                  {
++                      goto ruleDATEEx;
++                  }
++
++
++              }
++
++
++          }
++          break;
++      case 2:
++          // SMARTPL.g:138:6: 'today'
++          {
++              MATCHS(lit_31); 
++              if  (HASEXCEPTION())
++              {
++                  goto ruleDATEEx;
++              }
++
++
++
++          }
++          break;
++      case 3:
++          // SMARTPL.g:139:6: 'yesterday'
++          {
++              MATCHS(lit_32); 
++              if  (HASEXCEPTION())
++              {
++                  goto ruleDATEEx;
++              }
++
++
++
++          }
++          break;
++      case 4:
++          // SMARTPL.g:140:6: 'last week'
++          {
++              MATCHS(lit_33); 
++              if  (HASEXCEPTION())
++              {
++                  goto ruleDATEEx;
++              }
++
++
++
++          }
++          break;
++      case 5:
++          // SMARTPL.g:141:6: 'last month'
++          {
++              MATCHS(lit_34); 
++              if  (HASEXCEPTION())
++              {
++                  goto ruleDATEEx;
++              }
++
++
++
++          }
++          break;
++      case 6:
++          // SMARTPL.g:142:6: 'last year'
++          {
++              MATCHS(lit_35); 
++              if  (HASEXCEPTION())
++              {
++                  goto ruleDATEEx;
++              }
++
++
++
++          }
++          break;
++
++        }
++    }
++      LEXSTATE->type = _type;
++
++    // This is where rules clean up and exit
++    //
++    goto ruleDATEEx; /* Prevent compiler warnings */
++    ruleDATEEx: ;
++
++}
++// $ANTLR end DATE
++
++//   Comes from: 145:13: ( 'days' | 'weeks' | 'months' | 'years' )
++/** \brief Lexer rule generated by ANTLR3
++ *
++ * $ANTLR start DATINTERVAL
++ *
++ * Looks to match the characters the constitute the token DATINTERVAL
++ * from the attached input stream.
++ *
++ *
++ * \remark
++ *  - lexer->error == ANTLR3_TRUE if an exception was thrown.
++ */
++static ANTLR3_INLINE
++void mDATINTERVAL(pSMARTPLLexer ctx)
++{
++      ANTLR3_UINT32   _type;
++
++    _type         = DATINTERVAL;
++       
++    
++    {
++        //  SMARTPL.g:145:13: ( 'days' | 'weeks' | 'months' | 'years' )
++        
++        ANTLR3_UINT32 alt10;
++
++        alt10=4;
++
++        switch ( LA(1) ) 
++        {
++        case 'd':
++              {
++                      alt10=1;
++              }
++            break;
++        case 'w':
++              {
++                      alt10=2;
++              }
++            break;
++        case 'm':
++              {
++                      alt10=3;
++              }
++            break;
++        case 'y':
++              {
++                      alt10=4;
++              }
++            break;
++
++        default:
++            CONSTRUCTEX();
++            EXCEPTION->type         = ANTLR3_NO_VIABLE_ALT_EXCEPTION;
++            EXCEPTION->message      = (void *)"";
++            EXCEPTION->decisionNum  = 10;
++            EXCEPTION->state        = 0;
++
++
++            goto ruleDATINTERVALEx;
++        }
++
++        switch (alt10) 
++        {
++      case 1:
++          // SMARTPL.g:145:15: 'days'
++          {
++              MATCHS(lit_36); 
++              if  (HASEXCEPTION())
++              {
++                  goto ruleDATINTERVALEx;
++              }
++
++
++
++          }
++          break;
++      case 2:
++          // SMARTPL.g:146:6: 'weeks'
++          {
++              MATCHS(lit_37); 
++              if  (HASEXCEPTION())
++              {
++                  goto ruleDATINTERVALEx;
++              }
++
++
++
++          }
++          break;
++      case 3:
++          // SMARTPL.g:147:6: 'months'
++          {
++              MATCHS(lit_38); 
++              if  (HASEXCEPTION())
++              {
++                  goto ruleDATINTERVALEx;
++              }
++
++
++
++          }
++          break;
++      case 4:
++          // SMARTPL.g:148:6: 'years'
++          {
++              MATCHS(lit_39); 
++              if  (HASEXCEPTION())
++              {
++                  goto ruleDATINTERVALEx;
++              }
++
++
++
++          }
++          break;
++
++        }
++    }
++      LEXSTATE->type = _type;
++
++    // This is where rules clean up and exit
++    //
++    goto ruleDATINTERVALEx; /* Prevent compiler warnings */
++    ruleDATINTERVALEx: ;
++
++}
++// $ANTLR end DATINTERVAL
++
++//   Comes from: 151:10: ( 'music' | 'movie' | 'podcast' | 'audiobook' | 'tvshow' | 'file' | 'url' | 'spotify' | 'pipe' )
++/** \brief Lexer rule generated by ANTLR3
++ *
++ * $ANTLR start ENUMVAL
++ *
++ * Looks to match the characters the constitute the token ENUMVAL
++ * from the attached input stream.
++ *
++ *
++ * \remark
++ *  - lexer->error == ANTLR3_TRUE if an exception was thrown.
++ */
++static ANTLR3_INLINE
++void mENUMVAL(pSMARTPLLexer ctx)
++{
++      ANTLR3_UINT32   _type;
++
++    _type         = ENUMVAL;
++       
++    
++    {
++        //  SMARTPL.g:151:10: ( 'music' | 'movie' | 'podcast' | 'audiobook' | 'tvshow' | 'file' | 'url' | 'spotify' | 'pipe' )
++        
++        ANTLR3_UINT32 alt11;
++
++        alt11=9;
++
++        switch ( LA(1) ) 
++        {
++        case 'm':
++              {
++                      switch ( LA(2) ) 
++                      {
++                      case 'u':
++                              {
++                                      alt11=1;
++                              }
++                          break;
++                      case 'o':
++                              {
++                                      alt11=2;
++                              }
++                          break;
++
++                      default:
++                          CONSTRUCTEX();
++                          EXCEPTION->type         = ANTLR3_NO_VIABLE_ALT_EXCEPTION;
++                          EXCEPTION->message      = (void *)"";
++                          EXCEPTION->decisionNum  = 11;
++                          EXCEPTION->state        = 1;
++
++
++                          goto ruleENUMVALEx;
++                      }
++
++              }
++            break;
++        case 'p':
++              {
++                      switch ( LA(2) ) 
++                      {
++                      case 'o':
++                              {
++                                      alt11=3;
++                              }
++                          break;
++                      case 'i':
++                              {
++                                      alt11=9;
++                              }
++                          break;
++
++                      default:
++                          CONSTRUCTEX();
++                          EXCEPTION->type         = ANTLR3_NO_VIABLE_ALT_EXCEPTION;
++                          EXCEPTION->message      = (void *)"";
++                          EXCEPTION->decisionNum  = 11;
++                          EXCEPTION->state        = 2;
++
++
++                          goto ruleENUMVALEx;
++                      }
++
++              }
++            break;
++        case 'a':
++              {
++                      alt11=4;
++              }
++            break;
++        case 't':
++              {
++                      alt11=5;
++              }
++            break;
++        case 'f':
++              {
++                      alt11=6;
++              }
++            break;
++        case 'u':
++              {
++                      alt11=7;
++              }
++            break;
++        case 's':
++              {
++                      alt11=8;
++              }
++            break;
++
++        default:
++            CONSTRUCTEX();
++            EXCEPTION->type         = ANTLR3_NO_VIABLE_ALT_EXCEPTION;
++            EXCEPTION->message      = (void *)"";
++            EXCEPTION->decisionNum  = 11;
++            EXCEPTION->state        = 0;
++
++
++            goto ruleENUMVALEx;
++        }
++
++        switch (alt11) 
++        {
++      case 1:
++          // SMARTPL.g:151:12: 'music'
++          {
++              MATCHS(lit_40); 
++              if  (HASEXCEPTION())
++              {
++                  goto ruleENUMVALEx;
++              }
++
++
++
++          }
++          break;
++      case 2:
++          // SMARTPL.g:152:6: 'movie'
++          {
++              MATCHS(lit_41); 
++              if  (HASEXCEPTION())
++              {
++                  goto ruleENUMVALEx;
++              }
++
++
++
++          }
++          break;
++      case 3:
++          // SMARTPL.g:153:6: 'podcast'
++          {
++              MATCHS(lit_42); 
++              if  (HASEXCEPTION())
++              {
++                  goto ruleENUMVALEx;
++              }
++
++
++
++          }
++          break;
++      case 4:
++          // SMARTPL.g:154:6: 'audiobook'
++          {
++              MATCHS(lit_43); 
++              if  (HASEXCEPTION())
++              {
++                  goto ruleENUMVALEx;
++              }
++
++
++
++          }
++          break;
++      case 5:
++          // SMARTPL.g:155:6: 'tvshow'
++          {
++              MATCHS(lit_44); 
++              if  (HASEXCEPTION())
++              {
++                  goto ruleENUMVALEx;
++              }
++
++
++
++          }
++          break;
++      case 6:
++          // SMARTPL.g:156:6: 'file'
++          {
++              MATCHS(lit_45); 
++              if  (HASEXCEPTION())
++              {
++                  goto ruleENUMVALEx;
++              }
++
++
++
++          }
++          break;
++      case 7:
++          // SMARTPL.g:157:6: 'url'
++          {
++              MATCHS(lit_46); 
++              if  (HASEXCEPTION())
++              {
++                  goto ruleENUMVALEx;
++              }
++
++
++
++          }
++          break;
++      case 8:
++          // SMARTPL.g:158:6: 'spotify'
++          {
++              MATCHS(lit_47); 
++              if  (HASEXCEPTION())
++              {
++                  goto ruleENUMVALEx;
++              }
++
++
++
++          }
++          break;
++      case 9:
++          // SMARTPL.g:159:6: 'pipe'
++          {
++              MATCHS(lit_48); 
++              if  (HASEXCEPTION())
++              {
++                  goto ruleENUMVALEx;
++              }
++
++
++
++          }
++          break;
++
++        }
++    }
++      LEXSTATE->type = _type;
++
++    // This is where rules clean up and exit
++    //
++    goto ruleENUMVALEx; /* Prevent compiler warnings */
++    ruleENUMVALEx: ;
++
++}
++// $ANTLR end ENUMVAL
++
++//   Comes from: 162:7: ( '\"' (~ ( '\"' ) )+ '\"' )
++/** \brief Lexer rule generated by ANTLR3
++ *
++ * $ANTLR start STR
++ *
++ * Looks to match the characters the constitute the token STR
++ * from the attached input stream.
++ *
++ *
++ * \remark
++ *  - lexer->error == ANTLR3_TRUE if an exception was thrown.
++ */
++static ANTLR3_INLINE
++void mSTR(pSMARTPLLexer ctx)
++{
++      ANTLR3_UINT32   _type;
++
++    _type         = STR;
++       
++    
++    // SMARTPL.g:162:7: ( '\"' (~ ( '\"' ) )+ '\"' )
++    // SMARTPL.g:162:9: '\"' (~ ( '\"' ) )+ '\"'
++    {
++        MATCHC('"'); 
++        if  (HASEXCEPTION())
++        {
++            goto ruleSTREx;
++        }
++
++        // SMARTPL.g:162:13: (~ ( '\"' ) )+
++        {
++            int cnt12=0;
++
++            for (;;)
++            {
++                int alt12=2;
++              {
++                 /* dfaLoopbackState(k,edges,eotPredictsAlt,description,stateNumber,semPredState)
++                  */
++                  int LA12_0 = LA(1);
++                  if ( (((LA12_0 >= 0x0000) && (LA12_0 <= '!')) || ((LA12_0 >= '#') && (LA12_0 <= 0xFFFF))) ) 
++                  {
++                      alt12=1;
++                  }
++
++              }
++              switch (alt12) 
++              {
++                  case 1:
++                      // SMARTPL.g:162:13: ~ ( '\"' )
++                      {
++                          if ( ((LA(1) >= 0x0000) && (LA(1) <= '!')) || ((LA(1) >= '#') && (LA(1) <= 0xFFFF)) )
++                          {
++                              CONSUME();
++
++                          }
++                          else 
++                          {
++                              CONSTRUCTEX();
++                              EXCEPTION->type         = ANTLR3_MISMATCHED_SET_EXCEPTION;
++                              EXCEPTION->name         = (void *)ANTLR3_MISMATCHED_SET_NAME;
++
++                              LRECOVER();    goto ruleSTREx;
++                          }
++
++
++                      }
++                      break;
++
++                  default:
++                  
++                      if ( cnt12 >= 1 )
++                      {
++                          goto loop12;
++                      }
++                      /* mismatchedSetEx()
++                       */
++                      CONSTRUCTEX();
++                      EXCEPTION->type = ANTLR3_EARLY_EXIT_EXCEPTION;
++                      EXCEPTION->name = (void *)ANTLR3_EARLY_EXIT_NAME;
++
++
++                      goto ruleSTREx;
++              }
++              cnt12++;
++            }
++            loop12: ; /* Jump to here if this rule does not match */
++        }
++        MATCHC('"'); 
++        if  (HASEXCEPTION())
++        {
++            goto ruleSTREx;
++        }
++
++
++    }
++
++      LEXSTATE->type = _type;
++
++    // This is where rules clean up and exit
++    //
++    goto ruleSTREx; /* Prevent compiler warnings */
++    ruleSTREx: ;
++
++}
++// $ANTLR end STR
++
++//   Comes from: 165:7: ( ( '0' .. '9' )+ )
++/** \brief Lexer rule generated by ANTLR3
++ *
++ * $ANTLR start INT
++ *
++ * Looks to match the characters the constitute the token INT
++ * from the attached input stream.
++ *
++ *
++ * \remark
++ *  - lexer->error == ANTLR3_TRUE if an exception was thrown.
++ */
++static ANTLR3_INLINE
++void mINT(pSMARTPLLexer ctx)
++{
++      ANTLR3_UINT32   _type;
++
++    _type         = INT;
++       
++    
++    // SMARTPL.g:165:7: ( ( '0' .. '9' )+ )
++    // SMARTPL.g:165:9: ( '0' .. '9' )+
++    {
++        // SMARTPL.g:165:9: ( '0' .. '9' )+
++        {
++            int cnt13=0;
++
++            for (;;)
++            {
++                int alt13=2;
++              switch ( LA(1) ) 
++              {
++              case '0':
++              case '1':
++              case '2':
++              case '3':
++              case '4':
++              case '5':
++              case '6':
++              case '7':
++              case '8':
++              case '9':
++                      {
++                              alt13=1;
++                      }
++                  break;
++
++              }
++
++              switch (alt13) 
++              {
++                  case 1:
++                      // SMARTPL.g:165:10: '0' .. '9'
++                      {
++                          MATCHRANGE('0', '9'); 
++                          if  (HASEXCEPTION())
++                          {
++                              goto ruleINTEx;
++                          }
++
++
++                      }
++                      break;
++
++                  default:
++                  
++                      if ( cnt13 >= 1 )
++                      {
++                          goto loop13;
++                      }
++                      /* mismatchedSetEx()
++                       */
++                      CONSTRUCTEX();
++                      EXCEPTION->type = ANTLR3_EARLY_EXIT_EXCEPTION;
++                      EXCEPTION->name = (void *)ANTLR3_EARLY_EXIT_NAME;
++
++
++                      goto ruleINTEx;
++              }
++              cnt13++;
++            }
++            loop13: ; /* Jump to here if this rule does not match */
++        }
++
++    }
++
++      LEXSTATE->type = _type;
++
++    // This is where rules clean up and exit
++    //
++    goto ruleINTEx; /* Prevent compiler warnings */
++    ruleINTEx: ;
++
++}
++// $ANTLR end INT
++
++//   Comes from: 168:12: ( ( '\\t' | ' ' | '\\r' | '\\n' | '\\u000C' ) )
++/** \brief Lexer rule generated by ANTLR3
++ *
++ * $ANTLR start WHITESPACE
++ *
++ * Looks to match the characters the constitute the token WHITESPACE
++ * from the attached input stream.
++ *
++ *
++ * \remark
++ *  - lexer->error == ANTLR3_TRUE if an exception was thrown.
++ */
++static ANTLR3_INLINE
++void mWHITESPACE(pSMARTPLLexer ctx)
++{
++      ANTLR3_UINT32   _type;
++
++    _type         = WHITESPACE;
++       
++    
++    // SMARTPL.g:168:12: ( ( '\\t' | ' ' | '\\r' | '\\n' | '\\u000C' ) )
++    // SMARTPL.g:168:14: ( '\\t' | ' ' | '\\r' | '\\n' | '\\u000C' )
++    {
++        if ( ((LA(1) >= '\t') && (LA(1) <= '\n')) || ((LA(1) >= '\f') && (LA(1) <= '\r')) || LA(1) == ' ' )
++        {
++            CONSUME();
++
++        }
++        else 
++        {
++            CONSTRUCTEX();
++            EXCEPTION->type         = ANTLR3_MISMATCHED_SET_EXCEPTION;
++            EXCEPTION->name         = (void *)ANTLR3_MISMATCHED_SET_NAME;
++
++            LRECOVER();    goto ruleWHITESPACEEx;
++        }
++
++        {
++             LEXSTATE->channel = HIDDEN; 
++        }
++
++    }
++
++      LEXSTATE->type = _type;
++
++    // This is where rules clean up and exit
++    //
++    goto ruleWHITESPACEEx; /* Prevent compiler warnings */
++    ruleWHITESPACEEx: ;
++
++}
++// $ANTLR end WHITESPACE
++
++/** This is the entry point in to the lexer from an object that
++ *  wants to generate the next token, such as a pCOMMON_TOKEN_STREAM
++ */
++static void 
++mTokens(pSMARTPLLexer ctx)
++{
++    {
++        //  SMARTPL.g:1:8: ( T__30 | T__31 | STRTAG | INTTAG | DATETAG | ENUMTAG | INCLUDES | IS | INTBOOL | AFTER | BEFORE | AGO | AND | OR | NOT | LPAR | RPAR | DATE | DATINTERVAL | ENUMVAL | STR | INT | WHITESPACE )
++        
++        ANTLR3_UINT32 alt14;
++
++        alt14=23;
++
++        switch ( LA(1) ) 
++        {
++        case '{':
++              {
++                      alt14=1;
++              }
++            break;
++        case '}':
++              {
++                      alt14=2;
++              }
++            break;
++        case 'a':
++              {
++                      switch ( LA(2) ) 
++                      {
++                      case 'l':
++                      case 'r':
++                              {
++                                      alt14=3;
++                              }
++                          break;
++                      case 'f':
++                              {
++                                      alt14=10;
++                              }
++                          break;
++                      case 'g':
++                              {
++                                      alt14=12;
++                              }
++                          break;
++                      case 'n':
++                              {
++                                      alt14=13;
++                              }
++                          break;
++                      case 'u':
++                              {
++                                      alt14=20;
++                              }
++                          break;
++
++                      default:
++                          CONSTRUCTEX();
++                          EXCEPTION->type         = ANTLR3_NO_VIABLE_ALT_EXCEPTION;
++                          EXCEPTION->message      = (void *)"";
++                          EXCEPTION->decisionNum  = 14;
++                          EXCEPTION->state        = 3;
++
++
++                          goto ruleTokensEx;
++                      }
++
++              }
++            break;
++        case 't':
++              {
++                      switch ( LA(2) ) 
++                      {
++                      case 'i':
++                              {
++                                      switch ( LA(3) ) 
++                                      {
++                                      case 't':
++                                              {
++                                                      alt14=3;
++                                              }
++                                          break;
++                                      case 'm':
++                                              {
++                                                      alt14=5;
++                                              }
++                                          break;
++
++                                      default:
++                                          CONSTRUCTEX();
++                                          EXCEPTION->type         = ANTLR3_NO_VIABLE_ALT_EXCEPTION;
++                                          EXCEPTION->message      = (void *)"";
++                                          EXCEPTION->decisionNum  = 14;
++                                          EXCEPTION->state        = 28;
++
++
++                                          goto ruleTokensEx;
++                                      }
++
++                              }
++                          break;
++                      case 'y':
++                              {
++                                      alt14=3;
++                              }
++                          break;
++                      case 'o':
++                              {
++                                      alt14=18;
++                              }
++                          break;
++                      case 'v':
++                              {
++                                      alt14=20;
++                              }
++                          break;
++
++                      default:
++                          CONSTRUCTEX();
++                          EXCEPTION->type         = ANTLR3_NO_VIABLE_ALT_EXCEPTION;
++                          EXCEPTION->message      = (void *)"";
++                          EXCEPTION->decisionNum  = 14;
++                          EXCEPTION->state        = 4;
++
++
++                          goto ruleTokensEx;
++                      }
++
++              }
++            break;
++        case 'g':
++              {
++                      alt14=3;
++              }
++            break;
++        case 'c':
++              {
++                      switch ( LA(2) ) 
++                      {
++                      case 'o':
++                              {
++                                      switch ( LA(3) ) 
++                                      {
++                                      case 'm':
++                                              {
++                                                      switch ( LA(4) ) 
++                                                      {
++                                                      case 'p':
++                                                              {
++                                                                      switch ( LA(5) ) 
++                                                                      {
++                                                                      case 'o':
++                                                                              {
++                                                                                      alt14=3;
++                                                                              }
++                                                                          break;
++                                                                      case 'i':
++                                                                              {
++                                                                                      alt14=4;
++                                                                              }
++                                                                          break;
++
++                                                                      default:
++                                                                          CONSTRUCTEX();
++                                                                          EXCEPTION->type         = ANTLR3_NO_VIABLE_ALT_EXCEPTION;
++                                                                          EXCEPTION->message      = (void *)"";
++                                                                          EXCEPTION->decisionNum  = 14;
++                                                                          EXCEPTION->state        = 42;
++
++
++                                                                          goto ruleTokensEx;
++                                                                      }
++
++                                                              }
++                                                          break;
++
++                                                      default:
++                                                          CONSTRUCTEX();
++                                                          EXCEPTION->type         = ANTLR3_NO_VIABLE_ALT_EXCEPTION;
++                                                          EXCEPTION->message      = (void *)"";
++                                                          EXCEPTION->decisionNum  = 14;
++                                                          EXCEPTION->state        = 39;
++
++
++                                                          goto ruleTokensEx;
++                                                      }
++
++                                              }
++                                          break;
++
++                                      default:
++                                          CONSTRUCTEX();
++                                          EXCEPTION->type         = ANTLR3_NO_VIABLE_ALT_EXCEPTION;
++                                          EXCEPTION->message      = (void *)"";
++                                          EXCEPTION->decisionNum  = 14;
++                                          EXCEPTION->state        = 29;
++
++
++                                          goto ruleTokensEx;
++                                      }
++
++                              }
++                          break;
++
++                      default:
++                          CONSTRUCTEX();
++                          EXCEPTION->type         = ANTLR3_NO_VIABLE_ALT_EXCEPTION;
++                          EXCEPTION->message      = (void *)"";
++                          EXCEPTION->decisionNum  = 14;
++                          EXCEPTION->state        = 6;
++
++
++                          goto ruleTokensEx;
++                      }
++
++              }
++            break;
++        case 'p':
++              {
++                      switch ( LA(2) ) 
++                      {
++                      case 'a':
++                              {
++                                      alt14=3;
++                              }
++                          break;
++                      case 'l':
++                              {
++                                      alt14=4;
++                              }
++                          break;
++                      case 'i':
++                      case 'o':
++                              {
++                                      alt14=20;
++                              }
++                          break;
++
++                      default:
++                          CONSTRUCTEX();
++                          EXCEPTION->type         = ANTLR3_NO_VIABLE_ALT_EXCEPTION;
++                          EXCEPTION->message      = (void *)"";
++                          EXCEPTION->decisionNum  = 14;
++                          EXCEPTION->state        = 7;
++
++
++                          goto ruleTokensEx;
++                      }
++
++              }
++            break;
++        case 'r':
++              {
++                      alt14=4;
++              }
++            break;
++        case 'y':
++              {
++                      switch ( LA(2) ) 
++                      {
++                      case 'e':
++                              {
++                                      switch ( LA(3) ) 
++                                      {
++                                      case 'a':
++                                              {
++                                                      switch ( LA(4) ) 
++                                                      {
++                                                      case 'r':
++                                                              {
++                                                                      switch ( LA(5) ) 
++                                                                      {
++                                                                      case 's':
++                                                                              {
++                                                                                      alt14=19;
++                                                                              }
++                                                                          break;
++
++                                                                      default:
++                                                                          alt14=4;}
++
++                                                              }
++                                                          break;
++
++                                                      default:
++                                                          CONSTRUCTEX();
++                                                          EXCEPTION->type         = ANTLR3_NO_VIABLE_ALT_EXCEPTION;
++                                                          EXCEPTION->message      = (void *)"";
++                                                          EXCEPTION->decisionNum  = 14;
++                                                          EXCEPTION->state        = 40;
++
++
++                                                          goto ruleTokensEx;
++                                                      }
++
++                                              }
++                                          break;
++                                      case 's':
++                                              {
++                                                      alt14=18;
++                                              }
++                                          break;
++
++                                      default:
++                                          CONSTRUCTEX();
++                                          EXCEPTION->type         = ANTLR3_NO_VIABLE_ALT_EXCEPTION;
++                                          EXCEPTION->message      = (void *)"";
++                                          EXCEPTION->decisionNum  = 14;
++                                          EXCEPTION->state        = 30;
++
++
++                                          goto ruleTokensEx;
++                                      }
++
++                              }
++                          break;
++
++                      default:
++                          CONSTRUCTEX();
++                          EXCEPTION->type         = ANTLR3_NO_VIABLE_ALT_EXCEPTION;
++                          EXCEPTION->message      = (void *)"";
++                          EXCEPTION->decisionNum  = 14;
++                          EXCEPTION->state        = 9;
++
++
++                          goto ruleTokensEx;
++                      }
++
++              }
++            break;
++        case 'd':
++              {
++                      switch ( LA(2) ) 
++                      {
++                      case 'a':
++                              {
++                                      switch ( LA(3) ) 
++                                      {
++                                      case 't':
++                                              {
++                                                      alt14=6;
++                                              }
++                                          break;
++                                      case 'y':
++                                              {
++                                                      alt14=19;
++                                              }
++                                          break;
++
++                                      default:
++                                          CONSTRUCTEX();
++                                          EXCEPTION->type         = ANTLR3_NO_VIABLE_ALT_EXCEPTION;
++                                          EXCEPTION->message      = (void *)"";
++                                          EXCEPTION->decisionNum  = 14;
++                                          EXCEPTION->state        = 31;
++
++
++                                          goto ruleTokensEx;
++                                      }
++
++                              }
++                          break;
++
++                      default:
++                          CONSTRUCTEX();
++                          EXCEPTION->type         = ANTLR3_NO_VIABLE_ALT_EXCEPTION;
++                          EXCEPTION->message      = (void *)"";
++                          EXCEPTION->decisionNum  = 14;
++                          EXCEPTION->state        = 10;
++
++
++                          goto ruleTokensEx;
++                      }
++
++              }
++            break;
++        case 'm':
++              {
++                      switch ( LA(2) ) 
++                      {
++                      case 'e':
++                              {
++                                      alt14=6;
++                              }
++                          break;
++                      case 'o':
++                              {
++                                      switch ( LA(3) ) 
++                                      {
++                                      case 'n':
++                                              {
++                                                      alt14=19;
++                                              }
++                                          break;
++                                      case 'v':
++                                              {
++                                                      alt14=20;
++                                              }
++                                          break;
++
++                                      default:
++                                          CONSTRUCTEX();
++                                          EXCEPTION->type         = ANTLR3_NO_VIABLE_ALT_EXCEPTION;
++                                          EXCEPTION->message      = (void *)"";
++                                          EXCEPTION->decisionNum  = 14;
++                                          EXCEPTION->state        = 33;
++
++
++                                          goto ruleTokensEx;
++                                      }
++
++                              }
++                          break;
++                      case 'u':
++                              {
++                                      alt14=20;
++                              }
++                          break;
++
++                      default:
++                          CONSTRUCTEX();
++                          EXCEPTION->type         = ANTLR3_NO_VIABLE_ALT_EXCEPTION;
++                          EXCEPTION->message      = (void *)"";
++                          EXCEPTION->decisionNum  = 14;
++                          EXCEPTION->state        = 11;
++
++
++                          goto ruleTokensEx;
++                      }
++
++              }
++            break;
++        case 'i':
++              {
++                      switch ( LA(2) ) 
++                      {
++                      case 'n':
++                              {
++                                      alt14=7;
++                              }
++                          break;
++                      case 's':
++                              {
++                                      alt14=8;
++                              }
++                          break;
++
++                      default:
++                          CONSTRUCTEX();
++                          EXCEPTION->type         = ANTLR3_NO_VIABLE_ALT_EXCEPTION;
++                          EXCEPTION->message      = (void *)"";
++                          EXCEPTION->decisionNum  = 14;
++                          EXCEPTION->state        = 12;
++
++
++                          goto ruleTokensEx;
++                      }
++
++              }
++            break;
++        case '<':
++        case '=':
++        case '>':
++              {
++                      alt14=9;
++              }
++            break;
++        case 'b':
++              {
++                      alt14=11;
++              }
++            break;
++        case 'A':
++              {
++                      alt14=13;
++              }
++            break;
++        case 'O':
++        case 'o':
++              {
++                      alt14=14;
++              }
++            break;
++        case 'N':
++        case 'n':
++              {
++                      alt14=15;
++              }
++            break;
++        case '(':
++              {
++                      alt14=16;
++              }
++            break;
++        case ')':
++              {
++                      alt14=17;
++              }
++            break;
++        case '0':
++        case '1':
++        case '2':
++        case '3':
++        case '4':
++        case '5':
++        case '6':
++        case '7':
++        case '8':
++        case '9':
++              {
++                      switch ( LA(2) ) 
++                      {
++                      case '0':
++                      case '1':
++                      case '2':
++                      case '3':
++                      case '4':
++                      case '5':
++                      case '6':
++                      case '7':
++                      case '8':
++                      case '9':
++                              {
++                                      switch ( LA(3) ) 
++                                      {
++                                      case '0':
++                                      case '1':
++                                      case '2':
++                                      case '3':
++                                      case '4':
++                                      case '5':
++                                      case '6':
++                                      case '7':
++                                      case '8':
++                                      case '9':
++                                              {
++                                                      switch ( LA(4) ) 
++                                                      {
++                                                      case '0':
++                                                      case '1':
++                                                      case '2':
++                                                      case '3':
++                                                      case '4':
++                                                      case '5':
++                                                      case '6':
++                                                      case '7':
++                                                      case '8':
++                                                      case '9':
++                                                              {
++                                                                      switch ( LA(5) ) 
++                                                                      {
++                                                                      case '-':
++                                                                              {
++                                                                                      alt14=18;
++                                                                              }
++                                                                          break;
++
++                                                                      default:
++                                                                          alt14=22;}
++
++                                                              }
++                                                          break;
++
++                                                      default:
++                                                          alt14=22;}
++
++                                              }
++                                          break;
++
++                                      default:
++                                          alt14=22;}
++
++                              }
++                          break;
++
++                      default:
++                          alt14=22;}
++
++              }
++            break;
++        case 'l':
++              {
++                      alt14=18;
++              }
++            break;
++        case 'w':
++              {
++                      alt14=19;
++              }
++            break;
++        case 'f':
++        case 's':
++        case 'u':
++              {
++                      alt14=20;
++              }
++            break;
++        case '"':
++              {
++                      alt14=21;
++              }
++            break;
++        case '\t':
++        case '\n':
++        case '\f':
++        case '\r':
++        case ' ':
++              {
++                      alt14=23;
++              }
++            break;
++
++        default:
++            CONSTRUCTEX();
++            EXCEPTION->type         = ANTLR3_NO_VIABLE_ALT_EXCEPTION;
++            EXCEPTION->message      = (void *)"";
++            EXCEPTION->decisionNum  = 14;
++            EXCEPTION->state        = 0;
++
++
++            goto ruleTokensEx;
++        }
++
++        switch (alt14) 
++        {
++      case 1:
++          // SMARTPL.g:1:10: T__30
++          {
++              /* 1:10: T__30 */
++              mT__30(ctx ); 
++              if  (HASEXCEPTION())
++              {
++                  goto ruleTokensEx;
++              }
++
++
++          }
++          break;
++      case 2:
++          // SMARTPL.g:1:16: T__31
++          {
++              /* 1:16: T__31 */
++              mT__31(ctx ); 
++              if  (HASEXCEPTION())
++              {
++                  goto ruleTokensEx;
++              }
++
++
++          }
++          break;
++      case 3:
++          // SMARTPL.g:1:22: STRTAG
++          {
++              /* 1:22: STRTAG */
++              mSTRTAG(ctx ); 
++              if  (HASEXCEPTION())
++              {
++                  goto ruleTokensEx;
++              }
++
++
++          }
++          break;
++      case 4:
++          // SMARTPL.g:1:29: INTTAG
++          {
++              /* 1:29: INTTAG */
++              mINTTAG(ctx ); 
++              if  (HASEXCEPTION())
++              {
++                  goto ruleTokensEx;
++              }
++
++
++          }
++          break;
++      case 5:
++          // SMARTPL.g:1:36: DATETAG
++          {
++              /* 1:36: DATETAG */
++              mDATETAG(ctx ); 
++              if  (HASEXCEPTION())
++              {
++                  goto ruleTokensEx;
++              }
++
++
++          }
++          break;
++      case 6:
++          // SMARTPL.g:1:44: ENUMTAG
++          {
++              /* 1:44: ENUMTAG */
++              mENUMTAG(ctx ); 
++              if  (HASEXCEPTION())
++              {
++                  goto ruleTokensEx;
++              }
++
++
++          }
++          break;
++      case 7:
++          // SMARTPL.g:1:52: INCLUDES
++          {
++              /* 1:52: INCLUDES */
++              mINCLUDES(ctx ); 
++              if  (HASEXCEPTION())
++              {
++                  goto ruleTokensEx;
++              }
++
++
++          }
++          break;
++      case 8:
++          // SMARTPL.g:1:61: IS
++          {
++              /* 1:61: IS */
++              mIS(ctx ); 
++              if  (HASEXCEPTION())
++              {
++                  goto ruleTokensEx;
++              }
++
++
++          }
++          break;
++      case 9:
++          // SMARTPL.g:1:64: INTBOOL
++          {
++              /* 1:64: INTBOOL */
++              mINTBOOL(ctx ); 
++              if  (HASEXCEPTION())
++              {
++                  goto ruleTokensEx;
++              }
++
++
++          }
++          break;
++      case 10:
++          // SMARTPL.g:1:72: AFTER
++          {
++              /* 1:72: AFTER */
++              mAFTER(ctx ); 
++              if  (HASEXCEPTION())
++              {
++                  goto ruleTokensEx;
++              }
++
++
++          }
++          break;
++      case 11:
++          // SMARTPL.g:1:78: BEFORE
++          {
++              /* 1:78: BEFORE */
++              mBEFORE(ctx ); 
++              if  (HASEXCEPTION())
++              {
++                  goto ruleTokensEx;
++              }
++
++
++          }
++          break;
++      case 12:
++          // SMARTPL.g:1:85: AGO
++          {
++              /* 1:85: AGO */
++              mAGO(ctx ); 
++              if  (HASEXCEPTION())
++              {
++                  goto ruleTokensEx;
++              }
++
++
++          }
++          break;
++      case 13:
++          // SMARTPL.g:1:89: AND
++          {
++              /* 1:89: AND */
++              mAND(ctx ); 
++              if  (HASEXCEPTION())
++              {
++                  goto ruleTokensEx;
++              }
++
++
++          }
++          break;
++      case 14:
++          // SMARTPL.g:1:93: OR
++          {
++              /* 1:93: OR */
++              mOR(ctx ); 
++              if  (HASEXCEPTION())
++              {
++                  goto ruleTokensEx;
++              }
++
++
++          }
++          break;
++      case 15:
++          // SMARTPL.g:1:96: NOT
++          {
++              /* 1:96: NOT */
++              mNOT(ctx ); 
++              if  (HASEXCEPTION())
++              {
++                  goto ruleTokensEx;
++              }
++
++
++          }
++          break;
++      case 16:
++          // SMARTPL.g:1:100: LPAR
++          {
++              /* 1:100: LPAR */
++              mLPAR(ctx ); 
++              if  (HASEXCEPTION())
++              {
++                  goto ruleTokensEx;
++              }
++
++
++          }
++          break;
++      case 17:
++          // SMARTPL.g:1:105: RPAR
++          {
++              /* 1:105: RPAR */
++              mRPAR(ctx ); 
++              if  (HASEXCEPTION())
++              {
++                  goto ruleTokensEx;
++              }
++
++
++          }
++          break;
++      case 18:
++          // SMARTPL.g:1:110: DATE
++          {
++              /* 1:110: DATE */
++              mDATE(ctx ); 
++              if  (HASEXCEPTION())
++              {
++                  goto ruleTokensEx;
++              }
++
++
++          }
++          break;
++      case 19:
++          // SMARTPL.g:1:115: DATINTERVAL
++          {
++              /* 1:115: DATINTERVAL */
++              mDATINTERVAL(ctx ); 
++              if  (HASEXCEPTION())
++              {
++                  goto ruleTokensEx;
++              }
++
++
++          }
++          break;
++      case 20:
++          // SMARTPL.g:1:127: ENUMVAL
++          {
++              /* 1:127: ENUMVAL */
++              mENUMVAL(ctx ); 
++              if  (HASEXCEPTION())
++              {
++                  goto ruleTokensEx;
++              }
++
++
++          }
++          break;
++      case 21:
++          // SMARTPL.g:1:135: STR
++          {
++              /* 1:135: STR */
++              mSTR(ctx ); 
++              if  (HASEXCEPTION())
++              {
++                  goto ruleTokensEx;
++              }
++
++
++          }
++          break;
++      case 22:
++          // SMARTPL.g:1:139: INT
++          {
++              /* 1:139: INT */
++              mINT(ctx ); 
++              if  (HASEXCEPTION())
++              {
++                  goto ruleTokensEx;
++              }
++
++
++          }
++          break;
++      case 23:
++          // SMARTPL.g:1:143: WHITESPACE
++          {
++              /* 1:143: WHITESPACE */
++              mWHITESPACE(ctx ); 
++              if  (HASEXCEPTION())
++              {
++                  goto ruleTokensEx;
++              }
++
++
++          }
++          break;
++
++        }
++    }
++
++    
++    goto ruleTokensEx; /* Prevent compiler warnings */
++ruleTokensEx: ;
++}
++
++/* =========================================================================
++ * Lexer matching rules end.
++ * =========================================================================
++ */
++/* End of Lexer code
++ * ================================================
++ * ================================================
++ */ 
++
++
++/* End of code
++ * =============================================================================
++ */
+diff --git a/src/pregen/SMARTPLLexer.h b/src/pregen/SMARTPLLexer.h
+new file mode 100644
+index 0000000..9d73721
+--- /dev/null
++++ b/src/pregen/SMARTPLLexer.h
+@@ -0,0 +1,248 @@
++/** \file
++ *  This C header file was generated by $ANTLR version 3.2 debian-7ubuntu3
++ *
++ *     -  From the grammar source file : SMARTPL.g
++ *     -                            On : 2015-06-27 19:05:15
++ *     -                 for the lexer : SMARTPLLexerLexer *
++ * Editing it, at least manually, is not wise. 
++ *
++ * C language generator and runtime by Jim Idle, jimi|hereisanat|idle|dotgoeshere|ws.
++ *
++ *
++ * The lexer SMARTPLLexer has the callable functions (rules) shown below,
++ * which will invoke the code for the associated rule in the source grammar
++ * assuming that the input stream is pointing to a token/text stream that could begin
++ * this rule.
++ * 
++ * For instance if you call the first (topmost) rule in a parser grammar, you will
++ * get the results of a full parse, but calling a rule half way through the grammar will
++ * allow you to pass part of a full token stream to the parser, such as for syntax checking
++ * in editors and so on.
++ *
++ * The parser entry points are called indirectly (by function pointer to function) via
++ * a parser context typedef pSMARTPLLexer, which is returned from a call to SMARTPLLexerNew().
++ *
++ * As this is a generated lexer, it is unlikely you will call it 'manually'. However
++ * the methods are provided anyway.
++ * * The methods in pSMARTPLLexer are  as follows:
++ *
++ *  -  void      pSMARTPLLexer->T__30(pSMARTPLLexer)
++ *  -  void      pSMARTPLLexer->T__31(pSMARTPLLexer)
++ *  -  void      pSMARTPLLexer->STRTAG(pSMARTPLLexer)
++ *  -  void      pSMARTPLLexer->INTTAG(pSMARTPLLexer)
++ *  -  void      pSMARTPLLexer->DATETAG(pSMARTPLLexer)
++ *  -  void      pSMARTPLLexer->ENUMTAG(pSMARTPLLexer)
++ *  -  void      pSMARTPLLexer->INCLUDES(pSMARTPLLexer)
++ *  -  void      pSMARTPLLexer->IS(pSMARTPLLexer)
++ *  -  void      pSMARTPLLexer->INTBOOL(pSMARTPLLexer)
++ *  -  void      pSMARTPLLexer->GREATER(pSMARTPLLexer)
++ *  -  void      pSMARTPLLexer->GREATEREQUAL(pSMARTPLLexer)
++ *  -  void      pSMARTPLLexer->LESS(pSMARTPLLexer)
++ *  -  void      pSMARTPLLexer->LESSEQUAL(pSMARTPLLexer)
++ *  -  void      pSMARTPLLexer->EQUAL(pSMARTPLLexer)
++ *  -  void      pSMARTPLLexer->AFTER(pSMARTPLLexer)
++ *  -  void      pSMARTPLLexer->BEFORE(pSMARTPLLexer)
++ *  -  void      pSMARTPLLexer->AGO(pSMARTPLLexer)
++ *  -  void      pSMARTPLLexer->AND(pSMARTPLLexer)
++ *  -  void      pSMARTPLLexer->OR(pSMARTPLLexer)
++ *  -  void      pSMARTPLLexer->NOT(pSMARTPLLexer)
++ *  -  void      pSMARTPLLexer->LPAR(pSMARTPLLexer)
++ *  -  void      pSMARTPLLexer->RPAR(pSMARTPLLexer)
++ *  -  void      pSMARTPLLexer->DATE(pSMARTPLLexer)
++ *  -  void      pSMARTPLLexer->DATINTERVAL(pSMARTPLLexer)
++ *  -  void      pSMARTPLLexer->ENUMVAL(pSMARTPLLexer)
++ *  -  void      pSMARTPLLexer->STR(pSMARTPLLexer)
++ *  -  void      pSMARTPLLexer->INT(pSMARTPLLexer)
++ *  -  void      pSMARTPLLexer->WHITESPACE(pSMARTPLLexer)
++ *  -  void      pSMARTPLLexer->Tokens(pSMARTPLLexer)
++ *
++ * The return type for any particular rule is of course determined by the source
++ * grammar file.
++ */
++// [The "BSD licence"]
++// Copyright (c) 2005-2009 Jim Idle, Temporal Wave LLC
++// http://www.temporal-wave.com
++// http://www.linkedin.com/in/jimidle
++//
++// All rights reserved.
++//
++// Redistribution and use in source and binary forms, with or without
++// modification, are permitted provided that the following conditions
++// are met:
++// 1. Redistributions of source code must retain the above copyright
++//    notice, this list of conditions and the following disclaimer.
++// 2. Redistributions in binary form must reproduce the above copyright
++//    notice, this list of conditions and the following disclaimer in the
++//    documentation and/or other materials provided with the distribution.
++// 3. The name of the author may not be used to endorse or promote products
++//    derived from this software without specific prior written permission.
++//
++// THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
++// IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
++// OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
++// IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
++// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
++// NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
++// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
++// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
++// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
++// THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
++
++#ifndef       _SMARTPLLexer_H
++#define _SMARTPLLexer_H
++/* =============================================================================
++ * Standard antlr3 C runtime definitions
++ */
++#include    <antlr3.h>
++
++/* End of standard antlr 3 runtime definitions
++ * =============================================================================
++ */
++ 
++#ifdef __cplusplus
++extern "C" {
++#endif
++
++// Forward declare the context typedef so that we can use it before it is
++// properly defined. Delegators and delegates (from import statements) are
++// interdependent and their context structures contain pointers to each other
++// C only allows such things to be declared if you pre-declare the typedef.
++//
++typedef struct SMARTPLLexer_Ctx_struct SMARTPLLexer, * pSMARTPLLexer;
++
++
++
++#ifdef        ANTLR3_WINDOWS
++// Disable: Unreferenced parameter,                                                   - Rules with parameters that are not used
++//          constant conditional,                                                     - ANTLR realizes that a prediction is always true (synpred usually)
++//          initialized but unused variable                                   - tree rewrite variables declared but not needed
++//          Unreferenced local variable                                               - lexer rule declares but does not always use _type
++//          potentially unitialized variable used                     - retval always returned from a rule 
++//                    unreferenced local function has been removed    - susually getTokenNames or freeScope, they can go without warnigns
++//
++// These are only really displayed at warning level /W4 but that is the code ideal I am aiming at
++// and the codegen must generate some of these warnings by necessity, apart from 4100, which is
++// usually generated when a parser rule is given a parameter that it does not use. Mostly though
++// this is a matter of orthogonality hence I disable that one.
++//
++#pragma warning( disable : 4100 )
++#pragma warning( disable : 4101 )
++#pragma warning( disable : 4127 )
++#pragma warning( disable : 4189 )
++#pragma warning( disable : 4505 )
++#pragma warning( disable : 4701 )
++#endif
++
++/** Context tracking structure for SMARTPLLexer
++ */
++struct SMARTPLLexer_Ctx_struct
++{
++    /** Built in ANTLR3 context tracker contains all the generic elements
++     *  required for context tracking.
++     */
++    pANTLR3_LEXER    pLexer;
++
++
++     void (*mT__30)   (struct SMARTPLLexer_Ctx_struct * ctx);
++     void (*mT__31)   (struct SMARTPLLexer_Ctx_struct * ctx);
++     void (*mSTRTAG)  (struct SMARTPLLexer_Ctx_struct * ctx);
++     void (*mINTTAG)  (struct SMARTPLLexer_Ctx_struct * ctx);
++     void (*mDATETAG) (struct SMARTPLLexer_Ctx_struct * ctx);
++     void (*mENUMTAG) (struct SMARTPLLexer_Ctx_struct * ctx);
++     void (*mINCLUDES)        (struct SMARTPLLexer_Ctx_struct * ctx);
++     void (*mIS)      (struct SMARTPLLexer_Ctx_struct * ctx);
++     void (*mINTBOOL) (struct SMARTPLLexer_Ctx_struct * ctx);
++     void (*mGREATER) (struct SMARTPLLexer_Ctx_struct * ctx);
++     void (*mGREATEREQUAL)    (struct SMARTPLLexer_Ctx_struct * ctx);
++     void (*mLESS)    (struct SMARTPLLexer_Ctx_struct * ctx);
++     void (*mLESSEQUAL)       (struct SMARTPLLexer_Ctx_struct * ctx);
++     void (*mEQUAL)   (struct SMARTPLLexer_Ctx_struct * ctx);
++     void (*mAFTER)   (struct SMARTPLLexer_Ctx_struct * ctx);
++     void (*mBEFORE)  (struct SMARTPLLexer_Ctx_struct * ctx);
++     void (*mAGO)     (struct SMARTPLLexer_Ctx_struct * ctx);
++     void (*mAND)     (struct SMARTPLLexer_Ctx_struct * ctx);
++     void (*mOR)      (struct SMARTPLLexer_Ctx_struct * ctx);
++     void (*mNOT)     (struct SMARTPLLexer_Ctx_struct * ctx);
++     void (*mLPAR)    (struct SMARTPLLexer_Ctx_struct * ctx);
++     void (*mRPAR)    (struct SMARTPLLexer_Ctx_struct * ctx);
++     void (*mDATE)    (struct SMARTPLLexer_Ctx_struct * ctx);
++     void (*mDATINTERVAL)     (struct SMARTPLLexer_Ctx_struct * ctx);
++     void (*mENUMVAL) (struct SMARTPLLexer_Ctx_struct * ctx);
++     void (*mSTR)     (struct SMARTPLLexer_Ctx_struct * ctx);
++     void (*mINT)     (struct SMARTPLLexer_Ctx_struct * ctx);
++     void (*mWHITESPACE)      (struct SMARTPLLexer_Ctx_struct * ctx);
++     void (*mTokens)  (struct SMARTPLLexer_Ctx_struct * ctx);    const char * (*getGrammarFileName)();
++    void          (*free)   (struct SMARTPLLexer_Ctx_struct * ctx);
++        
++};
++
++// Function protoypes for the constructor functions that external translation units
++// such as delegators and delegates may wish to call.
++//
++ANTLR3_API pSMARTPLLexer SMARTPLLexerNew         (pANTLR3_INPUT_STREAM instream);
++ANTLR3_API pSMARTPLLexer SMARTPLLexerNewSSD      (pANTLR3_INPUT_STREAM instream, pANTLR3_RECOGNIZER_SHARED_STATE state);
++
++/** Symbolic definitions of all the tokens that the lexer will work with.
++ * \{
++ *
++ * Antlr will define EOF, but we can't use that as it it is too common in
++ * in C header files and that would be confusing. There is no way to filter this out at the moment
++ * so we just undef it here for now. That isn't the value we get back from C recognizers
++ * anyway. We are looking for ANTLR3_TOKEN_EOF.
++ */
++#ifdef        EOF
++#undef        EOF
++#endif
++#ifdef        Tokens
++#undef        Tokens
++#endif 
++#define INTBOOL      14
++#define STRTAG      10
++#define AGO      22
++#define WHITESPACE      29
++#define GREATEREQUAL      25
++#define BEFORE      18
++#define DATETAG      16
++#define INT      15
++#define NOT      7
++#define AFTER      17
++#define AND      6
++#define EOF      -1
++#define INCLUDES      11
++#define STR      4
++#define T__30      30
++#define T__31      31
++#define GREATER      24
++#define LPAR      8
++#define ENUMTAG      19
++#define IS      12
++#define ENUMVAL      20
++#define EQUAL      28
++#define OR      5
++#define LESS      26
++#define RPAR      9
++#define DATE      21
++#define LESSEQUAL      27
++#define INTTAG      13
++#define DATINTERVAL      23
++#ifdef        EOF
++#undef        EOF
++#define       EOF     ANTLR3_TOKEN_EOF
++#endif
++
++#ifndef TOKENSOURCE
++#define TOKENSOURCE(lxr) lxr->pLexer->rec->state->tokSource
++#endif
++
++/* End of token definitions for SMARTPLLexer
++ * =============================================================================
++ */
++/** \} */
++
++#ifdef __cplusplus
++}
++#endif
++
++#endif
++
++/* END - Note:Keep extra line feed to satisfy UNIX systems */
+diff --git a/src/pregen/SMARTPLParser.c b/src/pregen/SMARTPLParser.c
+new file mode 100644
+index 0000000..afe9f99
+--- /dev/null
++++ b/src/pregen/SMARTPLParser.c
+@@ -0,0 +1,1812 @@
++/** \file
++ *  This C source file was generated by $ANTLR version 3.2 debian-7ubuntu3
++ *
++ *     -  From the grammar source file : SMARTPL.g
++ *     -                            On : 2015-06-27 19:05:15
++ *     -                for the parser : SMARTPLParserParser *
++ * Editing it, at least manually, is not wise. 
++ *
++ * C language generator and runtime by Jim Idle, jimi|hereisanat|idle|dotgoeshere|ws.
++ *
++ *
++*/
++// [The "BSD licence"]
++// Copyright (c) 2005-2009 Jim Idle, Temporal Wave LLC
++// http://www.temporal-wave.com
++// http://www.linkedin.com/in/jimidle
++//
++// All rights reserved.
++//
++// Redistribution and use in source and binary forms, with or without
++// modification, are permitted provided that the following conditions
++// are met:
++// 1. Redistributions of source code must retain the above copyright
++//    notice, this list of conditions and the following disclaimer.
++// 2. Redistributions in binary form must reproduce the above copyright
++//    notice, this list of conditions and the following disclaimer in the
++//    documentation and/or other materials provided with the distribution.
++// 3. The name of the author may not be used to endorse or promote products
++//    derived from this software without specific prior written permission.
++//
++// THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
++// IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
++// OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
++// IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
++// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
++// NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
++// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
++// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
++// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
++// THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
++
++/* -----------------------------------------
++ * Include the ANTLR3 generated header file.
++ */
++#include    "SMARTPLParser.h"
++/* ----------------------------------------- */
++
++
++
++
++
++/* MACROS that hide the C interface implementations from the
++ * generated code, which makes it a little more understandable to the human eye.
++ * I am very much against using C pre-processor macros for function calls and bits
++ * of code as you cannot see what is happening when single stepping in debuggers
++ * and so on. The exception (in my book at least) is for generated code, where you are
++ * not maintaining it, but may wish to read and understand it. If you single step it, you know that input()
++ * hides some indirect calls, but is always referring to the input stream. This is
++ * probably more readable than ctx->input->istream->input(snarfle0->blarg) and allows me to rejig
++ * the runtime interfaces without changing the generated code too often, without
++ * confusing the reader of the generated output, who may not wish to know the gory
++ * details of the interface inheritance.
++ */
++ 
++#define               CTX     ctx
++
++/* Aids in accessing scopes for grammar programmers
++ */
++#undef        SCOPE_TYPE
++#undef        SCOPE_STACK
++#undef        SCOPE_TOP
++#define       SCOPE_TYPE(scope)   pSMARTPLParser_##scope##_SCOPE
++#define SCOPE_STACK(scope)  pSMARTPLParser_##scope##Stack
++#define       SCOPE_TOP(scope)    ctx->pSMARTPLParser_##scope##Top
++#define       SCOPE_SIZE(scope)               ctx->pSMARTPLParser_##scope##Stack_limit
++#define SCOPE_INSTANCE(scope, i)      (ctx->SCOPE_STACK(scope)->get(ctx->SCOPE_STACK(scope),i))
++
++/* Macros for accessing things in the parser
++ */
++ 
++#undef            PARSER                  
++#undef            RECOGNIZER              
++#undef            HAVEPARSEDRULE
++#undef                MEMOIZE
++#undef            INPUT
++#undef            STRSTREAM
++#undef            HASEXCEPTION
++#undef            EXCEPTION
++#undef            MATCHT
++#undef            MATCHANYT
++#undef            FOLLOWSTACK
++#undef            FOLLOWPUSH
++#undef            FOLLOWPOP
++#undef            PRECOVER
++#undef            PREPORTERROR
++#undef            LA
++#undef            LT
++#undef            CONSTRUCTEX
++#undef            CONSUME
++#undef            MARK
++#undef            REWIND
++#undef            REWINDLAST
++#undef            PERRORRECOVERY
++#undef            HASFAILED
++#undef            FAILEDFLAG
++#undef            RECOVERFROMMISMATCHEDSET
++#undef            RECOVERFROMMISMATCHEDELEMENT
++#undef                INDEX
++#undef      ADAPTOR
++#undef                SEEK
++#undef            RULEMEMO                
++#undef                DBG
++
++#define           PARSER                                                      ctx->pParser  
++#define           RECOGNIZER                                          PARSER->rec
++#define               PSRSTATE                                                RECOGNIZER->state
++#define           HAVEPARSEDRULE(r)                           RECOGNIZER->alreadyParsedRule(RECOGNIZER, r)
++#define               MEMOIZE(ri,si)                                  RECOGNIZER->memoize(RECOGNIZER, ri, si)
++#define           INPUT                                                       PARSER->tstream
++#define           STRSTREAM                                           INPUT
++#define               ISTREAM                                                 INPUT->istream
++#define               INDEX()                                                 ISTREAM->index(INPUT->istream)
++#define           HASEXCEPTION()                                      (PSRSTATE->error == ANTLR3_TRUE)
++#define           EXCEPTION                                           PSRSTATE->exception
++#define           MATCHT(t, fs)                                       RECOGNIZER->match(RECOGNIZER, t, fs)
++#define           MATCHANYT()                                         RECOGNIZER->matchAny(RECOGNIZER)
++#define           FOLLOWSTACK                                     PSRSTATE->following
++#define           FOLLOWPUSH(x)                                       FOLLOWSTACK->push(FOLLOWSTACK, ((void *)(&(x))), NULL)
++#define           FOLLOWPOP()                                         FOLLOWSTACK->pop(FOLLOWSTACK)
++#define           PRECOVER()                                          RECOGNIZER->recover(RECOGNIZER)
++#define           PREPORTERROR()                                      RECOGNIZER->reportError(RECOGNIZER)
++#define           LA(n)                                                       INPUT->istream->_LA(ISTREAM, n)
++#define           LT(n)                                                       INPUT->_LT(INPUT, n)
++#define           CONSTRUCTEX()                                       RECOGNIZER->exConstruct(RECOGNIZER)
++#define           CONSUME()                                           ISTREAM->consume(ISTREAM)
++#define           MARK()                                                      ISTREAM->mark(ISTREAM)
++#define           REWIND(m)                                           ISTREAM->rewind(ISTREAM, m)
++#define           REWINDLAST()                                        ISTREAM->rewindLast(ISTREAM)
++#define               SEEK(n)                                                 ISTREAM->seek(ISTREAM, n)
++#define           PERRORRECOVERY                                      PSRSTATE->errorRecovery
++#define           FAILEDFLAG                                          PSRSTATE->failed
++#define           HASFAILED()                                         (FAILEDFLAG == ANTLR3_TRUE)
++#define           BACKTRACKING                                        PSRSTATE->backtracking
++#define           RECOVERFROMMISMATCHEDSET(s)         RECOGNIZER->recoverFromMismatchedSet(RECOGNIZER, s)
++#define           RECOVERFROMMISMATCHEDELEMENT(e)     RECOGNIZER->recoverFromMismatchedElement(RECOGNIZER, s)
++#define     ADAPTOR                         ctx->adaptor
++#define               RULEMEMO                                                PSRSTATE->ruleMemo
++#define               DBG                                                             RECOGNIZER->debugger
++
++#define               TOKTEXT(tok, txt)                               tok, (pANTLR3_UINT8)txt
++
++/* The 4 tokens defined below may well clash with your own #defines or token types. If so
++ * then for the present you must use different names for your defines as these are hard coded
++ * in the code generator. It would be better not to use such names internally, and maybe
++ * we can change this in a forthcoming release. I deliberately do not #undef these
++ * here as this will at least give you a redefined error somewhere if they clash.
++ */
++#define           UP      ANTLR3_TOKEN_UP
++#define           DOWN    ANTLR3_TOKEN_DOWN
++#define           EOR     ANTLR3_TOKEN_EOR
++#define           INVALID ANTLR3_TOKEN_INVALID
++
++
++/* =============================================================================
++ * Functions to create and destroy scopes. First come the rule scopes, followed
++ * by the global declared scopes.
++ */
++
++
++
++/* ============================================================================= */
++
++/* =============================================================================
++ * Start of recognizer
++ */
++
++
++
++/** \brief Table of all token names in symbolic order, mainly used for
++ *         error reporting.
++ */
++pANTLR3_UINT8   SMARTPLParserTokenNames[28+4]
++     = {
++        (pANTLR3_UINT8) "<invalid>",       /* String to print to indicate an invalid token */
++        (pANTLR3_UINT8) "<EOR>",
++        (pANTLR3_UINT8) "<DOWN>", 
++        (pANTLR3_UINT8) "<UP>", 
++        (pANTLR3_UINT8) "STR",
++        (pANTLR3_UINT8) "OR",
++        (pANTLR3_UINT8) "AND",
++        (pANTLR3_UINT8) "NOT",
++        (pANTLR3_UINT8) "LPAR",
++        (pANTLR3_UINT8) "RPAR",
++        (pANTLR3_UINT8) "STRTAG",
++        (pANTLR3_UINT8) "INCLUDES",
++        (pANTLR3_UINT8) "IS",
++        (pANTLR3_UINT8) "INTTAG",
++        (pANTLR3_UINT8) "INTBOOL",
++        (pANTLR3_UINT8) "INT",
++        (pANTLR3_UINT8) "DATETAG",
++        (pANTLR3_UINT8) "AFTER",
++        (pANTLR3_UINT8) "BEFORE",
++        (pANTLR3_UINT8) "ENUMTAG",
++        (pANTLR3_UINT8) "ENUMVAL",
++        (pANTLR3_UINT8) "DATE",
++        (pANTLR3_UINT8) "AGO",
++        (pANTLR3_UINT8) "DATINTERVAL",
++        (pANTLR3_UINT8) "GREATER",
++        (pANTLR3_UINT8) "GREATEREQUAL",
++        (pANTLR3_UINT8) "LESS",
++        (pANTLR3_UINT8) "LESSEQUAL",
++        (pANTLR3_UINT8) "EQUAL",
++        (pANTLR3_UINT8) "WHITESPACE",
++        (pANTLR3_UINT8) "'{'",
++        (pANTLR3_UINT8) "'}'"
++       };
++
++        
++
++// Forward declare the locally static matching functions we have generated.
++//
++static SMARTPLParser_playlist_return  playlist    (pSMARTPLParser ctx);
++static SMARTPLParser_expression_return        expression    (pSMARTPLParser ctx);
++static SMARTPLParser_aexpr_return     aexpr    (pSMARTPLParser ctx);
++static SMARTPLParser_nexpr_return     nexpr    (pSMARTPLParser ctx);
++static SMARTPLParser_crit_return      crit    (pSMARTPLParser ctx);
++static SMARTPLParser_dateval_return   dateval    (pSMARTPLParser ctx);
++static SMARTPLParser_interval_return  interval    (pSMARTPLParser ctx);
++static void   SMARTPLParserFree(pSMARTPLParser ctx);
++/* For use in tree output where we are accumulating rule labels via label += ruleRef
++ * we need a function that knows how to free a return scope when the list is destroyed. 
++ * We cannot just use ANTLR3_FREE because in debug tracking mode, this is a macro.
++ */
++static        void ANTLR3_CDECL freeScope(void * scope)
++{
++    ANTLR3_FREE(scope);
++}
++
++/** \brief Name of the grammar file that generated this code
++ */
++static const char fileName[] = "SMARTPL.g";
++
++/** \brief Return the name of the grammar file that generated this code.
++ */
++static const char * getGrammarFileName()
++{
++      return fileName;
++}
++/** \brief Create a new SMARTPLParser parser and return a context for it.
++ *
++ * \param[in] instream Pointer to an input stream interface.
++ *
++ * \return Pointer to new parser context upon success.
++ */
++ANTLR3_API pSMARTPLParser
++SMARTPLParserNew   (pANTLR3_COMMON_TOKEN_STREAM instream)
++{
++      // See if we can create a new parser with the standard constructor
++      //
++      return SMARTPLParserNewSSD(instream, NULL);
++}
++
++/** \brief Create a new SMARTPLParser parser and return a context for it.
++ *
++ * \param[in] instream Pointer to an input stream interface.
++ *
++ * \return Pointer to new parser context upon success.
++ */
++ANTLR3_API pSMARTPLParser
++SMARTPLParserNewSSD   (pANTLR3_COMMON_TOKEN_STREAM instream, pANTLR3_RECOGNIZER_SHARED_STATE state)
++{
++    pSMARTPLParser ctx;           /* Context structure we will build and return   */
++    
++    ctx       = (pSMARTPLParser) ANTLR3_CALLOC(1, sizeof(SMARTPLParser));
++    
++    if        (ctx == NULL)
++    {
++              // Failed to allocate memory for parser context
++              //
++        return  NULL;
++    }
++    
++    /* -------------------------------------------------------------------
++     * Memory for basic structure is allocated, now to fill in
++     * the base ANTLR3 structures. We initialize the function pointers
++     * for the standard ANTLR3 parser function set, but upon return
++     * from here, the programmer may set the pointers to provide custom
++     * implementations of each function. 
++     *
++     * We don't use the macros defined in SMARTPLParser.h here, in order that you can get a sense
++     * of what goes where.
++     */
++
++    /* Create a base parser/recognizer, using the supplied token stream
++     */
++    ctx->pParser          = antlr3ParserNewStream(ANTLR3_SIZE_HINT, instream->tstream, state);
++    /* Install the implementation of our SMARTPLParser interface
++     */
++    ctx->playlist     = playlist;
++    ctx->expression   = expression;
++    ctx->aexpr        = aexpr;
++    ctx->nexpr        = nexpr;
++    ctx->crit = crit;
++    ctx->dateval      = dateval;
++    ctx->interval     = interval;
++    ctx->free                 = SMARTPLParserFree;
++    ctx->getGrammarFileName   = getGrammarFileName;
++    
++    /* Install the scope pushing methods.
++     */
++    ADAPTOR   = ANTLR3_TREE_ADAPTORNew(instream->tstream->tokenSource->strFactory);
++    ctx->vectors      = antlr3VectorFactoryNew(0);
++    
++
++      
++    /* Install the token table
++     */
++    PSRSTATE->tokenNames   = SMARTPLParserTokenNames;
++    
++    
++    /* Return the newly built parser to the caller
++     */
++    return  ctx;
++}
++
++/** Free the parser resources
++ */
++ static void
++ SMARTPLParserFree(pSMARTPLParser ctx)
++ {
++    /* Free any scope memory
++     */
++    
++    ctx->vectors->close(ctx->vectors);
++    /* We created the adaptor so we must free it
++     */
++    ADAPTOR->free(ADAPTOR);
++      // Free this parser
++      //
++    ctx->pParser->free(ctx->pParser);
++    ANTLR3_FREE(ctx);
++
++    /* Everything is released, so we can return
++     */
++    return;
++ }
++ 
++/** Return token names used by this parser
++ *
++ * The returned pointer is used as an index into the token names table (using the token 
++ * number as the index).
++ * 
++ * \return Pointer to first char * in the table.
++ */
++static pANTLR3_UINT8    *getTokenNames() 
++{
++        return SMARTPLParserTokenNames; 
++}
++
++    
++/* Declare the bitsets
++ */
++
++/** Bitset defining follow set for error recovery in rule state: FOLLOW_STR_in_playlist42  */
++static        ANTLR3_BITWORD FOLLOW_STR_in_playlist42_bits[]  = { ANTLR3_UINT64_LIT(0x0000000040000000) };
++static  ANTLR3_BITSET_LIST FOLLOW_STR_in_playlist42   = { FOLLOW_STR_in_playlist42_bits, 1    };
++/** Bitset defining follow set for error recovery in rule state: FOLLOW_30_in_playlist44  */
++static        ANTLR3_BITWORD FOLLOW_30_in_playlist44_bits[]   = { ANTLR3_UINT64_LIT(0x0000000000092580) };
++static  ANTLR3_BITSET_LIST FOLLOW_30_in_playlist44    = { FOLLOW_30_in_playlist44_bits, 1     };
++/** Bitset defining follow set for error recovery in rule state: FOLLOW_expression_in_playlist46  */
++static        ANTLR3_BITWORD FOLLOW_expression_in_playlist46_bits[]   = { ANTLR3_UINT64_LIT(0x0000000080000000) };
++static  ANTLR3_BITSET_LIST FOLLOW_expression_in_playlist46    = { FOLLOW_expression_in_playlist46_bits, 1     };
++/** Bitset defining follow set for error recovery in rule state: FOLLOW_31_in_playlist48  */
++static        ANTLR3_BITWORD FOLLOW_31_in_playlist48_bits[]   = { ANTLR3_UINT64_LIT(0x0000000000000000) };
++static  ANTLR3_BITSET_LIST FOLLOW_31_in_playlist48    = { FOLLOW_31_in_playlist48_bits, 1     };
++/** Bitset defining follow set for error recovery in rule state: FOLLOW_EOF_in_playlist50  */
++static        ANTLR3_BITWORD FOLLOW_EOF_in_playlist50_bits[]  = { ANTLR3_UINT64_LIT(0x0000000000000002) };
++static  ANTLR3_BITSET_LIST FOLLOW_EOF_in_playlist50   = { FOLLOW_EOF_in_playlist50_bits, 1    };
++/** Bitset defining follow set for error recovery in rule state: FOLLOW_aexpr_in_expression62  */
++static        ANTLR3_BITWORD FOLLOW_aexpr_in_expression62_bits[]      = { ANTLR3_UINT64_LIT(0x0000000000000022) };
++static  ANTLR3_BITSET_LIST FOLLOW_aexpr_in_expression62       = { FOLLOW_aexpr_in_expression62_bits, 1        };
++/** Bitset defining follow set for error recovery in rule state: FOLLOW_OR_in_expression65  */
++static        ANTLR3_BITWORD FOLLOW_OR_in_expression65_bits[] = { ANTLR3_UINT64_LIT(0x0000000000092580) };
++static  ANTLR3_BITSET_LIST FOLLOW_OR_in_expression65  = { FOLLOW_OR_in_expression65_bits, 1   };
++/** Bitset defining follow set for error recovery in rule state: FOLLOW_aexpr_in_expression68  */
++static        ANTLR3_BITWORD FOLLOW_aexpr_in_expression68_bits[]      = { ANTLR3_UINT64_LIT(0x0000000000000022) };
++static  ANTLR3_BITSET_LIST FOLLOW_aexpr_in_expression68       = { FOLLOW_aexpr_in_expression68_bits, 1        };
++/** Bitset defining follow set for error recovery in rule state: FOLLOW_nexpr_in_aexpr83  */
++static        ANTLR3_BITWORD FOLLOW_nexpr_in_aexpr83_bits[]   = { ANTLR3_UINT64_LIT(0x0000000000000042) };
++static  ANTLR3_BITSET_LIST FOLLOW_nexpr_in_aexpr83    = { FOLLOW_nexpr_in_aexpr83_bits, 1     };
++/** Bitset defining follow set for error recovery in rule state: FOLLOW_AND_in_aexpr86  */
++static        ANTLR3_BITWORD FOLLOW_AND_in_aexpr86_bits[]     = { ANTLR3_UINT64_LIT(0x0000000000092580) };
++static  ANTLR3_BITSET_LIST FOLLOW_AND_in_aexpr86      = { FOLLOW_AND_in_aexpr86_bits, 1       };
++/** Bitset defining follow set for error recovery in rule state: FOLLOW_nexpr_in_aexpr89  */
++static        ANTLR3_BITWORD FOLLOW_nexpr_in_aexpr89_bits[]   = { ANTLR3_UINT64_LIT(0x0000000000000042) };
++static  ANTLR3_BITSET_LIST FOLLOW_nexpr_in_aexpr89    = { FOLLOW_nexpr_in_aexpr89_bits, 1     };
++/** Bitset defining follow set for error recovery in rule state: FOLLOW_NOT_in_nexpr104  */
++static        ANTLR3_BITWORD FOLLOW_NOT_in_nexpr104_bits[]    = { ANTLR3_UINT64_LIT(0x0000000000092580) };
++static  ANTLR3_BITSET_LIST FOLLOW_NOT_in_nexpr104     = { FOLLOW_NOT_in_nexpr104_bits, 1      };
++/** Bitset defining follow set for error recovery in rule state: FOLLOW_crit_in_nexpr107  */
++static        ANTLR3_BITWORD FOLLOW_crit_in_nexpr107_bits[]   = { ANTLR3_UINT64_LIT(0x0000000000000002) };
++static  ANTLR3_BITSET_LIST FOLLOW_crit_in_nexpr107    = { FOLLOW_crit_in_nexpr107_bits, 1     };
++/** Bitset defining follow set for error recovery in rule state: FOLLOW_crit_in_nexpr114  */
++static        ANTLR3_BITWORD FOLLOW_crit_in_nexpr114_bits[]   = { ANTLR3_UINT64_LIT(0x0000000000000002) };
++static  ANTLR3_BITSET_LIST FOLLOW_crit_in_nexpr114    = { FOLLOW_crit_in_nexpr114_bits, 1     };
++/** Bitset defining follow set for error recovery in rule state: FOLLOW_LPAR_in_crit127  */
++static        ANTLR3_BITWORD FOLLOW_LPAR_in_crit127_bits[]    = { ANTLR3_UINT64_LIT(0x0000000000092580) };
++static  ANTLR3_BITSET_LIST FOLLOW_LPAR_in_crit127     = { FOLLOW_LPAR_in_crit127_bits, 1      };
++/** Bitset defining follow set for error recovery in rule state: FOLLOW_expression_in_crit129  */
++static        ANTLR3_BITWORD FOLLOW_expression_in_crit129_bits[]      = { ANTLR3_UINT64_LIT(0x0000000000000200) };
++static  ANTLR3_BITSET_LIST FOLLOW_expression_in_crit129       = { FOLLOW_expression_in_crit129_bits, 1        };
++/** Bitset defining follow set for error recovery in rule state: FOLLOW_RPAR_in_crit131  */
++static        ANTLR3_BITWORD FOLLOW_RPAR_in_crit131_bits[]    = { ANTLR3_UINT64_LIT(0x0000000000000002) };
++static  ANTLR3_BITSET_LIST FOLLOW_RPAR_in_crit131     = { FOLLOW_RPAR_in_crit131_bits, 1      };
++/** Bitset defining follow set for error recovery in rule state: FOLLOW_STRTAG_in_crit142  */
++static        ANTLR3_BITWORD FOLLOW_STRTAG_in_crit142_bits[]  = { ANTLR3_UINT64_LIT(0x0000000000001800) };
++static  ANTLR3_BITSET_LIST FOLLOW_STRTAG_in_crit142   = { FOLLOW_STRTAG_in_crit142_bits, 1    };
++/** Bitset defining follow set for error recovery in rule state: FOLLOW_set_in_crit144  */
++static        ANTLR3_BITWORD FOLLOW_set_in_crit144_bits[]     = { ANTLR3_UINT64_LIT(0x0000000000000010) };
++static  ANTLR3_BITSET_LIST FOLLOW_set_in_crit144      = { FOLLOW_set_in_crit144_bits, 1       };
++/** Bitset defining follow set for error recovery in rule state: FOLLOW_STR_in_crit150  */
++static        ANTLR3_BITWORD FOLLOW_STR_in_crit150_bits[]     = { ANTLR3_UINT64_LIT(0x0000000000000002) };
++static  ANTLR3_BITSET_LIST FOLLOW_STR_in_crit150      = { FOLLOW_STR_in_crit150_bits, 1       };
++/** Bitset defining follow set for error recovery in rule state: FOLLOW_INTTAG_in_crit157  */
++static        ANTLR3_BITWORD FOLLOW_INTTAG_in_crit157_bits[]  = { ANTLR3_UINT64_LIT(0x0000000000004000) };
++static  ANTLR3_BITSET_LIST FOLLOW_INTTAG_in_crit157   = { FOLLOW_INTTAG_in_crit157_bits, 1    };
++/** Bitset defining follow set for error recovery in rule state: FOLLOW_INTBOOL_in_crit159  */
++static        ANTLR3_BITWORD FOLLOW_INTBOOL_in_crit159_bits[] = { ANTLR3_UINT64_LIT(0x0000000000008000) };
++static  ANTLR3_BITSET_LIST FOLLOW_INTBOOL_in_crit159  = { FOLLOW_INTBOOL_in_crit159_bits, 1   };
++/** Bitset defining follow set for error recovery in rule state: FOLLOW_INT_in_crit161  */
++static        ANTLR3_BITWORD FOLLOW_INT_in_crit161_bits[]     = { ANTLR3_UINT64_LIT(0x0000000000000002) };
++static  ANTLR3_BITSET_LIST FOLLOW_INT_in_crit161      = { FOLLOW_INT_in_crit161_bits, 1       };
++/** Bitset defining follow set for error recovery in rule state: FOLLOW_DATETAG_in_crit168  */
++static        ANTLR3_BITWORD FOLLOW_DATETAG_in_crit168_bits[] = { ANTLR3_UINT64_LIT(0x0000000000060000) };
++static  ANTLR3_BITSET_LIST FOLLOW_DATETAG_in_crit168  = { FOLLOW_DATETAG_in_crit168_bits, 1   };
++/** Bitset defining follow set for error recovery in rule state: FOLLOW_set_in_crit170  */
++static        ANTLR3_BITWORD FOLLOW_set_in_crit170_bits[]     = { ANTLR3_UINT64_LIT(0x0000000000208000) };
++static  ANTLR3_BITSET_LIST FOLLOW_set_in_crit170      = { FOLLOW_set_in_crit170_bits, 1       };
++/** Bitset defining follow set for error recovery in rule state: FOLLOW_dateval_in_crit176  */
++static        ANTLR3_BITWORD FOLLOW_dateval_in_crit176_bits[] = { ANTLR3_UINT64_LIT(0x0000000000000002) };
++static  ANTLR3_BITSET_LIST FOLLOW_dateval_in_crit176  = { FOLLOW_dateval_in_crit176_bits, 1   };
++/** Bitset defining follow set for error recovery in rule state: FOLLOW_ENUMTAG_in_crit183  */
++static        ANTLR3_BITWORD FOLLOW_ENUMTAG_in_crit183_bits[] = { ANTLR3_UINT64_LIT(0x0000000000001000) };
++static  ANTLR3_BITSET_LIST FOLLOW_ENUMTAG_in_crit183  = { FOLLOW_ENUMTAG_in_crit183_bits, 1   };
++/** Bitset defining follow set for error recovery in rule state: FOLLOW_IS_in_crit185  */
++static        ANTLR3_BITWORD FOLLOW_IS_in_crit185_bits[]      = { ANTLR3_UINT64_LIT(0x0000000000100000) };
++static  ANTLR3_BITSET_LIST FOLLOW_IS_in_crit185       = { FOLLOW_IS_in_crit185_bits, 1        };
++/** Bitset defining follow set for error recovery in rule state: FOLLOW_ENUMVAL_in_crit187  */
++static        ANTLR3_BITWORD FOLLOW_ENUMVAL_in_crit187_bits[] = { ANTLR3_UINT64_LIT(0x0000000000000002) };
++static  ANTLR3_BITSET_LIST FOLLOW_ENUMVAL_in_crit187  = { FOLLOW_ENUMVAL_in_crit187_bits, 1   };
++/** Bitset defining follow set for error recovery in rule state: FOLLOW_DATE_in_dateval200  */
++static        ANTLR3_BITWORD FOLLOW_DATE_in_dateval200_bits[] = { ANTLR3_UINT64_LIT(0x0000000000000002) };
++static  ANTLR3_BITSET_LIST FOLLOW_DATE_in_dateval200  = { FOLLOW_DATE_in_dateval200_bits, 1   };
++/** Bitset defining follow set for error recovery in rule state: FOLLOW_interval_in_dateval207  */
++static        ANTLR3_BITWORD FOLLOW_interval_in_dateval207_bits[]     = { ANTLR3_UINT64_LIT(0x0000000000040000) };
++static  ANTLR3_BITSET_LIST FOLLOW_interval_in_dateval207      = { FOLLOW_interval_in_dateval207_bits, 1       };
++/** Bitset defining follow set for error recovery in rule state: FOLLOW_BEFORE_in_dateval209  */
++static        ANTLR3_BITWORD FOLLOW_BEFORE_in_dateval209_bits[]       = { ANTLR3_UINT64_LIT(0x0000000000200000) };
++static  ANTLR3_BITSET_LIST FOLLOW_BEFORE_in_dateval209        = { FOLLOW_BEFORE_in_dateval209_bits, 1 };
++/** Bitset defining follow set for error recovery in rule state: FOLLOW_DATE_in_dateval211  */
++static        ANTLR3_BITWORD FOLLOW_DATE_in_dateval211_bits[] = { ANTLR3_UINT64_LIT(0x0000000000000002) };
++static  ANTLR3_BITSET_LIST FOLLOW_DATE_in_dateval211  = { FOLLOW_DATE_in_dateval211_bits, 1   };
++/** Bitset defining follow set for error recovery in rule state: FOLLOW_interval_in_dateval218  */
++static        ANTLR3_BITWORD FOLLOW_interval_in_dateval218_bits[]     = { ANTLR3_UINT64_LIT(0x0000000000020000) };
++static  ANTLR3_BITSET_LIST FOLLOW_interval_in_dateval218      = { FOLLOW_interval_in_dateval218_bits, 1       };
++/** Bitset defining follow set for error recovery in rule state: FOLLOW_AFTER_in_dateval220  */
++static        ANTLR3_BITWORD FOLLOW_AFTER_in_dateval220_bits[]        = { ANTLR3_UINT64_LIT(0x0000000000200000) };
++static  ANTLR3_BITSET_LIST FOLLOW_AFTER_in_dateval220 = { FOLLOW_AFTER_in_dateval220_bits, 1  };
++/** Bitset defining follow set for error recovery in rule state: FOLLOW_DATE_in_dateval222  */
++static        ANTLR3_BITWORD FOLLOW_DATE_in_dateval222_bits[] = { ANTLR3_UINT64_LIT(0x0000000000000002) };
++static  ANTLR3_BITSET_LIST FOLLOW_DATE_in_dateval222  = { FOLLOW_DATE_in_dateval222_bits, 1   };
++/** Bitset defining follow set for error recovery in rule state: FOLLOW_interval_in_dateval229  */
++static        ANTLR3_BITWORD FOLLOW_interval_in_dateval229_bits[]     = { ANTLR3_UINT64_LIT(0x0000000000400000) };
++static  ANTLR3_BITSET_LIST FOLLOW_interval_in_dateval229      = { FOLLOW_interval_in_dateval229_bits, 1       };
++/** Bitset defining follow set for error recovery in rule state: FOLLOW_AGO_in_dateval231  */
++static        ANTLR3_BITWORD FOLLOW_AGO_in_dateval231_bits[]  = { ANTLR3_UINT64_LIT(0x0000000000000002) };
++static  ANTLR3_BITSET_LIST FOLLOW_AGO_in_dateval231   = { FOLLOW_AGO_in_dateval231_bits, 1    };
++/** Bitset defining follow set for error recovery in rule state: FOLLOW_INT_in_interval243  */
++static        ANTLR3_BITWORD FOLLOW_INT_in_interval243_bits[] = { ANTLR3_UINT64_LIT(0x0000000000800000) };
++static  ANTLR3_BITSET_LIST FOLLOW_INT_in_interval243  = { FOLLOW_INT_in_interval243_bits, 1   };
++/** Bitset defining follow set for error recovery in rule state: FOLLOW_DATINTERVAL_in_interval245  */
++static        ANTLR3_BITWORD FOLLOW_DATINTERVAL_in_interval245_bits[] = { ANTLR3_UINT64_LIT(0x0000000000000002) };
++static  ANTLR3_BITSET_LIST FOLLOW_DATINTERVAL_in_interval245  = { FOLLOW_DATINTERVAL_in_interval245_bits, 1   };
++     
++
++ 
++ 
++/* ==============================================
++ * Parsing rules
++ */
++/** 
++ * $ANTLR start playlist
++ * SMARTPL.g:27:1: playlist : STR '{' expression '}' EOF ;
++ */
++static SMARTPLParser_playlist_return
++playlist(pSMARTPLParser ctx)
++{   
++    SMARTPLParser_playlist_return retval;
++
++    pANTLR3_BASE_TREE root_0;
++
++    pANTLR3_COMMON_TOKEN    STR1;
++    pANTLR3_COMMON_TOKEN    char_literal2;
++    pANTLR3_COMMON_TOKEN    char_literal4;
++    pANTLR3_COMMON_TOKEN    EOF5;
++    SMARTPLParser_expression_return expression3;
++    #undef    RETURN_TYPE_expression3
++    #define   RETURN_TYPE_expression3 SMARTPLParser_expression_return
++
++    pANTLR3_BASE_TREE STR1_tree;
++    pANTLR3_BASE_TREE char_literal2_tree;
++    pANTLR3_BASE_TREE char_literal4_tree;
++    pANTLR3_BASE_TREE EOF5_tree;
++
++    /* Initialize rule variables
++     */
++
++
++    root_0 = NULL;
++
++    STR1       = NULL;
++    char_literal2       = NULL;
++    char_literal4       = NULL;
++    EOF5       = NULL;
++    expression3.tree = NULL;
++
++    retval.start = LT(1); retval.stop = retval.start;
++
++    STR1_tree   = NULL;
++    char_literal2_tree   = NULL;
++    char_literal4_tree   = NULL;
++    EOF5_tree   = NULL;
++
++
++    retval.tree  = NULL;
++    {
++        // SMARTPL.g:27:10: ( STR '{' expression '}' EOF )
++        // SMARTPL.g:27:12: STR '{' expression '}' EOF
++        {
++            root_0 = (pANTLR3_BASE_TREE)(ADAPTOR->nilNode(ADAPTOR));
++
++            STR1 = (pANTLR3_COMMON_TOKEN) MATCHT(STR, &FOLLOW_STR_in_playlist42); 
++            if  (HASEXCEPTION())
++            {
++                goto ruleplaylistEx;
++            }
++
++            STR1_tree = (pANTLR3_BASE_TREE)(ADAPTOR->create(ADAPTOR, STR1));
++            ADAPTOR->addChild(ADAPTOR, root_0, STR1_tree);
++
++            char_literal2 = (pANTLR3_COMMON_TOKEN) MATCHT(30, &FOLLOW_30_in_playlist44); 
++            if  (HASEXCEPTION())
++            {
++                goto ruleplaylistEx;
++            }
++
++            char_literal2_tree = (pANTLR3_BASE_TREE)(ADAPTOR->create(ADAPTOR, char_literal2));
++            ADAPTOR->addChild(ADAPTOR, root_0, char_literal2_tree);
++
++            FOLLOWPUSH(FOLLOW_expression_in_playlist46);
++            expression3=expression(ctx);
++
++            FOLLOWPOP();
++            if  (HASEXCEPTION())
++            {
++                goto ruleplaylistEx;
++            }
++
++            ADAPTOR->addChild(ADAPTOR, root_0, expression3.tree);
++            char_literal4 = (pANTLR3_COMMON_TOKEN) MATCHT(31, &FOLLOW_31_in_playlist48); 
++            if  (HASEXCEPTION())
++            {
++                goto ruleplaylistEx;
++            }
++
++            char_literal4_tree = (pANTLR3_BASE_TREE)(ADAPTOR->create(ADAPTOR, char_literal4));
++            ADAPTOR->addChild(ADAPTOR, root_0, char_literal4_tree);
++
++            EOF5 = (pANTLR3_COMMON_TOKEN) MATCHT(EOF, &FOLLOW_EOF_in_playlist50); 
++            if  (HASEXCEPTION())
++            {
++                goto ruleplaylistEx;
++            }
++
++            EOF5_tree = (pANTLR3_BASE_TREE)(ADAPTOR->create(ADAPTOR, EOF5));
++            ADAPTOR->addChild(ADAPTOR, root_0, EOF5_tree);
++
++
++        }
++
++    }
++    
++
++    // This is where rules clean up and exit
++    //
++    goto ruleplaylistEx; /* Prevent compiler warnings */
++    ruleplaylistEx: ;
++    retval.stop = LT(-1);
++
++      retval.stop = LT(-1);
++      retval.tree = (pANTLR3_BASE_TREE)(ADAPTOR->rulePostProcessing(ADAPTOR, root_0));
++      ADAPTOR->setTokenBoundaries(ADAPTOR, retval.tree, retval.start, retval.stop);
++
++            if (HASEXCEPTION())
++            {
++                PREPORTERROR();
++                PRECOVER();
++                retval.tree = (pANTLR3_BASE_TREE)(ADAPTOR->errorNode(ADAPTOR, INPUT, retval.start, LT(-1), EXCEPTION));
++            }
++
++
++    return retval;
++}
++/* $ANTLR end playlist */
++
++/** 
++ * $ANTLR start expression
++ * SMARTPL.g:30:1: expression : aexpr ( OR aexpr )* ;
++ */
++static SMARTPLParser_expression_return
++expression(pSMARTPLParser ctx)
++{   
++    SMARTPLParser_expression_return retval;
++
++    pANTLR3_BASE_TREE root_0;
++
++    pANTLR3_COMMON_TOKEN    OR7;
++    SMARTPLParser_aexpr_return aexpr6;
++    #undef    RETURN_TYPE_aexpr6
++    #define   RETURN_TYPE_aexpr6 SMARTPLParser_aexpr_return
++
++    SMARTPLParser_aexpr_return aexpr8;
++    #undef    RETURN_TYPE_aexpr8
++    #define   RETURN_TYPE_aexpr8 SMARTPLParser_aexpr_return
++
++    pANTLR3_BASE_TREE OR7_tree;
++
++    /* Initialize rule variables
++     */
++
++
++    root_0 = NULL;
++
++    OR7       = NULL;
++    aexpr6.tree = NULL;
++
++    aexpr8.tree = NULL;
++
++    retval.start = LT(1); retval.stop = retval.start;
++
++    OR7_tree   = NULL;
++
++
++    retval.tree  = NULL;
++    {
++        // SMARTPL.g:30:12: ( aexpr ( OR aexpr )* )
++        // SMARTPL.g:30:14: aexpr ( OR aexpr )*
++        {
++            root_0 = (pANTLR3_BASE_TREE)(ADAPTOR->nilNode(ADAPTOR));
++
++            FOLLOWPUSH(FOLLOW_aexpr_in_expression62);
++            aexpr6=aexpr(ctx);
++
++            FOLLOWPOP();
++            if  (HASEXCEPTION())
++            {
++                goto ruleexpressionEx;
++            }
++
++            ADAPTOR->addChild(ADAPTOR, root_0, aexpr6.tree);
++
++            // SMARTPL.g:30:20: ( OR aexpr )*
++
++            for (;;)
++            {
++                int alt1=2;
++                switch ( LA(1) ) 
++                {
++                case OR:
++                      {
++                              alt1=1;
++                      }
++                    break;
++
++                }
++
++                switch (alt1) 
++                {
++              case 1:
++                  // SMARTPL.g:30:21: OR aexpr
++                  {
++                      OR7 = (pANTLR3_COMMON_TOKEN) MATCHT(OR, &FOLLOW_OR_in_expression65); 
++                      if  (HASEXCEPTION())
++                      {
++                          goto ruleexpressionEx;
++                      }
++
++                      OR7_tree = (pANTLR3_BASE_TREE)(ADAPTOR->create(ADAPTOR, OR7));
++                      root_0 = (pANTLR3_BASE_TREE)(ADAPTOR->becomeRoot(ADAPTOR, OR7_tree, root_0));
++
++                      FOLLOWPUSH(FOLLOW_aexpr_in_expression68);
++                      aexpr8=aexpr(ctx);
++
++                      FOLLOWPOP();
++                      if  (HASEXCEPTION())
++                      {
++                          goto ruleexpressionEx;
++                      }
++
++                      ADAPTOR->addChild(ADAPTOR, root_0, aexpr8.tree);
++
++                  }
++                  break;
++
++              default:
++                  goto loop1; /* break out of the loop */
++                  break;
++                }
++            }
++            loop1: ; /* Jump out to here if this rule does not match */
++
++
++        }
++
++    }
++    
++
++    // This is where rules clean up and exit
++    //
++    goto ruleexpressionEx; /* Prevent compiler warnings */
++    ruleexpressionEx: ;
++    retval.stop = LT(-1);
++
++      retval.stop = LT(-1);
++      retval.tree = (pANTLR3_BASE_TREE)(ADAPTOR->rulePostProcessing(ADAPTOR, root_0));
++      ADAPTOR->setTokenBoundaries(ADAPTOR, retval.tree, retval.start, retval.stop);
++
++            if (HASEXCEPTION())
++            {
++                PREPORTERROR();
++                PRECOVER();
++                retval.tree = (pANTLR3_BASE_TREE)(ADAPTOR->errorNode(ADAPTOR, INPUT, retval.start, LT(-1), EXCEPTION));
++            }
++
++
++    return retval;
++}
++/* $ANTLR end expression */
++
++/** 
++ * $ANTLR start aexpr
++ * SMARTPL.g:33:1: aexpr : nexpr ( AND nexpr )* ;
++ */
++static SMARTPLParser_aexpr_return
++aexpr(pSMARTPLParser ctx)
++{   
++    SMARTPLParser_aexpr_return retval;
++
++    pANTLR3_BASE_TREE root_0;
++
++    pANTLR3_COMMON_TOKEN    AND10;
++    SMARTPLParser_nexpr_return nexpr9;
++    #undef    RETURN_TYPE_nexpr9
++    #define   RETURN_TYPE_nexpr9 SMARTPLParser_nexpr_return
++
++    SMARTPLParser_nexpr_return nexpr11;
++    #undef    RETURN_TYPE_nexpr11
++    #define   RETURN_TYPE_nexpr11 SMARTPLParser_nexpr_return
++
++    pANTLR3_BASE_TREE AND10_tree;
++
++    /* Initialize rule variables
++     */
++
++
++    root_0 = NULL;
++
++    AND10       = NULL;
++    nexpr9.tree = NULL;
++
++    nexpr11.tree = NULL;
++
++    retval.start = LT(1); retval.stop = retval.start;
++
++    AND10_tree   = NULL;
++
++
++    retval.tree  = NULL;
++    {
++        // SMARTPL.g:33:8: ( nexpr ( AND nexpr )* )
++        // SMARTPL.g:33:10: nexpr ( AND nexpr )*
++        {
++            root_0 = (pANTLR3_BASE_TREE)(ADAPTOR->nilNode(ADAPTOR));
++
++            FOLLOWPUSH(FOLLOW_nexpr_in_aexpr83);
++            nexpr9=nexpr(ctx);
++
++            FOLLOWPOP();
++            if  (HASEXCEPTION())
++            {
++                goto ruleaexprEx;
++            }
++
++            ADAPTOR->addChild(ADAPTOR, root_0, nexpr9.tree);
++
++            // SMARTPL.g:33:16: ( AND nexpr )*
++
++            for (;;)
++            {
++                int alt2=2;
++                switch ( LA(1) ) 
++                {
++                case AND:
++                      {
++                              alt2=1;
++                      }
++                    break;
++
++                }
++
++                switch (alt2) 
++                {
++              case 1:
++                  // SMARTPL.g:33:17: AND nexpr
++                  {
++                      AND10 = (pANTLR3_COMMON_TOKEN) MATCHT(AND, &FOLLOW_AND_in_aexpr86); 
++                      if  (HASEXCEPTION())
++                      {
++                          goto ruleaexprEx;
++                      }
++
++                      AND10_tree = (pANTLR3_BASE_TREE)(ADAPTOR->create(ADAPTOR, AND10));
++                      root_0 = (pANTLR3_BASE_TREE)(ADAPTOR->becomeRoot(ADAPTOR, AND10_tree, root_0));
++
++                      FOLLOWPUSH(FOLLOW_nexpr_in_aexpr89);
++                      nexpr11=nexpr(ctx);
++
++                      FOLLOWPOP();
++                      if  (HASEXCEPTION())
++                      {
++                          goto ruleaexprEx;
++                      }
++
++                      ADAPTOR->addChild(ADAPTOR, root_0, nexpr11.tree);
++
++                  }
++                  break;
++
++              default:
++                  goto loop2; /* break out of the loop */
++                  break;
++                }
++            }
++            loop2: ; /* Jump out to here if this rule does not match */
++
++
++        }
++
++    }
++    
++
++    // This is where rules clean up and exit
++    //
++    goto ruleaexprEx; /* Prevent compiler warnings */
++    ruleaexprEx: ;
++    retval.stop = LT(-1);
++
++      retval.stop = LT(-1);
++      retval.tree = (pANTLR3_BASE_TREE)(ADAPTOR->rulePostProcessing(ADAPTOR, root_0));
++      ADAPTOR->setTokenBoundaries(ADAPTOR, retval.tree, retval.start, retval.stop);
++
++            if (HASEXCEPTION())
++            {
++                PREPORTERROR();
++                PRECOVER();
++                retval.tree = (pANTLR3_BASE_TREE)(ADAPTOR->errorNode(ADAPTOR, INPUT, retval.start, LT(-1), EXCEPTION));
++            }
++
++
++    return retval;
++}
++/* $ANTLR end aexpr */
++
++/** 
++ * $ANTLR start nexpr
++ * SMARTPL.g:36:1: nexpr : ( NOT crit | crit );
++ */
++static SMARTPLParser_nexpr_return
++nexpr(pSMARTPLParser ctx)
++{   
++    SMARTPLParser_nexpr_return retval;
++
++    pANTLR3_BASE_TREE root_0;
++
++    pANTLR3_COMMON_TOKEN    NOT12;
++    SMARTPLParser_crit_return crit13;
++    #undef    RETURN_TYPE_crit13
++    #define   RETURN_TYPE_crit13 SMARTPLParser_crit_return
++
++    SMARTPLParser_crit_return crit14;
++    #undef    RETURN_TYPE_crit14
++    #define   RETURN_TYPE_crit14 SMARTPLParser_crit_return
++
++    pANTLR3_BASE_TREE NOT12_tree;
++
++    /* Initialize rule variables
++     */
++
++
++    root_0 = NULL;
++
++    NOT12       = NULL;
++    crit13.tree = NULL;
++
++    crit14.tree = NULL;
++
++    retval.start = LT(1); retval.stop = retval.start;
++
++    NOT12_tree   = NULL;
++
++
++    retval.tree  = NULL;
++    {
++        {
++            //  SMARTPL.g:36:8: ( NOT crit | crit )
++            
++            ANTLR3_UINT32 alt3;
++
++            alt3=2;
++
++            switch ( LA(1) ) 
++            {
++            case NOT:
++              {
++                      alt3=1;
++              }
++                break;
++            case LPAR:
++            case STRTAG:
++            case INTTAG:
++            case DATETAG:
++            case ENUMTAG:
++              {
++                      alt3=2;
++              }
++                break;
++
++            default:
++                CONSTRUCTEX();
++                EXCEPTION->type         = ANTLR3_NO_VIABLE_ALT_EXCEPTION;
++                EXCEPTION->message      = (void *)"";
++                EXCEPTION->decisionNum  = 3;
++                EXCEPTION->state        = 0;
++
++
++                goto rulenexprEx;
++            }
++
++            switch (alt3) 
++            {
++              case 1:
++                  // SMARTPL.g:36:10: NOT crit
++                  {
++                      root_0 = (pANTLR3_BASE_TREE)(ADAPTOR->nilNode(ADAPTOR));
++
++                      NOT12 = (pANTLR3_COMMON_TOKEN) MATCHT(NOT, &FOLLOW_NOT_in_nexpr104); 
++                      if  (HASEXCEPTION())
++                      {
++                          goto rulenexprEx;
++                      }
++
++                      NOT12_tree = (pANTLR3_BASE_TREE)(ADAPTOR->create(ADAPTOR, NOT12));
++                      root_0 = (pANTLR3_BASE_TREE)(ADAPTOR->becomeRoot(ADAPTOR, NOT12_tree, root_0));
++
++                      FOLLOWPUSH(FOLLOW_crit_in_nexpr107);
++                      crit13=crit(ctx);
++
++                      FOLLOWPOP();
++                      if  (HASEXCEPTION())
++                      {
++                          goto rulenexprEx;
++                      }
++
++                      ADAPTOR->addChild(ADAPTOR, root_0, crit13.tree);
++
++                  }
++                  break;
++              case 2:
++                  // SMARTPL.g:37:6: crit
++                  {
++                      root_0 = (pANTLR3_BASE_TREE)(ADAPTOR->nilNode(ADAPTOR));
++
++                      FOLLOWPUSH(FOLLOW_crit_in_nexpr114);
++                      crit14=crit(ctx);
++
++                      FOLLOWPOP();
++                      if  (HASEXCEPTION())
++                      {
++                          goto rulenexprEx;
++                      }
++
++                      ADAPTOR->addChild(ADAPTOR, root_0, crit14.tree);
++
++                  }
++                  break;
++
++            }
++        }
++    }
++    
++
++    // This is where rules clean up and exit
++    //
++    goto rulenexprEx; /* Prevent compiler warnings */
++    rulenexprEx: ;
++    retval.stop = LT(-1);
++
++      retval.stop = LT(-1);
++      retval.tree = (pANTLR3_BASE_TREE)(ADAPTOR->rulePostProcessing(ADAPTOR, root_0));
++      ADAPTOR->setTokenBoundaries(ADAPTOR, retval.tree, retval.start, retval.stop);
++
++            if (HASEXCEPTION())
++            {
++                PREPORTERROR();
++                PRECOVER();
++                retval.tree = (pANTLR3_BASE_TREE)(ADAPTOR->errorNode(ADAPTOR, INPUT, retval.start, LT(-1), EXCEPTION));
++            }
++
++
++    return retval;
++}
++/* $ANTLR end nexpr */
++
++/** 
++ * $ANTLR start crit
++ * SMARTPL.g:40:1: crit : ( LPAR expression RPAR -> expression | STRTAG ( INCLUDES | IS ) STR | INTTAG INTBOOL INT | DATETAG ( AFTER | BEFORE ) dateval | ENUMTAG IS ENUMVAL );
++ */
++static SMARTPLParser_crit_return
++crit(pSMARTPLParser ctx)
++{   
++    SMARTPLParser_crit_return retval;
++
++    pANTLR3_BASE_TREE root_0;
++
++    pANTLR3_COMMON_TOKEN    LPAR15;
++    pANTLR3_COMMON_TOKEN    RPAR17;
++    pANTLR3_COMMON_TOKEN    STRTAG18;
++    pANTLR3_COMMON_TOKEN    set19;
++    pANTLR3_COMMON_TOKEN    STR20;
++    pANTLR3_COMMON_TOKEN    INTTAG21;
++    pANTLR3_COMMON_TOKEN    INTBOOL22;
++    pANTLR3_COMMON_TOKEN    INT23;
++    pANTLR3_COMMON_TOKEN    DATETAG24;
++    pANTLR3_COMMON_TOKEN    set25;
++    pANTLR3_COMMON_TOKEN    ENUMTAG27;
++    pANTLR3_COMMON_TOKEN    IS28;
++    pANTLR3_COMMON_TOKEN    ENUMVAL29;
++    SMARTPLParser_expression_return expression16;
++    #undef    RETURN_TYPE_expression16
++    #define   RETURN_TYPE_expression16 SMARTPLParser_expression_return
++
++    SMARTPLParser_dateval_return dateval26;
++    #undef    RETURN_TYPE_dateval26
++    #define   RETURN_TYPE_dateval26 SMARTPLParser_dateval_return
++
++    pANTLR3_BASE_TREE LPAR15_tree;
++    pANTLR3_BASE_TREE RPAR17_tree;
++    pANTLR3_BASE_TREE STRTAG18_tree;
++    pANTLR3_BASE_TREE set19_tree;
++    pANTLR3_BASE_TREE STR20_tree;
++    pANTLR3_BASE_TREE INTTAG21_tree;
++    pANTLR3_BASE_TREE INTBOOL22_tree;
++    pANTLR3_BASE_TREE INT23_tree;
++    pANTLR3_BASE_TREE DATETAG24_tree;
++    pANTLR3_BASE_TREE set25_tree;
++    pANTLR3_BASE_TREE ENUMTAG27_tree;
++    pANTLR3_BASE_TREE IS28_tree;
++    pANTLR3_BASE_TREE ENUMVAL29_tree;
++    pANTLR3_REWRITE_RULE_TOKEN_STREAM stream_RPAR;
++    pANTLR3_REWRITE_RULE_TOKEN_STREAM stream_LPAR;
++    pANTLR3_REWRITE_RULE_SUBTREE_STREAM stream_expression;
++    /* Initialize rule variables
++     */
++
++
++    root_0 = NULL;
++
++    LPAR15       = NULL;
++    RPAR17       = NULL;
++    STRTAG18       = NULL;
++    set19       = NULL;
++    STR20       = NULL;
++    INTTAG21       = NULL;
++    INTBOOL22       = NULL;
++    INT23       = NULL;
++    DATETAG24       = NULL;
++    set25       = NULL;
++    ENUMTAG27       = NULL;
++    IS28       = NULL;
++    ENUMVAL29       = NULL;
++    expression16.tree = NULL;
++
++    dateval26.tree = NULL;
++
++    retval.start = LT(1); retval.stop = retval.start;
++
++    LPAR15_tree   = NULL;
++    RPAR17_tree   = NULL;
++    STRTAG18_tree   = NULL;
++    set19_tree   = NULL;
++    STR20_tree   = NULL;
++    INTTAG21_tree   = NULL;
++    INTBOOL22_tree   = NULL;
++    INT23_tree   = NULL;
++    DATETAG24_tree   = NULL;
++    set25_tree   = NULL;
++    ENUMTAG27_tree   = NULL;
++    IS28_tree   = NULL;
++    ENUMVAL29_tree   = NULL;
++
++    stream_RPAR   = NULL;
++    #define CREATE_stream_RPAR  if (stream_RPAR == NULL) {stream_RPAR = antlr3RewriteRuleTOKENStreamNewAE(ADAPTOR, RECOGNIZER, (pANTLR3_UINT8)"token RPAR"); } 
++    stream_LPAR   = NULL;
++    #define CREATE_stream_LPAR  if (stream_LPAR == NULL) {stream_LPAR = antlr3RewriteRuleTOKENStreamNewAE(ADAPTOR, RECOGNIZER, (pANTLR3_UINT8)"token LPAR"); } 
++    stream_expression   = NULL;
++    #define CREATE_stream_expression  if (stream_expression == NULL) {stream_expression = antlr3RewriteRuleSubtreeStreamNewAE(ADAPTOR, RECOGNIZER, (pANTLR3_UINT8)"rule expression"); }
++
++    retval.tree  = NULL;
++    {
++        {
++            //  SMARTPL.g:40:7: ( LPAR expression RPAR -> expression | STRTAG ( INCLUDES | IS ) STR | INTTAG INTBOOL INT | DATETAG ( AFTER | BEFORE ) dateval | ENUMTAG IS ENUMVAL )
++            
++            ANTLR3_UINT32 alt4;
++
++            alt4=5;
++
++            switch ( LA(1) ) 
++            {
++            case LPAR:
++              {
++                      alt4=1;
++              }
++                break;
++            case STRTAG:
++              {
++                      alt4=2;
++              }
++                break;
++            case INTTAG:
++              {
++                      alt4=3;
++              }
++                break;
++            case DATETAG:
++              {
++                      alt4=4;
++              }
++                break;
++            case ENUMTAG:
++              {
++                      alt4=5;
++              }
++                break;
++
++            default:
++                CONSTRUCTEX();
++                EXCEPTION->type         = ANTLR3_NO_VIABLE_ALT_EXCEPTION;
++                EXCEPTION->message      = (void *)"";
++                EXCEPTION->decisionNum  = 4;
++                EXCEPTION->state        = 0;
++
++
++                goto rulecritEx;
++            }
++
++            switch (alt4) 
++            {
++              case 1:
++                  // SMARTPL.g:40:9: LPAR expression RPAR
++                  {
++                      LPAR15 = (pANTLR3_COMMON_TOKEN) MATCHT(LPAR, &FOLLOW_LPAR_in_crit127); 
++                      if  (HASEXCEPTION())
++                      {
++                          goto rulecritEx;
++                      }
++                       
++                      CREATE_stream_LPAR; stream_LPAR->add(stream_LPAR, LPAR15, NULL);
++
++                      FOLLOWPUSH(FOLLOW_expression_in_crit129);
++                      expression16=expression(ctx);
++
++                      FOLLOWPOP();
++                      if  (HASEXCEPTION())
++                      {
++                          goto rulecritEx;
++                      }
++
++                      CREATE_stream_expression; stream_expression->add(stream_expression, expression16.tree, NULL);
++                      RPAR17 = (pANTLR3_COMMON_TOKEN) MATCHT(RPAR, &FOLLOW_RPAR_in_crit131); 
++                      if  (HASEXCEPTION())
++                      {
++                          goto rulecritEx;
++                      }
++                       
++                      CREATE_stream_RPAR; stream_RPAR->add(stream_RPAR, RPAR17, NULL);
++
++
++                       
++                      /* AST REWRITE
++                       * elements          : expression
++                       * token labels      : 
++                       * rule labels       : retval
++                       * token list labels : 
++                       * rule list labels  : 
++                       */
++                      {
++                              pANTLR3_REWRITE_RULE_SUBTREE_STREAM stream_retval;
++
++                              stream_retval=antlr3RewriteRuleSubtreeStreamNewAEE(ADAPTOR,  RECOGNIZER, (pANTLR3_UINT8)"token retval", retval.tree != NULL ? retval.tree : NULL);
++
++                              root_0                      = (pANTLR3_BASE_TREE)(ADAPTOR->nilNode(ADAPTOR));
++                              retval.tree    = root_0;
++                              // 40:30: -> expression
++                              {
++                                  ADAPTOR->addChild(ADAPTOR, root_0, stream_expression == NULL ? NULL : stream_expression->nextTree(stream_expression));
++
++                              }
++
++                              retval.tree = root_0; // set result root
++                              if (stream_retval != NULL) stream_retval->free(stream_retval);
++
++
++                      }
++                  }
++                  break;
++              case 2:
++                  // SMARTPL.g:41:6: STRTAG ( INCLUDES | IS ) STR
++                  {
++                      root_0 = (pANTLR3_BASE_TREE)(ADAPTOR->nilNode(ADAPTOR));
++
++                      STRTAG18 = (pANTLR3_COMMON_TOKEN) MATCHT(STRTAG, &FOLLOW_STRTAG_in_crit142); 
++                      if  (HASEXCEPTION())
++                      {
++                          goto rulecritEx;
++                      }
++
++                      STRTAG18_tree = (pANTLR3_BASE_TREE)(ADAPTOR->create(ADAPTOR, STRTAG18));
++                      ADAPTOR->addChild(ADAPTOR, root_0, STRTAG18_tree);
++
++                      set19=(pANTLR3_COMMON_TOKEN)LT(1);
++                      if ( ((LA(1) >= INCLUDES) && (LA(1) <= IS)) )
++                      {
++                          CONSUME();
++                          ADAPTOR->addChild(ADAPTOR, root_0, (pANTLR3_BASE_TREE)(ADAPTOR->create(ADAPTOR, set19)));
++                          PERRORRECOVERY=ANTLR3_FALSE;
++                      }
++                      else 
++                      {
++                          CONSTRUCTEX();
++                          EXCEPTION->type         = ANTLR3_MISMATCHED_SET_EXCEPTION;
++                          EXCEPTION->name         = (void *)ANTLR3_MISMATCHED_SET_NAME;
++                          EXCEPTION->expectingSet = &FOLLOW_set_in_crit144;
++                          RECOVERFROMMISMATCHEDSET(&FOLLOW_set_in_crit144);    goto rulecritEx;
++                      }
++
++                      STR20 = (pANTLR3_COMMON_TOKEN) MATCHT(STR, &FOLLOW_STR_in_crit150); 
++                      if  (HASEXCEPTION())
++                      {
++                          goto rulecritEx;
++                      }
++
++                      STR20_tree = (pANTLR3_BASE_TREE)(ADAPTOR->create(ADAPTOR, STR20));
++                      ADAPTOR->addChild(ADAPTOR, root_0, STR20_tree);
++
++
++                  }
++                  break;
++              case 3:
++                  // SMARTPL.g:42:6: INTTAG INTBOOL INT
++                  {
++                      root_0 = (pANTLR3_BASE_TREE)(ADAPTOR->nilNode(ADAPTOR));
++
++                      INTTAG21 = (pANTLR3_COMMON_TOKEN) MATCHT(INTTAG, &FOLLOW_INTTAG_in_crit157); 
++                      if  (HASEXCEPTION())
++                      {
++                          goto rulecritEx;
++                      }
++
++                      INTTAG21_tree = (pANTLR3_BASE_TREE)(ADAPTOR->create(ADAPTOR, INTTAG21));
++                      ADAPTOR->addChild(ADAPTOR, root_0, INTTAG21_tree);
++
++                      INTBOOL22 = (pANTLR3_COMMON_TOKEN) MATCHT(INTBOOL, &FOLLOW_INTBOOL_in_crit159); 
++                      if  (HASEXCEPTION())
++                      {
++                          goto rulecritEx;
++                      }
++
++                      INTBOOL22_tree = (pANTLR3_BASE_TREE)(ADAPTOR->create(ADAPTOR, INTBOOL22));
++                      ADAPTOR->addChild(ADAPTOR, root_0, INTBOOL22_tree);
++
++                      INT23 = (pANTLR3_COMMON_TOKEN) MATCHT(INT, &FOLLOW_INT_in_crit161); 
++                      if  (HASEXCEPTION())
++                      {
++                          goto rulecritEx;
++                      }
++
++                      INT23_tree = (pANTLR3_BASE_TREE)(ADAPTOR->create(ADAPTOR, INT23));
++                      ADAPTOR->addChild(ADAPTOR, root_0, INT23_tree);
++
++
++                  }
++                  break;
++              case 4:
++                  // SMARTPL.g:43:6: DATETAG ( AFTER | BEFORE ) dateval
++                  {
++                      root_0 = (pANTLR3_BASE_TREE)(ADAPTOR->nilNode(ADAPTOR));
++
++                      DATETAG24 = (pANTLR3_COMMON_TOKEN) MATCHT(DATETAG, &FOLLOW_DATETAG_in_crit168); 
++                      if  (HASEXCEPTION())
++                      {
++                          goto rulecritEx;
++                      }
++
++                      DATETAG24_tree = (pANTLR3_BASE_TREE)(ADAPTOR->create(ADAPTOR, DATETAG24));
++                      ADAPTOR->addChild(ADAPTOR, root_0, DATETAG24_tree);
++
++                      set25=(pANTLR3_COMMON_TOKEN)LT(1);
++                      if ( ((LA(1) >= AFTER) && (LA(1) <= BEFORE)) )
++                      {
++                          CONSUME();
++                          ADAPTOR->addChild(ADAPTOR, root_0, (pANTLR3_BASE_TREE)(ADAPTOR->create(ADAPTOR, set25)));
++                          PERRORRECOVERY=ANTLR3_FALSE;
++                      }
++                      else 
++                      {
++                          CONSTRUCTEX();
++                          EXCEPTION->type         = ANTLR3_MISMATCHED_SET_EXCEPTION;
++                          EXCEPTION->name         = (void *)ANTLR3_MISMATCHED_SET_NAME;
++                          EXCEPTION->expectingSet = &FOLLOW_set_in_crit170;
++                          RECOVERFROMMISMATCHEDSET(&FOLLOW_set_in_crit170);    goto rulecritEx;
++                      }
++
++                      FOLLOWPUSH(FOLLOW_dateval_in_crit176);
++                      dateval26=dateval(ctx);
++
++                      FOLLOWPOP();
++                      if  (HASEXCEPTION())
++                      {
++                          goto rulecritEx;
++                      }
++
++                      ADAPTOR->addChild(ADAPTOR, root_0, dateval26.tree);
++
++                  }
++                  break;
++              case 5:
++                  // SMARTPL.g:44:6: ENUMTAG IS ENUMVAL
++                  {
++                      root_0 = (pANTLR3_BASE_TREE)(ADAPTOR->nilNode(ADAPTOR));
++
++                      ENUMTAG27 = (pANTLR3_COMMON_TOKEN) MATCHT(ENUMTAG, &FOLLOW_ENUMTAG_in_crit183); 
++                      if  (HASEXCEPTION())
++                      {
++                          goto rulecritEx;
++                      }
++
++                      ENUMTAG27_tree = (pANTLR3_BASE_TREE)(ADAPTOR->create(ADAPTOR, ENUMTAG27));
++                      ADAPTOR->addChild(ADAPTOR, root_0, ENUMTAG27_tree);
++
++                      IS28 = (pANTLR3_COMMON_TOKEN) MATCHT(IS, &FOLLOW_IS_in_crit185); 
++                      if  (HASEXCEPTION())
++                      {
++                          goto rulecritEx;
++                      }
++
++                      IS28_tree = (pANTLR3_BASE_TREE)(ADAPTOR->create(ADAPTOR, IS28));
++                      ADAPTOR->addChild(ADAPTOR, root_0, IS28_tree);
++
++                      ENUMVAL29 = (pANTLR3_COMMON_TOKEN) MATCHT(ENUMVAL, &FOLLOW_ENUMVAL_in_crit187); 
++                      if  (HASEXCEPTION())
++                      {
++                          goto rulecritEx;
++                      }
++
++                      ENUMVAL29_tree = (pANTLR3_BASE_TREE)(ADAPTOR->create(ADAPTOR, ENUMVAL29));
++                      ADAPTOR->addChild(ADAPTOR, root_0, ENUMVAL29_tree);
++
++
++                  }
++                  break;
++
++            }
++        }
++    }
++    
++
++    // This is where rules clean up and exit
++    //
++    goto rulecritEx; /* Prevent compiler warnings */
++    rulecritEx: ;
++    retval.stop = LT(-1);
++
++      retval.stop = LT(-1);
++      retval.tree = (pANTLR3_BASE_TREE)(ADAPTOR->rulePostProcessing(ADAPTOR, root_0));
++      ADAPTOR->setTokenBoundaries(ADAPTOR, retval.tree, retval.start, retval.stop);
++        if (stream_RPAR != NULL) stream_RPAR->free(stream_RPAR);
++        if (stream_LPAR != NULL) stream_LPAR->free(stream_LPAR);
++        if (stream_expression != NULL) stream_expression->free(stream_expression);
++
++            if (HASEXCEPTION())
++            {
++                PREPORTERROR();
++                PRECOVER();
++                retval.tree = (pANTLR3_BASE_TREE)(ADAPTOR->errorNode(ADAPTOR, INPUT, retval.start, LT(-1), EXCEPTION));
++            }
++
++
++    return retval;
++}
++/* $ANTLR end crit */
++
++/** 
++ * $ANTLR start dateval
++ * SMARTPL.g:47:1: dateval : ( DATE | interval BEFORE DATE | interval AFTER DATE | interval AGO );
++ */
++static SMARTPLParser_dateval_return
++dateval(pSMARTPLParser ctx)
++{   
++    SMARTPLParser_dateval_return retval;
++
++    pANTLR3_BASE_TREE root_0;
++
++    pANTLR3_COMMON_TOKEN    DATE30;
++    pANTLR3_COMMON_TOKEN    BEFORE32;
++    pANTLR3_COMMON_TOKEN    DATE33;
++    pANTLR3_COMMON_TOKEN    AFTER35;
++    pANTLR3_COMMON_TOKEN    DATE36;
++    pANTLR3_COMMON_TOKEN    AGO38;
++    SMARTPLParser_interval_return interval31;
++    #undef    RETURN_TYPE_interval31
++    #define   RETURN_TYPE_interval31 SMARTPLParser_interval_return
++
++    SMARTPLParser_interval_return interval34;
++    #undef    RETURN_TYPE_interval34
++    #define   RETURN_TYPE_interval34 SMARTPLParser_interval_return
++
++    SMARTPLParser_interval_return interval37;
++    #undef    RETURN_TYPE_interval37
++    #define   RETURN_TYPE_interval37 SMARTPLParser_interval_return
++
++    pANTLR3_BASE_TREE DATE30_tree;
++    pANTLR3_BASE_TREE BEFORE32_tree;
++    pANTLR3_BASE_TREE DATE33_tree;
++    pANTLR3_BASE_TREE AFTER35_tree;
++    pANTLR3_BASE_TREE DATE36_tree;
++    pANTLR3_BASE_TREE AGO38_tree;
++
++    /* Initialize rule variables
++     */
++
++
++    root_0 = NULL;
++
++    DATE30       = NULL;
++    BEFORE32       = NULL;
++    DATE33       = NULL;
++    AFTER35       = NULL;
++    DATE36       = NULL;
++    AGO38       = NULL;
++    interval31.tree = NULL;
++
++    interval34.tree = NULL;
++
++    interval37.tree = NULL;
++
++    retval.start = LT(1); retval.stop = retval.start;
++
++    DATE30_tree   = NULL;
++    BEFORE32_tree   = NULL;
++    DATE33_tree   = NULL;
++    AFTER35_tree   = NULL;
++    DATE36_tree   = NULL;
++    AGO38_tree   = NULL;
++
++
++    retval.tree  = NULL;
++    {
++        {
++            //  SMARTPL.g:47:10: ( DATE | interval BEFORE DATE | interval AFTER DATE | interval AGO )
++            
++            ANTLR3_UINT32 alt5;
++
++            alt5=4;
++
++            switch ( LA(1) ) 
++            {
++            case DATE:
++              {
++                      alt5=1;
++              }
++                break;
++            case INT:
++              {
++                      switch ( LA(2) ) 
++                      {
++                      case DATINTERVAL:
++                              {
++                                      switch ( LA(3) ) 
++                                      {
++                                      case AGO:
++                                              {
++                                                      alt5=4;
++                                              }
++                                          break;
++                                      case AFTER:
++                                              {
++                                                      alt5=3;
++                                              }
++                                          break;
++                                      case BEFORE:
++                                              {
++                                                      alt5=2;
++                                              }
++                                          break;
++
++                                      default:
++                                          CONSTRUCTEX();
++                                          EXCEPTION->type         = ANTLR3_NO_VIABLE_ALT_EXCEPTION;
++                                          EXCEPTION->message      = (void *)"";
++                                          EXCEPTION->decisionNum  = 5;
++                                          EXCEPTION->state        = 3;
++
++
++                                          goto ruledatevalEx;
++                                      }
++
++                              }
++                          break;
++
++                      default:
++                          CONSTRUCTEX();
++                          EXCEPTION->type         = ANTLR3_NO_VIABLE_ALT_EXCEPTION;
++                          EXCEPTION->message      = (void *)"";
++                          EXCEPTION->decisionNum  = 5;
++                          EXCEPTION->state        = 2;
++
++
++                          goto ruledatevalEx;
++                      }
++
++              }
++                break;
++
++            default:
++                CONSTRUCTEX();
++                EXCEPTION->type         = ANTLR3_NO_VIABLE_ALT_EXCEPTION;
++                EXCEPTION->message      = (void *)"";
++                EXCEPTION->decisionNum  = 5;
++                EXCEPTION->state        = 0;
++
++
++                goto ruledatevalEx;
++            }
++
++            switch (alt5) 
++            {
++              case 1:
++                  // SMARTPL.g:47:12: DATE
++                  {
++                      root_0 = (pANTLR3_BASE_TREE)(ADAPTOR->nilNode(ADAPTOR));
++
++                      DATE30 = (pANTLR3_COMMON_TOKEN) MATCHT(DATE, &FOLLOW_DATE_in_dateval200); 
++                      if  (HASEXCEPTION())
++                      {
++                          goto ruledatevalEx;
++                      }
++
++                      DATE30_tree = (pANTLR3_BASE_TREE)(ADAPTOR->create(ADAPTOR, DATE30));
++                      ADAPTOR->addChild(ADAPTOR, root_0, DATE30_tree);
++
++
++                  }
++                  break;
++              case 2:
++                  // SMARTPL.g:48:6: interval BEFORE DATE
++                  {
++                      root_0 = (pANTLR3_BASE_TREE)(ADAPTOR->nilNode(ADAPTOR));
++
++                      FOLLOWPUSH(FOLLOW_interval_in_dateval207);
++                      interval31=interval(ctx);
++
++                      FOLLOWPOP();
++                      if  (HASEXCEPTION())
++                      {
++                          goto ruledatevalEx;
++                      }
++
++                      ADAPTOR->addChild(ADAPTOR, root_0, interval31.tree);
++                      BEFORE32 = (pANTLR3_COMMON_TOKEN) MATCHT(BEFORE, &FOLLOW_BEFORE_in_dateval209); 
++                      if  (HASEXCEPTION())
++                      {
++                          goto ruledatevalEx;
++                      }
++
++                      BEFORE32_tree = (pANTLR3_BASE_TREE)(ADAPTOR->create(ADAPTOR, BEFORE32));
++                      ADAPTOR->addChild(ADAPTOR, root_0, BEFORE32_tree);
++
++                      DATE33 = (pANTLR3_COMMON_TOKEN) MATCHT(DATE, &FOLLOW_DATE_in_dateval211); 
++                      if  (HASEXCEPTION())
++                      {
++                          goto ruledatevalEx;
++                      }
++
++                      DATE33_tree = (pANTLR3_BASE_TREE)(ADAPTOR->create(ADAPTOR, DATE33));
++                      ADAPTOR->addChild(ADAPTOR, root_0, DATE33_tree);
++
++
++                  }
++                  break;
++              case 3:
++                  // SMARTPL.g:49:6: interval AFTER DATE
++                  {
++                      root_0 = (pANTLR3_BASE_TREE)(ADAPTOR->nilNode(ADAPTOR));
++
++                      FOLLOWPUSH(FOLLOW_interval_in_dateval218);
++                      interval34=interval(ctx);
++
++                      FOLLOWPOP();
++                      if  (HASEXCEPTION())
++                      {
++                          goto ruledatevalEx;
++                      }
++
++                      ADAPTOR->addChild(ADAPTOR, root_0, interval34.tree);
++                      AFTER35 = (pANTLR3_COMMON_TOKEN) MATCHT(AFTER, &FOLLOW_AFTER_in_dateval220); 
++                      if  (HASEXCEPTION())
++                      {
++                          goto ruledatevalEx;
++                      }
++
++                      AFTER35_tree = (pANTLR3_BASE_TREE)(ADAPTOR->create(ADAPTOR, AFTER35));
++                      ADAPTOR->addChild(ADAPTOR, root_0, AFTER35_tree);
++
++                      DATE36 = (pANTLR3_COMMON_TOKEN) MATCHT(DATE, &FOLLOW_DATE_in_dateval222); 
++                      if  (HASEXCEPTION())
++                      {
++                          goto ruledatevalEx;
++                      }
++
++                      DATE36_tree = (pANTLR3_BASE_TREE)(ADAPTOR->create(ADAPTOR, DATE36));
++                      ADAPTOR->addChild(ADAPTOR, root_0, DATE36_tree);
++
++
++                  }
++                  break;
++              case 4:
++                  // SMARTPL.g:50:6: interval AGO
++                  {
++                      root_0 = (pANTLR3_BASE_TREE)(ADAPTOR->nilNode(ADAPTOR));
++
++                      FOLLOWPUSH(FOLLOW_interval_in_dateval229);
++                      interval37=interval(ctx);
++
++                      FOLLOWPOP();
++                      if  (HASEXCEPTION())
++                      {
++                          goto ruledatevalEx;
++                      }
++
++                      ADAPTOR->addChild(ADAPTOR, root_0, interval37.tree);
++                      AGO38 = (pANTLR3_COMMON_TOKEN) MATCHT(AGO, &FOLLOW_AGO_in_dateval231); 
++                      if  (HASEXCEPTION())
++                      {
++                          goto ruledatevalEx;
++                      }
++
++                      AGO38_tree = (pANTLR3_BASE_TREE)(ADAPTOR->create(ADAPTOR, AGO38));
++                      ADAPTOR->addChild(ADAPTOR, root_0, AGO38_tree);
++
++
++                  }
++                  break;
++
++            }
++        }
++    }
++    
++
++    // This is where rules clean up and exit
++    //
++    goto ruledatevalEx; /* Prevent compiler warnings */
++    ruledatevalEx: ;
++    retval.stop = LT(-1);
++
++      retval.stop = LT(-1);
++      retval.tree = (pANTLR3_BASE_TREE)(ADAPTOR->rulePostProcessing(ADAPTOR, root_0));
++      ADAPTOR->setTokenBoundaries(ADAPTOR, retval.tree, retval.start, retval.stop);
++
++            if (HASEXCEPTION())
++            {
++                PREPORTERROR();
++                PRECOVER();
++                retval.tree = (pANTLR3_BASE_TREE)(ADAPTOR->errorNode(ADAPTOR, INPUT, retval.start, LT(-1), EXCEPTION));
++            }
++
++
++    return retval;
++}
++/* $ANTLR end dateval */
++
++/** 
++ * $ANTLR start interval
++ * SMARTPL.g:53:1: interval : INT DATINTERVAL ;
++ */
++static SMARTPLParser_interval_return
++interval(pSMARTPLParser ctx)
++{   
++    SMARTPLParser_interval_return retval;
++
++    pANTLR3_BASE_TREE root_0;
++
++    pANTLR3_COMMON_TOKEN    INT39;
++    pANTLR3_COMMON_TOKEN    DATINTERVAL40;
++
++    pANTLR3_BASE_TREE INT39_tree;
++    pANTLR3_BASE_TREE DATINTERVAL40_tree;
++
++    /* Initialize rule variables
++     */
++
++
++    root_0 = NULL;
++
++    INT39       = NULL;
++    DATINTERVAL40       = NULL;
++    retval.start = LT(1); retval.stop = retval.start;
++
++    INT39_tree   = NULL;
++    DATINTERVAL40_tree   = NULL;
++
++
++    retval.tree  = NULL;
++    {
++        // SMARTPL.g:53:10: ( INT DATINTERVAL )
++        // SMARTPL.g:53:12: INT DATINTERVAL
++        {
++            root_0 = (pANTLR3_BASE_TREE)(ADAPTOR->nilNode(ADAPTOR));
++
++            INT39 = (pANTLR3_COMMON_TOKEN) MATCHT(INT, &FOLLOW_INT_in_interval243); 
++            if  (HASEXCEPTION())
++            {
++                goto ruleintervalEx;
++            }
++
++            INT39_tree = (pANTLR3_BASE_TREE)(ADAPTOR->create(ADAPTOR, INT39));
++            ADAPTOR->addChild(ADAPTOR, root_0, INT39_tree);
++
++            DATINTERVAL40 = (pANTLR3_COMMON_TOKEN) MATCHT(DATINTERVAL, &FOLLOW_DATINTERVAL_in_interval245); 
++            if  (HASEXCEPTION())
++            {
++                goto ruleintervalEx;
++            }
++
++            DATINTERVAL40_tree = (pANTLR3_BASE_TREE)(ADAPTOR->create(ADAPTOR, DATINTERVAL40));
++            ADAPTOR->addChild(ADAPTOR, root_0, DATINTERVAL40_tree);
++
++
++        }
++
++    }
++    
++
++    // This is where rules clean up and exit
++    //
++    goto ruleintervalEx; /* Prevent compiler warnings */
++    ruleintervalEx: ;
++    retval.stop = LT(-1);
++
++      retval.stop = LT(-1);
++      retval.tree = (pANTLR3_BASE_TREE)(ADAPTOR->rulePostProcessing(ADAPTOR, root_0));
++      ADAPTOR->setTokenBoundaries(ADAPTOR, retval.tree, retval.start, retval.stop);
++
++            if (HASEXCEPTION())
++            {
++                PREPORTERROR();
++                PRECOVER();
++                retval.tree = (pANTLR3_BASE_TREE)(ADAPTOR->errorNode(ADAPTOR, INPUT, retval.start, LT(-1), EXCEPTION));
++            }
++
++
++    return retval;
++}
++/* $ANTLR end interval */
++/* End of parsing rules
++ * ==============================================
++ */
++
++/* ==============================================
++ * Syntactic predicates
++ */
++/* End of syntactic predicates
++ * ==============================================
++ */
++
++ 
++ 
++
++
++
++/* End of code
++ * =============================================================================
++ */
+diff --git a/src/pregen/SMARTPLParser.h b/src/pregen/SMARTPLParser.h
+new file mode 100644
+index 0000000..5360136
+--- /dev/null
++++ b/src/pregen/SMARTPLParser.h
+@@ -0,0 +1,285 @@
++/** \file
++ *  This C header file was generated by $ANTLR version 3.2 debian-7ubuntu3
++ *
++ *     -  From the grammar source file : SMARTPL.g
++ *     -                            On : 2015-06-27 19:05:15
++ *     -                for the parser : SMARTPLParserParser *
++ * Editing it, at least manually, is not wise. 
++ *
++ * C language generator and runtime by Jim Idle, jimi|hereisanat|idle|dotgoeshere|ws.
++ *
++ *
++ * The parser SMARTPLParser has the callable functions (rules) shown below,
++ * which will invoke the code for the associated rule in the source grammar
++ * assuming that the input stream is pointing to a token/text stream that could begin
++ * this rule.
++ * 
++ * For instance if you call the first (topmost) rule in a parser grammar, you will
++ * get the results of a full parse, but calling a rule half way through the grammar will
++ * allow you to pass part of a full token stream to the parser, such as for syntax checking
++ * in editors and so on.
++ *
++ * The parser entry points are called indirectly (by function pointer to function) via
++ * a parser context typedef pSMARTPLParser, which is returned from a call to SMARTPLParserNew().
++ *
++ * The methods in pSMARTPLParser are  as follows:
++ *
++ *  - SMARTPLParser_playlist_return      pSMARTPLParser->playlist(pSMARTPLParser)
++ *  - SMARTPLParser_expression_return      pSMARTPLParser->expression(pSMARTPLParser)
++ *  - SMARTPLParser_aexpr_return      pSMARTPLParser->aexpr(pSMARTPLParser)
++ *  - SMARTPLParser_nexpr_return      pSMARTPLParser->nexpr(pSMARTPLParser)
++ *  - SMARTPLParser_crit_return      pSMARTPLParser->crit(pSMARTPLParser)
++ *  - SMARTPLParser_dateval_return      pSMARTPLParser->dateval(pSMARTPLParser)
++ *  - SMARTPLParser_interval_return      pSMARTPLParser->interval(pSMARTPLParser)
++ *
++ * The return type for any particular rule is of course determined by the source
++ * grammar file.
++ */
++// [The "BSD licence"]
++// Copyright (c) 2005-2009 Jim Idle, Temporal Wave LLC
++// http://www.temporal-wave.com
++// http://www.linkedin.com/in/jimidle
++//
++// All rights reserved.
++//
++// Redistribution and use in source and binary forms, with or without
++// modification, are permitted provided that the following conditions
++// are met:
++// 1. Redistributions of source code must retain the above copyright
++//    notice, this list of conditions and the following disclaimer.
++// 2. Redistributions in binary form must reproduce the above copyright
++//    notice, this list of conditions and the following disclaimer in the
++//    documentation and/or other materials provided with the distribution.
++// 3. The name of the author may not be used to endorse or promote products
++//    derived from this software without specific prior written permission.
++//
++// THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
++// IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
++// OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
++// IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
++// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
++// NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
++// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
++// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
++// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
++// THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
++
++#ifndef       _SMARTPLParser_H
++#define _SMARTPLParser_H
++/* =============================================================================
++ * Standard antlr3 C runtime definitions
++ */
++#include    <antlr3.h>
++
++/* End of standard antlr 3 runtime definitions
++ * =============================================================================
++ */
++ 
++#ifdef __cplusplus
++extern "C" {
++#endif
++
++// Forward declare the context typedef so that we can use it before it is
++// properly defined. Delegators and delegates (from import statements) are
++// interdependent and their context structures contain pointers to each other
++// C only allows such things to be declared if you pre-declare the typedef.
++//
++typedef struct SMARTPLParser_Ctx_struct SMARTPLParser, * pSMARTPLParser;
++
++
++
++#ifdef        ANTLR3_WINDOWS
++// Disable: Unreferenced parameter,                                                   - Rules with parameters that are not used
++//          constant conditional,                                                     - ANTLR realizes that a prediction is always true (synpred usually)
++//          initialized but unused variable                                   - tree rewrite variables declared but not needed
++//          Unreferenced local variable                                               - lexer rule declares but does not always use _type
++//          potentially unitialized variable used                     - retval always returned from a rule 
++//                    unreferenced local function has been removed    - susually getTokenNames or freeScope, they can go without warnigns
++//
++// These are only really displayed at warning level /W4 but that is the code ideal I am aiming at
++// and the codegen must generate some of these warnings by necessity, apart from 4100, which is
++// usually generated when a parser rule is given a parameter that it does not use. Mostly though
++// this is a matter of orthogonality hence I disable that one.
++//
++#pragma warning( disable : 4100 )
++#pragma warning( disable : 4101 )
++#pragma warning( disable : 4127 )
++#pragma warning( disable : 4189 )
++#pragma warning( disable : 4505 )
++#pragma warning( disable : 4701 )
++#endif
++typedef struct SMARTPLParser_playlist_return_struct
++{
++    /** Generic return elements for ANTLR3 rules that are not in tree parsers or returning trees
++     */
++    pANTLR3_COMMON_TOKEN    start;
++    pANTLR3_COMMON_TOKEN    stop;
++    pANTLR3_BASE_TREE tree;
++   
++}
++    SMARTPLParser_playlist_return;
++
++typedef struct SMARTPLParser_expression_return_struct
++{
++    /** Generic return elements for ANTLR3 rules that are not in tree parsers or returning trees
++     */
++    pANTLR3_COMMON_TOKEN    start;
++    pANTLR3_COMMON_TOKEN    stop;
++    pANTLR3_BASE_TREE tree;
++   
++}
++    SMARTPLParser_expression_return;
++
++typedef struct SMARTPLParser_aexpr_return_struct
++{
++    /** Generic return elements for ANTLR3 rules that are not in tree parsers or returning trees
++     */
++    pANTLR3_COMMON_TOKEN    start;
++    pANTLR3_COMMON_TOKEN    stop;
++    pANTLR3_BASE_TREE tree;
++   
++}
++    SMARTPLParser_aexpr_return;
++
++typedef struct SMARTPLParser_nexpr_return_struct
++{
++    /** Generic return elements for ANTLR3 rules that are not in tree parsers or returning trees
++     */
++    pANTLR3_COMMON_TOKEN    start;
++    pANTLR3_COMMON_TOKEN    stop;
++    pANTLR3_BASE_TREE tree;
++   
++}
++    SMARTPLParser_nexpr_return;
++
++typedef struct SMARTPLParser_crit_return_struct
++{
++    /** Generic return elements for ANTLR3 rules that are not in tree parsers or returning trees
++     */
++    pANTLR3_COMMON_TOKEN    start;
++    pANTLR3_COMMON_TOKEN    stop;
++    pANTLR3_BASE_TREE tree;
++   
++}
++    SMARTPLParser_crit_return;
++
++typedef struct SMARTPLParser_dateval_return_struct
++{
++    /** Generic return elements for ANTLR3 rules that are not in tree parsers or returning trees
++     */
++    pANTLR3_COMMON_TOKEN    start;
++    pANTLR3_COMMON_TOKEN    stop;
++    pANTLR3_BASE_TREE tree;
++   
++}
++    SMARTPLParser_dateval_return;
++
++typedef struct SMARTPLParser_interval_return_struct
++{
++    /** Generic return elements for ANTLR3 rules that are not in tree parsers or returning trees
++     */
++    pANTLR3_COMMON_TOKEN    start;
++    pANTLR3_COMMON_TOKEN    stop;
++    pANTLR3_BASE_TREE tree;
++   
++}
++    SMARTPLParser_interval_return;
++
++
++
++/** Context tracking structure for SMARTPLParser
++ */
++struct SMARTPLParser_Ctx_struct
++{
++    /** Built in ANTLR3 context tracker contains all the generic elements
++     *  required for context tracking.
++     */
++    pANTLR3_PARSER   pParser;
++
++
++     SMARTPLParser_playlist_return (*playlist)        (struct SMARTPLParser_Ctx_struct * ctx);
++     SMARTPLParser_expression_return (*expression)    (struct SMARTPLParser_Ctx_struct * ctx);
++     SMARTPLParser_aexpr_return (*aexpr)      (struct SMARTPLParser_Ctx_struct * ctx);
++     SMARTPLParser_nexpr_return (*nexpr)      (struct SMARTPLParser_Ctx_struct * ctx);
++     SMARTPLParser_crit_return (*crit)        (struct SMARTPLParser_Ctx_struct * ctx);
++     SMARTPLParser_dateval_return (*dateval)  (struct SMARTPLParser_Ctx_struct * ctx);
++     SMARTPLParser_interval_return (*interval)        (struct SMARTPLParser_Ctx_struct * ctx);
++    // Delegated rules
++    const char * (*getGrammarFileName)();
++    void          (*free)   (struct SMARTPLParser_Ctx_struct * ctx);
++    /* @headerFile.members() */
++    pANTLR3_BASE_TREE_ADAPTOR adaptor;
++    pANTLR3_VECTOR_FACTORY            vectors;
++    /* End @headerFile.members() */
++};
++
++// Function protoypes for the constructor functions that external translation units
++// such as delegators and delegates may wish to call.
++//
++ANTLR3_API pSMARTPLParser SMARTPLParserNew         (pANTLR3_COMMON_TOKEN_STREAM instream);
++ANTLR3_API pSMARTPLParser SMARTPLParserNewSSD      (pANTLR3_COMMON_TOKEN_STREAM instream, pANTLR3_RECOGNIZER_SHARED_STATE state);
++
++/** Symbolic definitions of all the tokens that the parser will work with.
++ * \{
++ *
++ * Antlr will define EOF, but we can't use that as it it is too common in
++ * in C header files and that would be confusing. There is no way to filter this out at the moment
++ * so we just undef it here for now. That isn't the value we get back from C recognizers
++ * anyway. We are looking for ANTLR3_TOKEN_EOF.
++ */
++#ifdef        EOF
++#undef        EOF
++#endif
++#ifdef        Tokens
++#undef        Tokens
++#endif 
++#define INTBOOL      14
++#define STRTAG      10
++#define AGO      22
++#define WHITESPACE      29
++#define GREATEREQUAL      25
++#define BEFORE      18
++#define DATETAG      16
++#define INT      15
++#define NOT      7
++#define AFTER      17
++#define AND      6
++#define EOF      -1
++#define INCLUDES      11
++#define STR      4
++#define T__30      30
++#define T__31      31
++#define GREATER      24
++#define LPAR      8
++#define ENUMTAG      19
++#define IS      12
++#define ENUMVAL      20
++#define EQUAL      28
++#define OR      5
++#define LESS      26
++#define RPAR      9
++#define DATE      21
++#define LESSEQUAL      27
++#define DATINTERVAL      23
++#define INTTAG      13
++#ifdef        EOF
++#undef        EOF
++#define       EOF     ANTLR3_TOKEN_EOF
++#endif
++
++#ifndef TOKENSOURCE
++#define TOKENSOURCE(lxr) lxr->pLexer->rec->state->tokSource
++#endif
++
++/* End of token definitions for SMARTPLParser
++ * =============================================================================
++ */
++/** \} */
++
++#ifdef __cplusplus
++}
++#endif
++
++#endif
++
++/* END - Note:Keep extra line feed to satisfy UNIX systems */
diff --git a/utils/banhosts/Makefile b/utils/banhosts/Makefile
new file mode 100644 (file)
index 0000000..0087a6f
--- /dev/null
@@ -0,0 +1,40 @@
+#
+# Copyright (C) 2015 OpenWrt.org
+#
+# This is free software, licensed under the GNU General Public License v2.
+# See /LICENSE for more information.
+#
+
+include $(TOPDIR)/rules.mk
+
+PKG_NAME:=banhostlist
+PKG_VERSION:=1
+PKG_RELEASE:=1
+
+PKG_BUILD_DIR=$(BUILD_DIR)/$(PKG_NAME)-$(PKG_VERSION)
+PKG_MAINTAINER:=Matteo Croce <matteo@openwrt.org>
+PKG_LICENCE:=GPL-2.0
+
+include $(INCLUDE_DIR)/package.mk
+
+define Package/banhostlist
+  SECTION:=utils
+  CATEGORY:=Utilities
+  TITLE:=List of advertising domains
+  URL:=http://winhelp2002.mvps.org/
+endef
+
+define Package/banhostlist/description
+List of domains serving advertising and malicious content to easily block them
+endef
+
+
+define Build/Compile/Default
+endef
+
+define Package/banhostlist/install
+       $(INSTALL_DIR) $(1)/etc/hotplug.d/iface
+       $(INSTALL_BIN) ./files/updatebanhost $(1)/etc/hotplug.d/iface/80-banhosts
+endef
+
+$(eval $(call BuildPackage,banhostlist))
diff --git a/utils/banhosts/files/updatebanhost b/utils/banhosts/files/updatebanhost
new file mode 100644 (file)
index 0000000..a00d9cb
--- /dev/null
@@ -0,0 +1,19 @@
+#!/bin/sh
+
+file=/tmp/banhost
+
+gethosts() {
+       logger -t "banhost[$$]" "Update $file"
+       wget -qO- http://winhelp2002.mvps.org/hosts.txt |awk 'BEGIN{printf "0.0.0.0"}/^0\.0\.0\.0/{printf " "$2}END{exit(!FNR)}' >$file || exit 1
+       echo -n $time >$file.time
+       exec killall -HUP dnsmasq
+}
+
+if [ "$ACTION" = ifup -a "$INTERFACE" = wan ]; then
+       read time </proc/uptime
+       time=${time%%.*}
+
+       [ -f $file -a -f $file.time ] || gethosts
+       read oldtime <$file.time
+       [ $((time - oldtime)) -lt 604800 ] || gethosts
+fi
index 6b19c9dccc952cf3202d934c3475e8562cc16b9c..0b29b5389dd10f590409bec894b79010fc251608 100644 (file)
@@ -9,12 +9,12 @@
 include $(TOPDIR)/rules.mk
 
 PKG_NAME:=gammu
-PKG_VERSION:=1.34.0
-PKG_RELEASE:=3
+PKG_VERSION:=1.36.3
+PKG_RELEASE:=1
 
 PKG_SOURCE_URL:=http://dl.cihar.com/gammu/releases/
 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.xz
-PKG_MD5SUM:=5bc2508389d9b291ca0b8d4f210d0012
+PKG_MD5SUM:=d5a6914996ebedcd6cac6622f2e4018b
 PKG_MAINTAINER:=Vitaly Protsko <villy@sft.ru>
 PKG_LICENCE:=GPL-2.0
 
diff --git a/utils/hfsprogs/patches/0015-sysctl-only-on-glibc.patch b/utils/hfsprogs/patches/0015-sysctl-only-on-glibc.patch
new file mode 100644 (file)
index 0000000..b71290f
--- /dev/null
@@ -0,0 +1,91 @@
+--- a/newfs_hfs.tproj/makehfs.c
++++ b/newfs_hfs.tproj/makehfs.c
+@@ -37,7 +37,9 @@
+ #endif
+ #include <sys/errno.h>
+ #include <sys/stat.h>
++#ifdef __GLIBC__
+ #include <sys/sysctl.h>
++#endif
+ #if !LINUX
+ #include <sys/vmmeter.h>
+ #endif
+@@ -2039,6 +2041,7 @@ getencodinghint(unsigned char *name)
+         if (getvfsbyname("hfs", &vfc) < 0)
+               goto error;
++#ifdef __GLIBC__
+         mib[0] = CTL_VFS;
+         mib[1] = vfc.vfc_typenum;
+         mib[2] = HFS_ENCODINGHINT;
+@@ -2046,6 +2049,7 @@ getencodinghint(unsigned char *name)
+       if (sysctl(mib, 3, &hint, &buflen, name, strlen((char *)name) + 1) < 0)
+               goto error;
+       return (hint);
++#endif
+ error:
+       hint = GetDefaultEncoding();
+       return (0);
+@@ -2062,7 +2066,7 @@ void GenerateVolumeUUID(VolumeUUID *newV
+       clock_t uptime;
+       size_t datalen;
+       double sysloadavg[3];
+-#if !LINUX
++#if !LINUX && defined(__GLIBC__)
+       int sysdata;
+       int mib[2];
+       char sysctlstring[128];
+@@ -2080,7 +2084,7 @@ void GenerateVolumeUUID(VolumeUUID *newV
+               SHA1_Update(&context, &uptime, sizeof(uptime));
+               
+               /* The kernel's boot time: */
+-#if !LINUX
++#if !LINUX && defined(__GLIBC__)
+               mib[0] = CTL_KERN;
+               mib[1] = KERN_BOOTTIME;
+               datalen = sizeof(sysdata);
+@@ -2088,7 +2092,7 @@ void GenerateVolumeUUID(VolumeUUID *newV
+               SHA1_Update(&context, &sysdata, datalen);
+ #endif
+               /* The system's host id: */
+-#if !LINUX
++#if !LINUX && defined(__GLIBC__)
+               mib[0] = CTL_KERN;
+               mib[1] = KERN_HOSTID;
+               datalen = sizeof(sysdata);
+@@ -2096,7 +2100,7 @@ void GenerateVolumeUUID(VolumeUUID *newV
+               SHA1_Update(&context, &sysdata, datalen);
+ #endif
+               /* The system's host name: */
+-#if !LINUX
++#if !LINUX && defined(__GLIBC__)
+               mib[0] = CTL_KERN;
+               mib[1] = KERN_HOSTNAME;
+               datalen = sizeof(sysctlstring);
+@@ -2104,7 +2108,7 @@ void GenerateVolumeUUID(VolumeUUID *newV
+               SHA1_Update(&context, sysctlstring, datalen);
+ #endif
+               /* The running kernel's OS release string: */
+-#if !LINUX
++#if !LINUX && defined(__GLIBC__)
+               mib[0] = CTL_KERN;
+               mib[1] = KERN_OSRELEASE;
+               datalen = sizeof(sysctlstring);
+@@ -2112,7 +2116,7 @@ void GenerateVolumeUUID(VolumeUUID *newV
+               SHA1_Update(&context, sysctlstring, datalen);
+ #endif
+               /* The running kernel's version string: */
+-#if !LINUX
++#if !LINUX && defined(__GLIBC__)
+               mib[0] = CTL_KERN;
+               mib[1] = KERN_VERSION;
+               datalen = sizeof(sysctlstring);
+@@ -2127,7 +2131,7 @@ void GenerateVolumeUUID(VolumeUUID *newV
+ #endif
+               /* The system's VM statistics: */
+-#if !LINUX
++#if !LINUX && defined(__GLIBC__)
+               mib[0] = CTL_VM;
+               mib[1] = VM_METER;
+               datalen = sizeof(sysvmtotal);
index 3019d34d1e82ce878a3439c165c05a9120632fb5..3ca592cfb60cfdbeece35f6f633b9542b05a7162 100644 (file)
 include $(TOPDIR)/rules.mk
 
 PKG_NAME:=joe
-PKG_VERSION:=3.7
-PKG_RELEASE:=3
+PKG_VERSION:=4.0
+PKG_RELEASE:=4
 
 PKG_SOURCE_URL:=@SF/joe-editor
 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
-PKG_MD5SUM:=66de1b073e869ba12abbfcde3885c577
+PKG_MD5SUM:=3c3b6d5089a29ddc746ee89bab59286e
 PKG_BUILD_DIR=$(BUILD_DIR)/$(PKG_NAME)-$(PKG_VERSION)
 PKG_MAINTAINER:=Vitaly Protsko <villy@sft.ru>
 PKG_LICENCE:=GPL-1.0
@@ -48,7 +48,7 @@ endef
 
 define Package/joe/install
        $(INSTALL_DIR) $(1)/usr/bin
-       $(INSTALL_BIN) $(PKG_BUILD_DIR)/joe $(1)/usr/bin/
+       $(INSTALL_BIN) $(PKG_BUILD_DIR)/joe/joe $(1)/usr/bin/
        for i in jmacs jstar rjoe jpico; do \
          ln -sf joe $(1)/usr/bin/$$$$i; \
        done
index 24def75a1c6efc210e8b4841ffcf682c995dbb06..2c42beebd880987baee0b29037ed4588e65aef34 100644 (file)
@@ -619,3 +619,31 @@ type               ^@ TO 
 
 :querysr               Search & replace query window
 type           ^@ TO Ã¿
+
+:shell                 Input to shell windows
+:inherit main
+"\ 3"            ^C              Abort
+"\ 4"            ^D              Eof
+"      "       ^I              Tab
+"\b"            ^H              Backspace
+"\r"            ^M              Return
+"\7f"            ^?              Backspace
+
+:vtshell               Input to ANSI shell windows
+:inherit main
+"\e[A"          \e [ A
+"\e[A"          .ku
+"\e[B"          \e [ B
+"\e[B"          .kd
+"\e[C"          \e [ C
+"\e[C"          .kr
+"\e[D"          \e [ D
+"\e[D"          .kl
+"\ 1"            ^A              BOL for bash
+"\ 3"            ^C              Abort
+"\ 4"            ^D              Eof
+"\ 5"            ^E              EOL for bash
+"      "       ^I              Tab
+"\b"            ^H              Backspace
+"\r"            ^M              Return
+"\7f"            ^?              Backspace
diff --git a/utils/joe/patches/001-mathaway.patch b/utils/joe/patches/001-mathaway.patch
deleted file mode 100644 (file)
index 99fc930..0000000
+++ /dev/null
@@ -1,58 +0,0 @@
---- a/umath.c
-+++ b/umath.c
-@@ -378,7 +378,6 @@ double m_cos(double n) { return cos(n); 
- double m_tan(double n) { return tan(n); }
- double m_exp(double n) { return exp(n); }
- double m_sqrt(double n) { return sqrt(n); }
--double m_cbrt(double n) { return cbrt(n); }
- double m_log(double n) { return log(n); }
- double m_log10(double n) { return log10(n); }
- double m_asin(double n) { return asin(n); }
-@@ -387,19 +386,10 @@ double m_atan(double n) { return atan(n)
- double m_sinh(double n) { return sinh(n); }
- double m_cosh(double n) { return cosh(n); }
- double m_tanh(double n) { return tanh(n); }
--double m_asinh(double n) { return asinh(n); }
--double m_acosh(double n) { return acosh(n); }
--double m_atanh(double n) { return atanh(n); }
- double m_int(double n) { return (int)(n); }
- double m_floor(double n) { return floor(n); }
- double m_ceil(double n) { return ceil(n); }
- double m_fabs(double n) { return fabs(n); }
--double m_erf(double n) { return erf(n); }
--double m_erfc(double n) { return erfc(n); }
--double m_j0(double n) { return j0(n); }
--double m_j1(double n) { return j1(n); }
--double m_y0(double n) { return y0(n); }
--double m_y1(double n) { return y1(n); }
- double calc(BW *bw, unsigned char *s)
- {
-@@ -414,7 +404,6 @@ double calc(BW *bw, unsigned char *s)
-               v = get(USTR "tan"); v->func = m_tan;
-               v = get(USTR "exp"); v->func = m_exp;
-               v = get(USTR "sqrt"); v->func = m_sqrt;
--              v = get(USTR "cbrt"); v->func = m_cbrt;
-               v = get(USTR "ln"); v->func = m_log;
-               v = get(USTR "log"); v->func = m_log10;
-               v = get(USTR "asin"); v->func = m_asin;
-@@ -425,19 +414,10 @@ double calc(BW *bw, unsigned char *s)
-               v = get(USTR "sinh"); v->func = m_sinh;
-               v = get(USTR "cosh"); v->func = m_cosh;
-               v = get(USTR "tanh"); v->func = m_tanh;
--              v = get(USTR "asinh"); v->func = m_asinh;
--              v = get(USTR "acosh"); v->func = m_acosh;
--              v = get(USTR "atanh"); v->func = m_atanh;
-               v = get(USTR "int"); v->func = m_int;
-               v = get(USTR "floor"); v->func = m_floor;
-               v = get(USTR "ceil"); v->func = m_ceil;
-               v = get(USTR "abs"); v->func = m_fabs;
--              v = get(USTR "erf"); v->func = m_erf;
--              v = get(USTR "erfc"); v->func = m_erfc;
--              v = get(USTR "j0"); v->func = m_j0;
--              v = get(USTR "j1"); v->func = m_j1;
--              v = get(USTR "y0"); v->func = m_y0;
--              v = get(USTR "y1"); v->func = m_y1;
-       }
-       v = get(USTR "top");
diff --git a/utils/lcd4linux/Config.in b/utils/lcd4linux/Config.in
new file mode 100644 (file)
index 0000000..a57f795
--- /dev/null
@@ -0,0 +1,489 @@
+if PACKAGE_lcd4linux-custom
+
+config LCD4LINUX_CUSTOM_NEEDS_libdbus
+       bool
+
+#config LCD4LINUX_CUSTOM_NEEDS_libftdi
+#      bool
+
+config LCD4LINUX_CUSTOM_NEEDS_libgd
+       bool
+
+config LCD4LINUX_CUSTOM_NEEDS_libiconv
+       bool
+
+config LCD4LINUX_CUSTOM_NEEDS_libjpeg
+       bool
+
+config LCD4LINUX_CUSTOM_NEEDS_libmpdclient
+       bool
+
+config LCD4LINUX_CUSTOM_NEEDS_libmysqlclient
+       bool
+
+config LCD4LINUX_CUSTOM_NEEDS_libncurses
+       bool
+
+config LCD4LINUX_CUSTOM_NEEDS_libnmeap
+       bool
+
+config LCD4LINUX_CUSTOM_NEEDS_libsqlite3
+       bool
+
+config LCD4LINUX_CUSTOM_NEEDS_libusb
+       bool
+
+#config LCD4LINUX_CUSTOM_NEEDS_libX11
+#      bool
+
+config LCD4LINUX_CUSTOM_NEEDS_ppp
+       bool
+
+config LCD4LINUX_CUSTOM_NEEDS_python
+       bool
+
+
+comment "Drivers ---"
+
+config LCD4LINUX_CUSTOM_DRIVER_ASTUSB
+       bool
+       prompt "ASTUSB"
+
+config LCD4LINUX_CUSTOM_DRIVER_BeckmannEgle
+       bool
+       prompt "BeckmannEgle"
+
+config LCD4LINUX_CUSTOM_DRIVER_BWCT
+       bool
+       prompt "BWCT"
+       select LCD4LINUX_CUSTOM_NEEDS_libusb
+
+config LCD4LINUX_CUSTOM_DRIVER_CrystalFontz
+       bool
+       prompt "CrystalFontz"
+
+config LCD4LINUX_CUSTOM_DRIVER_Curses
+       bool
+       prompt "Curses"
+       select LCD4LINUX_CUSTOM_NEEDS_libncurses
+
+config LCD4LINUX_CUSTOM_DRIVER_Cwlinux
+       bool
+       prompt "Cwlinux"
+
+config LCD4LINUX_CUSTOM_DRIVER_D4D
+       bool
+       prompt "D4D"
+       select LCD4LINUX_CUSTOM_NEEDS_libgd
+
+config LCD4LINUX_CUSTOM_DRIVER_dpf
+       bool
+       prompt "dpf"
+       select LCD4LINUX_CUSTOM_NEEDS_libdpf
+
+config LCD4LINUX_CUSTOM_DRIVER_EA232graphic
+       bool
+       prompt "EA232graphic"
+       select LCD4LINUX_CUSTOM_NEEDS_libgd
+
+config LCD4LINUX_CUSTOM_DRIVER_EFN
+       bool
+       prompt "EFN"
+
+config LCD4LINUX_CUSTOM_DRIVER_FutabaVFD
+       bool
+       prompt "FutabaVFD"
+
+config LCD4LINUX_CUSTOM_DRIVER_FW8888
+       bool
+       prompt "FW8888"
+
+config LCD4LINUX_CUSTOM_DRIVER_G15
+       bool
+       prompt "G15"
+       select LCD4LINUX_CUSTOM_NEEDS_libgd
+       select LCD4LINUX_CUSTOM_NEEDS_libusb
+
+config LCD4LINUX_CUSTOM_DRIVER_GLCD2USB
+       bool
+       prompt "GLCD2USB"
+       select LCD4LINUX_CUSTOM_NEEDS_libgd
+       select LCD4LINUX_CUSTOM_NEEDS_libusb
+
+config LCD4LINUX_CUSTOM_DRIVER_HD44780
+       bool
+       prompt "HD44780"
+       depends on BROKEN
+
+config LCD4LINUX_CUSTOM_DRIVER_HD44780-I2C
+       bool
+       prompt "HD44780-I2C"
+       depends on BROKEN
+
+config LCD4LINUX_CUSTOM_DRIVER_IRLCD
+       bool
+       prompt "IRLCD"
+       select LCD4LINUX_CUSTOM_NEEDS_libusb
+
+config LCD4LINUX_CUSTOM_DRIVER_LCD2USB
+       bool
+       prompt "LCD2USB"
+       select LCD4LINUX_CUSTOM_NEEDS_libgd
+       select LCD4LINUX_CUSTOM_NEEDS_libusb
+
+config LCD4LINUX_CUSTOM_DRIVER_LCDLinux
+       bool
+       prompt "LCDLinux"
+       depends on BROKEN
+
+config LCD4LINUX_CUSTOM_DRIVER_LCDTerm
+       bool
+       prompt "LCDTerm"
+
+config LCD4LINUX_CUSTOM_DRIVER_LEDMatrix
+       bool
+       prompt "LEDMatrix"
+       select LCD4LINUX_CUSTOM_NEEDS_libgd
+
+config LCD4LINUX_CUSTOM_DRIVER_LPH7508
+       bool
+       prompt "LPH7508"
+       select LCD4LINUX_CUSTOM_NEEDS_libgd
+
+config LCD4LINUX_CUSTOM_DRIVER_LUIse
+       bool
+       prompt "LUIse"
+       select LCD4LINUX_CUSTOM_NEEDS_libgd
+       #select LCD4LINUX_CUSTOM_NEEDS_libluise
+       depends on BROKEN
+
+config LCD4LINUX_CUSTOM_DRIVER_LW_ABP
+       bool
+       prompt "LW_ABP"
+
+config LCD4LINUX_CUSTOM_DRIVER_M50530
+       bool
+       prompt "M50530"
+
+config LCD4LINUX_CUSTOM_DRIVER_MatrixOrbital
+       bool
+       prompt "MatrixOrbital"
+
+config LCD4LINUX_CUSTOM_DRIVER_MatrixOrbitalGX
+       bool
+       prompt "MatrixOrbitalGX"
+       select LCD4LINUX_CUSTOM_NEEDS_libgd
+       select LCD4LINUX_CUSTOM_NEEDS_libusb
+
+config LCD4LINUX_CUSTOM_DRIVER_mdm166a
+       bool
+       prompt "mdm166a"
+       select LCD4LINUX_CUSTOM_NEEDS_libgd
+
+config LCD4LINUX_CUSTOM_DRIVER_MilfordInstruments
+       bool
+       prompt "MilfordInstruments"
+
+config LCD4LINUX_CUSTOM_DRIVER_Newhaven
+       bool
+       prompt "Newhaven"
+
+config LCD4LINUX_CUSTOM_DRIVER_Noritake
+       bool
+       prompt "Noritake"
+       select LCD4LINUX_CUSTOM_NEEDS_libgd
+
+config LCD4LINUX_CUSTOM_DRIVER_NULL
+       bool
+       prompt "NULL"
+       default y
+
+config LCD4LINUX_CUSTOM_DRIVER_Pertelian
+       bool
+       prompt "Pertelian"
+
+config LCD4LINUX_CUSTOM_DRIVER_PHAnderson
+       bool
+       prompt "PHAnderson"
+
+config LCD4LINUX_CUSTOM_DRIVER_PICGraphic
+       bool
+       prompt "PICGraphic"
+       select LCD4LINUX_CUSTOM_NEEDS_libgd
+
+config LCD4LINUX_CUSTOM_DRIVER_picoLCD
+       bool
+       prompt "picoLCD"
+       select LCD4LINUX_CUSTOM_NEEDS_libusb
+
+config LCD4LINUX_CUSTOM_DRIVER_picoLCDGraphic
+       bool
+       prompt "picoLCDGraphic"
+       select LCD4LINUX_CUSTOM_NEEDS_libgd
+       select LCD4LINUX_CUSTOM_NEEDS_libusb
+
+config LCD4LINUX_CUSTOM_DRIVER_PNG
+       bool
+       prompt "PNG"
+       select LCD4LINUX_CUSTOM_NEEDS_libgd
+
+config LCD4LINUX_CUSTOM_DRIVER_PPM
+       bool
+       prompt "PPM"
+       select LCD4LINUX_CUSTOM_NEEDS_libgd
+
+config LCD4LINUX_CUSTOM_DRIVER_RouterBoard
+       bool
+       prompt "RouterBoard"
+       depends on TARGET_rb532
+
+config LCD4LINUX_CUSTOM_DRIVER_SamsungSPF
+       bool
+       prompt "SamsungSPF"
+       select LCD4LINUX_CUSTOM_NEEDS_libgd
+       select LCD4LINUX_CUSTOM_NEEDS_libjpeg
+
+config LCD4LINUX_CUSTOM_DRIVER_serdisplib
+       bool
+       prompt "serdisplib"
+       select LCD4LINUX_CUSTOM_NEEDS_libgd
+       select LCD4LINUX_CUSTOM_NEEDS_serdisplib
+
+config LCD4LINUX_CUSTOM_DRIVER_ShuttleVFD
+       bool
+       prompt "ShuttleVFD"
+       select LCD4LINUX_CUSTOM_NEEDS_libusb
+
+config LCD4LINUX_CUSTOM_DRIVER_SimpleLCD
+       bool
+       prompt "SimpleLCD"
+
+config LCD4LINUX_CUSTOM_DRIVER_st2205
+       bool
+       prompt "st2205"
+       select LCD4LINUX_CUSTOM_NEEDS_libgd
+       select LCD4LINUX_CUSTOM_NEEDS_st2205tool
+
+config LCD4LINUX_CUSTOM_DRIVER_T6963
+       bool
+       prompt "T6963"
+       select LCD4LINUX_CUSTOM_NEEDS_libgd
+
+config LCD4LINUX_CUSTOM_DRIVER_TeakLCM
+       bool
+       prompt "TeakLCM"
+
+config LCD4LINUX_CUSTOM_DRIVER_TEW673GRU
+       bool
+       select LCD4LINUX_CUSTOM_NEEDS_libgd
+       depends on TARGET_ar71xx
+       default TARGET_ar71xx
+
+config LCD4LINUX_CUSTOM_DRIVER_Trefon
+       bool
+       prompt "Trefon"
+       select LCD4LINUX_CUSTOM_NEEDS_libusb
+
+#config LCD4LINUX_CUSTOM_DRIVER_ULA200
+#      bool
+#      prompt "ULA200"
+#      select LCD4LINUX_CUSTOM_NEEDS_libftdi
+#      select LCD4LINUX_CUSTOM_NEEDS_libusb
+
+config LCD4LINUX_CUSTOM_DRIVER_USBHUB
+       bool
+       prompt "USBHUB"
+       select LCD4LINUX_CUSTOM_NEEDS_libusb
+
+config LCD4LINUX_CUSTOM_DRIVER_USBLCD
+       bool
+       prompt "USBLCD"
+       select LCD4LINUX_CUSTOM_NEEDS_libusb
+
+config LCD4LINUX_CUSTOM_DRIVER_VNC
+       bool
+       prompt "VNC"
+       select LCD4LINUX_CUSTOM_NEEDS_libgd
+       select LCD4LINUX_CUSTOM_NEEDS_libvncserver
+
+config LCD4LINUX_CUSTOM_DRIVER_WincorNixdorf
+       bool
+       prompt "WincorNixdorf"
+
+#config LCD4LINUX_CUSTOM_DRIVER_X11
+#      bool
+#      prompt "X11"
+#      select LCD4LINUX_CUSTOM_NEEDS_libgd
+#      select LCD4LINUX_CUSTOM_NEEDS_libX11
+
+
+comment "Plugins ---"
+
+config LCD4LINUX_CUSTOM_PLUGIN_apm
+       bool
+       prompt "apm"
+
+config LCD4LINUX_CUSTOM_PLUGIN_asterisk
+       bool
+       prompt "asterisk"
+
+config LCD4LINUX_CUSTOM_PLUGIN_button_exec
+       bool
+       prompt "button_exec"
+
+config LCD4LINUX_CUSTOM_PLUGIN_cpuinfo
+       bool
+       prompt "cpuinfo"
+       default y
+
+config LCD4LINUX_CUSTOM_PLUGIN_dbus
+       bool
+       prompt "dbus"
+       select LCD4LINUX_CUSTOM_NEEDS_libdbus
+
+config LCD4LINUX_CUSTOM_PLUGIN_diskstats
+       bool
+       prompt "diskstats"
+
+config LCD4LINUX_CUSTOM_PLUGIN_dvb
+       bool
+       prompt "dvb"
+
+config LCD4LINUX_CUSTOM_PLUGIN_event
+       bool
+       prompt "event"
+
+config LCD4LINUX_CUSTOM_PLUGIN_exec
+       bool
+       prompt "exec"
+
+config LCD4LINUX_CUSTOM_PLUGIN_fifo
+       bool
+       prompt "fifo"
+
+config LCD4LINUX_CUSTOM_PLUGIN_file
+       bool
+       prompt "file"
+
+config LCD4LINUX_CUSTOM_PLUGIN_gps
+       bool
+       prompt "gps"
+       select LCD4LINUX_CUSTOM_NEEDS_libnmeap
+
+config LCD4LINUX_CUSTOM_PLUGIN_hddtemp
+       bool
+       prompt "hddtemp"
+
+config LCD4LINUX_CUSTOM_PLUGIN_huawei
+       bool
+       prompt "huawei"
+
+config LCD4LINUX_CUSTOM_PLUGIN_i2c_sensors
+       bool
+       prompt "i2c_sensors"
+
+config LCD4LINUX_CUSTOM_PLUGIN_iconv
+       bool
+       prompt "iconv"
+       select LCD4LINUX_CUSTOM_NEEDS_libiconv
+
+config LCD4LINUX_CUSTOM_PLUGIN_imon
+       bool
+       prompt "imon"
+
+config LCD4LINUX_CUSTOM_PLUGIN_isdn
+       bool
+       prompt "isdn"
+
+config LCD4LINUX_CUSTOM_PLUGIN_kvv
+       bool
+       prompt "kvv"
+
+config LCD4LINUX_CUSTOM_PLUGIN_loadavg
+       bool
+       prompt "loadavg"
+       default y
+
+config LCD4LINUX_CUSTOM_PLUGIN_meminfo
+       bool
+       prompt "meminfo"
+       default y
+
+config LCD4LINUX_CUSTOM_PLUGIN_mpd
+       bool
+       prompt "mpd"
+       select LCD4LINUX_CUSTOM_NEEDS_libmpdclient
+
+config LCD4LINUX_CUSTOM_PLUGIN_mpris_dbus
+       bool
+       prompt "mpris_dbus"
+       select LCD4LINUX_CUSTOM_NEEDS_libdbus
+
+config LCD4LINUX_CUSTOM_PLUGIN_mysql
+       bool
+       prompt "mysql"
+       select LCD4LINUX_CUSTOM_NEEDS_libmysqlclient
+
+config LCD4LINUX_CUSTOM_PLUGIN_netdev
+       bool
+       prompt "netdev"
+
+config LCD4LINUX_CUSTOM_PLUGIN_netinfo
+       bool
+       prompt "netinfo"
+
+config LCD4LINUX_CUSTOM_PLUGIN_pop3
+       bool
+       prompt "pop3"
+
+config LCD4LINUX_CUSTOM_PLUGIN_ppp
+       bool
+       prompt "ppp"
+       select LCD4LINUX_CUSTOM_NEEDS_ppp
+
+config LCD4LINUX_CUSTOM_PLUGIN_proc_stat
+       bool
+       prompt "proc_stat"
+       default y
+
+#config LCD4LINUX_CUSTOM_PLUGIN_python
+#      bool
+#      prompt "python"
+#      select LCD4LINUX_CUSTOM_NEEDS_python
+
+config LCD4LINUX_CUSTOM_PLUGIN_qnaplog
+       bool
+       prompt "qnaplog"
+       select LCD4LINUX_CUSTOM_NEEDS_libsqlite3
+
+config LCD4LINUX_CUSTOM_PLUGIN_seti
+       bool
+       prompt "seti"
+
+config LCD4LINUX_CUSTOM_PLUGIN_statfs
+       bool
+       prompt "statfs"
+
+config LCD4LINUX_CUSTOM_PLUGIN_uname
+       bool
+       prompt "uname"
+
+config LCD4LINUX_CUSTOM_PLUGIN_uptime
+       bool
+       prompt "uptime"
+       default y
+
+config LCD4LINUX_CUSTOM_PLUGIN_w1retap
+       bool
+       prompt "w1retap"
+
+config LCD4LINUX_CUSTOM_PLUGIN_wireless
+       bool
+       prompt "wireless"
+       depends on BROKEN
+
+config LCD4LINUX_CUSTOM_PLUGIN_xmms
+       bool
+       prompt "xmms"
+
+endif
diff --git a/utils/lcd4linux/Makefile b/utils/lcd4linux/Makefile
new file mode 100644 (file)
index 0000000..54b0ed8
--- /dev/null
@@ -0,0 +1,309 @@
+#
+# Copyright (C) 2007-2015 OpenWrt.org
+#
+# This is free software, licensed under the GNU General Public License v2.
+# See /LICENSE for more information.
+#
+
+include $(TOPDIR)/rules.mk
+
+PKG_NAME:=lcd4linux
+PKG_REV:=1203
+PKG_VERSION:=r$(PKG_REV)
+PKG_RELEASE:=1
+
+PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.bz2
+PKG_SOURCE_URL:=https://ssl.bulix.org/svn/lcd4linux/trunk/
+PKG_SOURCE_SUBDIR:=lcd4linux-$(PKG_VERSION)
+PKG_SOURCE_VERSION:=$(PKG_REV)
+PKG_SOURCE_PROTO:=svn
+
+LCD4LINUX_DRIVERS:= \
+       ASTUSB \
+       BeckmannEgle \
+       BWCT \
+       CrystalFontz \
+       Curses \
+       Cwlinux \
+       D4D \
+       DPF \
+       EA232graphic \
+       EFN \
+       FutabaVFD \
+       FW8888 \
+       G15 \
+       GLCD2USB \
+       IRLCD \
+       $(if $(CONFIG_BROKEN),HD44780) \
+       $(if $(CONFIG_BROKEN),HD44780-I2C) \
+       LCD2USB \
+       $(if $(CONFIG_BROKEN),LCDLinux) \
+       LCDTerm \
+       LEDMatrix \
+       LPH7508 \
+       $(if $(CONFIG_BROKEN),LUIse) \
+       LW_ABP \
+       M50530 \
+       MatrixOrbital \
+       MatrixOrbitalGX \
+       MilfordInstruments \
+       Newhaven \
+       Noritake \
+       NULL \
+       Pertelian \
+       PHAnderson \
+       PICGraphic \
+       picoLCD \
+       picoLCDGraphic \
+       PNG \
+       PPM \
+       $(if $(CONFIG_TARGET_rb532),RouterBoard) \
+       $(if $(CONFIG_BROKEN),SamsungSPF) \
+       ShuttleVFD \
+       SimpleLCD \
+       st2205 \
+       T6963 \
+       TeakLCM \
+       $(if $(CONFIG_TARGET_ar71xx),TEW673GRU) \
+       Trefon \
+       USBHUB \
+       USBLCD \
+       VNC \
+       WincorNixdorf \
+#      ULA200 \
+#      X11 \
+
+LCD4LINUX_PLUGINS:= \
+       apm \
+       asterisk \
+       button_exec \
+       cpuinfo \
+       dbus \
+       diskstats \
+       dvb \
+       event \
+       exec \
+       fifo \
+       file \
+       gps \
+       hddtemp \
+       huawei \
+       i2c_sensors \
+       iconv \
+       imon \
+       isdn \
+       kvv \
+       loadavg \
+       netdev \
+       netinfo \
+       meminfo \
+       mpd \
+       mpris_dbus \
+       mysql \
+       netdev \
+       pop3 \
+       ppp \
+       proc_stat \
+       qnaplog \
+       seti \
+       statfs \
+       uname \
+       uptime \
+       w1retap \
+       $(if $(CONFIG_BROKEN),wireless) \
+       xmms \
+#      python \
+
+PKG_FIXUP:=autoreconf
+PKG_INSTALL:=1
+
+PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)-$(BUILD_VARIANT)/$(PKG_NAME)-$(PKG_VERSION)
+
+PKG_BUILD_DEPENDS:= \
+       libdbus \
+       libgd \
+       libmpdclient \
+       libmysqlclient \
+       libncurses \
+       libnmeap \
+       libsqlite3 \
+       ppp \
+#      libftdi \
+#      libX11 \
+#      python \
+
+PKG_CONFIG_DEPENDS:= \
+       $(patsubst %,CONFIG_LCD4LINUX_CUSTOM_DRIVER_%,$(LCD4LINUX_DRIVERS)) \
+       $(patsubst %,CONFIG_LCD4LINUX_CUSTOM_PLUGIN_%,$(LCD4LINUX_PLUGINS)) \
+
+include $(INCLUDE_DIR)/package.mk
+include $(INCLUDE_DIR)/nls.mk
+
+define Package/lcd4linux/Default
+  SECTION:=utils
+  CATEGORY:=Utilities
+  PKG_MAINTAINER:=Jonathan McCrohan <jmccrohan@gmail.com>
+  TITLE:=LCD display utility
+  URL:=http://lcd4linux.bulix.org/
+endef
+
+define Package/lcd4linux/Default/description
+ LCD4Linux is a small program that grabs information from the kernel and
+ some subsystems and displays it on an external liquid crystal display.
+endef
+
+
+define Package/lcd4linux-custom
+$(call Package/lcd4linux/Default)
+  DEPENDS:= \
+       +LCD4LINUX_CUSTOM_NEEDS_libdbus:libdbus \
+       +LCD4LINUX_CUSTOM_NEEDS_libgd:libgd \
+       $(if $(ICONV_FULL),+LCD4LINUX_CUSTOM_NEEDS_libiconv:libiconv-full) \
+       +LCD4LINUX_CUSTOM_NEEDS_libjpeg:libjpeg \
+       +LCD4LINUX_CUSTOM_NEEDS_libmpdclient:libmpdclient \
+       +LCD4LINUX_CUSTOM_NEEDS_libmysqlclient:libmysqlclient \
+       +LCD4LINUX_CUSTOM_NEEDS_libncurses:libncurses \
+       +LCD4LINUX_CUSTOM_NEEDS_libsqlite3:libsqlite3 \
+       +LCD4LINUX_CUSTOM_NEEDS_libusb:libusb-compat \
+#      +LCD4LINUX_CUSTOM_NEEDS_libftdi:libftdi \
+#      +LCD4LINUX_CUSTOM_NEEDS_libX11:libX11 \
+#      +LCD4LINUX_CUSTOM_NEEDS_python:python
+  MENU:=1
+  PROVIDES:=lcd4linux
+  VARIANT=custom
+endef
+
+define Package/lcd4linux-custom/config
+       source "$(SOURCE)/Config.in"
+endef
+
+define Package/lcd4linux-custom/description
+$(call Package/lcd4linux/Default/description)
+ .
+ This package contains a customized version of LCD4Linux.
+endef
+
+
+define Package/lcd4linux-full
+$(call Package/lcd4linux/Default)
+  DEPENDS:= @DEVEL \
+       +libdbus \
+       +libgd \
+       $(if $(ICONV_FULL),+libiconv-full) \
+       +libmpdclient \
+       +libmysqlclient \
+       +libncurses \
+       +libsqlite3 \
+       +libusb-compat \
+#      +libftdi \
+#      +libX11 \
+#      +python
+  PROVIDES:=lcd4linux
+  VARIANT=full
+endef
+
+define Package/lcd4linux-full/description
+$(call Package/lcd4linux/Default/description)
+ .
+ This package contains a version of LCD4Linux built with all supported
+ drivers and plugins.
+endef
+
+
+CONFIGURE_ARGS+= \
+       --disable-rpath \
+
+EXTRA_LDFLAGS+= -Wl,-rpath-link,$(STAGING_DIR)/usr/lib
+
+ifeq ($(BUILD_VARIANT),custom)
+
+  LCD4LINUX_CUSTOM_DRIVERS:= $(strip $(foreach c, $(LCD4LINUX_DRIVERS), \
+    $(if $(CONFIG_LCD4LINUX_CUSTOM_DRIVER_$(c)),$(c),) \
+ ))
+  ifeq ($(LCD4LINUX_CUSTOM_DRIVERS),)
+    LCD4LINUX_CUSTOM_DRIVERS:=Sample
+  endif
+
+  LCD4LINUX_CUSTOM_PLUGINS:= $(strip $(foreach c, $(LCD4LINUX_PLUGINS), \
+    $(if $(CONFIG_LCD4LINUX_CUSTOM_PLUGIN_$(c)),$(c)) \
+  ))
+  ifeq ($(LCD4LINUX_CUSTOM_PLUGINS),)
+    LCD4LINUX_CUSTOM_PLUGINS:=sample
+  endif
+
+  CONFIGURE_ARGS+= \
+       --with-drivers="$(LCD4LINUX_CUSTOM_DRIVERS)" \
+       --with-plugins="$(LCD4LINUX_CUSTOM_PLUGINS)" \
+
+  ifneq ($(CONFIG_LCD4LINUX_CUSTOM_NEEDS_libiconv),)
+    CONFIGURE_ARGS+= --with-libiconv-prefix="$(ICONV_PREFIX)"
+  else
+    CONFIGURE_ARGS+= --without-libiconv-prefix
+  endif
+
+  ifneq ($(CONFIG_LCD4LINUX_CUSTOM_NEEDS_libmysqlclient),)
+    EXTRA_LDFLAGS+= -L$(STAGING_DIR)/usr/lib/mysql
+  endif
+
+#  ifneq ($(CONFIG_LCD4LINUX_CUSTOM_NEEDS_python),)
+#    CONFIGURE_ARGS+= --with-python
+#  else
+    CONFIGURE_ARGS+= --without-python
+#  endif
+
+#  ifneq ($(CONFIG_LCD4LINUX_CUSTOM_NEEDS_libX11),)
+#    CONFIGURE_ARGS+= --with-x
+#  else
+    CONFIGURE_ARGS+= --without-x
+#  endif
+
+endif
+
+ifeq ($(BUILD_VARIANT),full)
+
+  LCD4LINUX_FULL_DRIVERS:= $(strip $(foreach c, $(LCD4LINUX_DRIVERS), \
+    $(c) \
+  ))
+
+  LCD4LINUX_FULL_PLUGINS:= $(strip $(foreach c, $(LCD4LINUX_PLUGINS), \
+    $(c) \
+  ))
+
+  CONFIGURE_ARGS+= \
+       --with-drivers="$(LCD4LINUX_FULL_DRIVERS)" \
+       --with-plugins="$(LCD4LINUX_FULL_PLUGINS)" \
+       --with-libiconv-prefix="$(ICONV_PREFIX)" \
+       --without-python \
+       --without-x \
+
+  EXTRA_LDFLAGS+= -L$(STAGING_DIR)/usr/lib/mysql
+
+endif
+
+
+define Package/lcd4linux/conffiles
+/etc/lcd4linux.conf
+endef
+
+define Package/lcd4linux/install
+       $(INSTALL_DIR) $(1)/usr/bin
+       $(CP) $(PKG_INSTALL_DIR)/usr/bin/lcd4linux $(1)/usr/bin/
+       $(INSTALL_DIR) $(1)/etc
+       $(INSTALL_CONF) $(PKG_BUILD_DIR)/lcd4linux.conf.sample $(1)/etc/lcd4linux.conf
+       $(INSTALL_DIR) $(1)/etc/init.d
+       $(INSTALL_BIN) ./files/lcd4linux.init $(1)/etc/init.d/lcd4linux
+       $(SED) "s|^\(Display 'GLCD2USB'\)|#\1|g" \
+           -e "s|^\(Layout 'TestLayer'\)|#\1|g" \
+           -e "s|^#\(Display 'Image'\)|\1|g" \
+           -e "s|^#\(Layout 'Default'\)|\1|g" \
+            $(1)/etc/lcd4linux.conf
+endef
+
+Package/lcd4linux-custom/conffiles = $(Package/lcd4linux/conffiles)
+Package/lcd4linux-custom/install = $(Package/lcd4linux/install)
+
+Package/lcd4linux-full/conffiles = $(Package/lcd4linux/conffiles)
+Package/lcd4linux-full/install = $(Package/lcd4linux/install)
+
+$(eval $(call BuildPackage,lcd4linux-custom))
+$(eval $(call BuildPackage,lcd4linux-full))
diff --git a/utils/lcd4linux/files/lcd4linux.init b/utils/lcd4linux/files/lcd4linux.init
new file mode 100644 (file)
index 0000000..25033f3
--- /dev/null
@@ -0,0 +1,15 @@
+#!/bin/sh /etc/rc.common
+# Copyright (C) 2007-2015 OpenWrt.org
+
+START=98
+
+SERVICE_USE_PID=1
+
+start() {
+       service_start /usr/bin/lcd4linux -o /tmp/lcd4linux.png -q
+}
+
+stop() {
+       service_stop /usr/bin/lcd4linux
+}
+
diff --git a/utils/lcd4linux/patches/100-drv_RouterBoard.patch b/utils/lcd4linux/patches/100-drv_RouterBoard.patch
new file mode 100644 (file)
index 0000000..9780f5a
--- /dev/null
@@ -0,0 +1,11 @@
+--- a/drv_RouterBoard.c
++++ b/drv_RouterBoard.c
+@@ -106,7 +106,7 @@
+ #include <string.h>
+ #include <errno.h>
+ #include <unistd.h>
+-#include <sys/io.h>
++#include <asm/io.h>
+ #include "debug.h"
+ #include "cfg.h"
diff --git a/utils/lcd4linux/patches/110-uclibc-logarithm-fix.patch b/utils/lcd4linux/patches/110-uclibc-logarithm-fix.patch
new file mode 100644 (file)
index 0000000..8f6d861
--- /dev/null
@@ -0,0 +1,11 @@
+--- a/plugin_netinfo.c
++++ b/plugin_netinfo.c
+@@ -264,7 +264,7 @@ static void my_netmask_short(RESULT * re
+     sin = get_netmask(arg1);
+     if (NULL != sin) {
+       logval = (long double) (get_netmask(arg1)->sin_addr.s_addr);
+-      netlen = (int) rint(log2l(logval) / log2l(2.0));
++      netlen = (int) rint(log2f(logval) / log2f(2.0));
+       qprintf(value, sizeof(value), "/%d", netlen);
+     } else {
+       qprintf(value, sizeof(value), "/?");
diff --git a/utils/lcd4linux/patches/120-remove-as-needed-linker-option.patch b/utils/lcd4linux/patches/120-remove-as-needed-linker-option.patch
new file mode 100644 (file)
index 0000000..b5e56fe
--- /dev/null
@@ -0,0 +1,11 @@
+--- a/Makefile.am
++++ b/Makefile.am
+@@ -18,7 +18,7 @@ ACLOCAL_AMFLAGS=-I m4
+ # use this for lots of warnings
+ #AM_CFLAGS = -D_GNU_SOURCE -std=c99 -m64 -Wall -W -pedantic -Wno-variadic-macros -fno-strict-aliasing
+-lcd4linux_LDFLAGS ="-Wl,--as-needed"
++lcd4linux_LDFLAGS = 
+ lcd4linux_LDADD   = @DRIVERS@ @PLUGINS@ @DRVLIBS@ @PLUGINLIBS@
+ lcd4linux_DEPENDENCIES = @DRIVERS@ @PLUGINS@
diff --git a/utils/lcd4linux/patches/140-no_repnop_T6963.patch b/utils/lcd4linux/patches/140-no_repnop_T6963.patch
new file mode 100644 (file)
index 0000000..85be2c3
--- /dev/null
@@ -0,0 +1,22 @@
+--- a/drv_T6963.c
++++ b/drv_T6963.c
+@@ -114,7 +114,9 @@ static void drv_T6_status1(void)
+     /* wait for STA0=1 and STA1=1 */
+     n = 0;
+     do {
++#if 0
+       rep_nop();
++#endif
+       if (++n > 1000) {
+           debug("hang in status1");
+           bug = 1;
+@@ -150,7 +152,9 @@ static void drv_T6_status2(void)
+     /* wait for STA3=1 */
+     n = 0;
+     do {
++#if 0
+       rep_nop();
++#endif
+       if (++n > 1000) {
+           debug("hang in status2");
+           bug = 1;
diff --git a/utils/lcd4linux/patches/150-addlibmpdclient.patch b/utils/lcd4linux/patches/150-addlibmpdclient.patch
new file mode 100644 (file)
index 0000000..0e51f67
--- /dev/null
@@ -0,0 +1,2624 @@
+--- /dev/null
++++ b/libmpdclient.c
+@@ -0,0 +1,1957 @@
++/* libmpdclient
++   (c)2003-2006 by Warren Dukes (warren.dukes@gmail.com)
++   This project's homepage is: http://www.musicpd.org
++
++   Redistribution and use in source and binary forms, with or without
++   modification, are permitted provided that the following conditions
++   are met:
++
++   - Redistributions of source code must retain the above copyright
++   notice, this list of conditions and the following disclaimer.
++
++   - Redistributions in binary form must reproduce the above copyright
++   notice, this list of conditions and the following disclaimer in the
++   documentation and/or other materials provided with the distribution.
++
++   - Neither the name of the Music Player Daemon nor the names of its
++   contributors may be used to endorse or promote products derived from
++   this software without specific prior written permission.
++
++   THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
++   ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
++   LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
++   A PARTICULAR PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR
++   CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
++   EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
++   PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
++   PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
++   LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
++   NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
++   SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
++*/
++
++#include "libmpdclient.h"
++
++#include <errno.h>
++#include <ctype.h>
++#include <sys/types.h>
++#include <stdio.h>
++#include <sys/param.h>
++#include <string.h>
++#include <unistd.h>
++#include <stdlib.h>
++#include <fcntl.h>
++#include <limits.h>
++
++#ifdef WIN32
++#  include <ws2tcpip.h>
++#  include <winsock.h>
++#else
++#  include <netinet/in.h>
++#  include <arpa/inet.h>
++#  include <sys/socket.h>
++#  include <netdb.h>
++#endif
++
++/* (bits+1)/3 (plus the sign character) */
++#define INTLEN      ((sizeof(int)       * CHAR_BIT + 1) / 3 + 1)
++#define LONGLONGLEN ((sizeof(long long) * CHAR_BIT + 1) / 3 + 1)
++
++#define COMMAND_LIST    1
++#define COMMAND_LIST_OK 2
++
++#ifndef MPD_NO_GAI
++#  ifdef AI_ADDRCONFIG
++#    define MPD_HAVE_GAI
++#  endif
++#endif
++
++#ifndef MSG_DONTWAIT
++#  define MSG_DONTWAIT 0
++#endif
++
++#ifdef WIN32
++#  define SELECT_ERRNO_IGNORE   (errno == WSAEINTR || errno == WSAEINPROGRESS)
++#  define SENDRECV_ERRNO_IGNORE SELECT_ERRNO_IGNORE
++#else
++#  define SELECT_ERRNO_IGNORE   (errno == EINTR)
++#  define SENDRECV_ERRNO_IGNORE (errno == EINTR || errno == EAGAIN)
++#  define winsock_dll_error(c)  0
++#  define closesocket(s)        close(s)
++#  define WSACleanup()          do { /* nothing */ } while (0)
++#endif
++
++#ifdef WIN32
++static int winsock_dll_error(mpd_Connection * connection)
++{
++    WSADATA wsaData;
++    if ((WSAStartup(MAKEWORD(2, 2), &wsaData)) != 0 || LOBYTE(wsaData.wVersion) != 2 || HIBYTE(wsaData.wVersion) != 2) {
++      strcpy(connection->errorStr, "Could not find usable WinSock DLL.");
++      connection->error = MPD_ERROR_SYSTEM;
++      return 1;
++    }
++    return 0;
++}
++
++static int do_connect_fail(mpd_Connection * connection, const struct sockaddr *serv_addr, int addrlen)
++{
++    int iMode = 1;            /* 0 = blocking, else non-blocking */
++    ioctlsocket(connection->sock, FIONBIO, (u_long FAR *) & iMode);
++    return (connect(connection->sock, serv_addr, addrlen) == SOCKET_ERROR && WSAGetLastError() != WSAEWOULDBLOCK);
++}
++#else                         /* !WIN32 (sane operating systems) */
++static int do_connect_fail(mpd_Connection * connection, const struct sockaddr *serv_addr, int addrlen)
++{
++    int flags = fcntl(connection->sock, F_GETFL, 0);
++    fcntl(connection->sock, F_SETFL, flags | O_NONBLOCK);
++    return (connect(connection->sock, serv_addr, addrlen) < 0 && errno != EINPROGRESS);
++}
++#endif                                /* !WIN32 */
++
++#ifdef MPD_HAVE_GAI
++static int mpd_connect(mpd_Connection * connection, const char *host, int port, float timeout)
++{
++    int error;
++    char service[INTLEN + 1];
++    struct addrinfo hints;
++    struct addrinfo *res = NULL;
++    struct addrinfo *addrinfo = NULL;
++
++      /**
++       * Setup hints
++       */
++    hints.ai_flags = AI_ADDRCONFIG;
++    hints.ai_family = PF_UNSPEC;
++    hints.ai_socktype = SOCK_STREAM;
++    hints.ai_protocol = IPPROTO_TCP;
++    hints.ai_addrlen = 0;
++    hints.ai_addr = NULL;
++    hints.ai_canonname = NULL;
++    hints.ai_next = NULL;
++
++    snprintf(service, sizeof(service), "%i", port);
++
++    error = getaddrinfo(host, service, &hints, &addrinfo);
++
++    if (error) {
++      snprintf(connection->errorStr, MPD_ERRORSTR_MAX_LENGTH, "host \"%s\" not found: %s", host, gai_strerror(error));
++      connection->error = MPD_ERROR_UNKHOST;
++      return -1;
++    }
++
++    for (res = addrinfo; res; res = res->ai_next) {
++      /* create socket */
++      connection->sock = socket(res->ai_family, SOCK_STREAM, res->ai_protocol);
++      if (connection->sock < 0) {
++          snprintf(connection->errorStr, MPD_ERRORSTR_MAX_LENGTH, "problems creating socket: %s", strerror(errno));
++          connection->error = MPD_ERROR_SYSTEM;
++          freeaddrinfo(addrinfo);
++          return -1;
++      }
++
++      mpd_setConnectionTimeout(connection, timeout);
++
++      /* connect stuff */
++      if (do_connect_fail(connection, res->ai_addr, res->ai_addrlen)) {
++          /* try the next address family */
++          closesocket(connection->sock);
++          connection->sock = -1;
++          continue;
++      }
++    }
++
++    freeaddrinfo(addrinfo);
++
++    if (connection->sock < 0) {
++      snprintf(connection->errorStr, MPD_ERRORSTR_MAX_LENGTH,
++               "problems connecting to \"%s\" on port %i: %s", host, port, strerror(errno));
++      connection->error = MPD_ERROR_CONNPORT;
++
++      return -1;
++    }
++
++    return 0;
++}
++#else                         /* !MPD_HAVE_GAI */
++static int mpd_connect(mpd_Connection * connection, const char *host, int port, float timeout)
++{
++    struct hostent *he;
++    struct sockaddr *dest;
++    int destlen;
++    struct sockaddr_in sin;
++
++    if (!(he = gethostbyname(host))) {
++      snprintf(connection->errorStr, MPD_ERRORSTR_MAX_LENGTH, "host \"%s\" not found", host);
++      connection->error = MPD_ERROR_UNKHOST;
++      return -1;
++    }
++
++    memset(&sin, 0, sizeof(struct sockaddr_in));
++    /*dest.sin_family = he->h_addrtype; */
++    sin.sin_family = AF_INET;
++    sin.sin_port = htons(port);
++
++    switch (he->h_addrtype) {
++    case AF_INET:
++      memcpy((char *) &sin.sin_addr.s_addr, (char *) he->h_addr, he->h_length);
++      dest = (struct sockaddr *) &sin;
++      destlen = sizeof(struct sockaddr_in);
++      break;
++    default:
++      strcpy(connection->errorStr, "address type is not IPv4");
++      connection->error = MPD_ERROR_SYSTEM;
++      return -1;
++      break;
++    }
++
++    if ((connection->sock = socket(dest->sa_family, SOCK_STREAM, 0)) < 0) {
++      strcpy(connection->errorStr, "problems creating socket");
++      connection->error = MPD_ERROR_SYSTEM;
++      return -1;
++    }
++
++    mpd_setConnectionTimeout(connection, timeout);
++
++    /* connect stuff */
++    if (do_connect_fail(connection, dest, destlen)) {
++      snprintf(connection->errorStr, MPD_ERRORSTR_MAX_LENGTH,
++               "problems connecting to \"%s\" on port" " %i", host, port);
++      connection->error = MPD_ERROR_CONNPORT;
++      return -1;
++    }
++
++    return 0;
++}
++#endif                                /* !MPD_HAVE_GAI */
++
++char *mpdTagItemKeys[MPD_TAG_NUM_OF_ITEM_TYPES] = {
++    "Artist",
++    "Album",
++    "Title",
++    "Track",
++    "Name",
++    "Genre",
++    "Date",
++    "Composer",
++    "Performer",
++    "Comment",
++    "Disc",
++    "Filename",
++    "Any"
++};
++
++static char *mpd_sanitizeArg(const char *arg)
++{
++    size_t i;
++    char *ret;
++    register const char *c;
++    register char *rc;
++
++    /* instead of counting in that loop above, just
++     * use a bit more memory and half running time
++     */
++    ret = malloc(strlen(arg) * 2 + 1);
++
++    c = arg;
++    rc = ret;
++    for (i = strlen(arg) + 1; i != 0; --i) {
++      if (*c == '"' || *c == '\\')
++          *rc++ = '\\';
++      *(rc++) = *(c++);
++    }
++
++    return ret;
++}
++
++static mpd_ReturnElement *mpd_newReturnElement(const char *name, const char *value)
++{
++    mpd_ReturnElement *ret = malloc(sizeof(mpd_ReturnElement));
++
++    ret->name = strdup(name);
++    ret->value = strdup(value);
++
++    return ret;
++}
++
++static void mpd_freeReturnElement(mpd_ReturnElement * re)
++{
++    free(re->name);
++    free(re->value);
++    free(re);
++}
++
++void mpd_setConnectionTimeout(mpd_Connection * connection, float timeout)
++{
++    connection->timeout.tv_sec = (int) timeout;
++    connection->timeout.tv_usec = (int) (timeout * 1e6 - connection->timeout.tv_sec * 1000000 + 0.5);
++}
++
++static int mpd_parseWelcome(mpd_Connection * connection, const char *host, int port, char *rt, char *output)
++{
++    char *tmp;
++    char *test;
++    int i;
++
++    if (strncmp(output, MPD_WELCOME_MESSAGE, strlen(MPD_WELCOME_MESSAGE))) {
++      snprintf(connection->errorStr, MPD_ERRORSTR_MAX_LENGTH,
++               "mpd not running on port %i on host \"%s\"", port, host);
++      connection->error = MPD_ERROR_NOTMPD;
++      return 1;
++    }
++
++    tmp = &output[strlen(MPD_WELCOME_MESSAGE)];
++
++    for (i = 0; i < 3; i++) {
++      if (tmp)
++          connection->version[i] = strtol(tmp, &test, 10);
++
++      if (!tmp || (test[0] != '.' && test[0] != '\0')) {
++          snprintf(connection->errorStr,
++                   MPD_ERRORSTR_MAX_LENGTH,
++                   "error parsing version number at " "\"%s\"", &output[strlen(MPD_WELCOME_MESSAGE)]);
++          connection->error = MPD_ERROR_NOTMPD;
++          return 1;
++      }
++      tmp = ++test;
++    }
++
++    return 0;
++}
++
++mpd_Connection *mpd_newConnection(const char *host, int port, float timeout)
++{
++    int err;
++    char *rt;
++    char *output = NULL;
++    mpd_Connection *connection = malloc(sizeof(mpd_Connection));
++    struct timeval tv;
++    fd_set fds;
++    strcpy(connection->buffer, "");
++    connection->buflen = 0;
++    connection->bufstart = 0;
++    strcpy(connection->errorStr, "");
++    connection->error = 0;
++    connection->doneProcessing = 0;
++    connection->commandList = 0;
++    connection->listOks = 0;
++    connection->doneListOk = 0;
++    connection->returnElement = NULL;
++    connection->request = NULL;
++
++    if (winsock_dll_error(connection))
++      return connection;
++
++    if (mpd_connect(connection, host, port, timeout) < 0)
++      return connection;
++
++    while (!(rt = strstr(connection->buffer, "\n"))) {
++      tv.tv_sec = connection->timeout.tv_sec;
++      tv.tv_usec = connection->timeout.tv_usec;
++      FD_ZERO(&fds);
++      FD_SET(connection->sock, &fds);
++      if ((err = select(connection->sock + 1, &fds, NULL, NULL, &tv)) == 1) {
++          int readed;
++          readed = recv(connection->sock,
++                        &(connection->buffer[connection->buflen]), MPD_BUFFER_MAX_LENGTH - connection->buflen, 0);
++          if (readed <= 0) {
++              snprintf(connection->errorStr, MPD_ERRORSTR_MAX_LENGTH,
++                       "problems getting a response from" " \"%s\" on port %i : %s", host, port, strerror(errno));
++              connection->error = MPD_ERROR_NORESPONSE;
++              return connection;
++          }
++          connection->buflen += readed;
++          connection->buffer[connection->buflen] = '\0';
++      } else if (err < 0) {
++          if (SELECT_ERRNO_IGNORE)
++              continue;
++          snprintf(connection->errorStr,
++                   MPD_ERRORSTR_MAX_LENGTH, "problems connecting to \"%s\" on port" " %i", host, port);
++          connection->error = MPD_ERROR_CONNPORT;
++          return connection;
++      } else {
++          snprintf(connection->errorStr, MPD_ERRORSTR_MAX_LENGTH,
++                   "timeout in attempting to get a response from" " \"%s\" on port %i", host, port);
++          connection->error = MPD_ERROR_NORESPONSE;
++          return connection;
++      }
++    }
++
++    *rt = '\0';
++    output = strdup(connection->buffer);
++    strcpy(connection->buffer, rt + 1);
++    connection->buflen = strlen(connection->buffer);
++
++    if (mpd_parseWelcome(connection, host, port, rt, output) == 0)
++      connection->doneProcessing = 1;
++
++    free(output);
++
++    return connection;
++}
++
++void mpd_clearError(mpd_Connection * connection)
++{
++    connection->error = 0;
++    connection->errorStr[0] = '\0';
++}
++
++void mpd_closeConnection(mpd_Connection * connection)
++{
++    closesocket(connection->sock);
++    if (connection->returnElement)
++      free(connection->returnElement);
++    if (connection->request)
++      free(connection->request);
++    free(connection);
++    WSACleanup();
++}
++
++static void mpd_executeCommand(mpd_Connection * connection, char *command)
++{
++    int ret;
++    struct timeval tv;
++    fd_set fds;
++    char *commandPtr = command;
++    int commandLen = strlen(command);
++
++    if (!connection->doneProcessing && !connection->commandList) {
++      strcpy(connection->errorStr, "not done processing current command");
++      connection->error = 1;
++      return;
++    }
++
++    mpd_clearError(connection);
++
++    FD_ZERO(&fds);
++    FD_SET(connection->sock, &fds);
++    tv.tv_sec = connection->timeout.tv_sec;
++    tv.tv_usec = connection->timeout.tv_usec;
++
++    while ((ret = select(connection->sock + 1, NULL, &fds, NULL, &tv) == 1) || (ret == -1 && SELECT_ERRNO_IGNORE)) {
++      ret = send(connection->sock, commandPtr, commandLen, MSG_DONTWAIT);
++      if (ret <= 0) {
++          if (SENDRECV_ERRNO_IGNORE)
++              continue;
++          snprintf(connection->errorStr, MPD_ERRORSTR_MAX_LENGTH, "problems giving command \"%s\"", command);
++          connection->error = MPD_ERROR_SENDING;
++          return;
++      } else {
++          commandPtr += ret;
++          commandLen -= ret;
++      }
++
++      if (commandLen <= 0)
++          break;
++    }
++
++    if (commandLen > 0) {
++      perror("");
++      snprintf(connection->errorStr, MPD_ERRORSTR_MAX_LENGTH, "timeout sending command \"%s\"", command);
++      connection->error = MPD_ERROR_TIMEOUT;
++      return;
++    }
++
++    if (!connection->commandList)
++      connection->doneProcessing = 0;
++    else if (connection->commandList == COMMAND_LIST_OK) {
++      connection->listOks++;
++    }
++}
++
++static void mpd_getNextReturnElement(mpd_Connection * connection)
++{
++    char *output = NULL;
++    char *rt = NULL;
++    char *name = NULL;
++    char *value = NULL;
++    fd_set fds;
++    struct timeval tv;
++    char *tok = NULL;
++    int readed;
++    char *bufferCheck = NULL;
++    int err;
++    int pos;
++
++    if (connection->returnElement)
++      mpd_freeReturnElement(connection->returnElement);
++    connection->returnElement = NULL;
++
++    if (connection->doneProcessing || (connection->listOks && connection->doneListOk)) {
++      strcpy(connection->errorStr, "already done processing current command");
++      connection->error = 1;
++      return;
++    }
++
++    bufferCheck = connection->buffer + connection->bufstart;
++    while (connection->bufstart >= connection->buflen || !(rt = strchr(bufferCheck, '\n'))) {
++      if (connection->buflen >= MPD_BUFFER_MAX_LENGTH) {
++          memmove(connection->buffer,
++                  connection->buffer + connection->bufstart, connection->buflen - connection->bufstart + 1);
++          connection->buflen -= connection->bufstart;
++          connection->bufstart = 0;
++      }
++      if (connection->buflen >= MPD_BUFFER_MAX_LENGTH) {
++          strcpy(connection->errorStr, "buffer overrun");
++          connection->error = MPD_ERROR_BUFFEROVERRUN;
++          connection->doneProcessing = 1;
++          connection->doneListOk = 0;
++          return;
++      }
++      bufferCheck = connection->buffer + connection->buflen;
++      tv.tv_sec = connection->timeout.tv_sec;
++      tv.tv_usec = connection->timeout.tv_usec;
++      FD_ZERO(&fds);
++      FD_SET(connection->sock, &fds);
++      if ((err = select(connection->sock + 1, &fds, NULL, NULL, &tv) == 1)) {
++          readed = recv(connection->sock,
++                        connection->buffer + connection->buflen,
++                        MPD_BUFFER_MAX_LENGTH - connection->buflen, MSG_DONTWAIT);
++          if (readed < 0 && SENDRECV_ERRNO_IGNORE) {
++              continue;
++          }
++          if (readed <= 0) {
++              strcpy(connection->errorStr, "connection" " closed");
++              connection->error = MPD_ERROR_CONNCLOSED;
++              connection->doneProcessing = 1;
++              connection->doneListOk = 0;
++              return;
++          }
++          connection->buflen += readed;
++          connection->buffer[connection->buflen] = '\0';
++      } else if (err < 0 && SELECT_ERRNO_IGNORE)
++          continue;
++      else {
++          strcpy(connection->errorStr, "connection timeout");
++          connection->error = MPD_ERROR_TIMEOUT;
++          connection->doneProcessing = 1;
++          connection->doneListOk = 0;
++          return;
++      }
++    }
++
++    *rt = '\0';
++    output = connection->buffer + connection->bufstart;
++    connection->bufstart = rt - connection->buffer + 1;
++
++    if (strcmp(output, "OK") == 0) {
++      if (connection->listOks > 0) {
++          strcpy(connection->errorStr, "expected more list_OK's");
++          connection->error = 1;
++      }
++      connection->listOks = 0;
++      connection->doneProcessing = 1;
++      connection->doneListOk = 0;
++      return;
++    }
++
++    if (strcmp(output, "list_OK") == 0) {
++      if (!connection->listOks) {
++          strcpy(connection->errorStr, "got an unexpected list_OK");
++          connection->error = 1;
++      } else {
++          connection->doneListOk = 1;
++          connection->listOks--;
++      }
++      return;
++    }
++
++    if (strncmp(output, "ACK", strlen("ACK")) == 0) {
++      char *test;
++      char *needle;
++      int val;
++
++      strcpy(connection->errorStr, output);
++      connection->error = MPD_ERROR_ACK;
++      connection->errorCode = MPD_ACK_ERROR_UNK;
++      connection->errorAt = MPD_ERROR_AT_UNK;
++      connection->doneProcessing = 1;
++      connection->doneListOk = 0;
++
++      needle = strchr(output, '[');
++      if (!needle)
++          return;
++      val = strtol(needle + 1, &test, 10);
++      if (*test != '@')
++          return;
++      connection->errorCode = val;
++      val = strtol(test + 1, &test, 10);
++      if (*test != ']')
++          return;
++      connection->errorAt = val;
++      return;
++    }
++
++    tok = strchr(output, ':');
++    if (!tok)
++      return;
++    pos = tok - output;
++    value = ++tok;
++    name = output;
++    name[pos] = '\0';
++
++    if (value[0] == ' ') {
++      connection->returnElement = mpd_newReturnElement(name, &(value[1]));
++    } else {
++      snprintf(connection->errorStr, MPD_ERRORSTR_MAX_LENGTH, "error parsing: %s:%s", name, value);
++      connection->error = 1;
++    }
++}
++
++void mpd_finishCommand(mpd_Connection * connection)
++{
++    while (!connection->doneProcessing) {
++      if (connection->doneListOk)
++          connection->doneListOk = 0;
++      mpd_getNextReturnElement(connection);
++    }
++}
++
++static void mpd_finishListOkCommand(mpd_Connection * connection)
++{
++    while (!connection->doneProcessing && connection->listOks && !connection->doneListOk) {
++      mpd_getNextReturnElement(connection);
++    }
++}
++
++int mpd_nextListOkCommand(mpd_Connection * connection)
++{
++    mpd_finishListOkCommand(connection);
++    if (!connection->doneProcessing)
++      connection->doneListOk = 0;
++    if (connection->listOks == 0 || connection->doneProcessing)
++      return -1;
++    return 0;
++}
++
++void mpd_sendStatusCommand(mpd_Connection * connection)
++{
++    mpd_executeCommand(connection, "status\n");
++}
++
++mpd_Status *mpd_getStatus(mpd_Connection * connection)
++{
++    mpd_Status *status;
++
++    /*mpd_executeCommand(connection,"status\n");
++
++       if(connection->error) return NULL; */
++
++    if (connection->doneProcessing || (connection->listOks && connection->doneListOk)) {
++      return NULL;
++    }
++
++    if (!connection->returnElement)
++      mpd_getNextReturnElement(connection);
++
++    status = malloc(sizeof(mpd_Status));
++    status->volume = -1;
++    status->repeat = 0;
++    status->random = 0;
++    status->playlist = -1;
++    status->playlistLength = -1;
++    status->state = -1;
++    status->song = 0;
++    status->songid = 0;
++    status->elapsedTime = 0;
++    status->totalTime = 0;
++    status->bitRate = 0;
++    status->sampleRate = 0;
++    status->bits = 0;
++    status->channels = 0;
++    status->crossfade = -1;
++    status->error = NULL;
++    status->updatingDb = 0;
++
++    if (connection->error) {
++      free(status);
++      return NULL;
++    }
++    while (connection->returnElement) {
++      mpd_ReturnElement *re = connection->returnElement;
++      if (strcmp(re->name, "volume") == 0) {
++          status->volume = atoi(re->value);
++      } else if (strcmp(re->name, "repeat") == 0) {
++          status->repeat = atoi(re->value);
++      } else if (strcmp(re->name, "random") == 0) {
++          status->random = atoi(re->value);
++      } else if (strcmp(re->name, "playlist") == 0) {
++          status->playlist = strtol(re->value, NULL, 10);
++      } else if (strcmp(re->name, "playlistlength") == 0) {
++          status->playlistLength = atoi(re->value);
++      } else if (strcmp(re->name, "bitrate") == 0) {
++          status->bitRate = atoi(re->value);
++      } else if (strcmp(re->name, "state") == 0) {
++          if (strcmp(re->value, "play") == 0) {
++              status->state = MPD_STATUS_STATE_PLAY;
++          } else if (strcmp(re->value, "stop") == 0) {
++              status->state = MPD_STATUS_STATE_STOP;
++          } else if (strcmp(re->value, "pause") == 0) {
++              status->state = MPD_STATUS_STATE_PAUSE;
++          } else {
++              status->state = MPD_STATUS_STATE_UNKNOWN;
++          }
++      } else if (strcmp(re->name, "song") == 0) {
++          status->song = atoi(re->value);
++      } else if (strcmp(re->name, "songid") == 0) {
++          status->songid = atoi(re->value);
++      } else if (strcmp(re->name, "time") == 0) {
++          char *tok = strchr(re->value, ':');
++          /* the second strchr below is a safety check */
++          if (tok && (strchr(tok, 0) > (tok + 1))) {
++              /* atoi stops at the first non-[0-9] char: */
++              status->elapsedTime = atoi(re->value);
++              status->totalTime = atoi(tok + 1);
++          }
++      } else if (strcmp(re->name, "error") == 0) {
++          status->error = strdup(re->value);
++      } else if (strcmp(re->name, "xfade") == 0) {
++          status->crossfade = atoi(re->value);
++      } else if (strcmp(re->name, "updating_db") == 0) {
++          status->updatingDb = atoi(re->value);
++      } else if (strcmp(re->name, "audio") == 0) {
++          char *tok = strchr(re->value, ':');
++          if (tok && (strchr(tok, 0) > (tok + 1))) {
++              status->sampleRate = atoi(re->value);
++              status->bits = atoi(++tok);
++              tok = strchr(tok, ':');
++              if (tok && (strchr(tok, 0) > (tok + 1)))
++                  status->channels = atoi(tok + 1);
++          }
++      }
++
++      mpd_getNextReturnElement(connection);
++      if (connection->error) {
++          free(status);
++          return NULL;
++      }
++    }
++
++    if (connection->error) {
++      free(status);
++      return NULL;
++    } else if (status->state < 0) {
++      strcpy(connection->errorStr, "state not found");
++      connection->error = 1;
++      free(status);
++      return NULL;
++    }
++
++    return status;
++}
++
++void mpd_freeStatus(mpd_Status * status)
++{
++    if (status->error)
++      free(status->error);
++    free(status);
++}
++
++void mpd_sendStatsCommand(mpd_Connection * connection)
++{
++    mpd_executeCommand(connection, "stats\n");
++}
++
++mpd_Stats *mpd_getStats(mpd_Connection * connection)
++{
++    mpd_Stats *stats;
++
++    /*mpd_executeCommand(connection,"stats\n");
++
++       if(connection->error) return NULL; */
++
++    if (connection->doneProcessing || (connection->listOks && connection->doneListOk)) {
++      return NULL;
++    }
++
++    if (!connection->returnElement)
++      mpd_getNextReturnElement(connection);
++
++    stats = malloc(sizeof(mpd_Stats));
++    stats->numberOfArtists = 0;
++    stats->numberOfAlbums = 0;
++    stats->numberOfSongs = 0;
++    stats->uptime = 0;
++    stats->dbUpdateTime = 0;
++    stats->playTime = 0;
++    stats->dbPlayTime = 0;
++
++    if (connection->error) {
++      free(stats);
++      return NULL;
++    }
++    while (connection->returnElement) {
++      mpd_ReturnElement *re = connection->returnElement;
++      if (strcmp(re->name, "artists") == 0) {
++          stats->numberOfArtists = atoi(re->value);
++      } else if (strcmp(re->name, "albums") == 0) {
++          stats->numberOfAlbums = atoi(re->value);
++      } else if (strcmp(re->name, "songs") == 0) {
++          stats->numberOfSongs = atoi(re->value);
++      } else if (strcmp(re->name, "uptime") == 0) {
++          stats->uptime = strtol(re->value, NULL, 10);
++      } else if (strcmp(re->name, "db_update") == 0) {
++          stats->dbUpdateTime = strtol(re->value, NULL, 10);
++      } else if (strcmp(re->name, "playtime") == 0) {
++          stats->playTime = strtol(re->value, NULL, 10);
++      } else if (strcmp(re->name, "db_playtime") == 0) {
++          stats->dbPlayTime = strtol(re->value, NULL, 10);
++      }
++
++      mpd_getNextReturnElement(connection);
++      if (connection->error) {
++          free(stats);
++          return NULL;
++      }
++    }
++
++    if (connection->error) {
++      free(stats);
++      return NULL;
++    }
++
++    return stats;
++}
++
++void mpd_freeStats(mpd_Stats * stats)
++{
++    free(stats);
++}
++
++mpd_SearchStats *mpd_getSearchStats(mpd_Connection * connection)
++{
++    mpd_SearchStats *stats;
++    mpd_ReturnElement *re;
++
++    if (connection->doneProcessing || (connection->listOks && connection->doneListOk)) {
++      return NULL;
++    }
++
++    if (!connection->returnElement)
++      mpd_getNextReturnElement(connection);
++
++    if (connection->error)
++      return NULL;
++
++    stats = malloc(sizeof(mpd_SearchStats));
++    stats->numberOfSongs = 0;
++    stats->playTime = 0;
++
++    while (connection->returnElement) {
++      re = connection->returnElement;
++
++      if (strcmp(re->name, "songs") == 0) {
++          stats->numberOfSongs = atoi(re->value);
++      } else if (strcmp(re->name, "playtime") == 0) {
++          stats->playTime = strtol(re->value, NULL, 10);
++      }
++
++      mpd_getNextReturnElement(connection);
++      if (connection->error) {
++          free(stats);
++          return NULL;
++      }
++    }
++
++    if (connection->error) {
++      free(stats);
++      return NULL;
++    }
++
++    return stats;
++}
++
++void mpd_freeSearchStats(mpd_SearchStats * stats)
++{
++    free(stats);
++}
++
++static void mpd_initSong(mpd_Song * song)
++{
++    song->file = NULL;
++    song->artist = NULL;
++    song->album = NULL;
++    song->track = NULL;
++    song->title = NULL;
++    song->name = NULL;
++    song->date = NULL;
++    /* added by Qball */
++    song->genre = NULL;
++    song->composer = NULL;
++    song->performer = NULL;
++    song->disc = NULL;
++    song->comment = NULL;
++
++    song->time = MPD_SONG_NO_TIME;
++    song->pos = MPD_SONG_NO_NUM;
++    song->id = MPD_SONG_NO_ID;
++}
++
++static void mpd_finishSong(mpd_Song * song)
++{
++    if (song->file)
++      free(song->file);
++    if (song->artist)
++      free(song->artist);
++    if (song->album)
++      free(song->album);
++    if (song->title)
++      free(song->title);
++    if (song->track)
++      free(song->track);
++    if (song->name)
++      free(song->name);
++    if (song->date)
++      free(song->date);
++    if (song->genre)
++      free(song->genre);
++    if (song->composer)
++      free(song->composer);
++    if (song->disc)
++      free(song->disc);
++    if (song->comment)
++      free(song->comment);
++}
++
++mpd_Song *mpd_newSong(void)
++{
++    mpd_Song *ret = malloc(sizeof(mpd_Song));
++
++    mpd_initSong(ret);
++
++    return ret;
++}
++
++void mpd_freeSong(mpd_Song * song)
++{
++    mpd_finishSong(song);
++    free(song);
++}
++
++mpd_Song *mpd_songDup(mpd_Song * song)
++{
++    mpd_Song *ret = mpd_newSong();
++
++    if (song->file)
++      ret->file = strdup(song->file);
++    if (song->artist)
++      ret->artist = strdup(song->artist);
++    if (song->album)
++      ret->album = strdup(song->album);
++    if (song->title)
++      ret->title = strdup(song->title);
++    if (song->track)
++      ret->track = strdup(song->track);
++    if (song->name)
++      ret->name = strdup(song->name);
++    if (song->date)
++      ret->date = strdup(song->date);
++    if (song->genre)
++      ret->genre = strdup(song->genre);
++    if (song->composer)
++      ret->composer = strdup(song->composer);
++    if (song->disc)
++      ret->disc = strdup(song->disc);
++    if (song->comment)
++      ret->comment = strdup(song->comment);
++    ret->time = song->time;
++    ret->pos = song->pos;
++    ret->id = song->id;
++
++    return ret;
++}
++
++static void mpd_initDirectory(mpd_Directory * directory)
++{
++    directory->path = NULL;
++}
++
++static void mpd_finishDirectory(mpd_Directory * directory)
++{
++    if (directory->path)
++      free(directory->path);
++}
++
++mpd_Directory *mpd_newDirectory(void)
++{
++    mpd_Directory *directory = malloc(sizeof(mpd_Directory));;
++
++    mpd_initDirectory(directory);
++
++    return directory;
++}
++
++void mpd_freeDirectory(mpd_Directory * directory)
++{
++    mpd_finishDirectory(directory);
++
++    free(directory);
++}
++
++mpd_Directory *mpd_directoryDup(mpd_Directory * directory)
++{
++    mpd_Directory *ret = mpd_newDirectory();
++
++    if (directory->path)
++      ret->path = strdup(directory->path);
++
++    return ret;
++}
++
++static void mpd_initPlaylistFile(mpd_PlaylistFile * playlist)
++{
++    playlist->path = NULL;
++}
++
++static void mpd_finishPlaylistFile(mpd_PlaylistFile * playlist)
++{
++    if (playlist->path)
++      free(playlist->path);
++}
++
++mpd_PlaylistFile *mpd_newPlaylistFile(void)
++{
++    mpd_PlaylistFile *playlist = malloc(sizeof(mpd_PlaylistFile));
++
++    mpd_initPlaylistFile(playlist);
++
++    return playlist;
++}
++
++void mpd_freePlaylistFile(mpd_PlaylistFile * playlist)
++{
++    mpd_finishPlaylistFile(playlist);
++    free(playlist);
++}
++
++mpd_PlaylistFile *mpd_playlistFileDup(mpd_PlaylistFile * playlist)
++{
++    mpd_PlaylistFile *ret = mpd_newPlaylistFile();
++
++    if (playlist->path)
++      ret->path = strdup(playlist->path);
++
++    return ret;
++}
++
++static void mpd_initInfoEntity(mpd_InfoEntity * entity)
++{
++    entity->info.directory = NULL;
++}
++
++static void mpd_finishInfoEntity(mpd_InfoEntity * entity)
++{
++    if (entity->info.directory) {
++      if (entity->type == MPD_INFO_ENTITY_TYPE_DIRECTORY) {
++          mpd_freeDirectory(entity->info.directory);
++      } else if (entity->type == MPD_INFO_ENTITY_TYPE_SONG) {
++          mpd_freeSong(entity->info.song);
++      } else if (entity->type == MPD_INFO_ENTITY_TYPE_PLAYLISTFILE) {
++          mpd_freePlaylistFile(entity->info.playlistFile);
++      }
++    }
++}
++
++mpd_InfoEntity *mpd_newInfoEntity(void)
++{
++    mpd_InfoEntity *entity = malloc(sizeof(mpd_InfoEntity));
++
++    mpd_initInfoEntity(entity);
++
++    return entity;
++}
++
++void mpd_freeInfoEntity(mpd_InfoEntity * entity)
++{
++    mpd_finishInfoEntity(entity);
++    free(entity);
++}
++
++static void mpd_sendInfoCommand(mpd_Connection * connection, char *command)
++{
++    mpd_executeCommand(connection, command);
++}
++
++mpd_InfoEntity *mpd_getNextInfoEntity(mpd_Connection * connection)
++{
++    mpd_InfoEntity *entity = NULL;
++
++    if (connection->doneProcessing || (connection->listOks && connection->doneListOk)) {
++      return NULL;
++    }
++
++    if (!connection->returnElement)
++      mpd_getNextReturnElement(connection);
++
++    if (connection->returnElement) {
++      if (strcmp(connection->returnElement->name, "file") == 0) {
++          entity = mpd_newInfoEntity();
++          entity->type = MPD_INFO_ENTITY_TYPE_SONG;
++          entity->info.song = mpd_newSong();
++          entity->info.song->file = strdup(connection->returnElement->value);
++      } else if (strcmp(connection->returnElement->name, "directory") == 0) {
++          entity = mpd_newInfoEntity();
++          entity->type = MPD_INFO_ENTITY_TYPE_DIRECTORY;
++          entity->info.directory = mpd_newDirectory();
++          entity->info.directory->path = strdup(connection->returnElement->value);
++      } else if (strcmp(connection->returnElement->name, "playlist") == 0) {
++          entity = mpd_newInfoEntity();
++          entity->type = MPD_INFO_ENTITY_TYPE_PLAYLISTFILE;
++          entity->info.playlistFile = mpd_newPlaylistFile();
++          entity->info.playlistFile->path = strdup(connection->returnElement->value);
++      } else if (strcmp(connection->returnElement->name, "cpos") == 0) {
++          entity = mpd_newInfoEntity();
++          entity->type = MPD_INFO_ENTITY_TYPE_SONG;
++          entity->info.song = mpd_newSong();
++          entity->info.song->pos = atoi(connection->returnElement->value);
++      } else {
++          connection->error = 1;
++          strcpy(connection->errorStr, "problem parsing song info");
++          return NULL;
++      }
++    } else
++      return NULL;
++
++    mpd_getNextReturnElement(connection);
++    while (connection->returnElement) {
++      mpd_ReturnElement *re = connection->returnElement;
++
++      if (strcmp(re->name, "file") == 0)
++          return entity;
++      else if (strcmp(re->name, "directory") == 0)
++          return entity;
++      else if (strcmp(re->name, "playlist") == 0)
++          return entity;
++      else if (strcmp(re->name, "cpos") == 0)
++          return entity;
++
++      if (entity->type == MPD_INFO_ENTITY_TYPE_SONG && strlen(re->value)) {
++          if (!entity->info.song->artist && strcmp(re->name, "Artist") == 0) {
++              entity->info.song->artist = strdup(re->value);
++          } else if (!entity->info.song->album && strcmp(re->name, "Album") == 0) {
++              entity->info.song->album = strdup(re->value);
++          } else if (!entity->info.song->title && strcmp(re->name, "Title") == 0) {
++              entity->info.song->title = strdup(re->value);
++          } else if (!entity->info.song->track && strcmp(re->name, "Track") == 0) {
++              entity->info.song->track = strdup(re->value);
++          } else if (!entity->info.song->name && strcmp(re->name, "Name") == 0) {
++              entity->info.song->name = strdup(re->value);
++          } else if (entity->info.song->time == MPD_SONG_NO_TIME && strcmp(re->name, "Time") == 0) {
++              entity->info.song->time = atoi(re->value);
++          } else if (entity->info.song->pos == MPD_SONG_NO_NUM && strcmp(re->name, "Pos") == 0) {
++              entity->info.song->pos = atoi(re->value);
++          } else if (entity->info.song->id == MPD_SONG_NO_ID && strcmp(re->name, "Id") == 0) {
++              entity->info.song->id = atoi(re->value);
++          } else if (!entity->info.song->date && strcmp(re->name, "Date") == 0) {
++              entity->info.song->date = strdup(re->value);
++          } else if (!entity->info.song->genre && strcmp(re->name, "Genre") == 0) {
++              entity->info.song->genre = strdup(re->value);
++          } else if (!entity->info.song->composer && strcmp(re->name, "Composer") == 0) {
++              entity->info.song->composer = strdup(re->value);
++          } else if (!entity->info.song->performer && strcmp(re->name, "Performer") == 0) {
++              entity->info.song->performer = strdup(re->value);
++          } else if (!entity->info.song->disc && strcmp(re->name, "Disc") == 0) {
++              entity->info.song->disc = strdup(re->value);
++          } else if (!entity->info.song->comment && strcmp(re->name, "Comment") == 0) {
++              entity->info.song->comment = strdup(re->value);
++          }
++      } else if (entity->type == MPD_INFO_ENTITY_TYPE_DIRECTORY) {
++      } else if (entity->type == MPD_INFO_ENTITY_TYPE_PLAYLISTFILE) {
++      }
++
++      mpd_getNextReturnElement(connection);
++    }
++
++    return entity;
++}
++
++static char *mpd_getNextReturnElementNamed(mpd_Connection * connection, const char *name)
++{
++    if (connection->doneProcessing || (connection->listOks && connection->doneListOk)) {
++      return NULL;
++    }
++
++    mpd_getNextReturnElement(connection);
++    while (connection->returnElement) {
++      mpd_ReturnElement *re = connection->returnElement;
++
++      if (strcmp(re->name, name) == 0)
++          return strdup(re->value);
++      mpd_getNextReturnElement(connection);
++    }
++
++    return NULL;
++}
++
++char *mpd_getNextTag(mpd_Connection * connection, int type)
++{
++    if (type < 0 || type >= MPD_TAG_NUM_OF_ITEM_TYPES || type == MPD_TAG_ITEM_ANY)
++      return NULL;
++    if (type == MPD_TAG_ITEM_FILENAME)
++      return mpd_getNextReturnElementNamed(connection, "file");
++    return mpd_getNextReturnElementNamed(connection, mpdTagItemKeys[type]);
++}
++
++char *mpd_getNextArtist(mpd_Connection * connection)
++{
++    return mpd_getNextReturnElementNamed(connection, "Artist");
++}
++
++char *mpd_getNextAlbum(mpd_Connection * connection)
++{
++    return mpd_getNextReturnElementNamed(connection, "Album");
++}
++
++void mpd_sendPlaylistInfoCommand(mpd_Connection * connection, int songPos)
++{
++    int len = strlen("playlistinfo") + 2 + INTLEN + 3;
++    char *string = malloc(len);
++    snprintf(string, len, "playlistinfo \"%i\"\n", songPos);
++    mpd_sendInfoCommand(connection, string);
++    free(string);
++}
++
++void mpd_sendPlaylistIdCommand(mpd_Connection * connection, int id)
++{
++    int len = strlen("playlistid") + 2 + INTLEN + 3;
++    char *string = malloc(len);
++    snprintf(string, len, "playlistid \"%i\"\n", id);
++    mpd_sendInfoCommand(connection, string);
++    free(string);
++}
++
++void mpd_sendPlChangesCommand(mpd_Connection * connection, long long playlist)
++{
++    int len = strlen("plchanges") + 2 + LONGLONGLEN + 3;
++    char *string = malloc(len);
++    snprintf(string, len, "plchanges \"%lld\"\n", playlist);
++    mpd_sendInfoCommand(connection, string);
++    free(string);
++}
++
++void mpd_sendPlChangesPosIdCommand(mpd_Connection * connection, long long playlist)
++{
++    int len = strlen("plchangesposid") + 2 + LONGLONGLEN + 3;
++    char *string = malloc(len);
++    snprintf(string, len, "plchangesposid \"%lld\"\n", playlist);
++    mpd_sendInfoCommand(connection, string);
++    free(string);
++}
++
++void mpd_sendListallCommand(mpd_Connection * connection, const char *dir)
++{
++    char *sDir = mpd_sanitizeArg(dir);
++    int len = strlen("listall") + 2 + strlen(sDir) + 3;
++    char *string = malloc(len);
++    snprintf(string, len, "listall \"%s\"\n", sDir);
++    mpd_sendInfoCommand(connection, string);
++    free(string);
++    free(sDir);
++}
++
++void mpd_sendListallInfoCommand(mpd_Connection * connection, const char *dir)
++{
++    char *sDir = mpd_sanitizeArg(dir);
++    int len = strlen("listallinfo") + 2 + strlen(sDir) + 3;
++    char *string = malloc(len);
++    snprintf(string, len, "listallinfo \"%s\"\n", sDir);
++    mpd_sendInfoCommand(connection, string);
++    free(string);
++    free(sDir);
++}
++
++void mpd_sendLsInfoCommand(mpd_Connection * connection, const char *dir)
++{
++    char *sDir = mpd_sanitizeArg(dir);
++    int len = strlen("lsinfo") + 2 + strlen(sDir) + 3;
++    char *string = malloc(len);
++    snprintf(string, len, "lsinfo \"%s\"\n", sDir);
++    mpd_sendInfoCommand(connection, string);
++    free(string);
++    free(sDir);
++}
++
++void mpd_sendCurrentSongCommand(mpd_Connection * connection)
++{
++    mpd_executeCommand(connection, "currentsong\n");
++}
++
++void mpd_sendSearchCommand(mpd_Connection * connection, int table, const char *str)
++{
++    mpd_startSearch(connection, 0);
++    mpd_addConstraintSearch(connection, table, str);
++    mpd_commitSearch(connection);
++}
++
++void mpd_sendFindCommand(mpd_Connection * connection, int table, const char *str)
++{
++    mpd_startSearch(connection, 1);
++    mpd_addConstraintSearch(connection, table, str);
++    mpd_commitSearch(connection);
++}
++
++void mpd_sendListCommand(mpd_Connection * connection, int table, const char *arg1)
++{
++    char st[10];
++    int len;
++    char *string;
++    if (table == MPD_TABLE_ARTIST)
++      strcpy(st, "artist");
++    else if (table == MPD_TABLE_ALBUM)
++      strcpy(st, "album");
++    else {
++      connection->error = 1;
++      strcpy(connection->errorStr, "unknown table for list");
++      return;
++    }
++    if (arg1) {
++      char *sanitArg1 = mpd_sanitizeArg(arg1);
++      len = strlen("list") + 1 + strlen(sanitArg1) + 2 + strlen(st) + 3;
++      string = malloc(len);
++      snprintf(string, len, "list %s \"%s\"\n", st, sanitArg1);
++      free(sanitArg1);
++    } else {
++      len = strlen("list") + 1 + strlen(st) + 2;
++      string = malloc(len);
++      snprintf(string, len, "list %s\n", st);
++    }
++    mpd_sendInfoCommand(connection, string);
++    free(string);
++}
++
++void mpd_sendAddCommand(mpd_Connection * connection, const char *file)
++{
++    char *sFile = mpd_sanitizeArg(file);
++    int len = strlen("add") + 2 + strlen(sFile) + 3;
++    char *string = malloc(len);
++    snprintf(string, len, "add \"%s\"\n", sFile);
++    mpd_executeCommand(connection, string);
++    free(string);
++    free(sFile);
++}
++
++int mpd_sendAddIdCommand(mpd_Connection * connection, const char *file)
++{
++    int retval = -1;
++    char *sFile = mpd_sanitizeArg(file);
++    int len = strlen("addid") + 2 + strlen(sFile) + 3;
++    char *string = malloc(len);
++
++    snprintf(string, len, "addid \"%s\"\n", sFile);
++    mpd_sendInfoCommand(connection, string);
++    free(string);
++    free(sFile);
++
++    string = mpd_getNextReturnElementNamed(connection, "Id");
++    if (string) {
++      retval = atoi(string);
++      free(string);
++    }
++
++    return retval;
++}
++
++void mpd_sendDeleteCommand(mpd_Connection * connection, int songPos)
++{
++    int len = strlen("delete") + 2 + INTLEN + 3;
++    char *string = malloc(len);
++    snprintf(string, len, "delete \"%i\"\n", songPos);
++    mpd_sendInfoCommand(connection, string);
++    free(string);
++}
++
++void mpd_sendDeleteIdCommand(mpd_Connection * connection, int id)
++{
++    int len = strlen("deleteid") + 2 + INTLEN + 3;
++    char *string = malloc(len);
++    snprintf(string, len, "deleteid \"%i\"\n", id);
++    mpd_sendInfoCommand(connection, string);
++    free(string);
++}
++
++void mpd_sendSaveCommand(mpd_Connection * connection, const char *name)
++{
++    char *sName = mpd_sanitizeArg(name);
++    int len = strlen("save") + 2 + strlen(sName) + 3;
++    char *string = malloc(len);
++    snprintf(string, len, "save \"%s\"\n", sName);
++    mpd_executeCommand(connection, string);
++    free(string);
++    free(sName);
++}
++
++void mpd_sendLoadCommand(mpd_Connection * connection, const char *name)
++{
++    char *sName = mpd_sanitizeArg(name);
++    int len = strlen("load") + 2 + strlen(sName) + 3;
++    char *string = malloc(len);
++    snprintf(string, len, "load \"%s\"\n", sName);
++    mpd_executeCommand(connection, string);
++    free(string);
++    free(sName);
++}
++
++void mpd_sendRmCommand(mpd_Connection * connection, const char *name)
++{
++    char *sName = mpd_sanitizeArg(name);
++    int len = strlen("rm") + 2 + strlen(sName) + 3;
++    char *string = malloc(len);
++    snprintf(string, len, "rm \"%s\"\n", sName);
++    mpd_executeCommand(connection, string);
++    free(string);
++    free(sName);
++}
++
++void mpd_sendRenameCommand(mpd_Connection * connection, const char *from, const char *to)
++{
++    char *sFrom = mpd_sanitizeArg(from);
++    char *sTo = mpd_sanitizeArg(to);
++    int len = strlen("rename") + 2 + strlen(sFrom) + 3 + strlen(sTo) + 3;
++    char *string = malloc(len);
++    snprintf(string, len, "rename \"%s\" \"%s\"\n", sFrom, sTo);
++    mpd_executeCommand(connection, string);
++    free(string);
++    free(sFrom);
++    free(sTo);
++}
++
++void mpd_sendShuffleCommand(mpd_Connection * connection)
++{
++    mpd_executeCommand(connection, "shuffle\n");
++}
++
++void mpd_sendClearCommand(mpd_Connection * connection)
++{
++    mpd_executeCommand(connection, "clear\n");
++}
++
++void mpd_sendPlayCommand(mpd_Connection * connection, int songPos)
++{
++    int len = strlen("play") + 2 + INTLEN + 3;
++    char *string = malloc(len);
++    snprintf(string, len, "play \"%i\"\n", songPos);
++    mpd_sendInfoCommand(connection, string);
++    free(string);
++}
++
++void mpd_sendPlayIdCommand(mpd_Connection * connection, int id)
++{
++    int len = strlen("playid") + 2 + INTLEN + 3;
++    char *string = malloc(len);
++    snprintf(string, len, "playid \"%i\"\n", id);
++    mpd_sendInfoCommand(connection, string);
++    free(string);
++}
++
++void mpd_sendStopCommand(mpd_Connection * connection)
++{
++    mpd_executeCommand(connection, "stop\n");
++}
++
++void mpd_sendPauseCommand(mpd_Connection * connection, int pauseMode)
++{
++    int len = strlen("pause") + 2 + INTLEN + 3;
++    char *string = malloc(len);
++    snprintf(string, len, "pause \"%i\"\n", pauseMode);
++    mpd_executeCommand(connection, string);
++    free(string);
++}
++
++void mpd_sendNextCommand(mpd_Connection * connection)
++{
++    mpd_executeCommand(connection, "next\n");
++}
++
++void mpd_sendMoveCommand(mpd_Connection * connection, int from, int to)
++{
++    int len = strlen("move") + 2 + INTLEN + 3 + INTLEN + 3;
++    char *string = malloc(len);
++    snprintf(string, len, "move \"%i\" \"%i\"\n", from, to);
++    mpd_sendInfoCommand(connection, string);
++    free(string);
++}
++
++void mpd_sendMoveIdCommand(mpd_Connection * connection, int id, int to)
++{
++    int len = strlen("moveid") + 2 + INTLEN + 3 + INTLEN + 3;
++    char *string = malloc(len);
++    snprintf(string, len, "moveid \"%i\" \"%i\"\n", id, to);
++    mpd_sendInfoCommand(connection, string);
++    free(string);
++}
++
++void mpd_sendSwapCommand(mpd_Connection * connection, int song1, int song2)
++{
++    int len = strlen("swap") + 2 + INTLEN + 3 + INTLEN + 3;
++    char *string = malloc(len);
++    snprintf(string, len, "swap \"%i\" \"%i\"\n", song1, song2);
++    mpd_sendInfoCommand(connection, string);
++    free(string);
++}
++
++void mpd_sendSwapIdCommand(mpd_Connection * connection, int id1, int id2)
++{
++    int len = strlen("swapid") + 2 + INTLEN + 3 + INTLEN + 3;
++    char *string = malloc(len);
++    snprintf(string, len, "swapid \"%i\" \"%i\"\n", id1, id2);
++    mpd_sendInfoCommand(connection, string);
++    free(string);
++}
++
++void mpd_sendSeekCommand(mpd_Connection * connection, int song, int time)
++{
++    int len = strlen("seek") + 2 + INTLEN + 3 + INTLEN + 3;
++    char *string = malloc(len);
++    snprintf(string, len, "seek \"%i\" \"%i\"\n", song, time);
++    mpd_sendInfoCommand(connection, string);
++    free(string);
++}
++
++void mpd_sendSeekIdCommand(mpd_Connection * connection, int id, int time)
++{
++    int len = strlen("seekid") + 2 + INTLEN + 3 + INTLEN + 3;
++    char *string = malloc(len);
++    snprintf(string, len, "seekid \"%i\" \"%i\"\n", id, time);
++    mpd_sendInfoCommand(connection, string);
++    free(string);
++}
++
++void mpd_sendUpdateCommand(mpd_Connection * connection, char *path)
++{
++    char *sPath = mpd_sanitizeArg(path);
++    int len = strlen("update") + 2 + strlen(sPath) + 3;
++    char *string = malloc(len);
++    snprintf(string, len, "update \"%s\"\n", sPath);
++    mpd_sendInfoCommand(connection, string);
++    free(string);
++    free(sPath);
++}
++
++int mpd_getUpdateId(mpd_Connection * connection)
++{
++    char *jobid;
++    int ret = 0;
++
++    jobid = mpd_getNextReturnElementNamed(connection, "updating_db");
++    if (jobid) {
++      ret = atoi(jobid);
++      free(jobid);
++    }
++
++    return ret;
++}
++
++void mpd_sendPrevCommand(mpd_Connection * connection)
++{
++    mpd_executeCommand(connection, "previous\n");
++}
++
++void mpd_sendRepeatCommand(mpd_Connection * connection, int repeatMode)
++{
++    int len = strlen("repeat") + 2 + INTLEN + 3;
++    char *string = malloc(len);
++    snprintf(string, len, "repeat \"%i\"\n", repeatMode);
++    mpd_executeCommand(connection, string);
++    free(string);
++}
++
++void mpd_sendRandomCommand(mpd_Connection * connection, int randomMode)
++{
++    int len = strlen("random") + 2 + INTLEN + 3;
++    char *string = malloc(len);
++    snprintf(string, len, "random \"%i\"\n", randomMode);
++    mpd_executeCommand(connection, string);
++    free(string);
++}
++
++void mpd_sendSetvolCommand(mpd_Connection * connection, int volumeChange)
++{
++    int len = strlen("setvol") + 2 + INTLEN + 3;
++    char *string = malloc(len);
++    snprintf(string, len, "setvol \"%i\"\n", volumeChange);
++    mpd_executeCommand(connection, string);
++    free(string);
++}
++
++void mpd_sendVolumeCommand(mpd_Connection * connection, int volumeChange)
++{
++    int len = strlen("volume") + 2 + INTLEN + 3;
++    char *string = malloc(len);
++    snprintf(string, len, "volume \"%i\"\n", volumeChange);
++    mpd_executeCommand(connection, string);
++    free(string);
++}
++
++void mpd_sendCrossfadeCommand(mpd_Connection * connection, int seconds)
++{
++    int len = strlen("crossfade") + 2 + INTLEN + 3;
++    char *string = malloc(len);
++    snprintf(string, len, "crossfade \"%i\"\n", seconds);
++    mpd_executeCommand(connection, string);
++    free(string);
++}
++
++void mpd_sendPasswordCommand(mpd_Connection * connection, const char *pass)
++{
++    char *sPass = mpd_sanitizeArg(pass);
++    int len = strlen("password") + 2 + strlen(sPass) + 3;
++    char *string = malloc(len);
++    snprintf(string, len, "password \"%s\"\n", sPass);
++    mpd_executeCommand(connection, string);
++    free(string);
++    free(sPass);
++}
++
++void mpd_sendCommandListBegin(mpd_Connection * connection)
++{
++    if (connection->commandList) {
++      strcpy(connection->errorStr, "already in command list mode");
++      connection->error = 1;
++      return;
++    }
++    connection->commandList = COMMAND_LIST;
++    mpd_executeCommand(connection, "command_list_begin\n");
++}
++
++void mpd_sendCommandListOkBegin(mpd_Connection * connection)
++{
++    if (connection->commandList) {
++      strcpy(connection->errorStr, "already in command list mode");
++      connection->error = 1;
++      return;
++    }
++    connection->commandList = COMMAND_LIST_OK;
++    mpd_executeCommand(connection, "command_list_ok_begin\n");
++    connection->listOks = 0;
++}
++
++void mpd_sendCommandListEnd(mpd_Connection * connection)
++{
++    if (!connection->commandList) {
++      strcpy(connection->errorStr, "not in command list mode");
++      connection->error = 1;
++      return;
++    }
++    connection->commandList = 0;
++    mpd_executeCommand(connection, "command_list_end\n");
++}
++
++void mpd_sendOutputsCommand(mpd_Connection * connection)
++{
++    mpd_executeCommand(connection, "outputs\n");
++}
++
++mpd_OutputEntity *mpd_getNextOutput(mpd_Connection * connection)
++{
++    mpd_OutputEntity *output = NULL;
++
++    if (connection->doneProcessing || (connection->listOks && connection->doneListOk)) {
++      return NULL;
++    }
++
++    if (connection->error)
++      return NULL;
++
++    output = malloc(sizeof(mpd_OutputEntity));
++    output->id = -10;
++    output->name = NULL;
++    output->enabled = 0;
++
++    if (!connection->returnElement)
++      mpd_getNextReturnElement(connection);
++
++    while (connection->returnElement) {
++      mpd_ReturnElement *re = connection->returnElement;
++      if (strcmp(re->name, "outputid") == 0) {
++          if (output != NULL && output->id >= 0)
++              return output;
++          output->id = atoi(re->value);
++      } else if (strcmp(re->name, "outputname") == 0) {
++          output->name = strdup(re->value);
++      } else if (strcmp(re->name, "outputenabled") == 0) {
++          output->enabled = atoi(re->value);
++      }
++
++      mpd_getNextReturnElement(connection);
++      if (connection->error) {
++          free(output);
++          return NULL;
++      }
++
++    }
++
++    return output;
++}
++
++void mpd_sendEnableOutputCommand(mpd_Connection * connection, int outputId)
++{
++    int len = strlen("enableoutput") + 2 + INTLEN + 3;
++    char *string = malloc(len);
++    snprintf(string, len, "enableoutput \"%i\"\n", outputId);
++    mpd_executeCommand(connection, string);
++    free(string);
++}
++
++void mpd_sendDisableOutputCommand(mpd_Connection * connection, int outputId)
++{
++    int len = strlen("disableoutput") + 2 + INTLEN + 3;
++    char *string = malloc(len);
++    snprintf(string, len, "disableoutput \"%i\"\n", outputId);
++    mpd_executeCommand(connection, string);
++    free(string);
++}
++
++void mpd_freeOutputElement(mpd_OutputEntity * output)
++{
++    free(output->name);
++    free(output);
++}
++
++/**
++ * mpd_sendNotCommandsCommand
++ * odd naming, but it gets the not allowed commands
++ */
++
++void mpd_sendNotCommandsCommand(mpd_Connection * connection)
++{
++    mpd_executeCommand(connection, "notcommands\n");
++}
++
++/**
++ * mpd_sendCommandsCommand
++ * odd naming, but it gets the allowed commands
++ */
++void mpd_sendCommandsCommand(mpd_Connection * connection)
++{
++    mpd_executeCommand(connection, "commands\n");
++}
++
++/**
++ * Get the next returned command
++ */
++char *mpd_getNextCommand(mpd_Connection * connection)
++{
++    return mpd_getNextReturnElementNamed(connection, "command");
++}
++
++void mpd_sendUrlHandlersCommand(mpd_Connection * connection)
++{
++    mpd_executeCommand(connection, "urlhandlers\n");
++}
++
++char *mpd_getNextHandler(mpd_Connection * connection)
++{
++    return mpd_getNextReturnElementNamed(connection, "handler");
++}
++
++void mpd_sendTagTypesCommand(mpd_Connection * connection)
++{
++    mpd_executeCommand(connection, "tagtypes\n");
++}
++
++char *mpd_getNextTagType(mpd_Connection * connection)
++{
++    return mpd_getNextReturnElementNamed(connection, "tagtype");
++}
++
++void mpd_startSearch(mpd_Connection * connection, int exact)
++{
++    if (connection->request) {
++      strcpy(connection->errorStr, "search already in progress");
++      connection->error = 1;
++      return;
++    }
++
++    if (exact)
++      connection->request = strdup("find");
++    else
++      connection->request = strdup("search");
++}
++
++void mpd_startStatsSearch(mpd_Connection * connection)
++{
++    if (connection->request) {
++      strcpy(connection->errorStr, "search already in progress");
++      connection->error = 1;
++      return;
++    }
++
++    connection->request = strdup("count");
++}
++
++void mpd_startPlaylistSearch(mpd_Connection * connection, int exact)
++{
++    if (connection->request) {
++      strcpy(connection->errorStr, "search already in progress");
++      connection->error = 1;
++      return;
++    }
++
++    if (exact)
++      connection->request = strdup("playlistfind");
++    else
++      connection->request = strdup("playlistsearch");
++}
++
++void mpd_startFieldSearch(mpd_Connection * connection, int type)
++{
++    char *strtype;
++    int len;
++
++    if (connection->request) {
++      strcpy(connection->errorStr, "search already in progress");
++      connection->error = 1;
++      return;
++    }
++
++    if (type < 0 || type >= MPD_TAG_NUM_OF_ITEM_TYPES) {
++      strcpy(connection->errorStr, "invalid type specified");
++      connection->error = 1;
++      return;
++    }
++
++    strtype = mpdTagItemKeys[type];
++
++    len = 5 + strlen(strtype) + 1;
++    connection->request = malloc(len);
++
++    snprintf(connection->request, len, "list %c%s", tolower(strtype[0]), strtype + 1);
++}
++
++void mpd_addConstraintSearch(mpd_Connection * connection, int type, const char *name)
++{
++    char *strtype;
++    char *arg;
++    int len;
++    char *string;
++
++    if (!connection->request) {
++      strcpy(connection->errorStr, "no search in progress");
++      connection->error = 1;
++      return;
++    }
++
++    if (type < 0 || type >= MPD_TAG_NUM_OF_ITEM_TYPES) {
++      strcpy(connection->errorStr, "invalid type specified");
++      connection->error = 1;
++      return;
++    }
++
++    if (name == NULL) {
++      strcpy(connection->errorStr, "no name specified");
++      connection->error = 1;
++      return;
++    }
++
++    string = strdup(connection->request);
++    strtype = mpdTagItemKeys[type];
++    arg = mpd_sanitizeArg(name);
++
++    len = strlen(string) + 1 + strlen(strtype) + 2 + strlen(arg) + 2;
++    connection->request = realloc(connection->request, len);
++    snprintf(connection->request, len, "%s %c%s \"%s\"", string, tolower(strtype[0]), strtype + 1, arg);
++
++    free(string);
++    free(arg);
++}
++
++void mpd_commitSearch(mpd_Connection * connection)
++{
++    int len;
++
++    if (!connection->request) {
++      strcpy(connection->errorStr, "no search in progress");
++      connection->error = 1;
++      return;
++    }
++
++    len = strlen(connection->request) + 2;
++    connection->request = realloc(connection->request, len);
++    connection->request[len - 2] = '\n';
++    connection->request[len - 1] = '\0';
++    mpd_sendInfoCommand(connection, connection->request);
++
++    free(connection->request);
++    connection->request = NULL;
++}
++
++/**
++ * @param connection a MpdConnection
++ * @param path        the path to the playlist.
++ *
++ * List the content, with full metadata, of a stored playlist.
++ *
++ */
++void mpd_sendListPlaylistInfoCommand(mpd_Connection * connection, char *path)
++{
++    char *arg = mpd_sanitizeArg(path);
++    int len = strlen("listplaylistinfo") + 2 + strlen(arg) + 3;
++    char *query = malloc(len);
++    snprintf(query, len, "listplaylistinfo \"%s\"\n", arg);
++    mpd_sendInfoCommand(connection, query);
++    free(arg);
++    free(query);
++}
++
++/**
++ * @param connection a MpdConnection
++ * @param path        the path to the playlist.
++ *
++ * List the content of a stored playlist.
++ *
++ */
++void mpd_sendListPlaylistCommand(mpd_Connection * connection, char *path)
++{
++    char *arg = mpd_sanitizeArg(path);
++    int len = strlen("listplaylist") + 2 + strlen(arg) + 3;
++    char *query = malloc(len);
++    snprintf(query, len, "listplaylist \"%s\"\n", arg);
++    mpd_sendInfoCommand(connection, query);
++    free(arg);
++    free(query);
++}
++
++void mpd_sendPlaylistClearCommand(mpd_Connection * connection, char *path)
++{
++    char *sPath = mpd_sanitizeArg(path);
++    int len = strlen("playlistclear") + 2 + strlen(sPath) + 3;
++    char *string = malloc(len);
++    snprintf(string, len, "playlistclear \"%s\"\n", sPath);
++    mpd_executeCommand(connection, string);
++    free(sPath);
++    free(string);
++}
++
++void mpd_sendPlaylistAddCommand(mpd_Connection * connection, char *playlist, char *path)
++{
++    char *sPlaylist = mpd_sanitizeArg(playlist);
++    char *sPath = mpd_sanitizeArg(path);
++    int len = strlen("playlistadd") + 2 + strlen(sPlaylist) + 3 + strlen(sPath) + 3;
++    char *string = malloc(len);
++    snprintf(string, len, "playlistadd \"%s\" \"%s\"\n", sPlaylist, sPath);
++    mpd_executeCommand(connection, string);
++    free(sPlaylist);
++    free(sPath);
++    free(string);
++}
++
++void mpd_sendPlaylistMoveCommand(mpd_Connection * connection, char *playlist, int from, int to)
++{
++    char *sPlaylist = mpd_sanitizeArg(playlist);
++    int len = strlen("playlistmove") + 2 + strlen(sPlaylist) + 3 + INTLEN + 3 + INTLEN + 3;
++    char *string = malloc(len);
++    snprintf(string, len, "playlistmove \"%s\" \"%i\" \"%i\"\n", sPlaylist, from, to);
++    mpd_executeCommand(connection, string);
++    free(sPlaylist);
++    free(string);
++}
++
++void mpd_sendPlaylistDeleteCommand(mpd_Connection * connection, char *playlist, int pos)
++{
++    char *sPlaylist = mpd_sanitizeArg(playlist);
++    int len = strlen("playlistdelete") + 2 + strlen(sPlaylist) + 3 + INTLEN + 3;
++    char *string = malloc(len);
++    snprintf(string, len, "playlistdelete \"%s\" \"%i\"\n", sPlaylist, pos);
++    mpd_executeCommand(connection, string);
++    free(sPlaylist);
++    free(string);
++}
+--- /dev/null
++++ b/libmpdclient.h
+@@ -0,0 +1,661 @@
++/* libmpdclient
++   (c)2003-2006 by Warren Dukes (warren.dukes@gmail.com)
++   This project's homepage is: http://www.musicpd.org
++
++   Redistribution and use in source and binary forms, with or without
++   modification, are permitted provided that the following conditions
++   are met:
++
++   - Redistributions of source code must retain the above copyright
++   notice, this list of conditions and the following disclaimer.
++
++   - Redistributions in binary form must reproduce the above copyright
++   notice, this list of conditions and the following disclaimer in the
++   documentation and/or other materials provided with the distribution.
++
++   - Neither the name of the Music Player Daemon nor the names of its
++   contributors may be used to endorse or promote products derived from
++   this software without specific prior written permission.
++
++   THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
++   ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
++   LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
++   A PARTICULAR PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR
++   CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
++   EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
++   PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
++   PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
++   LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
++   NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
++   SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
++*/
++
++#ifndef LIBMPDCLIENT_H
++#define LIBMPDCLIENT_H
++
++#ifdef WIN32
++#  define __W32API_USE_DLLIMPORT__ 1
++#endif
++
++#include <sys/time.h>
++#include <stdarg.h>
++#define MPD_BUFFER_MAX_LENGTH 50000
++#define MPD_ERRORSTR_MAX_LENGTH       1000
++#define MPD_WELCOME_MESSAGE   "OK MPD "
++
++#define MPD_ERROR_TIMEOUT     10      /* timeout trying to talk to mpd */
++#define MPD_ERROR_SYSTEM      11      /* system error */
++#define MPD_ERROR_UNKHOST     12      /* unknown host */
++#define MPD_ERROR_CONNPORT    13      /* problems connecting to port on host */
++#define MPD_ERROR_NOTMPD      14      /* mpd not running on port at host */
++#define MPD_ERROR_NORESPONSE  15      /* no response on attempting to connect */
++#define MPD_ERROR_SENDING     16      /* error sending command */
++#define MPD_ERROR_CONNCLOSED  17      /* connection closed by mpd */
++#define MPD_ERROR_ACK         18      /* ACK returned! */
++#define MPD_ERROR_BUFFEROVERRUN       19      /* Buffer was overrun! */
++
++#define MPD_ACK_ERROR_UNK     -1
++#define MPD_ERROR_AT_UNK      -1
++
++#define MPD_ACK_ERROR_NOT_LIST                        1
++#define MPD_ACK_ERROR_ARG                     2
++#define MPD_ACK_ERROR_PASSWORD                        3
++#define MPD_ACK_ERROR_PERMISSION              4
++#define MPD_ACK_ERROR_UNKNOWN_CMD             5
++
++#define MPD_ACK_ERROR_NO_EXIST                        50
++#define MPD_ACK_ERROR_PLAYLIST_MAX            51
++#define MPD_ACK_ERROR_SYSTEM                  52
++#define MPD_ACK_ERROR_PLAYLIST_LOAD           53
++#define MPD_ACK_ERROR_UPDATE_ALREADY          54
++#define MPD_ACK_ERROR_PLAYER_SYNC             55
++#define MPD_ACK_ERROR_EXIST                   56
++
++#ifdef __cplusplus
++extern "C" {
++#endif
++
++    typedef enum mpd_TagItems {
++      MPD_TAG_ITEM_ARTIST,
++      MPD_TAG_ITEM_ALBUM,
++      MPD_TAG_ITEM_TITLE,
++      MPD_TAG_ITEM_TRACK,
++      MPD_TAG_ITEM_NAME,
++      MPD_TAG_ITEM_GENRE,
++      MPD_TAG_ITEM_DATE,
++      MPD_TAG_ITEM_COMPOSER,
++      MPD_TAG_ITEM_PERFORMER,
++      MPD_TAG_ITEM_COMMENT,
++      MPD_TAG_ITEM_DISC,
++      MPD_TAG_ITEM_FILENAME,
++      MPD_TAG_ITEM_ANY,
++      MPD_TAG_NUM_OF_ITEM_TYPES
++    } mpd_TagItems;
++
++    extern char *mpdTagItemKeys[MPD_TAG_NUM_OF_ITEM_TYPES];
++
++/* internal stuff don't touch this struct */
++    typedef struct _mpd_ReturnElement {
++      char *name;
++      char *value;
++    } mpd_ReturnElement;
++
++/* mpd_Connection
++ * holds info about connection to mpd
++ * use error, and errorStr to detect errors
++ */
++    typedef struct _mpd_Connection {
++      /* use this to check the version of mpd */
++      int version[3];
++      /* IMPORTANT, you want to get the error messages from here */
++      char errorStr[MPD_ERRORSTR_MAX_LENGTH + 1];
++      int errorCode;
++      int errorAt;
++      /* this will be set to MPD_ERROR_* if there is an error, 0 if not */
++      int error;
++      /* DON'T TOUCH any of the rest of this stuff */
++      int sock;
++      char buffer[MPD_BUFFER_MAX_LENGTH + 1];
++      int buflen;
++      int bufstart;
++      int doneProcessing;
++      int listOks;
++      int doneListOk;
++      int commandList;
++      mpd_ReturnElement *returnElement;
++      struct timeval timeout;
++      char *request;
++    } mpd_Connection;
++
++/* mpd_newConnection
++ * use this to open a new connection
++ * you should use mpd_closeConnection, when your done with the connection,
++ * even if an error has occurred
++ * _timeout_ is the connection timeout period in seconds
++ */
++    mpd_Connection *mpd_newConnection(const char *host, int port, float timeout);
++
++    void mpd_setConnectionTimeout(mpd_Connection * connection, float timeout);
++
++/* mpd_closeConnection
++ * use this to close a connection and free'ing subsequent memory
++ */
++    void mpd_closeConnection(mpd_Connection * connection);
++
++/* mpd_clearError
++ * clears error
++ */
++    void mpd_clearError(mpd_Connection * connection);
++
++/* STATUS STUFF */
++
++/* use these with status.state to determine what state the player is in */
++#define MPD_STATUS_STATE_UNKNOWN      0
++#define MPD_STATUS_STATE_STOP         1
++#define MPD_STATUS_STATE_PLAY         2
++#define MPD_STATUS_STATE_PAUSE                3
++
++/* us this with status.volume to determine if mpd has volume support */
++#define MPD_STATUS_NO_VOLUME          -1
++
++/* mpd_Status
++ * holds info return from status command
++ */
++    typedef struct mpd_Status {
++      /* 0-100, or MPD_STATUS_NO_VOLUME when there is no volume support */
++      int volume;
++      /* 1 if repeat is on, 0 otherwise */
++      int repeat;
++      /* 1 if random is on, 0 otherwise */
++      int random;
++      /* playlist length */
++      int playlistLength;
++      /* playlist, use this to determine when the playlist has changed */
++      long long playlist;
++      /* use with MPD_STATUS_STATE_* to determine state of player */
++      int state;
++      /* crossfade setting in seconds */
++      int crossfade;
++      /* if a song is currently selected (always the case when state is
++       * PLAY or PAUSE), this is the position of the currently
++       * playing song in the playlist, beginning with 0
++       */
++      int song;
++      /* Song ID of the currently selected song */
++      int songid;
++      /* time in seconds that have elapsed in the currently playing/paused
++       * song
++       */
++      int elapsedTime;
++      /* length in seconds of the currently playing/paused song */
++      int totalTime;
++      /* current bit rate in kbs */
++      int bitRate;
++      /* audio sample rate */
++      unsigned int sampleRate;
++      /* audio bits */
++      int bits;
++      /* audio channels */
++      int channels;
++      /* 1 if mpd is updating, 0 otherwise */
++      int updatingDb;
++      /* error */
++      char *error;
++    } mpd_Status;
++
++    void mpd_sendStatusCommand(mpd_Connection * connection);
++
++/* mpd_getStatus
++ * returns status info, be sure to free it with mpd_freeStatus()
++ * call this after mpd_sendStatusCommand()
++ */
++    mpd_Status *mpd_getStatus(mpd_Connection * connection);
++
++/* mpd_freeStatus
++ * free's status info malloc'd and returned by mpd_getStatus
++ */
++    void mpd_freeStatus(mpd_Status * status);
++
++    typedef struct _mpd_Stats {
++      int numberOfArtists;
++      int numberOfAlbums;
++      int numberOfSongs;
++      unsigned long uptime;
++      unsigned long dbUpdateTime;
++      unsigned long playTime;
++      unsigned long dbPlayTime;
++    } mpd_Stats;
++
++    typedef struct _mpd_SearchStats {
++      int numberOfSongs;
++      unsigned long playTime;
++    } mpd_SearchStats;
++
++    void mpd_sendStatsCommand(mpd_Connection * connection);
++
++    mpd_Stats *mpd_getStats(mpd_Connection * connection);
++
++    void mpd_freeStats(mpd_Stats * stats);
++
++    mpd_SearchStats *mpd_getSearchStats(mpd_Connection * connection);
++
++    void mpd_freeSearchStats(mpd_SearchStats * stats);
++
++/* SONG STUFF */
++
++#define MPD_SONG_NO_TIME      -1
++#define MPD_SONG_NO_NUM               -1
++#define MPD_SONG_NO_ID                -1
++
++/* mpd_Song
++ * for storing song info returned by mpd
++ */
++    typedef struct _mpd_Song {
++      /* filename of song */
++      char *file;
++      /* artist, maybe NULL if there is no tag */
++      char *artist;
++      /* title, maybe NULL if there is no tag */
++      char *title;
++      /* album, maybe NULL if there is no tag */
++      char *album;
++      /* track, maybe NULL if there is no tag */
++      char *track;
++      /* name, maybe NULL if there is no tag; it's the name of the current
++       * song, f.e. the icyName of the stream */
++      char *name;
++      /* date */
++      char *date;
++
++      /* added by qball */
++      /* Genre */
++      char *genre;
++      /* Composer */
++      char *composer;
++      /* Performer */
++      char *performer;
++      /* Disc */
++      char *disc;
++      /* Comment */
++      char *comment;
++
++      /* length of song in seconds, check that it is not MPD_SONG_NO_TIME  */
++      int time;
++      /* if plchanges/playlistinfo/playlistid used, is the position of the
++       * song in the playlist */
++      int pos;
++      /* song id for a song in the playlist */
++      int id;
++    } mpd_Song;
++
++/* mpd_newSong
++ * use to allocate memory for a new mpd_Song
++ * file, artist, etc all initialized to NULL
++ * if your going to assign values to file, artist, etc
++ * be sure to malloc or strdup the memory
++ * use mpd_freeSong to free the memory for the mpd_Song, it will also
++ * free memory for file, artist, etc, so don't do it yourself
++ */
++    mpd_Song *mpd_newSong(void);
++
++/* mpd_freeSong
++ * use to free memory allocated by mpd_newSong
++ * also it will free memory pointed to by file, artist, etc, so be careful
++ */
++    void mpd_freeSong(mpd_Song * song);
++
++/* mpd_songDup
++ * works like strDup, but for a mpd_Song
++ */
++    mpd_Song *mpd_songDup(mpd_Song * song);
++
++/* DIRECTORY STUFF */
++
++/* mpd_Directory
++ * used to store info fro directory (right now that just the path)
++ */
++    typedef struct _mpd_Directory {
++      char *path;
++    } mpd_Directory;
++
++/* mpd_newDirectory
++ * allocates memory for a new directory
++ * use mpd_freeDirectory to free this memory
++ */
++    mpd_Directory *mpd_newDirectory(void);
++
++/* mpd_freeDirectory
++ * used to free memory allocated with mpd_newDirectory, and it frees
++ * path of mpd_Directory, so be careful
++ */
++    void mpd_freeDirectory(mpd_Directory * directory);
++
++/* mpd_directoryDup
++ * works like strdup, but for mpd_Directory
++ */
++    mpd_Directory *mpd_directoryDup(mpd_Directory * directory);
++
++/* PLAYLISTFILE STUFF */
++
++/* mpd_PlaylistFile
++ * stores info about playlist file returned by lsinfo
++ */
++    typedef struct _mpd_PlaylistFile {
++      char *path;
++    } mpd_PlaylistFile;
++
++/* mpd_newPlaylistFile
++ * allocates memory for new mpd_PlaylistFile, path is set to NULL
++ * free this memory with mpd_freePlaylistFile
++ */
++    mpd_PlaylistFile *mpd_newPlaylistFile(void);
++
++/* mpd_freePlaylist
++ * free memory allocated for freePlaylistFile, will also free
++ * path, so be careful
++ */
++    void mpd_freePlaylistFile(mpd_PlaylistFile * playlist);
++
++/* mpd_playlistFileDup
++ * works like strdup, but for mpd_PlaylistFile
++ */
++    mpd_PlaylistFile *mpd_playlistFileDup(mpd_PlaylistFile * playlist);
++
++/* INFO ENTITY STUFF */
++
++/* the type of entity returned from one of the commands that generates info
++ * use in conjunction with mpd_InfoEntity.type
++ */
++#define MPD_INFO_ENTITY_TYPE_DIRECTORY                0
++#define MPD_INFO_ENTITY_TYPE_SONG             1
++#define MPD_INFO_ENTITY_TYPE_PLAYLISTFILE     2
++
++/* mpd_InfoEntity
++ * stores info on stuff returned info commands
++ */
++    typedef struct mpd_InfoEntity {
++      /* the type of entity, use with MPD_INFO_ENTITY_TYPE_* to determine
++       * what this entity is (song, directory, etc...)
++       */
++      int type;
++      /* the actual data you want, mpd_Song, mpd_Directory, etc */
++      union {
++          mpd_Directory *directory;
++          mpd_Song *song;
++          mpd_PlaylistFile *playlistFile;
++      } info;
++    } mpd_InfoEntity;
++
++    mpd_InfoEntity *mpd_newInfoEntity(void);
++
++    void mpd_freeInfoEntity(mpd_InfoEntity * entity);
++
++/* INFO COMMANDS AND STUFF */
++
++/* use this function to loop over after calling Info/Listall functions */
++    mpd_InfoEntity *mpd_getNextInfoEntity(mpd_Connection * connection);
++
++/* fetches the currently seeletect song (the song referenced by status->song
++ * and status->songid*/
++    void mpd_sendCurrentSongCommand(mpd_Connection * connection);
++
++/* songNum of -1, means to display the whole list */
++    void mpd_sendPlaylistInfoCommand(mpd_Connection * connection, int songNum);
++
++/* songId of -1, means to display the whole list */
++    void mpd_sendPlaylistIdCommand(mpd_Connection * connection, int songId);
++
++/* use this to get the changes in the playlist since version _playlist_ */
++    void mpd_sendPlChangesCommand(mpd_Connection * connection, long long playlist);
++
++/**
++ * @param connection: A valid and connected mpd_Connection.
++ * @param playlist: The playlist version you want the diff with.
++ * A more bandwidth efficient version of the mpd_sendPlChangesCommand.
++ * It only returns the pos+id of the changes song.
++ */
++    void mpd_sendPlChangesPosIdCommand(mpd_Connection * connection, long long playlist);
++
++/* recursivel fetches all songs/dir/playlists in "dir* (no metadata is
++ * returned) */
++    void mpd_sendListallCommand(mpd_Connection * connection, const char *dir);
++
++/* same as sendListallCommand, but also metadata is returned */
++    void mpd_sendListallInfoCommand(mpd_Connection * connection, const char *dir);
++
++/* non-recursive version of ListallInfo */
++    void mpd_sendLsInfoCommand(mpd_Connection * connection, const char *dir);
++
++#define MPD_TABLE_ARTIST      MPD_TAG_ITEM_ARTIST
++#define MPD_TABLE_ALBUM               MPD_TAG_ITEM_ALBUM
++#define MPD_TABLE_TITLE               MPD_TAG_ITEM_TITLE
++#define MPD_TABLE_FILENAME    MPD_TAG_ITEM_FILENAME
++
++    void mpd_sendSearchCommand(mpd_Connection * connection, int table, const char *str);
++
++    void mpd_sendFindCommand(mpd_Connection * connection, int table, const char *str);
++
++/* LIST TAG COMMANDS */
++
++/* use this function fetch next artist entry, be sure to free the returned
++ * string.  NULL means there are no more.  Best used with sendListArtists
++ */
++    char *mpd_getNextArtist(mpd_Connection * connection);
++
++    char *mpd_getNextAlbum(mpd_Connection * connection);
++
++    char *mpd_getNextTag(mpd_Connection * connection, int type);
++
++/* list artist or albums by artist, arg1 should be set to the artist if
++ * listing albums by a artist, otherwise NULL for listing all artists or albums
++ */
++    void mpd_sendListCommand(mpd_Connection * connection, int table, const char *arg1);
++
++/* SIMPLE COMMANDS */
++
++    void mpd_sendAddCommand(mpd_Connection * connection, const char *file);
++
++    int mpd_sendAddIdCommand(mpd_Connection * connection, const char *file);
++
++    void mpd_sendDeleteCommand(mpd_Connection * connection, int songNum);
++
++    void mpd_sendDeleteIdCommand(mpd_Connection * connection, int songNum);
++
++    void mpd_sendSaveCommand(mpd_Connection * connection, const char *name);
++
++    void mpd_sendLoadCommand(mpd_Connection * connection, const char *name);
++
++    void mpd_sendRmCommand(mpd_Connection * connection, const char *name);
++
++    void mpd_sendRenameCommand(mpd_Connection * connection, const char *from, const char *to);
++
++    void mpd_sendShuffleCommand(mpd_Connection * connection);
++
++    void mpd_sendClearCommand(mpd_Connection * connection);
++
++/* use this to start playing at the beginning, useful when in random mode */
++#define MPD_PLAY_AT_BEGINNING -1
++
++    void mpd_sendPlayCommand(mpd_Connection * connection, int songNum);
++
++    void mpd_sendPlayIdCommand(mpd_Connection * connection, int songNum);
++
++    void mpd_sendStopCommand(mpd_Connection * connection);
++
++    void mpd_sendPauseCommand(mpd_Connection * connection, int pauseMode);
++
++    void mpd_sendNextCommand(mpd_Connection * connection);
++
++    void mpd_sendPrevCommand(mpd_Connection * connection);
++
++    void mpd_sendMoveCommand(mpd_Connection * connection, int from, int to);
++
++    void mpd_sendMoveIdCommand(mpd_Connection * connection, int from, int to);
++
++    void mpd_sendSwapCommand(mpd_Connection * connection, int song1, int song2);
++
++    void mpd_sendSwapIdCommand(mpd_Connection * connection, int song1, int song2);
++
++    void mpd_sendSeekCommand(mpd_Connection * connection, int song, int time);
++
++    void mpd_sendSeekIdCommand(mpd_Connection * connection, int song, int time);
++
++    void mpd_sendRepeatCommand(mpd_Connection * connection, int repeatMode);
++
++    void mpd_sendRandomCommand(mpd_Connection * connection, int randomMode);
++
++    void mpd_sendSetvolCommand(mpd_Connection * connection, int volumeChange);
++
++/* WARNING: don't use volume command, its depreacted */
++    void mpd_sendVolumeCommand(mpd_Connection * connection, int volumeChange);
++
++    void mpd_sendCrossfadeCommand(mpd_Connection * connection, int seconds);
++
++    void mpd_sendUpdateCommand(mpd_Connection * connection, char *path);
++
++/* returns the update job id, call this after a update command*/
++    int mpd_getUpdateId(mpd_Connection * connection);
++
++    void mpd_sendPasswordCommand(mpd_Connection * connection, const char *pass);
++
++/* after executing a command, when your done with it to get its status
++ * (you want to check connection->error for an error)
++ */
++    void mpd_finishCommand(mpd_Connection * connection);
++
++/* command list stuff, use this to do things like add files very quickly */
++    void mpd_sendCommandListBegin(mpd_Connection * connection);
++
++    void mpd_sendCommandListOkBegin(mpd_Connection * connection);
++
++    void mpd_sendCommandListEnd(mpd_Connection * connection);
++
++/* advance to the next listOk
++ * returns 0 if advanced to the next list_OK,
++ * returns -1 if it advanced to an OK or ACK */
++    int mpd_nextListOkCommand(mpd_Connection * connection);
++
++    typedef struct _mpd_OutputEntity {
++      int id;
++      char *name;
++      int enabled;
++    } mpd_OutputEntity;
++
++    void mpd_sendOutputsCommand(mpd_Connection * connection);
++
++    mpd_OutputEntity *mpd_getNextOutput(mpd_Connection * connection);
++
++    void mpd_sendEnableOutputCommand(mpd_Connection * connection, int outputId);
++
++    void mpd_sendDisableOutputCommand(mpd_Connection * connection, int outputId);
++
++    void mpd_freeOutputElement(mpd_OutputEntity * output);
++
++/**
++ * @param connection a #mpd_Connection
++ *
++ * Queries mpd for the allowed commands
++ */
++    void mpd_sendCommandsCommand(mpd_Connection * connection);
++
++/**
++ * @param connection a #mpd_Connection
++ *
++ * Queries mpd for the not allowed commands
++ */
++    void mpd_sendNotCommandsCommand(mpd_Connection * connection);
++
++/**
++ * @param connection a #mpd_Connection
++ *
++ * returns the next supported command.
++ *
++ * @returns a string, needs to be free'ed
++ */
++    char *mpd_getNextCommand(mpd_Connection * connection);
++
++    void mpd_sendUrlHandlersCommand(mpd_Connection * connection);
++
++    char *mpd_getNextHandler(mpd_Connection * connection);
++
++    void mpd_sendTagTypesCommand(mpd_Connection * connection);
++
++    char *mpd_getNextTagType(mpd_Connection * connection);
++
++/**
++ * @param connection a MpdConnection
++ * @param path        the path to the playlist.
++ *
++ * List the content, with full metadata, of a stored playlist.
++ *
++ */
++    void mpd_sendListPlaylistInfoCommand(mpd_Connection * connection, char *path);
++
++/**
++ * @param connection a MpdConnection
++ * @param path        the path to the playlist.
++ *
++ * List the content of a stored playlist.
++ *
++ */
++    void mpd_sendListPlaylistCommand(mpd_Connection * connection, char *path);
++
++/**
++ * @param connection a #mpd_Connection
++ * @param exact if to match exact
++ *
++ * starts a search, use mpd_addConstraintSearch to add
++ * a constraint to the search, and mpd_commitSearch to do the actual search
++ */
++    void mpd_startSearch(mpd_Connection * connection, int exact);
++
++/**
++ * @param connection a #mpd_Connection
++ * @param type
++ * @param name
++ */
++    void mpd_addConstraintSearch(mpd_Connection * connection, int type, const char *name);
++
++/**
++ * @param connection a #mpd_Connection
++ */
++    void mpd_commitSearch(mpd_Connection * connection);
++
++/**
++ * @param connection a #mpd_Connection
++ * @param type The type to search for
++ *
++ * starts a search for fields... f.e. get a list of artists would be:
++ * @code
++ * mpd_startFieldSearch(connection, MPD_TAG_ITEM_ARTIST);
++ * mpd_commitSearch(connection);
++ * @endcode
++ *
++ * or get a list of artist in genre "jazz" would be:
++ * @code
++ * mpd_startFieldSearch(connection, MPD_TAG_ITEM_ARTIST);
++ * mpd_addConstraintSearch(connection, MPD_TAG_ITEM_GENRE, "jazz")
++ * mpd_commitSearch(connection);
++ * @endcode
++ *
++ * mpd_startSearch will return  a list of songs (and you need mpd_getNextInfoEntity)
++ * this one will return a list of only one field (the one specified with type) and you need
++ * mpd_getNextTag to get the results
++ */
++    void mpd_startFieldSearch(mpd_Connection * connection, int type);
++
++    void mpd_startPlaylistSearch(mpd_Connection * connection, int exact);
++
++    void mpd_startStatsSearch(mpd_Connection * connection);
++
++    void mpd_sendPlaylistClearCommand(mpd_Connection * connection, char *path);
++
++    void mpd_sendPlaylistAddCommand(mpd_Connection * connection, char *playlist, char *path);
++
++    void mpd_sendPlaylistMoveCommand(mpd_Connection * connection, char *playlist, int from, int to);
++
++    void mpd_sendPlaylistDeleteCommand(mpd_Connection * connection, char *playlist, int pos);
++#ifdef __cplusplus
++}
++#endif
++#endif
diff --git a/utils/lcd4linux/patches/160-uinput_defs.patch b/utils/lcd4linux/patches/160-uinput_defs.patch
new file mode 100644 (file)
index 0000000..44b24b3
--- /dev/null
@@ -0,0 +1,24 @@
+--- a/drv_G15.c
++++ b/drv_G15.c
+@@ -42,6 +42,7 @@
+ #include <usb.h>
+ #include <fcntl.h>
++#include <linux/version.h>
+ #include <linux/input.h>
+ #include <linux/uinput.h>
+@@ -269,8 +270,13 @@ void drv_G15_initKeyHandling(char *devic
+     }
+     memset(&device, 0, sizeof(device));
+     strncpy(device.name, "G15 Keys", UINPUT_MAX_NAME_SIZE);
++#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0)
+     device.id.bustype = BUS_USB;
+     device.id.version = 4;
++#else
++    device.idbus = BUS_USB;
++    device.idversion = 4;
++#endif
+     ioctl(uinput_fd, UI_SET_EVBIT, EV_KEY);
diff --git a/utils/lcd4linux/patches/170-add-generic-spidev-driver.patch b/utils/lcd4linux/patches/170-add-generic-spidev-driver.patch
new file mode 100644 (file)
index 0000000..4cd53d6
--- /dev/null
@@ -0,0 +1,195 @@
+--- a/Makefile.am
++++ b/Makefile.am
+@@ -71,6 +71,8 @@ drv_generic_i2c.c             \
+ drv_generic_i2c.h             \
+ drv_generic_keypad.c          \
+ drv_generic_keypad.h          \
++drv_generic_spidev.c          \
++drv_generic_spidev.h          \
+ drv_ASTUSB.c                  \
+ drv_BeckmannEgle.c            \
+ drv_BWCT.c                    \
+--- /dev/null
++++ b/drv_generic_spidev.c
+@@ -0,0 +1,89 @@
++/* $Id$
++ * $URL$
++ *
++ * generic driver helper for displays connected via SPI bus
++ *
++ * Copyright (C) 2012 Gabor Juhos <juhosg@openwrt.org>
++ *
++ * This file is part of LCD4Linux.
++ *
++ * LCD4Linux is free software; you can redistribute it and/or modify
++ * it under the terms of the GNU General Public License as published by
++ * the Free Software Foundation; either version 2, or (at your option)
++ * any later version.
++ *
++ * LCD4Linux is distributed in the hope that it will be useful,
++ * but WITHOUT ANY WARRANTY; without even the implied warranty of
++ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
++ * GNU General Public License for more details.
++ *
++ * You should have received a copy of the GNU General Public License
++ * along with this program; if not, write to the Free Software
++ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
++ *
++ */
++
++#include "config.h"
++
++#include <stdlib.h>
++#include <stdio.h>
++#include <string.h>
++#include <errno.h>
++#include <unistd.h>
++#include <fcntl.h>
++#include <sys/types.h>
++#include <sys/ioctl.h>
++
++#include "debug.h"
++#include "qprintf.h"
++#include "cfg.h"
++#include "drv_generic_spidev.h"
++
++static char *generic_spidev_section = "";
++static char *generic_spidev_driver = "";
++static int generic_spidev_fd;
++
++int drv_generic_spidev_open(const char *section, const char *driver)
++{
++    char *spidev;
++
++    udelay_init();
++
++    generic_spidev_section = (char *) section;
++    generic_spidev_driver = (char *) driver;
++
++    spidev = cfg_get(generic_spidev_section, "Port", NULL);
++
++    info("%s: initializing SPI device %s", generic_spidev_driver, spidev);
++    generic_spidev_fd = open(spidev, O_WRONLY);
++    if (generic_spidev_fd < 0) {
++      error("%s: unable to open SPI device %s!\n", generic_spidev_driver, spidev);
++      goto exit_error;
++    }
++
++    return 0;
++
++  exit_error:
++    free(spidev);
++    return -1;
++}
++
++int drv_generic_spidev_close(void)
++{
++    close(generic_spidev_fd);
++    return 0;
++}
++
++int drv_generic_spidev_transfer(const int count, struct spi_ioc_transfer *tr)
++{
++    int ret;
++
++    ret = ioctl(generic_spidev_fd, SPI_IOC_MESSAGE(count), tr);
++    if (ret < count) {
++      error("%s: can't send SPI message! (%s)\n",
++              generic_spidev_driver, strerror(errno));
++      return -1;
++    }
++
++    return 0;
++}
+--- /dev/null
++++ b/drv_generic_spidev.h
+@@ -0,0 +1,54 @@
++/* $Id$
++ * $URL$
++ *
++ * generic driver helper for displays connected via SPI bus
++ *
++ * Copyright (C) 2012 Gabor Juhos <juhosg@openwrt.org>
++ * Copyright (C) 2012 The LCD4Linux Team <lcd4linux-devel@users.sourceforge.net>
++ *
++ * This file is part of LCD4Linux.
++ *
++ * LCD4Linux is free software; you can redistribute it and/or modify
++ * it under the terms of the GNU General Public License as published by
++ * the Free Software Foundation; either version 2, or (at your option)
++ * any later version.
++ *
++ * LCD4Linux is distributed in the hope that it will be useful,
++ * but WITHOUT ANY WARRANTY; without even the implied warranty of
++ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
++ * GNU General Public License for more details.
++ *
++ * You should have received a copy of the GNU General Public License
++ * along with this program; if not, write to the Free Software
++ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
++ *
++ */
++
++/*
++ *
++ * exported fuctions:
++ *
++ * int drv_generic_spidev_open (const char *section, const char *driver)
++ *   reads 'Port' entry from config and opens
++ *   the SPI device
++ *   returns 0 if ok, -1 on failure
++ *
++ * int drv_generic_spidev_close (void)
++ *   closes SPI device
++ *   returns 0 if ok, -1 on failure
++ *
++ * void drv_generic_spidev_transfer (int count, struct spi_ioc_transfer *tr)
++ *   transfer data to/from the SPI device
++ *
++ */
++
++#ifndef _DRV_GENERIC_SPIDEV_H_
++#define _DRV_GENERIC_SPIDEV_H_
++
++#include <linux/spi/spidev.h>
++
++int drv_generic_spidev_open(const char *section, const char *driver);
++int drv_generic_spidev_close(void);
++int drv_generic_spidev_transfer(const int count, struct spi_ioc_transfer *tr);
++
++#endif /* _DRV_GENERIC_SPIDEV_H_ */
+--- a/drivers.m4
++++ b/drivers.m4
+@@ -301,6 +301,7 @@ PARPORT="no"
+ SERIAL="no"
+ I2C="no"
+ KEYPAD="no"
++SPIDEV="no"
+ # generic libraries
+ LIBUSB="no"
+@@ -936,6 +937,12 @@ if test "$LIBJPEG" = "yes"; then
+    DRVLIBS="$DRVLIBS -ljpeg"
+ fi
++# generic spidev driver
++if test "$SPIDEV" = "yes"; then
++   DRIVERS="$DRIVERS drv_generic_spidev.o"
++   AC_DEFINE(WITH_SPIDEV, 1, [SPIDEV driver])
++fi
++
+ # libusb
+ if test "$LIBUSB" = "yes"; then
+    DRVLIBS="$DRVLIBS -lusb"
+--- a/configure.ac
++++ b/configure.ac
+@@ -115,6 +115,9 @@ AC_ARG_WITH(outb,
+ AC_CHECK_HEADERS([asm/io.h] [linux/parport.h linux/ppdev.h], [has_parport="true"], [has_parport="false"])
++# check for spidev
++AC_CHECK_HEADERS([linux/spi/spidev.h], [has_spidev="true"], [has_spidev="false"])
++
+ # drivers
+ sinclude(drivers.m4)
diff --git a/utils/lcd4linux/patches/171-allow-to-specify-drv_generic_graphic_real_clear.patch b/utils/lcd4linux/patches/171-allow-to-specify-drv_generic_graphic_real_clear.patch
new file mode 100644 (file)
index 0000000..5a26643
--- /dev/null
@@ -0,0 +1,45 @@
+--- a/drv_generic_graphic.c
++++ b/drv_generic_graphic.c
+@@ -24,7 +24,7 @@
+  *
+  */
+-/* 
++/*
+  *
+  * exported functions:
+  *
+@@ -98,6 +98,9 @@ static int INVERTED = 0;
+ /* must be implemented by the real driver */
+ void (*drv_generic_graphic_real_blit) () = NULL;
++/* can be implemented by the real driver */
++void (*drv_generic_graphic_real_clear) () = NULL;
++
+ /****************************************/
+ /*** generic Framebuffer stuff        ***/
+@@ -691,7 +694,10 @@ int drv_generic_graphic_clear(void)
+       for (i = 0; i < LCOLS * LROWS; i++)
+           drv_generic_graphic_FB[l][i] = NO_COL;
+-    drv_generic_graphic_blit(0, 0, LROWS, LCOLS);
++    if (drv_generic_graphic_real_clear)
++      drv_generic_graphic_real_clear(NO_COL);
++    else
++      drv_generic_graphic_blit(0, 0, LROWS, LCOLS);
+     return 0;
+ }
+--- a/drv_generic_graphic.h
++++ b/drv_generic_graphic.h
+@@ -40,6 +40,9 @@ extern RGBA NO_COL;          /* no color (comple
+ /* these functions must be implemented by the real driver */
+ extern void (*drv_generic_graphic_real_blit) (const int row, const int col, const int height, const int width);
++/* these functions can be implemented by the real driver */
++void (*drv_generic_graphic_real_clear) (const RGBA rgba);
++
+ /* helper function to get pixel color or gray value */
+ extern RGBA drv_generic_graphic_rgb(const int row, const int col);
+ extern unsigned char drv_generic_graphic_gray(const int row, const int col);
diff --git a/utils/lcd4linux/patches/172-add-TEW673GRU-driver.patch b/utils/lcd4linux/patches/172-add-TEW673GRU-driver.patch
new file mode 100644 (file)
index 0000000..428465c
--- /dev/null
@@ -0,0 +1,552 @@
+--- a/drivers.m4
++++ b/drivers.m4
+@@ -39,7 +39,7 @@ AC_ARG_WITH(
+   [                        Newhaven, Noritake, NULL, Pertelian, PHAnderson,]
+   [                        PICGraphic, picoLCD, picoLCDGraphic, PNG, PPM, RouterBoard,]
+   [                        Sample, SamsungSPF, serdisplib, ShuttleVFD, SimpleLCD, st2205, T6963,]
+-  [                        TeakLCM, Trefon, ULA200, USBHUB, USBLCD, VNC, WincorNixdorf, X11],
++  [                        TeakLCM, TEW673GRU, Trefon, ULA200, USBHUB, USBLCD, VNC, WincorNixdorf, X11],
+   drivers=$withval,
+   drivers=all
+ )
+@@ -107,6 +107,7 @@ for driver in $drivers; do
+        SHUTTLEVFD="yes"
+          SIMPLELCD="yes"
+          T6963="yes"
++         TEW673GRU="yes"
+          TeakLCM="yes"
+          Trefon="yes"
+          ULA200="yes"
+@@ -260,6 +261,9 @@ for driver in $drivers; do
+       TeakLCM)
+          TeakLCM=$val
+          ;;
++      TEW673GRU)
++         TEW673GRU=$val
++         ;;
+       Trefon)
+          Trefon=$val
+          ;;
+@@ -797,6 +801,18 @@ if test "$TeakLCM" = "yes"; then
+    AC_DEFINE(WITH_TEAK_LCM,1,[TeakLCM driver])
+ fi
++if test "$TEW673GRU" = "yes"; then
++   if test "$has_spidev" = "true"; then
++      GRAPHIC="yes"
++      TEXT="yes"
++      SPIDEV="yes"
++      DRIVERS="$DRIVERS drv_TEW673GRU.o"
++      AC_DEFINE(WITH_TEW673GRU,1,[TEW673GRU driver])
++   else
++      AC_MSG_WARN(linux/spi/spidev.h not found: TEW673GRU driver disabled)
++   fi
++fi
++
+ if test "$Trefon" = "yes"; then
+    if test "$has_usb" = "true"; then
+       TEXT="yes"
+--- a/drv.c
++++ b/drv.c
+@@ -92,6 +92,7 @@ extern DRIVER drv_serdisplib;
+ extern DRIVER drv_ShuttleVFD;
+ extern DRIVER drv_SimpleLCD;
+ extern DRIVER drv_T6963;
++extern DRIVER drv_TEW673GRU;
+ extern DRIVER drv_TeakLCM;
+ extern DRIVER drv_Trefon;
+ extern DRIVER drv_ula200;
+@@ -248,6 +249,9 @@ DRIVER *Driver[] = {
+ #ifdef WITH_TEAK_LCM
+     &drv_TeakLCM,
+ #endif
++#ifdef WITH_TEW673GRU
++    &drv_TEW673GRU,
++#endif
+ #ifdef WITH_TREFON
+     &drv_Trefon,
+ #endif
+--- a/Makefile.am
++++ b/Makefile.am
+@@ -119,6 +119,7 @@ drv_ShuttleVFD.c              \
+ drv_SimpleLCD.c               \
+ drv_T6963.c                   \
+ drv_TeakLCM.c                 \
++drv_TEW673GRU.c               \
+ drv_Trefon.c                  \
+ drv_ula200.c                  \
+ drv_USBHUB.c                  \
+--- /dev/null
++++ b/drv_TEW673GRU.c
+@@ -0,0 +1,457 @@
++/* $Id$
++ * $URL$
++ *
++ * TRENDnet TEW673GRU LCD4linux driver
++ *
++ * Copyright (C) 2012 Gabor Juhos <juhosg@openwrt.org>
++ *
++ * based on the Sample driver which is:
++ * Copyright (C) 2005 Michael Reinelt <michael@reinelt.co.at>
++ * Copyright (C) 2005, 2006, 2007 The LCD4Linux Team <lcd4linux-devel@users.sourceforge.net>
++ *
++ * This file is part of LCD4Linux.
++ *
++ * LCD4Linux is free software; you can redistribute it and/or modify
++ * it under the terms of the GNU General Public License as published by
++ * the Free Software Foundation; either version 2, or (at your option)
++ * any later version.
++ *
++ * LCD4Linux is distributed in the hope that it will be useful,
++ * but WITHOUT ANY WARRANTY; without even the implied warranty of
++ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
++ * GNU General Public License for more details.
++ *
++ * You should have received a copy of the GNU General Public License
++ * along with this program; if not, write to the Free Software
++ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
++ *
++ */
++
++/*
++ * exported fuctions:
++ *
++ * struct DRIVER drv_TEW673GRU
++ */
++
++#include "config.h"
++
++#include <stdlib.h>
++#include <stdio.h>
++#include <unistd.h>
++#include <string.h>
++#include <errno.h>
++
++#include "debug.h"
++#include "cfg.h"
++#include "qprintf.h"
++#include "udelay.h"
++#include "plugin.h"
++#include "widget.h"
++#include "widget_text.h"
++#include "widget_icon.h"
++#include "widget_bar.h"
++#include "drv.h"
++
++#include "drv_generic_text.h"
++#include "drv_generic_graphic.h"
++#include "drv_generic_spidev.h"
++
++#ifdef WITH_DMALLOC
++#include <dmalloc.h>
++#endif
++
++#define TEW673GRU_NUM_COLS    220
++#define TEW673GRU_NUM_ROWS    176
++#define TEW673GRU_BPP         2       /* bytes per pixel */
++
++#define TEW673GRU_CMD_SIZE    9
++#define TEW673GRU_NUM_ROW_BYTES (TEW673GRU_NUM_COLS * TEW673GRU_BPP)
++
++enum {
++      CMD_SHOW_STRING         = 49,
++      CMD_SHOW_IMAGE_DIR      = 52,
++      CMD_SCREEN_COLOR        = 54,
++};
++
++static char Name[] = "TEW673GRU";
++
++static char *drv_TEW673GRU_FB;
++static long FB_SIZE;
++static int MODE;
++
++static unsigned int RGBAto16(RGBA rgb)
++{
++    return (((rgb.R >> 3) << 11) | ((rgb.G >> 2) << 5) | (rgb.B >> 3));
++}
++
++static unsigned char color_msb(unsigned int color)
++{
++    return color >> 8;
++}
++
++static unsigned char color_lsb(unsigned int color)
++{
++    return color & 0xff;
++}
++
++static void drv_TEW673GRU_hw_clear(const unsigned int color)
++{
++    unsigned char cmd[TEW673GRU_CMD_SIZE];
++    struct spi_ioc_transfer tr[1];
++
++    memset(tr, '\0', sizeof(tr));
++    memset(cmd, '\0', sizeof(cmd));
++
++    cmd[0] = CMD_SCREEN_COLOR;
++    cmd[7] = color_msb(color);
++    cmd[8] = color_lsb(color);
++
++    tr[0].tx_buf = (unsigned long) cmd;
++    tr[0].len = sizeof(cmd);
++
++    drv_generic_spidev_transfer(1, tr);
++}
++
++static void drv_TEW673GRU_hw_send_row(const int row, const int col, const char *data, const int width)
++{
++    unsigned char cmd[TEW673GRU_CMD_SIZE];
++    struct spi_ioc_transfer tr[2];
++    int datasize;
++
++    memset(tr, '\0', sizeof(tr));
++    memset(cmd, '\0', sizeof(cmd));
++
++    datasize =  width * TEW673GRU_BPP;
++
++    cmd[0] = CMD_SHOW_IMAGE_DIR;
++    cmd[1] = col;
++    cmd[2] = col + width;
++    cmd[3] = row;
++    cmd[4] = row;
++    cmd[5] = datasize >> 8;
++    cmd[6] = datasize & 0xff;
++
++    tr[0].tx_buf = (unsigned long) cmd;
++    tr[0].len = sizeof(cmd);
++    tr[1].tx_buf = (unsigned long) data;
++    tr[1].len = datasize;
++
++    drv_generic_spidev_transfer(2, tr);
++}
++
++static void drv_TEW673GRU_hw_write_string(const int row, const int col, const char *data, const int datasize)
++{
++    unsigned char cmd[TEW673GRU_CMD_SIZE];
++    struct spi_ioc_transfer tr[2];
++    unsigned char len;
++
++    memset(tr, '\0', sizeof(tr));
++    memset(cmd, '\0', sizeof(cmd));
++
++    len = datasize & 0xff;
++    cmd[0] = CMD_SHOW_STRING;
++    cmd[1] = col;
++    cmd[2] = col + (XRES * len);
++    cmd[3] = row;
++    cmd[4] = row + YRES;
++    cmd[7] = 0;
++    cmd[8] = len;
++
++    tr[0].tx_buf = (unsigned long) cmd;
++    tr[0].len = sizeof(cmd);
++    tr[1].tx_buf = (unsigned long) data;
++    tr[1].len = datasize;
++
++    drv_generic_spidev_transfer(2, tr);
++}
++
++static void drv_TEW673GRU_FB_set_pixel(const int col, const unsigned int color)
++{
++    int pos;
++
++    pos = col * TEW673GRU_BPP;
++    drv_TEW673GRU_FB[pos] = color_msb(color);
++    drv_TEW673GRU_FB[pos + 1] = color_lsb(color);
++}
++
++static void drv_TEW673GRU_blit(const int row, const int col, const int height, const int width)
++{
++    int r, c;
++
++    debug("%s: update area r:%d c:%d w:%d h:%d", Name, row, col, height, width);
++
++    for (r = row; r < row + height; r++) {
++      for (c = col; c < col + width; c++) {
++          unsigned int color;
++          RGBA rgb;
++
++          rgb = drv_generic_graphic_rgb(r, c);
++          color = RGBAto16(rgb);
++            drv_TEW673GRU_FB_set_pixel(c, color);
++      }
++
++      if (width) {
++          char *data;
++
++          data = &drv_TEW673GRU_FB[col * TEW673GRU_BPP];
++          drv_TEW673GRU_hw_send_row(r, col, data, width);
++          udelay(100 + width * 50);
++      }
++    }
++}
++
++static void drv_TEW673GRU_clear(RGBA rgba)
++{
++    unsigned int color;
++
++    color = RGBAto16(rgba);
++    drv_TEW673GRU_hw_clear(color);
++}
++
++static void drv_TEW673GRU_write(const int row, const int col, const char *data, const int len)
++{
++    int i;
++
++    for (i = 0; i < len; i++) {
++      drv_TEW673GRU_hw_write_string(row * YRES, (col + i) * XRES, " ", 1);
++      udelay(10000);
++      drv_TEW673GRU_hw_write_string(row * YRES, 2 + (col + i) * XRES, " ", 1);
++      udelay(10000);
++      drv_TEW673GRU_hw_write_string(row * YRES, (col + i) * XRES, &data[i], 1);
++      udelay(10000);
++    }
++}
++
++static int drv_TEW673GRU_open(const char *section)
++{
++    int err;
++
++    err = drv_generic_spidev_open(section, Name);
++    if (err < 0)
++      return err;
++
++    return 0;
++}
++
++static int drv_TEW673GRU_close(void)
++{
++    drv_generic_spidev_close();
++    return 0;
++}
++
++static void drv_TEW673GRU_clear_screen(void)
++{
++    if (MODE) {
++      drv_generic_graphic_clear();
++    } else {
++      memset(drv_TEW673GRU_FB, ' ', FB_SIZE);
++      drv_TEW673GRU_hw_clear(0x0000);
++    }
++}
++
++static int drv_TEW673GRU_init_font(const char *section)
++{
++    char *font;
++    int ret = -1;
++
++    font = cfg_get(section, "Font", "6x8");
++    if (font == NULL) {
++      error("%s: no '%s.Font' entry from %s", Name, section, cfg_source());
++      goto out;
++    }
++
++    if (*font == '\0') {
++      error("%s: invalid '%s.Font' entry in %s", Name, section, cfg_source());
++      goto out_free;
++    }
++
++    XRES = -1;
++    YRES = -1;
++    if (sscanf(font, "%dx%d", &XRES, &YRES) != 2 ||
++      XRES < 1 ||
++      YRES < 1) {
++      error("%s: bad Font '%s' from %s", Name, font, cfg_source());
++      goto out_free;
++    }
++
++    if (XRES != 6 && YRES != 8) {
++      error("%s: bad Font '%s' from %s (only 6x8 at the moment)",
++            Name, font, cfg_source());
++      goto out_free;
++    }
++
++    error("%s: font '%s' selected", Name, font);
++
++    ret = 0;
++
++out_free:
++    free(font);
++out:
++    return ret;
++}
++
++static int drv_TEW673GRU_start(const char *section)
++{
++    int ret;
++
++    DCOLS = TEW673GRU_NUM_COLS;
++    DROWS = TEW673GRU_NUM_ROWS;
++
++    if (MODE) {
++      ret = drv_TEW673GRU_init_font(section);
++      if (ret)
++          goto err;
++
++      FB_SIZE = DCOLS * TEW673GRU_BPP;
++    } else {
++      XRES = 10;
++      YRES = 16;
++      DCOLS = DCOLS / XRES;
++      DROWS = DROWS / YRES;
++
++      FB_SIZE = DCOLS * DROWS;
++    }
++
++    if (FB_SIZE) {
++      drv_TEW673GRU_FB = malloc(FB_SIZE);
++      if (drv_TEW673GRU_FB == NULL) {
++          error("%s: framebuffer could not be allocated", Name);
++          goto err;
++      }
++    }
++
++    ret = drv_TEW673GRU_open(section);
++    if (ret < 0)
++        goto err_free;
++
++    if (MODE == 0)
++      drv_TEW673GRU_clear_screen();
++
++    return 0;
++
++ err_free:
++    if (drv_TEW673GRU_FB)
++      free(drv_TEW673GRU_FB);
++ err:
++    return -1;
++}
++
++static int drv_TEW673GRU_greet(const char *msg1, const char *msg2)
++{
++    if (MODE)
++      return drv_generic_graphic_greet(msg1, msg2);
++
++    return drv_generic_text_greet(msg1, msg2);
++}
++
++
++/****************************************/
++/***        widget callbacks          ***/
++/****************************************/
++
++
++/* using drv_generic_text_draw(W) */
++/* using drv_generic_text_icon_draw(W) */
++/* using drv_generic_text_bar_draw(W) */
++/* using drv_generic_gpio_draw(W) */
++
++
++/****************************************/
++/***        exported functions        ***/
++/****************************************/
++
++int drv_TEW673GRU_list(void)
++{
++    printf("TEW673GRU driver");
++    return 0;
++}
++
++int drv_TEW673GRU_init(const char *section, const int quiet)
++{
++    WIDGET_CLASS wc;
++    int ret;
++
++    cfg_number(section, "Mode", 0, 0, 1, &MODE);
++
++    if (MODE) {
++      drv_generic_graphic_real_blit = drv_TEW673GRU_blit;
++      drv_generic_graphic_real_clear = drv_TEW673GRU_clear;
++    } else {
++      drv_generic_text_real_write = drv_TEW673GRU_write;
++    }
++
++    ret = drv_TEW673GRU_start(section);
++    if (ret)
++      return ret;
++
++    if (MODE) {
++      ret = drv_generic_graphic_init(section, Name);
++      if (ret)
++          return ret;
++    } else {
++      ret = drv_generic_text_init(section, Name);
++      if (ret)
++          return ret;
++
++      ret = drv_generic_text_icon_init();
++      if (ret != 0)
++          return ret;
++
++      ret = drv_generic_text_bar_init(1);
++      if (ret != 0)
++          return ret;
++
++      drv_generic_text_bar_add_segment(0, 0, 255, ' ');
++      drv_generic_text_bar_add_segment(255, 255, 255, '#');
++
++      wc = Widget_Text;
++      wc.draw = drv_generic_text_draw;
++      widget_register(&wc);
++
++      wc = Widget_Icon;
++      wc.draw = drv_generic_text_icon_draw;
++      widget_register(&wc);
++
++      wc = Widget_Bar;
++      wc.draw = drv_generic_text_bar_draw;
++      widget_register(&wc);
++    }
++
++    if (!quiet) {
++      char buffer[40];
++      qprintf(buffer, sizeof(buffer), "%s %dx%d", Name, DCOLS, DROWS);
++      drv_TEW673GRU_greet(buffer, "www.openwrt.org");
++      sleep(3);
++      drv_TEW673GRU_clear_screen();
++    }
++
++    return 0;
++}
++
++int drv_TEW673GRU_quit(const int quiet)
++{
++
++    info("%s: shutting down.", Name);
++
++    drv_TEW673GRU_clear_screen();
++
++    if (!quiet)
++      drv_TEW673GRU_greet("goodbye!", NULL);
++
++    if (MODE)
++      drv_generic_graphic_quit();
++    else
++      drv_generic_text_quit();
++
++    debug("closing connection");
++    drv_TEW673GRU_close();
++
++    return (0);
++}
++
++DRIVER drv_TEW673GRU = {
++    .name = Name,
++    .list = drv_TEW673GRU_list,
++    .init = drv_TEW673GRU_init,
++    .quit = drv_TEW673GRU_quit,
++};
+--- a/lcd4linux.conf.sample
++++ b/lcd4linux.conf.sample
+@@ -581,6 +581,11 @@ Display FutabaVFD {
+     }
+ }
++Display TEW673GRU {
++    Driver       'TEW673GRU'
++    Font         '6x8'
++    Port         '/dev/spidev1.0'
++}
+ #Plugin KVV {
+ #    StationID '12_701'
index 2bc8c9231f383c50abb50fda4e60172937f5412e..b035d197092c5a6d59815151b4900af3cd4a6075 100644 (file)
@@ -9,13 +9,13 @@
 include $(TOPDIR)/rules.mk
 
 PKG_NAME:=LVM2
-PKG_VERSION:=2.02.122
+PKG_VERSION:=2.02.125
 PKG_RELEASE:=1
 PKG_LICENSE:=GPL-2.0 LGPL-2.1
 
 PKG_SOURCE:=$(PKG_NAME).$(PKG_VERSION).tgz
 PKG_SOURCE_URL:=ftp://sources.redhat.com/pub/lvm2
-PKG_MD5SUM:=a88bf7d68955635d009a5aec1ffecc48
+PKG_MD5SUM:=2d24ba982c8a85e8c837210f087a6a51
 PKG_MAINTAINER:=Daniel Golle <daniel@makrotopia.org>
 PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME).$(PKG_VERSION)
 
@@ -74,10 +74,14 @@ endef
 
 define Package/lvm2/install
        $(INSTALL_DIR) $(1)/sbin
-       $(INSTALL_BIN) $(PKG_BUILD_DIR)/tools/lvm $(1)/sbin
+       $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/sbin/lvm $(1)/sbin
+       $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/sbin/dmsetup $(1)/sbin
        $(INSTALL_DIR) $(1)/etc/lvm
-       $(SED) '/^[[:space:]]*\(#\|$$$$\)/d; /cache_dir/s@.*@    cache_dir = "/tmp/lvm/cache"@' $(PKG_BUILD_DIR)/conf/example.conf
-       $(INSTALL_CONF) $(PKG_BUILD_DIR)/conf/example.conf $(1)/etc/lvm/lvm.conf
+       $(SED) '/^[[:space:]]*\(#\|$$$$\)/d; /cache_dir/s@.*@   cache_dir = "/tmp/lvm/cache"@' $(PKG_INSTALL_DIR)/etc/lvm/lvm.conf
+       $(INSTALL_CONF) $(PKG_INSTALL_DIR)/etc/lvm/lvm.conf $(1)/etc/lvm/
+       $(INSTALL_CONF) $(PKG_INSTALL_DIR)/etc/lvm/lvmlocal.conf $(1)/etc/lvm/
+       $(INSTALL_DIR) $(1)/etc/lvm/profile
+       $(INSTALL_CONF) $(PKG_INSTALL_DIR)/etc/lvm/profile/* $(1)/etc/lvm/profile/
        $(INSTALL_DIR) $(1)/etc/init.d
        $(INSTALL_BIN) ./files/lvm2.init $(1)/etc/init.d/lvm2
        $(FIND) $(PKG_INSTALL_DIR)/usr/sbin/ -type l -exec $(CP) -a {} $(1)/sbin/ \;
index e7625b6c6a35428ea0abb78a4251b661be895ad6..d06f4eb0fbe7195ece5529ad5c6e53b7d92a4315 100644 (file)
@@ -1,6 +1,6 @@
 --- a/lib/commands/toolcontext.c
 +++ b/lib/commands/toolcontext.c
-@@ -1637,8 +1637,10 @@ struct cmd_context *create_toolcontext(u
+@@ -1690,8 +1690,10 @@ struct cmd_context *create_toolcontext(u
                                       unsigned threaded)
  {
        struct cmd_context *cmd;
@@ -11,7 +11,7 @@
  
  #ifdef M_MMAP_MAX
        mallopt(M_MMAP_MAX, 0);
-@@ -1674,7 +1676,7 @@ struct cmd_context *create_toolcontext(u
+@@ -1727,7 +1729,7 @@ struct cmd_context *create_toolcontext(u
        /* FIXME Make this configurable? */
        reset_lvm_errno(1);
  
@@ -20,7 +20,7 @@
        /* Set in/out stream buffering before glibc */
        if (set_buffering) {
                /* Allocate 2 buffers */
-@@ -2047,7 +2049,7 @@ void destroy_toolcontext(struct cmd_cont
+@@ -2100,7 +2102,7 @@ void destroy_toolcontext(struct cmd_cont
        if (cmd->libmem)
                dm_pool_destroy(cmd->libmem);
  
@@ -31,7 +31,7 @@
                if (is_valid_fd(STDIN_FILENO) &&
 --- a/tools/lvmcmdline.c
 +++ b/tools/lvmcmdline.c
-@@ -1635,6 +1635,7 @@ int lvm_split(char *str, int *argc, char
+@@ -1689,6 +1689,7 @@ int lvm_split(char *str, int *argc, char
  /* Make sure we have always valid filedescriptors 0,1,2 */
  static int _check_standard_fds(void)
  {
@@ -39,7 +39,7 @@
        int err = is_valid_fd(STDERR_FILENO);
  
        if (!is_valid_fd(STDIN_FILENO) &&
-@@ -1661,6 +1662,12 @@ static int _check_standard_fds(void)
+@@ -1715,6 +1716,12 @@ static int _check_standard_fds(void)
                       strerror(errno));
                return 0;
        }
index f0553a9d73eea94ed1d26dfb752bd35b54ebb22c..11d47d5635348ebb8ce45d5bd1ddae7a369da7e9 100644 (file)
@@ -1,5 +1,5 @@
 #
-# Copyright (C) 2006-2014 OpenWrt.org
+# Copyright (C) 2006-2015 OpenWrt.org
 #
 # This is free software, licensed under the GNU General Public License v2.
 # See /LICENSE for more information.
@@ -10,7 +10,7 @@ include $(INCLUDE_DIR)/uclibc++.mk
 
 PKG_NAME:=mysql
 PKG_VERSION:=5.1.73
-PKG_RELEASE:=1
+PKG_RELEASE:=2
 
 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
 PKG_SOURCE_URL:=\
index 48e61896ef952e98f2eaad22651d77f12499e0ff..eec96c08545e181fa11d31348019b4a78b7bea98 100644 (file)
@@ -13,7 +13,7 @@ error() {
 }
 
 start() {
-       local datadir=$(sed -n -e "s/^[[:space:]]*datadir[[:space:]]*=[[:space:]]*[\"']\?\([^\"']*\)[\"']\?/\1/p" /etc/my.cnf)
+       local datadir=$(sed -n -e "s/^[[:space:]]*datadir[[:space:]]*=[[:space:]\"']*\([^[:space:]\"']*\)[[:space:]\"']*/\1/p" /etc/my.cnf)
        if [ ! -d "$datadir" ]; then
                error "Error: datadir '$datadir' in /etc/my.cnf doesn't exist"
                return 1
index e1600c03be645229f282b78c9ce51afc0f94dcb2..ce63c88a1c61edfdf7343f9670577c3aa728004c 100644 (file)
@@ -8,14 +8,14 @@
 include $(TOPDIR)/rules.mk
 
 PKG_NAME:=nano
-PKG_VERSION:=2.4.1
+PKG_VERSION:=2.4.2
 PKG_RELEASE:=1
 PKG_LICENSE:=GPL-3.0+
 PKG_LICENSE_FILES:=COPYING
 
 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
 PKG_SOURCE_URL:=http://www.nano-editor.org/dist/v2.4
-PKG_MD5SUM:=1c612b478f976abf8ef926480c7a3684
+PKG_MD5SUM:=ce6968992fec4283c17984b53554168b
 
 PKG_INSTALL:=1
 PKG_BUILD_PARALLEL:=1
index 480711a74756ab49edadb9de339220b7fe843a88..74a9f995f3eb69a4a72cb30283b3f80726644fc1 100644 (file)
@@ -8,13 +8,13 @@
 include $(TOPDIR)/rules.mk
 
 PKG_NAME:=open-plc-utils
-PKG_VERSION:=2015-06-26
+PKG_VERSION:=2015-07-06
 PKG_RELEASE:=$(PKG_SOURCE_VERSION)
 
 PKG_SOURCE_PROTO:=git
 PKG_SOURCE_URL:=git://github.com/qca/open-plc-utils.git
 PKG_SOURCE_SUBDIR:=$(PKG_NAME)-$(PKG_VERSION)
-PKG_SOURCE_VERSION:=1f6e7e372b313cf570aa63314037588ed01ec0de
+PKG_SOURCE_VERSION:=885a1b7e2e663b5ab8797db6d40a0318131fdf18
 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION)-$(PKG_SOURCE_VERSION).tar.gz
 
 PKG_MAINTAINER:=Florian Fainelli <florian@openwrt.org>
diff --git a/utils/rtl-ais/Makefile b/utils/rtl-ais/Makefile
new file mode 100644 (file)
index 0000000..9f692d2
--- /dev/null
@@ -0,0 +1,46 @@
+#
+# Copyright (C) 2015 OpenWrt.org
+#
+# This is free software, licensed under the GNU General Public License v2.
+# See /LICENSE for more information.
+
+include $(TOPDIR)/rules.mk
+
+PKG_NAME:=rtl-ais
+PKG_VERSION:=20150713
+
+PKG_RELEASE=$(PKG_SOURCE_VERSION)
+
+PKG_SOURCE_PROTO:=git
+PKG_SOURCE_URL:=https://github.com/dgiardini/rtl-ais.git
+PKG_SOURCE_SUBDIR:=$(PKG_NAME)-$(PKG_VERSION)
+PKG_SOURCE_VERSION:=d1084f6514cb161266f5bc5c6662070ad7c87560
+PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION)-$(PKG_SOURCE_VERSION).tar.gz
+
+PKG_LICENSE:=GPL-2.0+
+PKG_LICENSE_FILES:=COPYING
+
+PKG_MAINTAINER:=Nuno Goncalves <nunojpg@gmail.com>
+
+include $(INCLUDE_DIR)/package.mk
+
+define Package/rtl-ais
+  SECTION:=utils
+  CATEGORY:=Utilities
+  TITLE:=rtl-sdr AIS dual channel tuner
+  DEPENDS:=+libpthread +librtlsdr
+  URL:=https://github.com/dgiardini/rtl-ais
+endef
+
+define Package/rtl-ais/description
+  rtl_ais uses a rtl2832u dvb-t dongle to tune AIS (Automatic Identification
+  System) used on ships and by vessel traffic services
+endef
+
+
+define Package/rtl-ais/install
+       $(INSTALL_DIR) $(1)/usr/bin
+       $(INSTALL_BIN) $(PKG_BUILD_DIR)/rtl_ais $(1)/usr/bin/
+endef
+
+$(eval $(call BuildPackage,rtl-ais))
index 5879e37a60d671a7ffd6c37830cb7085e3dc342d..80524d30f8d5fff69d431e3ca602b8d484030b50 100644 (file)
@@ -8,12 +8,12 @@
 include $(TOPDIR)/rules.mk
 
 PKG_NAME:=screen
-PKG_VERSION:=4.2.1
-PKG_RELEASE:=4
+PKG_VERSION:=4.3.1
+PKG_RELEASE:=1
 
 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
 PKG_SOURCE_URL:=@GNU/screen
-PKG_MD5SUM:=419a0594e2b25039239af8b90eda7d92
+PKG_MD5SUM:=5bb3b0ff2674e29378c31ad3411170ad
 
 PKG_LICENSE:=GPL-3.0+
 PKG_LICENSE_FILES:=
@@ -40,10 +40,6 @@ define Build/Configure
        )
        # XXX: memmove() works well with overlapped memory areas
        echo "#define USEMEMMOVE 1" >>$(PKG_BUILD_DIR)/config.h
-  ifeq ($(CONFIG_USE_MUSL),y)
-       # XXX: assume a working getlogin() for musl
-       echo "#undef BUGGYGETLOGIN" >>$(PKG_BUILD_DIR)/config.h
-  endif
 endef
 
 define Package/screen/install
index b4bc30797c9d4a6277b58c4e0861101e4def2181..d9662b4f0a38c815ff7273c2d111f5d1fe337cbd 100644 (file)
@@ -9,7 +9,7 @@
  } # as_fn_error
  
  if expr a : '\(a\)' >/dev/null 2>&1 &&
-@@ -5941,8 +5941,6 @@ else
+@@ -5942,8 +5942,6 @@ else
  fi
  rm -f core conftest.err conftest.$ac_objext \
      conftest$ac_exeext conftest.$ac_ext
@@ -18,7 +18,7 @@
  oldlibs="$LIBS"
  LIBS="$LIBS -lsun"
  { $as_echo "$as_me:${as_lineno-$LINENO}: checking IRIX sun library..." >&5
-@@ -7023,7 +7021,7 @@ as_fn_error ()
+@@ -7024,7 +7022,7 @@ as_fn_error ()
      $as_echo "$as_me:${as_lineno-$LINENO}: error: $2" >&$4
    fi
    $as_echo "$as_me: error: $2" >&2
index 5bbc9d0ea5262d35f9eea289514110c79078216f..cd783bde38e17bcadd02770e56543dfc474e3239 100644 (file)
@@ -1,6 +1,6 @@
 --- a/configure
 +++ b/configure
-@@ -4154,44 +4154,6 @@ fi
+@@ -4155,44 +4155,6 @@ fi
  rm -f conftest*
  
  
index ad9bb11554e8ef50667d73f143b2f3c40de094e1..d56be82713f96467aebb8af9dd53ba98a92d8208 100644 (file)
@@ -1,5 +1,5 @@
 #
-# Copyright (C) 2008-2014 OpenWrt.org
+# Copyright (C) 2008-2015 OpenWrt.org
 #
 # This is free software, licensed under the GNU General Public License v2.
 # See /LICENSE for more information.
@@ -9,7 +9,7 @@ include $(TOPDIR)/rules.mk
 
 PKG_NAME:=shadow
 PKG_VERSION:=4.2.1
-PKG_RELEASE:=4
+PKG_RELEASE:=5
 
 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.xz
 PKG_SOURCE_URL:=http://pkg-shadow.alioth.debian.org/releases
diff --git a/utils/shadow/patches/004-fix-su-controoling-term.patch b/utils/shadow/patches/004-fix-su-controoling-term.patch
new file mode 100644 (file)
index 0000000..4c130c7
--- /dev/null
@@ -0,0 +1,16 @@
+--- a/src/su.c
++++ b/src/su.c
+@@ -1090,8 +1090,12 @@
+               if (fd >= 0) {
+                       err = ioctl (fd, TIOCNOTTY, (char *) 0);
++                      if (-1 == err && ENOTTY == errno) {
++                              /* There are no controlling terminal already */
++                              err = 0;
++                      }
+                       (void) close (fd);
+-              } else if (ENXIO == errno) {
++              } else if (ENXIO == errno || EACCES == errno) {
+                       /* There are no controlling terminal already */
+                       err = 0;
+               }
index 2c68a4a0deed6d13015df91f3f66961f404cc994..8e2f7a2cf307b1fb905e4aa326cffe079d61f3af 100644 (file)
@@ -8,10 +8,14 @@ include $(TOPDIR)/rules.mk
 
 PKG_NAME:=tcsh
 PKG_VERSION:=6.19.00
-PKG_RELEASE:=2
+PKG_RELEASE:=3
 
 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
-PKG_SOURCE_URL:=http://ftp.funet.fi/pub/mirrors/ftp.astron.com/pub/tcsh/
+PKG_SOURCE_URL:= \
+       http://ftp.funet.fi/pub/mirrors/ftp.astron.com/pub/tcsh/ \
+       http://ftp.funet.fi/pub/mirrors/ftp.astron.com/pub/tcsh/old/ \
+       ftp://ftp.astron.com/pub/tcsh/ \
+       ftp://ftp.astron.com/pub/tcsh/old
 PKG_MD5SUM:=f5f854833578647795bc906dd4bcb5d5
 PKG_LICENSE:=BSD-4-Clause-UC
 PKG_LICENSE_FILES:=Copyright